From 4ccab7e5eb0843a490ab8292514e1d654f801ba6 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 10 Dec 2013 16:17:40 +0100 Subject: stork OA config frontend --- .../src/main/resources/applicationResources.properties | 3 +++ id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties index 456c37ff1..fa955e944 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties @@ -222,6 +222,9 @@ webpages.oaconfig.sso.singlelogouturl=Single Log-Out URL webpages.oaconfig.sso.useauthdataframe=Zus\u00E4tzliche Userabfrage webpages.oaconfig.sso.usesso=Single Sign-On verwenden +webpages.oaconfig.stork.header=Secure idenTity acrOss boRders linKed +webpages.oaconfig.stork.usestork=STORK Logon aktivieren + webpages.oaconfig.protocols.saml1.header=SAML1 Konfiguration webpages.oaconfig.saml1.isActice=SAML1 aktivieren webpages.oaconfig.saml1.provideStammZahl=Stammzahl \u00FCbertragen diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp index 97f0d01c2..aef6aff24 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp @@ -302,6 +302,18 @@ +
+

<%=LanguageHelper.getGUIString("webpages.oaconfig.stork.header", request) %>

+ + + +
+

<%=LanguageHelper.getGUIString("webpages.oaconfig.protocols.header", request) %>

-- cgit v1.2.3 From f10baaa115823b8e0d2e6a736559467335a096df Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 10 Dec 2013 18:59:10 +0100 Subject: stork OA config persisted --- .../id/configuration/data/oa/OASTORKConfig.java | 33 ++++++++++++++++++++++ .../configuration/struts/action/EditOAAction.java | 16 +++++++++++ .../validation/oa/OASTORKConfigValidation.java | 1 + .../src/main/webapp/jsp/editOAGeneral.jsp | 4 +-- .../src/main/resources/config/moaid_config_2.0.xsd | 9 +++++- 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java index 74edde653..1884fb808 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java @@ -1,5 +1,38 @@ package at.gv.egovernment.moa.id.configuration.data.oa; +import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK; +import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; + public class OASTORKConfig { + private boolean isStorkLogonEnabled = false; + + public OASTORKConfig() { + + } + + /** + * Parses the OA config for stork entities. + * + * @param dbOAConfig + * the db oa config + */ + public void parse(OnlineApplication dbOAConfig) { + AuthComponentOA authdata = dbOAConfig.getAuthComponentOA(); + if (authdata != null) { + OASTORK config = authdata.getOASTORK(); + if(config != null) { + setStorkLogonEnabled(config.isStorkLogonEnabled()); + } + } + } + + public boolean isStorkLogonEnabled() { + return isStorkLogonEnabled; + } + + public void setStorkLogonEnabled(boolean enabled) { + this.isStorkLogonEnabled = enabled; + } } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index fc66eede4..d5a50836a 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -38,6 +38,7 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.OAOAUTH20; import at.gv.egovernment.moa.id.commons.db.dao.config.OAPVP2; import at.gv.egovernment.moa.id.commons.db.dao.config.OASAML1; import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO; +import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplicationType; import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; @@ -102,6 +103,7 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware, private OASSOConfig ssoOA = new OASSOConfig(); private OAOAuth20Config oauth20OA = new OAOAuth20Config(); private OASTORKConfig storkOA; + private OASTORKConfig storkOA = new OASTORKConfig(); private FormularCustomization formOA = new FormularCustomization(); private InputStream stream; @@ -160,6 +162,8 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware, saml1OA.parse(onlineapplication); oauth20OA.parse(onlineapplication); session.setAttribute(Constants.SESSION_OAUTH20SECRET, this.oauth20OA.getClientSecret()); + + storkOA.parse(onlineapplication); Map map = new HashMap(); map.putAll(FormBuildUtils.getDefaultMap()); @@ -952,6 +956,18 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware, } + + // fetch stork configuration from database model + OASTORK stork = authoa.getOASTORK(); + if (stork == null) { + // if there is none, create a new one with default values. + stork = new OASTORK(); + authoa.setOASTORK(stork); + stork.setStorkLogonEnabled(false); + } + // transfer the incoming data to the database model + stork.setStorkLogonEnabled(storkOA.isStorkLogonEnabled()); + try { if (newentry) { ConfigurationDBUtils.save(dboa); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java index 76183caad..d12d918bd 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java @@ -10,6 +10,7 @@ public class OASTORKConfigValidation { List errors = new ArrayList(); + // we only have a checkbox for now, so no need to validate anything here return errors; } diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp index aef6aff24..3234c6a86 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp @@ -305,8 +305,8 @@

<%=LanguageHelper.getGUIString("webpages.oaconfig.stork.header", request) %>

- - + @@ -917,6 +917,13 @@ + + + + + + + -- cgit v1.2.3 From 7315bd2e79fe16cf13059408489050ca3450e578 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 5 Dec 2013 12:13:39 +0100 Subject: reactivated stork in default login template --- id/server/auth/src/main/webapp/info_stork.html | 4 +- .../resources/templates/loginFormFull.html | 51 +++++++++------------- 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/id/server/auth/src/main/webapp/info_stork.html b/id/server/auth/src/main/webapp/info_stork.html index 3bd88300c..2bdf62711 100644 --- a/id/server/auth/src/main/webapp/info_stork.html +++ b/id/server/auth/src/main/webapp/info_stork.html @@ -28,16 +28,14 @@
-

Information using STORK for secure authentication

The STORK project makes it easier for citizens to access online public services across borders by implementing Europe-wide interoperable cross border platforms for the mutual recognition of national electronic identity (eID) between participating countries.

-

For more information, please consult the STORK website:

https://www.eid-stork.eu/ +

For more information, please consult the STORK website:

https://www.eid-stork2.eu/
-
diff --git a/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html b/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html index 801a2dbf1..f25e7129a 100644 --- a/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html +++ b/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html @@ -424,11 +424,6 @@ text-align: right; } - #stork { - margin-bottom: 10px; - margin-top: 5px; - } - #mandateLogin { padding-bottom: 4%; padding-top: 4%; @@ -812,32 +807,26 @@ - - +
+

Home Country Selection

+

+ + + i +

+
-
+

Home Country Selection

" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/> + + + + " onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/> + + + " onclick='var target = document.getElementById("template"); var clone = target.cloneNode(true); clone.style=""; target.parentNode.appendChild(clone);' /> +

+

<%=LanguageHelper.getGUIString("webpages.moaconfig.protocols.header", request) %>

-- cgit v1.2.3 From 9c46233d2fc5f81908addac6a5ec28046a1bc618 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 13 Dec 2013 08:24:53 +0100 Subject: peps list commitable --- .../egovernment/moa/id/configuration/data/GeneralStorkConfig.java | 7 ++----- id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java index 51c6e8aa4..41d19d116 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java @@ -39,10 +39,7 @@ public class GeneralStorkConfig { return cpepslist; } - public void setCpepslist(List cpepslist) { - this.cpepslist = cpepslist; + public void setCpepslist(List list) { + this.cpepslist = list; } - - - } diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index 52fc79b68..686b10c12 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -231,9 +231,9 @@

<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.pepslist", request) %>

- - - + + + -- cgit v1.2.3 From 9786de6a3b5886437d23d9cce06ae76ab440ff51 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 13 Dec 2013 09:13:50 +0100 Subject: new peps list entry can be created --- id/ConfigWebTool/src/main/webapp/js/common.js | 11 ++++++++++- id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp | 8 ++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index ff9509895..e6fcdf977 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -177,4 +177,13 @@ function oaOnLoad() { ); return true; -} \ No newline at end of file +} +function newPeps() { + var target = $(document.getElementById("stork_pepslist").getElementsByTagName("tr")).last()[0]; + var clone = target.cloneNode(true); + var lastindex = parseInt(clone.innerHTML.match(/name="storkconfig.cpepslist\[(\d)/)[1]); + var nextindex = lastindex + 1; + clone.innerHTML = clone.innerHTML.replace(/name="storkconfig.cpepslist\[\d/g, 'name="storkconfig.cpepslist[' + nextindex); + clone.innerHTML = clone.innerHTML.replace(/(.*" value=").*?(".*)/g, '$1$2'); + target.parentNode.appendChild(clone); +} diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index 686b10c12..1b87ffc57 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -229,19 +229,15 @@

<%=LanguageHelper.getGUIString("webpages.oaconfig.stork.header", request) %>

<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.pepslist", request) %>

-
Country ShortcodePEPS URL
" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>
+
- - - -
Country ShortcodePEPS URL
" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>
- " onclick='var target = document.getElementById("template"); var clone = target.cloneNode(true); clone.style=""; target.parentNode.appendChild(clone);' /> + " onclick='newPeps();' />
-- cgit v1.2.3 From 6f418eaa49c86c26a5d8cb0d9577545167ba850d Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 13 Dec 2013 10:01:36 +0100 Subject: peps save is validated --- .../struts/action/EditGeneralConfigAction.java | 3 ++ .../validation/moaconfig/StorkConfigValidator.java | 60 ++++++++++++++++++++++ .../main/resources/applicationResources.properties | 4 ++ 3 files changed, 67 insertions(+) create mode 100644 id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index b4ae27c6a..5dc6f33e7 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -51,6 +51,7 @@ import at.gv.egovernment.moa.id.configuration.data.GeneralMOAIDConfig; import at.gv.egovernment.moa.id.configuration.data.GeneralStorkConfig; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; import at.gv.egovernment.moa.id.configuration.validation.moaconfig.MOAConfigValidator; +import at.gv.egovernment.moa.id.configuration.validation.moaconfig.StorkConfigValidator; import at.gv.egovernment.moa.id.util.Random; import at.gv.egovernment.moa.util.MiscUtil; @@ -132,6 +133,8 @@ public class EditGeneralConfigAction extends ActionSupport MOAConfigValidator validator = new MOAConfigValidator(); List errors = validator.validate(moaconfig); + + errors.addAll(new StorkConfigValidator().validate(storkconfig)); if (errors.size() > 0) { log.info("General MOA-ID configuration has some erros."); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java new file mode 100644 index 000000000..91d5ecabd --- /dev/null +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java @@ -0,0 +1,60 @@ +package at.gv.egovernment.moa.id.configuration.validation.moaconfig; + +import java.util.ArrayList; +import java.util.List; +import org.apache.log4j.Logger; + +import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; +import at.gv.egovernment.moa.id.configuration.data.GeneralStorkConfig; +import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; +import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper; +import at.gv.egovernment.moa.util.MiscUtil; + +public class StorkConfigValidator { + + private static final Logger log = Logger.getLogger(StorkConfigValidator.class); + + public List validate(GeneralStorkConfig form) { + + List errors = new ArrayList(); + + log.debug("Validate general STORK configuration"); + + // check peps list + for(CPEPS current : form.getCpepslist()) { + // check country code + String check = current.getCountryCode(); + if (MiscUtil.isNotEmpty(check)) { + if (ValidationHelper.containsPotentialCSSCharacter(check, false)) { + log.warn("CPEPS config countrycode contains potentail XSS characters: " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc", + new Object[] {ValidationHelper.getPotentialCSSCharacter(false)} )); + } + if(!check.toLowerCase().matches("^[a-z][a-z]$")) { + log.warn("CPEPS config countrycode does not comply to ISO 3166-2 : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc", + new Object[] {check} )); + } + } else { + log.warn("CPEPS config countrycode is empty : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.empty", + new Object[] {check} )); + } + + // check url + check = current.getURL(); + if (MiscUtil.isNotEmpty(check)) { + if (!ValidationHelper.validateURL(check)) { + log.info("CPEPS config URL is invalid : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.url")); + } + } else { + log.warn("CPEPS config url is empty : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.empty", + new Object[] {check} )); + } + } + + return errors; + } +} diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties index 5751783ae..f79b5a286 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties @@ -370,6 +370,10 @@ validation.general.oaidentifier.empty=Es wurde kein eindeutiger Identifier f\u00 validation.general.oaidentifier.valid=Der eindeutige Identifier f\u00FCr die Online-Applikation ist keine g\u00FCltige URL. validation.general.oaidentifier.notunique=Der gew\u00E4hlte eindeutige Identifier ist bereits vorhanden. Eine Eintragung der Online-Applikation ist nicht m\u00F6glich. +validation.stork.cpeps.cc=CPEPS L\u00E4ndercode folgt nicht ISO 3166-2 +validation.stork.cpeps.empty=CPEPS Konfiguration ist unvollst\u00E4ndig +validation.stork.cpeps.url=CPEPS URL ist ung\u00FCltig + validation.pvp2.metadataurl.empty=Keine Metadaten URL angegeben. validation.pvp2.metadataurl.valid=Die Metadaten URL wei\u00DFt kein g\u00FCltiges URL Format auf. validation.pvp2.metadataurl.read=Unter der angegebenen Metadaten URL konnten keine Informationen abgerufen werden. -- cgit v1.2.3 From 21fb0d3c25a49f57cf79d4d11571f6f857eac780 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 17 Dec 2013 12:29:48 +0100 Subject: peps list is persisted --- .../moa/id/configuration/struts/action/EditGeneralConfigAction.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index 5dc6f33e7..092dd5613 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -395,7 +395,10 @@ public class EditGeneralConfigAction extends ActionSupport if (oldforeign != null) { STORK oldstork = oldforeign.getSTORK(); if (oldstork != null) - dbforeign.setSTORK(oldstork); + oldstork = new STORK(); + + oldstork.setCPEPS(storkconfig.getCpepslist()); + dbforeign.setSTORK(oldstork); } } -- cgit v1.2.3 From 999756bd381ec4d81db7db7bb59863ad549d69b0 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 17 Dec 2013 13:52:47 +0100 Subject: default qaa and attributes persisted and validated --- .../id/configuration/data/GeneralStorkConfig.java | 44 +++++++++++++++++++++- .../struts/action/EditGeneralConfigAction.java | 4 +- .../validation/moaconfig/StorkConfigValidator.java | 23 +++++++++++ .../main/resources/applicationResources.properties | 4 ++ .../src/main/webapp/jsp/editMOAConfig.jsp | 10 +++++ 5 files changed, 83 insertions(+), 2 deletions(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java index 41d19d116..f270ab624 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java @@ -3,15 +3,20 @@ package at.gv.egovernment.moa.id.configuration.data; import java.util.ArrayList; import java.util.List; +import edu.emory.mathcs.backport.java.util.Arrays; + import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities; import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.RequestedAttributesType; import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; public class GeneralStorkConfig { private List cpepslist; + private List attributes; + private int qaa; public void parse(MOAIDConfiguration config) { @@ -29,6 +34,19 @@ public class GeneralStorkConfig { for(CPEPS current : stork.getCPEPS()) { cpepslist.add(current); } + + RequestedAttributesType tmp = stork.getRequestedAttributes(); + if(null != tmp) { + attributes = new ArrayList(); + for(String current : tmp.getAttributeValue()) + attributes.add(current); + } + + try { + qaa = stork.getQualityAuthenticationAssuranceLevel(); + } catch(NullPointerException e) { + qaa = 4; + } } } } @@ -40,6 +58,30 @@ public class GeneralStorkConfig { } public void setCpepslist(List list) { - this.cpepslist = list; + cpepslist = list; + } + + public RequestedAttributesType getRequestedAttributesType() { + RequestedAttributesType tmp = new RequestedAttributesType(); + tmp.setAttributeValue(attributes); + return tmp; + } + + public String getDefaultAttributes() { + return Arrays.toString(attributes.toArray()).replace("[", "").replace("]", ""); + } + + public void setDefaultAttributes(String attributes) { + this.attributes = new ArrayList(); + for(String current : attributes.split(",")) + this.attributes.add(current.trim()); + } + + public int getDefaultQaa() { + return qaa; + } + + public void setDefaultQaa(int qaa) { + this.qaa = qaa; } } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index 092dd5613..72da0b59f 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -397,11 +397,13 @@ public class EditGeneralConfigAction extends ActionSupport if (oldstork != null) oldstork = new STORK(); + oldstork.setQualityAuthenticationAssuranceLevel(storkconfig.getDefaultQaa()); + oldstork.setRequestedAttributes(storkconfig.getRequestedAttributesType()); oldstork.setCPEPS(storkconfig.getCpepslist()); dbforeign.setSTORK(oldstork); } } - + if (MiscUtil.isNotEmpty(moaconfig.getMandateURL())) { OnlineMandates dbmandate = dbauth.getOnlineMandates(); if (dbmandate == null) { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java index 91d5ecabd..4ee247695 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java @@ -55,6 +55,29 @@ public class StorkConfigValidator { } } + // check qaa + int qaa = form.getDefaultQaa(); + if(1 > qaa && 4 < qaa) { + log.warn("QAA is out of range : " + qaa); + errors.add(LanguageHelper.getErrorString("validation.stork.qaa.outofrange", + new Object[] {qaa} )); + } + + // check attributes + String check = form.getDefaultAttributes(); + if (MiscUtil.isNotEmpty(check)) { + if (ValidationHelper.containsPotentialCSSCharacter(check, true)) { + log.warn("default attributes contains potentail XSS characters: " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", + new Object[] {ValidationHelper.getPotentialCSSCharacter(false)} )); + } + if(!check.toLowerCase().matches("^[a-z0-9, ]*$")) { + log.warn("default attributes do not match the requested format : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", + new Object[] {check} )); + } + } + return errors; } } diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties index f79b5a286..2dacf14a2 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties @@ -227,6 +227,8 @@ webpages.oaconfig.stork.usestork=STORK Logon aktivieren webpages.moaconfig.stork.pepslist=C-PEPS Konfiguration webpages.moaconfig.stork.newpeps=Neuen PEPS konfigurieren webpages.moaconfig.stork.removepeps=l\u00F6schen +webpages.moaconfig.stork.requestedattributes.default=Standardattribute, die von STORK angefordert werden +webpages.moaconfig.stork.qaa.default=Standard QAA-Level ausw\u00E4hlen webpages.oaconfig.protocols.saml1.header=SAML1 Konfiguration webpages.oaconfig.saml1.isActice=SAML1 aktivieren @@ -373,6 +375,8 @@ validation.general.oaidentifier.notunique=Der gew\u00E4hlte eindeutige Identifie validation.stork.cpeps.cc=CPEPS L\u00E4ndercode folgt nicht ISO 3166-2 validation.stork.cpeps.empty=CPEPS Konfiguration ist unvollst\u00E4ndig validation.stork.cpeps.url=CPEPS URL ist ung\u00FCltig +validation.stork.requestedattributes=STORK Attribute sind fehlerhaft. Bsp.: attr1, attr2 +validation.stork.qaa.outofrange=Gültige QAA Werte sind 1, 2, 3, und 4 validation.pvp2.metadataurl.empty=Keine Metadaten URL angegeben. validation.pvp2.metadataurl.valid=Die Metadaten URL wei\u00DFt kein g\u00FCltiges URL Format auf. diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index 1b87ffc57..df6a43e7a 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -228,6 +228,16 @@

<%=LanguageHelper.getGUIString("webpages.oaconfig.stork.header", request) %>

+ +

<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.pepslist", request) %>

-- cgit v1.2.3 From 1bb655bbb372f069e907c6ddcc40a43ca1f36e09 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 19 Dec 2013 11:01:44 +0100 Subject: OA qaa and attributes gui --- .../src/main/resources/applicationResources.properties | 4 +++- id/ConfigWebTool/src/main/webapp/js/common.js | 7 +++++++ id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp | 16 ++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties index 2dacf14a2..0ac4b2cbc 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties @@ -229,6 +229,8 @@ webpages.moaconfig.stork.newpeps=Neuen PEPS konfigurieren webpages.moaconfig.stork.removepeps=l\u00F6schen webpages.moaconfig.stork.requestedattributes.default=Standardattribute, die von STORK angefordert werden webpages.moaconfig.stork.qaa.default=Standard QAA-Level ausw\u00E4hlen +webpages.moaconfig.stork.requestedattributes=Attribute, die von STORK angefordert werden +webpages.moaconfig.stork.qaa=Mindest-QAA-Level f\u00FCr diese OA ausw\u00E4hlen webpages.oaconfig.protocols.saml1.header=SAML1 Konfiguration webpages.oaconfig.saml1.isActice=SAML1 aktivieren @@ -401,4 +403,4 @@ validation.general.form.button.color.back.focus=Die Hintergrundfarbe f\\u00FCr F validation.general.form.button.color.back=Die Hintergrundfarbe der BKU-Auswahlbuttons enth\\u00E4lt keinen g\\u00FCltigen Hexadezimalwert. (z.B. \\\#FFFFFF) validation.general.form.button.color.front=Die Vordergrundfarbe der BKU-Auswahlbuttons enth\\u00E4lt keinen g\\u00FCltigen Hexadezimalwert. (z.B. \\\#FFFFFF) validation.general.form.appletredirecttarget=Der RedirectTarget beinhaltet einen ung\\u00FCltiten Wert. -validation.general.form.fonttype=Der BKU-Auswahl Schrifttyp enth\u00E4lt nicht erlaubte Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} \ No newline at end of file +validation.general.form.fonttype=Der BKU-Auswahl Schrifttyp enth\u00E4lt nicht erlaubte Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index e6fcdf977..b07b31205 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -22,6 +22,13 @@ function oaSSOService() { } } +function oaStork() { + if ($('#OAuseSTORKLogon').attr('checked') == 'checked') { + $('#stork_block').css('display', "block"); + } else { + $('#stork_block').css('display', "none"); + } +} function oaSAML1() { if ($('#oa_saml1_area').css('display') == "block") { $('#oa_saml1_area').css('display', "none"); diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp index 3234c6a86..d12a47b9e 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp @@ -310,8 +310,20 @@ labelposition="left" key="webpages.oaconfig.stork.usestork" cssClass="checkbox" - id="OAuseSTORKLogon"> - + onclick="oaStork();" + id="OAuseSTORKLogon" /> +
+ + +
-- cgit v1.2.3 From f306cf7529f44d09a12a87f177368353fe1d3bc5 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 19 Dec 2013 12:04:10 +0100 Subject: OA qaa and attributes validated and persisted --- .../id/configuration/data/GeneralStorkConfig.java | 3 +- .../id/configuration/data/oa/OASTORKConfig.java | 49 +++++++++++++++++++++- .../configuration/struts/action/EditOAAction.java | 2 + .../validation/oa/OASTORKConfigValidation.java | 37 ++++++++++++++-- .../src/main/resources/config/moaid_config_2.0.xsd | 9 +++- 5 files changed, 92 insertions(+), 8 deletions(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java index f270ab624..8b527aa8f 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java @@ -1,10 +1,9 @@ package at.gv.egovernment.moa.id.configuration.data; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import edu.emory.mathcs.backport.java.util.Arrays; - import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java index 1884fb808..f6fc4416f 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java @@ -1,12 +1,20 @@ package at.gv.egovernment.moa.id.configuration.data.oa; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.RequestedAttributesType; public class OASTORKConfig { private boolean isStorkLogonEnabled = false; + private int qaa; + private List attributes; public OASTORKConfig() { @@ -14,7 +22,7 @@ public class OASTORKConfig { /** * Parses the OA config for stork entities. - * + * * @param dbOAConfig * the db oa config */ @@ -24,6 +32,21 @@ public class OASTORKConfig { OASTORK config = authdata.getOASTORK(); if(config != null) { setStorkLogonEnabled(config.isStorkLogonEnabled()); + + try { + setQaa(config.getQaa()); + } catch(NullPointerException e) { + // if there is no configuration available for the OA, get the default qaa level + setQaa(ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getQualityAuthenticationAssuranceLevel()); + } + + RequestedAttributesType tmp = config.getAttributes(); + if(null == tmp) + // if there is no configuration available for the OA, get the default attributes + tmp = ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getRequestedAttributes(); + attributes = new ArrayList(); + for(String current : tmp.getAttributeValue()) + attributes.add(current); } } } @@ -35,4 +58,28 @@ public class OASTORKConfig { public void setStorkLogonEnabled(boolean enabled) { this.isStorkLogonEnabled = enabled; } + + public int getQaa() { + return qaa; + } + + public void setQaa(int qaa) { + this.qaa = qaa; + } + + public RequestedAttributesType getRequestedAttributesType() { + RequestedAttributesType tmp = new RequestedAttributesType(); + tmp.setAttributeValue(attributes); + return tmp; + } + + public String getAttributes() { + return Arrays.toString(attributes.toArray()).replace("[", "").replace("]", ""); + } + + public void setAttributes(String attributes) { + this.attributes = new ArrayList(); + for(String current : attributes.split(",")) + this.attributes.add(current.trim()); + } } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index 5e473d85c..466feba23 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -967,6 +967,8 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware, } // transfer the incoming data to the database model stork.setStorkLogonEnabled(storkOA.isStorkLogonEnabled()); + stork.setQaa(storkOA.getQaa()); + stork.setAttributes(storkOA.getRequestedAttributesType()); try { if (newentry) { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java index d12d918bd..31cf7bcee 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java @@ -3,15 +3,44 @@ package at.gv.egovernment.moa.id.configuration.validation.oa; import java.util.ArrayList; import java.util.List; +import org.apache.log4j.Logger; + import at.gv.egovernment.moa.id.configuration.data.oa.OASTORKConfig; +import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; +import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper; +import at.gv.egovernment.moa.util.MiscUtil; public class OASTORKConfigValidation { + + private static final Logger log = Logger.getLogger(OASTORKConfigValidation.class); + public List validate(OASTORKConfig oageneral) { - + List errors = new ArrayList(); - - // we only have a checkbox for now, so no need to validate anything here - + + // check qaa + int qaa = oageneral.getQaa(); + if(1 > qaa && 4 < qaa) { + log.warn("QAA is out of range : " + qaa); + errors.add(LanguageHelper.getErrorString("validation.stork.qaa.outofrange", + new Object[] {qaa} )); + } + + // check attributes + String check = oageneral.getAttributes(); + if (MiscUtil.isNotEmpty(check)) { + if (ValidationHelper.containsPotentialCSSCharacter(check, true)) { + log.warn("attributes contains potentail XSS characters: " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", + new Object[] {ValidationHelper.getPotentialCSSCharacter(true)} )); + } + if(!check.toLowerCase().matches("^[a-z0-9, ]*$")) { + log.warn("attributes do not match the requested format : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", + new Object[] {check} )); + } + } + return errors; } } diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd index 7df6bad3f..9700b0a4f 100644 --- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd +++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd @@ -920,7 +920,10 @@ - + + + @@ -985,4 +988,8 @@ + + + + -- cgit v1.2.3 From bb32dd1f8978907c57beedfb490229b39a77e8df Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 19 Dec 2013 12:07:29 +0100 Subject: fixed minor bug in error reporting --- .../moa/id/configuration/validation/moaconfig/StorkConfigValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java index 4ee247695..730466e15 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java @@ -69,7 +69,7 @@ public class StorkConfigValidator { if (ValidationHelper.containsPotentialCSSCharacter(check, true)) { log.warn("default attributes contains potentail XSS characters: " + check); errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", - new Object[] {ValidationHelper.getPotentialCSSCharacter(false)} )); + new Object[] {ValidationHelper.getPotentialCSSCharacter(true)} )); } if(!check.toLowerCase().matches("^[a-z0-9, ]*$")) { log.warn("default attributes do not match the requested format : " + check); -- cgit v1.2.3 From 7c39d9e0cff15a87678bf68d6d754ee1e720ca12 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 7 Jan 2014 13:48:06 +0100 Subject: attr table in global config --- .../id/configuration/data/GeneralStorkConfig.java | 11 ++++------ .../validation/moaconfig/StorkConfigValidator.java | 25 +++++++++++++--------- .../main/resources/applicationResources.properties | 4 ++-- .../src/main/webapp/jsp/editMOAConfig.jsp | 13 ++++++----- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java index 8b527aa8f..695caa3fd 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java @@ -1,7 +1,6 @@ package at.gv.egovernment.moa.id.configuration.data; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; @@ -66,14 +65,12 @@ public class GeneralStorkConfig { return tmp; } - public String getDefaultAttributes() { - return Arrays.toString(attributes.toArray()).replace("[", "").replace("]", ""); + public List getAttributes() { + return attributes; } - public void setDefaultAttributes(String attributes) { - this.attributes = new ArrayList(); - for(String current : attributes.split(",")) - this.attributes.add(current.trim()); + public void setAttributes(List attributes) { + this.attributes = attributes; } public int getDefaultQaa() { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java index 730466e15..cc5d0f2c4 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java @@ -64,18 +64,23 @@ public class StorkConfigValidator { } // check attributes - String check = form.getDefaultAttributes(); - if (MiscUtil.isNotEmpty(check)) { - if (ValidationHelper.containsPotentialCSSCharacter(check, true)) { - log.warn("default attributes contains potentail XSS characters: " + check); - errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", - new Object[] {ValidationHelper.getPotentialCSSCharacter(true)} )); - } - if(!check.toLowerCase().matches("^[a-z0-9, ]*$")) { - log.warn("default attributes do not match the requested format : " + check); + if (MiscUtil.isNotEmpty(form.getAttributes())) { + for(String check : form.getAttributes()) { + if (ValidationHelper.containsPotentialCSSCharacter(check, true)) { + log.warn("default attributes contains potentail XSS characters: " + check); errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", - new Object[] {check} )); + new Object[] {ValidationHelper.getPotentialCSSCharacter(true)} )); + } + if(!check.toLowerCase().matches("^[a-z0-9]*$")) { + log.warn("default attributes do not match the requested format : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", + new Object[] {check} )); + } } + } else { + log.warn("no attributes specified"); + errors.add(LanguageHelper.getErrorString("validation.stork.attributes.empty", + new Object[] {} )); } return errors; diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties index 0ac4b2cbc..14f282c85 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties @@ -227,9 +227,8 @@ webpages.oaconfig.stork.usestork=STORK Logon aktivieren webpages.moaconfig.stork.pepslist=C-PEPS Konfiguration webpages.moaconfig.stork.newpeps=Neuen PEPS konfigurieren webpages.moaconfig.stork.removepeps=l\u00F6schen -webpages.moaconfig.stork.requestedattributes.default=Standardattribute, die von STORK angefordert werden webpages.moaconfig.stork.qaa.default=Standard QAA-Level ausw\u00E4hlen -webpages.moaconfig.stork.requestedattributes=Attribute, die von STORK angefordert werden +webpages.moaconfig.stork.attributes.heading=Attributkonfiguration webpages.moaconfig.stork.qaa=Mindest-QAA-Level f\u00FCr diese OA ausw\u00E4hlen webpages.oaconfig.protocols.saml1.header=SAML1 Konfiguration @@ -379,6 +378,7 @@ validation.stork.cpeps.empty=CPEPS Konfiguration ist unvollst\u00E4ndig validation.stork.cpeps.url=CPEPS URL ist ung\u00FCltig validation.stork.requestedattributes=STORK Attribute sind fehlerhaft. Bsp.: attr1, attr2 validation.stork.qaa.outofrange=Gültige QAA Werte sind 1, 2, 3, und 4 +validation.stork.attributes.empty=Es muss mindestens ein Attribut definiert sein validation.pvp2.metadataurl.empty=Keine Metadaten URL angegeben. validation.pvp2.metadataurl.valid=Die Metadaten URL wei\u00DFt kein g\u00FCltiges URL Format auf. diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index df6a43e7a..aff2028ac 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -228,11 +228,6 @@

<%=LanguageHelper.getGUIString("webpages.oaconfig.stork.header", request) %>

-
Country ShortcodePEPS URL
" onclick='newPeps();' /> +

<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading", request) %>

+ + + + + + +
Attribute Name
-- cgit v1.2.3 From 3da3836bcd77a23ca00df2bdb088e63b47cc6499 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 7 Jan 2014 15:07:32 +0100 Subject: mandatory field in global config --- .../id/configuration/data/GeneralStorkConfig.java | 23 +++++++++------------- .../struts/action/EditGeneralConfigAction.java | 2 +- .../validation/moaconfig/StorkConfigValidator.java | 7 ++++--- .../src/main/webapp/jsp/editMOAConfig.jsp | 7 ++++--- .../src/main/resources/config/moaid_config_2.0.xsd | 17 ++++++++-------- 5 files changed, 27 insertions(+), 29 deletions(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java index 695caa3fd..854334bed 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java @@ -7,13 +7,13 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities; import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.RequestedAttributesType; import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; +import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; public class GeneralStorkConfig { private List cpepslist; - private List attributes; + private List attributes; private int qaa; public void parse(MOAIDConfiguration config) { @@ -27,16 +27,17 @@ public class GeneralStorkConfig { if (foreign != null) { STORK stork = foreign.getSTORK(); if (stork != null) { - // deep clone to foreclose lazyloading session timeouts + // deep clone all the things + // to foreclose lazyloading session timeouts cpepslist = new ArrayList(); for(CPEPS current : stork.getCPEPS()) { cpepslist.add(current); } - RequestedAttributesType tmp = stork.getRequestedAttributes(); + List tmp = stork.getRequestedAttributes(); if(null != tmp) { - attributes = new ArrayList(); - for(String current : tmp.getAttributeValue()) + attributes = new ArrayList(); + for(StorkAttribute current : tmp) attributes.add(current); } @@ -59,17 +60,11 @@ public class GeneralStorkConfig { cpepslist = list; } - public RequestedAttributesType getRequestedAttributesType() { - RequestedAttributesType tmp = new RequestedAttributesType(); - tmp.setAttributeValue(attributes); - return tmp; - } - - public List getAttributes() { + public List getAttributes() { return attributes; } - public void setAttributes(List attributes) { + public void setAttributes(List attributes) { this.attributes = attributes; } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index 72da0b59f..1de440506 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -398,7 +398,7 @@ public class EditGeneralConfigAction extends ActionSupport oldstork = new STORK(); oldstork.setQualityAuthenticationAssuranceLevel(storkconfig.getDefaultQaa()); - oldstork.setRequestedAttributes(storkconfig.getRequestedAttributesType()); + oldstork.setRequestedAttributes(storkconfig.getAttributes()); oldstork.setCPEPS(storkconfig.getCpepslist()); dbforeign.setSTORK(oldstork); } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java index cc5d0f2c4..318b3b3e7 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java @@ -5,6 +5,7 @@ import java.util.List; import org.apache.log4j.Logger; import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; +import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; import at.gv.egovernment.moa.id.configuration.data.GeneralStorkConfig; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper; @@ -65,13 +66,13 @@ public class StorkConfigValidator { // check attributes if (MiscUtil.isNotEmpty(form.getAttributes())) { - for(String check : form.getAttributes()) { - if (ValidationHelper.containsPotentialCSSCharacter(check, true)) { + for(StorkAttribute check : form.getAttributes()) { + if (ValidationHelper.containsPotentialCSSCharacter(check.getName(), true)) { log.warn("default attributes contains potentail XSS characters: " + check); errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", new Object[] {ValidationHelper.getPotentialCSSCharacter(true)} )); } - if(!check.toLowerCase().matches("^[a-z0-9]*$")) { + if(!check.getName().toLowerCase().matches("^[a-z0-9]*$")) { log.warn("default attributes do not match the requested format : " + check); errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", new Object[] {check} )); diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index aff2028ac..078e5f681 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -245,9 +245,10 @@ " onclick='newPeps();' />

<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading", request) %>

- - - + + + +
Attribute Name
Attribute NameMandatory
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd index 9700b0a4f..b1834fc96 100644 --- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd +++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd @@ -49,7 +49,7 @@ - + possibility to include common austrian primary keys in human readable way, english translation not available @@ -79,12 +79,13 @@ - + - + + - + @@ -853,7 +854,7 @@ - + @@ -922,10 +923,10 @@ - + - + @@ -989,7 +990,7 @@ - + -- cgit v1.2.3 From c26721de9136104520fd0ce9e8aba91b480a4bb9 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 7 Jan 2014 15:12:46 +0100 Subject: new attribute button --- .../src/main/resources/applicationResources.properties | 1 + id/ConfigWebTool/src/main/webapp/js/common.js | 9 +++++++++ id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties index 14f282c85..712c8f56b 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties @@ -229,6 +229,7 @@ webpages.moaconfig.stork.newpeps=Neuen PEPS konfigurieren webpages.moaconfig.stork.removepeps=l\u00F6schen webpages.moaconfig.stork.qaa.default=Standard QAA-Level ausw\u00E4hlen webpages.moaconfig.stork.attributes.heading=Attributkonfiguration +webpages.moaconfig.stork.attributes.new=Neues Attribut hinzuf\u00FCgen webpages.moaconfig.stork.qaa=Mindest-QAA-Level f\u00FCr diese OA ausw\u00E4hlen webpages.oaconfig.protocols.saml1.header=SAML1 Konfiguration diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index b07b31205..774bffd8d 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -194,3 +194,12 @@ function newPeps() { clone.innerHTML = clone.innerHTML.replace(/(.*" value=").*?(".*)/g, '$1$2'); target.parentNode.appendChild(clone); } +function newStorkAttribute() { + var target = $(document.getElementById("stork_attributelist").getElementsByTagName("tr")).last()[0]; + var clone = target.cloneNode(true); + var lastindex = parseInt(clone.innerHTML.match(/name="storkconfig.attributes\[(\d)/)[1]); + var nextindex = lastindex + 1; + clone.innerHTML = clone.innerHTML.replace(/name="storkconfig.attributes\[\d/g, 'name="storkconfig.attributes[' + nextindex); + clone.innerHTML = clone.innerHTML.replace(/(.*" value=").*?(".*)/g, '$1$2'); + target.parentNode.appendChild(clone); +} \ No newline at end of file diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index 078e5f681..0f8ec5f1b 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -244,7 +244,7 @@ " onclick='newPeps();' />

<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading", request) %>

- +
@@ -252,6 +252,7 @@
Attribute NameMandatory
+ " onclick='newStorkAttribute();' />
-- cgit v1.2.3 From 6ef9296d79741b455530f70262003fefd51ee85c Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 7 Jan 2014 15:17:56 +0100 Subject: i18n --- .../moa/id/configuration/data/StorkAttributes.java | 28 ---------------------- .../main/resources/applicationResources.properties | 3 +++ .../src/main/webapp/jsp/editMOAConfig.jsp | 4 ++-- 3 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/StorkAttributes.java diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/StorkAttributes.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/StorkAttributes.java deleted file mode 100644 index b1857aea1..000000000 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/StorkAttributes.java +++ /dev/null @@ -1,28 +0,0 @@ -package at.gv.egovernment.moa.id.configuration.data; - -public class StorkAttributes { - - - public AttributValues eIdentifier; - - - public void parse() { - eIdentifier = AttributValues.MANDATORY; - } - - - public enum AttributValues { - MANDATORY, OPTIONAL, NOT; - - public String getValue() { - if (this == MANDATORY) - return MANDATORY.name(); - if (this == OPTIONAL) - return OPTIONAL.name(); - else - return NOT.name(); - } - } - -} - diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties index 712c8f56b..8691ab8ae 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties @@ -230,6 +230,9 @@ webpages.moaconfig.stork.removepeps=l\u00F6schen webpages.moaconfig.stork.qaa.default=Standard QAA-Level ausw\u00E4hlen webpages.moaconfig.stork.attributes.heading=Attributkonfiguration webpages.moaconfig.stork.attributes.new=Neues Attribut hinzuf\u00FCgen +webpages.moaconfig.stork.attributes.heading.name=Attributname +webpages.moaconfig.stork.attributes.heading.mandatory=zwingend +webpages.moaconfig.stork.attributes.remove=l\u00F6schen webpages.moaconfig.stork.qaa=Mindest-QAA-Level f\u00FCr diese OA ausw\u00E4hlen webpages.oaconfig.protocols.saml1.header=SAML1 Konfiguration diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index 0f8ec5f1b..a86daf699 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -245,11 +245,11 @@ " onclick='newPeps();' />

<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading", request) %>

- + - +
Attribute NameMandatory
<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading.name", request) %><%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading.mandatory", request) %>
" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>
" onclick='newStorkAttribute();' /> -- cgit v1.2.3 From fb6e40832df5182ae1ebd7555583caed174e8776 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 7 Jan 2014 17:25:38 +0100 Subject: oa attr configuration revisited --- .../id/configuration/data/oa/AttributeHelper.java | 61 ++++++++++++++++++++++ .../id/configuration/data/oa/OASTORKConfig.java | 56 +++++++++++++------- .../configuration/struts/action/EditOAAction.java | 2 +- .../validation/oa/OASTORKConfigValidation.java | 17 ------ .../src/main/webapp/jsp/editOAGeneral.jsp | 15 ++++-- .../src/main/resources/config/moaid_config_2.0.xsd | 11 +++- 6 files changed, 117 insertions(+), 45 deletions(-) create mode 100644 id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java new file mode 100644 index 000000000..1590918c6 --- /dev/null +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java @@ -0,0 +1,61 @@ +package at.gv.egovernment.moa.id.configuration.data.oa; + +import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute; +import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; + +public class AttributeHelper { + private boolean isUsed = false; + private String name; + private boolean mandatory; + private boolean readonly; + + public AttributeHelper() { + // TODO Auto-generated constructor stub + } + + public AttributeHelper(OAStorkAttribute attribute) { + isUsed = true; + name = attribute.getAttribute().getName(); + mandatory = attribute.isMandatory(); + readonly = attribute.getAttribute().isMandatory(); + } + + public AttributeHelper(StorkAttribute attribute) { + name = attribute.getName(); + mandatory = false; + readonly = attribute.isMandatory(); + isUsed = readonly; + } + + public boolean isUsed() { + return isUsed; + } + + public void setUsed(boolean used) { + isUsed = used; + } + + public String getName() { + return name; + } + + public void setName(String newname) { + name = newname; + } + + public boolean isMandatory() { + return mandatory; + } + + public void setMandatory(boolean value) { + mandatory = value; + } + + public boolean isReadOnly() { + return readonly; + } + + public void setReadOnly(boolean value) { + // we do not allow setting the readonly field + } +} \ No newline at end of file diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java index f6fc4416f..42501b4d1 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java @@ -1,20 +1,21 @@ package at.gv.egovernment.moa.id.configuration.data.oa; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK; +import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -import at.gv.egovernment.moa.id.commons.db.dao.config.RequestedAttributesType; +import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; public class OASTORKConfig { private boolean isStorkLogonEnabled = false; private int qaa; - private List attributes; + + private List attributes; public OASTORKConfig() { @@ -40,13 +41,20 @@ public class OASTORKConfig { setQaa(ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getQualityAuthenticationAssuranceLevel()); } - RequestedAttributesType tmp = config.getAttributes(); - if(null == tmp) - // if there is no configuration available for the OA, get the default attributes - tmp = ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getRequestedAttributes(); - attributes = new ArrayList(); - for(String current : tmp.getAttributeValue()) - attributes.add(current); + // prepare attribute helper list + attributes = new ArrayList(); + for(StorkAttribute current : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getRequestedAttributes()) { + AttributeHelper tmp = null; + + for(OAStorkAttribute sepp : config.getAttributes()) + if(sepp.getAttribute().equals(current)) + tmp = new AttributeHelper(sepp); + + if(null == tmp) + tmp = new AttributeHelper(current); + + attributes.add(tmp); + } } } } @@ -67,19 +75,27 @@ public class OASTORKConfig { this.qaa = qaa; } - public RequestedAttributesType getRequestedAttributesType() { - RequestedAttributesType tmp = new RequestedAttributesType(); - tmp.setAttributeValue(attributes); - return tmp; + public List getAttributes() { + List result = new ArrayList(); + for(AttributeHelper current : getHelperAttributes()) { + if(current.isUsed()) { + OAStorkAttribute tmp = new OAStorkAttribute(); + for(StorkAttribute currentAttribute : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getRequestedAttributes()) + if(currentAttribute.getName().equals(current.getName())) + tmp.setAttribute(currentAttribute); + tmp.setMandatory(current.isMandatory()); + result.add(tmp); + } + } + + return result; } - public String getAttributes() { - return Arrays.toString(attributes.toArray()).replace("[", "").replace("]", ""); + public List getHelperAttributes() { + return attributes; } - public void setAttributes(String attributes) { - this.attributes = new ArrayList(); - for(String current : attributes.split(",")) - this.attributes.add(current.trim()); + public void setHelperAttributes(List attributes) { + this.attributes = attributes; } } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index 466feba23..59d5f7302 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -968,7 +968,7 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware, // transfer the incoming data to the database model stork.setStorkLogonEnabled(storkOA.isStorkLogonEnabled()); stork.setQaa(storkOA.getQaa()); - stork.setAttributes(storkOA.getRequestedAttributesType()); + stork.setAttributes(storkOA.getAttributes()); try { if (newentry) { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java index 31cf7bcee..71b3857c3 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java @@ -7,8 +7,6 @@ import org.apache.log4j.Logger; import at.gv.egovernment.moa.id.configuration.data.oa.OASTORKConfig; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; -import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper; -import at.gv.egovernment.moa.util.MiscUtil; public class OASTORKConfigValidation { @@ -26,21 +24,6 @@ public class OASTORKConfigValidation { new Object[] {qaa} )); } - // check attributes - String check = oageneral.getAttributes(); - if (MiscUtil.isNotEmpty(check)) { - if (ValidationHelper.containsPotentialCSSCharacter(check, true)) { - log.warn("attributes contains potentail XSS characters: " + check); - errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", - new Object[] {ValidationHelper.getPotentialCSSCharacter(true)} )); - } - if(!check.toLowerCase().matches("^[a-z0-9, ]*$")) { - log.warn("attributes do not match the requested format : " + check); - errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", - new Object[] {check} )); - } - } - return errors; } } diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp index d12a47b9e..57728845c 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp @@ -313,16 +313,21 @@ onclick="oaStork();" id="OAuseSTORKLogon" />
- +

Attributes

+ + + + + + + + +
verwendetAttributnamemandatory
" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd index b1834fc96..6972b031c 100644 --- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd +++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd @@ -49,7 +49,7 @@ - + possibility to include common austrian primary keys in human readable way, english translation not available @@ -923,8 +923,8 @@ - + @@ -993,4 +993,11 @@ + + + + + + + -- cgit v1.2.3 From 21c26bc3ead6ca414179268056bfc11006c5efe3 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 7 Jan 2014 17:34:03 +0100 Subject: global mandatory attr cannot be deselected for OA --- id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp index 57728845c..413298724 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp @@ -322,7 +322,7 @@ - + -- cgit v1.2.3 From 7fb3ae0e4922ec76e998937b771df244574be394 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 14 Jan 2014 13:45:24 +0100 Subject: refactored stork-related database structure --- .../id/configuration/data/GeneralStorkConfig.java | 4 +++- .../id/configuration/data/oa/AttributeHelper.java | 3 +-- .../id/configuration/data/oa/OASTORKConfig.java | 28 +++++++++++++--------- .../struts/action/EditGeneralConfigAction.java | 2 +- .../configuration/struts/action/EditOAAction.java | 2 +- .../src/main/webapp/jsp/editOAGeneral.jsp | 7 +++--- .../src/main/resources/config/moaid_config_2.0.xsd | 15 ++++++------ 7 files changed, 34 insertions(+), 27 deletions(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java index 854334bed..ce4803978 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java @@ -34,12 +34,14 @@ public class GeneralStorkConfig { cpepslist.add(current); } - List tmp = stork.getRequestedAttributes(); + List tmp = stork.getAttributes(); if(null != tmp) { attributes = new ArrayList(); for(StorkAttribute current : tmp) attributes.add(current); } + if(attributes.isEmpty()) + attributes.add(new StorkAttribute()); try { qaa = stork.getQualityAuthenticationAssuranceLevel(); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java index 1590918c6..349f3bf4a 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java @@ -15,9 +15,8 @@ public class AttributeHelper { public AttributeHelper(OAStorkAttribute attribute) { isUsed = true; - name = attribute.getAttribute().getName(); + name = attribute.getName(); mandatory = attribute.isMandatory(); - readonly = attribute.getAttribute().isMandatory(); } public AttributeHelper(StorkAttribute attribute) { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java index 42501b4d1..10ebbe112 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java @@ -43,11 +43,11 @@ public class OASTORKConfig { // prepare attribute helper list attributes = new ArrayList(); - for(StorkAttribute current : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getRequestedAttributes()) { + for(StorkAttribute current : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getAttributes()) { AttributeHelper tmp = null; - for(OAStorkAttribute sepp : config.getAttributes()) - if(sepp.getAttribute().equals(current)) + for(OAStorkAttribute sepp : config.getOAAttributes()) + if(sepp.getName().equals(current.getName())) tmp = new AttributeHelper(sepp); if(null == tmp) @@ -77,15 +77,21 @@ public class OASTORKConfig { public List getAttributes() { List result = new ArrayList(); + + if(null == getHelperAttributes()) + return result; + for(AttributeHelper current : getHelperAttributes()) { - if(current.isUsed()) { - OAStorkAttribute tmp = new OAStorkAttribute(); - for(StorkAttribute currentAttribute : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getRequestedAttributes()) - if(currentAttribute.getName().equals(current.getName())) - tmp.setAttribute(currentAttribute); - tmp.setMandatory(current.isMandatory()); - result.add(tmp); - } + for(StorkAttribute currentAttribute : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getAttributes()) + if(currentAttribute.getName().equals(current.getName())) { + if(current.isUsed() || currentAttribute.isMandatory()) { + OAStorkAttribute tmp = new OAStorkAttribute(); + tmp.setName(current.getName()); + tmp.setMandatory(current.isMandatory()); + result.add(tmp); + } + break; + } } return result; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index 1de440506..1c0cc5c89 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -398,7 +398,7 @@ public class EditGeneralConfigAction extends ActionSupport oldstork = new STORK(); oldstork.setQualityAuthenticationAssuranceLevel(storkconfig.getDefaultQaa()); - oldstork.setRequestedAttributes(storkconfig.getAttributes()); + oldstork.setAttributes(storkconfig.getAttributes()); oldstork.setCPEPS(storkconfig.getCpepslist()); dbforeign.setSTORK(oldstork); } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index 59d5f7302..ca027e578 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -968,7 +968,7 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware, // transfer the incoming data to the database model stork.setStorkLogonEnabled(storkOA.isStorkLogonEnabled()); stork.setQaa(storkOA.getQaa()); - stork.setAttributes(storkOA.getAttributes()); + stork.setOAAttributes(storkOA.getAttributes()); try { if (newentry) { diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp index 413298724..b58b997ec 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp @@ -322,10 +322,9 @@
verwendetAttributnamemandatory
" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>
- - - - + + +
verwendetAttributnamemandatory
" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd index 6972b031c..3ed7c936a 100644 --- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd +++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd @@ -72,8 +72,6 @@ - - @@ -85,7 +83,6 @@ - @@ -853,8 +850,10 @@ - - + + + + @@ -924,7 +923,7 @@ - + @@ -996,8 +995,10 @@ - + + + -- cgit v1.2.3 From 4ef34e63ce36e20529d6350e81283617a8d69b96 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 14 Jan 2014 14:02:32 +0100 Subject: outgoing auth request works --- .../moa/id/auth/AuthenticationServer.java | 208 +++++++++++---------- .../moa/id/auth/data/AuthenticationSession.java | 1 - .../id/config/auth/AuthConfigurationProvider.java | 3 +- .../moa/id/config/auth/OAAuthParameter.java | 31 +-- .../moa/id/config/stork/STORKConfig.java | 1 - 5 files changed, 114 insertions(+), 130 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 278f93f14..b30720501 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -29,8 +29,12 @@ import iaik.x509.X509Certificate; import iaik.x509.X509ExtensionInitException; import java.io.ByteArrayInputStream; +import java.io.CharArrayWriter; import java.io.IOException; import java.io.InputStream; +import java.io.StringWriter; +import java.net.HttpURLConnection; +import java.net.URL; import java.security.GeneralSecurityException; import java.security.Principal; import java.security.cert.CertificateException; @@ -50,8 +54,18 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import org.apache.commons.lang.StringEscapeUtils; +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; import org.apache.xpath.XPathAPI; -import org.opensaml.saml2.metadata.RequestedAttribute; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLObjectBuilder; +import org.opensaml.common.binding.BasicSAMLMessageContext; +import org.opensaml.saml2.binding.encoding.HTTPPostEncoder; +import org.opensaml.saml2.metadata.AssertionConsumerService; +import org.opensaml.saml2.metadata.Endpoint; +import org.opensaml.ws.transport.http.HTTPOutTransport; +import org.opensaml.ws.transport.http.HttpServletResponseAdapter; import org.opensaml.xml.util.Base64; import org.opensaml.xml.util.XMLHelper; import org.springframework.util.xml.DomUtils; @@ -91,6 +105,7 @@ import at.gv.egovernment.moa.id.auth.parser.InfoboxReadResponseParser; import at.gv.egovernment.moa.id.auth.parser.VerifyXMLSignatureResponseParser; import at.gv.egovernment.moa.id.auth.servlet.PEPSConnectorServlet; import at.gv.egovernment.moa.id.auth.stork.STORKAuthnRequestProcessor; +import at.gv.egovernment.moa.id.auth.stork.VelocityProvider; import at.gv.egovernment.moa.id.auth.validator.CreateXMLSignatureResponseValidator; import at.gv.egovernment.moa.id.auth.validator.IdentityLinkValidator; import at.gv.egovernment.moa.id.auth.validator.InfoboxValidator; @@ -103,6 +118,7 @@ import at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.SZRGWConstants import at.gv.egovernment.moa.id.client.SZRGWClient; import at.gv.egovernment.moa.id.client.SZRGWClientException; import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber; +import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.ConnectionParameter; @@ -131,13 +147,21 @@ import at.gv.egovernment.moa.util.XPathUtils; import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest; import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; import eu.stork.mw.messages.saml.STORKAuthnRequest; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.engine.SAMLEngine; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.auth.engine.core.QAAAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeBuilder; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeBuilder; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesBuilder; +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; import eu.stork.vidp.messages.builder.STORKMessagesBuilder; -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.exception.SAMLException; -import eu.stork.vidp.messages.exception.SAMLValidationException; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; -import eu.stork.vidp.messages.stork.RequestedAttributes; -import eu.stork.vidp.messages.util.SAMLUtil; import eu.stork.vidp.messages.util.XMLUtil; /** @@ -1813,58 +1837,28 @@ public class AuthenticationServer implements MOAIDAuthConstants { String providerName= oaParam.getFriendlyName(); String issuerValue = HTTPUtils.getBaseURL(req); Logger.debug("Issuer value: " + issuerValue); - - - QualityAuthenticationAssuranceLevel qaaLevel = STORKMessagesBuilder.buildQualityAuthenticationAssuranceLevel(oaParam.getQaaLevel().getValue()); - //Logger.debug("QAALevel: " + qaaLevel.getValue()); - - RequestedAttributes requestedAttributes = null; - - requestedAttributes = oaParam.getRequestedAttributes(); - requestedAttributes.detach(); - List reqAttributeList = new ArrayList(); - List oaReqAttributeList = null; - oaReqAttributeList = new ArrayList(oaParam.getRequestedAttributes().getRequestedAttributes()); - - //check if country specific attributes must be additionally requested - if (!cpeps.getCountrySpecificRequestedAttributes().isEmpty()) { - //add country specific attributes to be requested (Hierarchy: default oa attributes > country specific attributes > oa specific attributes - Logger.debug("We have addtional country specific attributes to be requested from the C-PEPS of country: " + moasession.getCcc()); - Logger.debug("The following attributes are requested for this specific country:"); - List countrySpecificReqAttributeList = new ArrayList(cpeps.getCountrySpecificRequestedAttributes()); - for (RequestedAttribute csReqAttr : countrySpecificReqAttributeList) { - csReqAttr.detach(); - if (!STORKConstants.DEFAULT_STORK_REQUESTED_ATTRIBUTE_SET.contains(csReqAttr.getName())) { - //this country specific attribute does not override default attribute - if (SAMLUtil.containsAttribute(oaReqAttributeList, csReqAttr.getName())) { - //the same attribute is requested for OA, applying hierachy - //remove oa attribute - oaReqAttributeList.remove(SAMLUtil.getAttribute(oaReqAttributeList, csReqAttr.getName())); - //add country specific attribute instead - Logger.debug("Requested Attribute (" + csReqAttr.getName() + ") is also requested by OA but we use Country Specific value instead"); - } - oaReqAttributeList.add(csReqAttr); - Logger.debug("Country specific requested attribute: " + csReqAttr.getName() + ", isRequired: " + csReqAttr.isRequired()); - } else { - Logger.debug("Country specific requested attribute: " + csReqAttr.getName() + ", isRequired: " + csReqAttr.isRequired() + " tries to overwrite default requested and required attributes, hence we skip it."); - } - - } - reqAttributeList.addAll(oaReqAttributeList); - } else { - //no country specific requested attributes - reqAttributeList.addAll(oaReqAttributeList); + + + + // prepare collection of required attributes + // - attributes for online application + List attributesFromConfig = oaParam.getRequestedAttributes(); + + // - prepare attribute list + PersonalAttributeList attributeList = new PersonalAttributeList(); + + // - fill container + for(OAStorkAttribute current : attributesFromConfig) { + PersonalAttribute newAttribute = new PersonalAttribute(); + newAttribute.setName(current.getName()); + newAttribute.setIsRequired(current.isMandatory()); + attributeList.add(newAttribute); } - - reqAttributeList = (List) SAMLUtil.releaseDOM(reqAttributeList); - requestedAttributes = STORKMessagesBuilder.buildRequestedAttributes(reqAttributeList); - + if (Logger.isDebugEnabled()) { Logger.debug("The following attributes are requested for this OA:"); - for (RequestedAttribute logReqAttr : reqAttributeList) { - Logger.debug("OA specific requested attribute: " + logReqAttr.getName() + ", isRequired: " + logReqAttr.isRequired()); - - } + for (OAStorkAttribute logReqAttr : attributesFromConfig) + Logger.debug("OA specific requested attribute: " + logReqAttr.getName() + ", isRequired: " + logReqAttr.isMandatory()); } @@ -1876,38 +1870,42 @@ public class AuthenticationServer implements MOAIDAuthConstants { String textToBeSigned = CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession); - - //generate AuthnRquest - STORKAuthnRequest storkAuthnRequest = STORKAuthnRequestProcessor.generateSTORKAuthnRequest( - destination, - acsURL, - providerName, - issuerValue, - qaaLevel, - requestedAttributes, - spSector, - spInstitution, - spApplication, - spCountry, - textToBeSigned, - "application/xhtml+xml"); - + + //generate AuthnRquest + STORKAuthnRequest authnRequest = new STORKAuthnRequest(); + authnRequest.setDestination(destination); + authnRequest.setAssertionConsumerServiceURL(acsURL); + authnRequest.setProviderName(providerName); + authnRequest.setIssuer(issuerValue); + authnRequest.setQaa(oaParam.getQaaLevel()); + authnRequest.setSpInstitution(spInstitution); + authnRequest.setCountry(spCountry); + authnRequest.setSpApplication(spApplication); + authnRequest.setSpSector(spSector); + authnRequest.setPersonalAttributeList(attributeList); + +// STORKAuthnRequestProcessor.generateSTORKAuthnRequest( +// destination, +// acsURL, +// providerName, +// issuerValue, +// qaaLevel, +// spInstitution, +// spApplication, +// spCountry, +// spSector, +// requestedAttributes, + +// textToBeSigned, +// "application/xhtml+xml"); + Logger.debug("STORK AuthnRequest succesfully assembled."); - - //sign AuthnRequest - String keyStorePath = storkConfig.getSignatureCreationParameter().getKeyStorePath(); - String keyStorePassword = storkConfig.getSignatureCreationParameter().getKeyStorePassword(); - String keyName = storkConfig.getSignatureCreationParameter().getKeyName(); - String keyPassword = storkConfig.getSignatureCreationParameter().getKeyPassword(); - - Logger.debug("Starting signing process of STORK AuthnRequest."); - Logger.trace("Using the following Keystore and Key for that:"); - Logger.trace("KeyStore: " + keyStorePath); - Logger.trace("KeyName: " + keyName); - + + STORKSAMLEngine samlEngine = STORKSAMLEngine.getInstance("CONF0"); try { - storkAuthnRequest = STORKAuthnRequestProcessor.signSTORKAuthnRequest(storkAuthnRequest, keyStorePath, keyStorePassword, keyName, keyPassword); - } catch (SAMLException e) { + authnRequest = samlEngine.generateSTORKAuthnRequest(authnRequest); +// authnRequest = STORKAuthnRequestProcessor.signSTORKAuthnRequest(authnRequest, keyStorePath, keyStorePassword, keyName, keyPassword); + } catch (STORKSAMLEngineException e) { Logger.error("Could not sign STORK SAML AuthnRequest.", e); throw new MOAIDException("stork.00", null); } @@ -1916,8 +1914,8 @@ public class AuthenticationServer implements MOAIDAuthConstants { //validate AuthnRequest try { - STORKAuthnRequestProcessor.validateSTORKAuthnRequest(storkAuthnRequest); - } catch (SAMLValidationException e) { + samlEngine.validateSTORKAuthnRequest(authnRequest.getTokenSaml()); + } catch (STORKSAMLEngineException e) { Logger.error("STORK SAML AuthnRequest not valid.", e); throw new MOAIDException("stork.01", null); } @@ -1925,26 +1923,36 @@ public class AuthenticationServer implements MOAIDAuthConstants { Logger.debug("STORK AuthnRequest successfully internally validated."); //send - moasession.setStorkAuthnRequest(storkAuthnRequest); + moasession.setStorkAuthnRequest(authnRequest); HttpSession httpSession = req.getSession(); httpSession.setAttribute("MOA-Session-ID", moasession.getSessionID()); - - Logger.debug("Preparing to send STORK AuthnRequest."); - + + + Logger.info("Preparing to send STORK AuthnRequest."); + Logger.info("prepared STORKAuthnRequest: "); + Logger.info(new String(authnRequest.getTokenSaml())); +// SAMLRequest = PEPSUtil.encodeSAMLToken(authnRequest.getTokenSaml()); + try { - STORKAuthnRequestProcessor.sendSTORKAuthnRequest(req, resp, storkAuthnRequest); + Logger.trace("Initialize VelocityEngine..."); + + VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine(); + Template template = velocityEngine.getTemplate("/saml2-post-binding-moa.vm"); + VelocityContext context = new VelocityContext(); + context.put("SAMLRequest", PEPSUtil.encodeSAMLToken(authnRequest.getTokenSaml())); + context.put("action", destination); + + StringWriter writer = new StringWriter(); + template.merge(context, writer); + + resp.getOutputStream().write(writer.toString().getBytes()); } catch (Exception e) { Logger.error("Error sending STORK SAML AuthnRequest.", e); httpSession.invalidate(); throw new MOAIDException("stork.02", new Object[] { destination }); } - - Logger.info("STORK AuthnRequest successfully sent to: " + storkAuthnRequest.getDestination()); - Logger.debug("STORKAuthnRequest sent (pretty print): "); - Logger.debug(XMLHelper.prettyPrintXML(storkAuthnRequest.getDOM())); - Logger.trace("STORKAuthnRequest sent (original): "); - Logger.trace(XMLUtil.printXML(storkAuthnRequest.getDOM())); - + + Logger.info("STORK AuthnRequest successfully successfully prepared for client with target location: " + authnRequest.getDestination()); } /** diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java index 9aecefd43..43ba83f91 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java @@ -33,7 +33,6 @@ import at.gv.egovernment.moa.id.util.client.mis.simple.MISMandate; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.Constants; import at.gv.egovernment.moa.util.DOMUtils; -import eu.stork.mw.messages.saml.STORKAuthnRequest; /** * Session data to be stored between AuthenticationServer API calls. diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java index 29f567324..f44f21db9 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java @@ -88,11 +88,10 @@ import at.gv.egovernment.moa.id.config.stork.STORKConfig; import at.gv.egovernment.moa.id.data.IssuerAndSerial; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; -import eu.stork.vidp.messages.common.STORKBootstrap; /** * A class providing access to the Auth Part of the MOA-ID configuration data. - * + * *

Configuration data is read from an XML file, whose location is given by * the moa.id.configuration system property.

*

This class implements the Singleton pattern. The reload() diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java index 3edb3cad9..60803bb8a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java @@ -37,6 +37,7 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.Mandates; import at.gv.egovernment.moa.id.commons.db.dao.config.OAPVP2; import at.gv.egovernment.moa.id.commons.db.dao.config.OASAML1; import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO; +import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.TemplateType; import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType; @@ -46,10 +47,6 @@ import at.gv.egovernment.moa.id.config.OAParameter; import at.gv.egovernment.moa.id.util.FormBuildUtils; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; -import eu.stork.vidp.messages.builder.STORKMessagesBuilder; -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; -import eu.stork.vidp.messages.stork.RequestedAttributes; /** * Configuration parameters belonging to an online application, @@ -78,21 +75,6 @@ public class OAAuthParameter extends OAParameter { this.keyBoxIdentifier = oa.getKeyBoxIdentifier().value(); } - - /** - * STORK QAA Level, Default = 4 - */ - private QualityAuthenticationAssuranceLevel qaaLevel = STORKMessagesBuilder.buildQualityAuthenticationAssuranceLevel(4); - - /** - * STORK RequestedAttributes for Online Application - * Default RequestedAttributes are: eIdentifier, givenName, surname, dateOfBirth - */ - private RequestedAttributes requestedAttributes = STORKMessagesBuilder.buildRequestedAttributes( - STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_EIDENTIFIER, true, null), - STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_GIVENNAME, true, null), - STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_SURNAME, true, null), - STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_DATEOFBIRTH, false, null)); private String keyBoxIdentifier; @@ -317,18 +299,15 @@ public Map getFormCustomizaten() { return map; } -/** - * @return the qaaLevel - */ -public QualityAuthenticationAssuranceLevel getQaaLevel() { - return qaaLevel; +public Integer getQaaLevel() { + return oa_auth.getOASTORK().getQaa(); } /** * @return the requestedAttributes */ -public RequestedAttributes getRequestedAttributes() { - return requestedAttributes; +public List getRequestedAttributes() { + return oa_auth.getOASTORK().getOAAttributes(); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java index 6a3f4cc9e..25f12af62 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java @@ -22,7 +22,6 @@ import org.xml.sax.SAXException; import eu.stork.vidp.messages.util.SAMLUtil; import eu.stork.vidp.messages.util.XMLUtil; -import at.gv.egovernment.moa.id.commons.db.dao.config.RequestedAttributeType; import at.gv.egovernment.moa.id.commons.db.dao.config.SAMLSigningParameter; import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; import at.gv.egovernment.moa.id.commons.db.dao.config.SignatureVerificationParameterType; -- cgit v1.2.3 From 5624eaf5d2f0305f92eb376cf5e4362da0f07e3a Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 14 Jan 2014 14:11:10 +0100 Subject: cleanup --- .../moa/id/auth/AuthenticationServer.java | 20 +-- .../moa/id/auth/data/AuthenticationSession.java | 2 + .../id/auth/stork/STORKAuthnRequestProcessor.java | 165 --------------------- .../id/config/auth/AuthConfigurationProvider.java | 6 +- 4 files changed, 6 insertions(+), 187 deletions(-) delete mode 100644 id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKAuthnRequestProcessor.java diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index b30720501..3857cd15c 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -29,17 +29,13 @@ import iaik.x509.X509Certificate; import iaik.x509.X509ExtensionInitException; import java.io.ByteArrayInputStream; -import java.io.CharArrayWriter; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; -import java.net.HttpURLConnection; -import java.net.URL; import java.security.GeneralSecurityException; import java.security.Principal; import java.security.cert.CertificateException; //import java.security.cert.CertificateFactory; -import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.Iterator; @@ -58,14 +54,6 @@ import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; import org.apache.xpath.XPathAPI; -import org.opensaml.Configuration; -import org.opensaml.common.SAMLObjectBuilder; -import org.opensaml.common.binding.BasicSAMLMessageContext; -import org.opensaml.saml2.binding.encoding.HTTPPostEncoder; -import org.opensaml.saml2.metadata.AssertionConsumerService; -import org.opensaml.saml2.metadata.Endpoint; -import org.opensaml.ws.transport.http.HTTPOutTransport; -import org.opensaml.ws.transport.http.HttpServletResponseAdapter; import org.opensaml.xml.util.Base64; import org.opensaml.xml.util.XMLHelper; import org.springframework.util.xml.DomUtils; @@ -104,7 +92,6 @@ import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser; import at.gv.egovernment.moa.id.auth.parser.InfoboxReadResponseParser; import at.gv.egovernment.moa.id.auth.parser.VerifyXMLSignatureResponseParser; import at.gv.egovernment.moa.id.auth.servlet.PEPSConnectorServlet; -import at.gv.egovernment.moa.id.auth.stork.STORKAuthnRequestProcessor; import at.gv.egovernment.moa.id.auth.stork.VelocityProvider; import at.gv.egovernment.moa.id.auth.validator.CreateXMLSignatureResponseValidator; import at.gv.egovernment.moa.id.auth.validator.IdentityLinkValidator; @@ -1860,16 +1847,12 @@ public class AuthenticationServer implements MOAIDAuthConstants { for (OAStorkAttribute logReqAttr : attributesFromConfig) Logger.debug("OA specific requested attribute: " + logReqAttr.getName() + ", isRequired: " + logReqAttr.isMandatory()); } - - + //TODO: check Target in case of SSO!! String spSector = StringUtils.isEmpty(moasession.getTarget()) ? "Business" : moasession.getTarget(); String spInstitution = StringUtils.isEmpty(oaParam.getFriendlyName()) ? "UNKNOWN" : oaParam.getFriendlyName(); String spApplication = spInstitution; String spCountry = "AT"; - - String textToBeSigned = - CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession); //generate AuthnRquest STORKAuthnRequest authnRequest = new STORKAuthnRequest(); @@ -1931,7 +1914,6 @@ public class AuthenticationServer implements MOAIDAuthConstants { Logger.info("Preparing to send STORK AuthnRequest."); Logger.info("prepared STORKAuthnRequest: "); Logger.info(new String(authnRequest.getTokenSaml())); -// SAMLRequest = PEPSUtil.encodeSAMLToken(authnRequest.getTokenSaml()); try { Logger.trace("Initialize VelocityEngine..."); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java index 43ba83f91..4a7676ec8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java @@ -26,6 +26,8 @@ import java.util.Vector; import org.w3c.dom.Element; +import eu.stork.peps.auth.commons.STORKAuthnRequest; + import at.gv.egovernment.moa.id.auth.validator.InfoboxValidator; import at.gv.egovernment.moa.id.auth.validator.parep.ParepUtils; import at.gv.egovernment.moa.id.protocols.oauth20.OAuth20SessionObject; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKAuthnRequestProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKAuthnRequestProcessor.java deleted file mode 100644 index e5c55d038..000000000 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKAuthnRequestProcessor.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * - */ -package at.gv.egovernment.moa.id.auth.stork; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.velocity.app.VelocityEngine; -import org.opensaml.common.binding.BasicSAMLMessageContext; -import org.opensaml.saml2.binding.encoding.HTTPPostEncoder; -import org.opensaml.saml2.metadata.AssertionConsumerService; -import org.opensaml.saml2.metadata.Endpoint; -import org.opensaml.ws.transport.http.HTTPOutTransport; -import org.opensaml.ws.transport.http.HttpServletResponseAdapter; -import org.opensaml.xml.security.credential.Credential; - -import at.gv.egovernment.moa.logging.Logger; -import eu.stork.mw.messages.saml.STORKAuthnRequest; -import eu.stork.vidp.messages.builder.STORKMessagesBuilder; -import eu.stork.vidp.messages.exception.SAMLException; -import eu.stork.vidp.messages.exception.SAMLValidationException; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; -import eu.stork.vidp.messages.stork.RequestedAttributes; -import eu.stork.vidp.messages.util.SAMLUtil; - -/** - * Class handling all necessary functionality for STORK AuthnRequest processing - * - * @author bzwattendorfer - * - */ -public class STORKAuthnRequestProcessor { - - /** - * Creates a STORK AuthnRequest - * @param destination Destination URL - * @param acsURL Assertion Consumer Service URL - * @param providerName SP Provider Name - * @param issuerValue Issuer Name - * @param qaaLevel STORK QAALevel to be requested - * @param requestedAttributes Requested Attributes to be requested - * @param spSector Sp Sector - * @param spInstitution SP Institution - * @param spApplication SP Application - * @param spCountry SP Country - * @param textToBeSigned text to be included in signedDoc element - * @param mimeType mimeType for the text to be signed in signedDoc - * @return STORK AuthnRequest - */ - public static STORKAuthnRequest generateSTORKAuthnRequest( - String destination, - String acsURL, - String providerName, - String issuerValue, - QualityAuthenticationAssuranceLevel qaaLevel, - RequestedAttributes requestedAttributes, - String spSector, - String spInstitution, - String spApplication, - String spCountry, - String textToBeSigned, - String mimeType) { - - - STORKAuthnRequest storkAuthnRequest = - STORKMessagesBuilder.buildSTORKAuthnRequest( - destination, - acsURL, - providerName, - issuerValue, - qaaLevel, - requestedAttributes, - spSector, - spInstitution, - spApplication, - spCountry); - - STORKMessagesBuilder.buildAndAddSignatureRequestToAuthnRequest(storkAuthnRequest, textToBeSigned, mimeType, true); - - Logger.debug("Added signedDoc attribute to STORK AuthnRequest"); - - return storkAuthnRequest; - - } - - /** - * Signs a STORK AuthnRequest - * @param storkAuthnRequest STORK AuthRequest to sign - * @param keyStorePath KeyStorePath to the signing key - * @param keyStorePassword KeyStore Password - * @param keyName Signing key name - * @param keyPassword Signing key password - * @return Signed STORK AuthnRequest - * @throws SAMLException - */ - public static STORKAuthnRequest signSTORKAuthnRequest( - STORKAuthnRequest storkAuthnRequest, - String keyStorePath, - String keyStorePassword, - String keyName, - String keyPassword) throws SAMLException { - - Logger.trace("Building Credential Provider for signing process"); - - CredentialProvider credentialProvider = new KeyStoreCredentialProvider(keyStorePath, keyStorePassword, keyName, keyPassword); - - Credential credential = credentialProvider.getCredential(); - - Logger.trace("Credentials found"); - - SAMLUtil.signSAMLObject(storkAuthnRequest, credential); - - return storkAuthnRequest; - } - - /** - * Validates a STORK AuthnRequest - * @param storkAuthnRequest STORK AuthnRequest to validate - * @throws SAMLValidationException - */ - public static void validateSTORKAuthnRequest(STORKAuthnRequest storkAuthnRequest) throws SAMLValidationException { - - SAMLUtil.verifySAMLObjectStandardValidation(storkAuthnRequest, "saml2-core-schema-and-stork-validator"); - - } - - /** - * Sends a STORK AuthnRequest (Endpoint taken out of AuthnRequest) - * @param request HttpServletRequest - * @param response HttpServletResponse - * @param storkAuthnRequest STORK AuthnRequest to send - * @throws Exception - */ - public static void sendSTORKAuthnRequest(HttpServletRequest request, HttpServletResponse response, STORKAuthnRequest storkAuthnRequest) throws Exception { - - Logger.trace("Create endpoint..."); - Endpoint endpoint = STORKMessagesBuilder.buildSAMLObject(AssertionConsumerService.DEFAULT_ELEMENT_NAME); - endpoint.setBinding("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"); - endpoint.setLocation(storkAuthnRequest.getDestination()); - - - Logger.trace("Prepare SAMLMessageContext..."); - HTTPOutTransport outTransport = new HttpServletResponseAdapter(response, request.isSecure()); - BasicSAMLMessageContext samlMessageContext = new BasicSAMLMessageContext(); - samlMessageContext.setOutboundMessageTransport(outTransport); - samlMessageContext.setPeerEntityEndpoint(endpoint); - - Logger.trace("Set STORK SAML AuthnRequest to SAMLMessageContext..."); - samlMessageContext.setOutboundSAMLMessage(storkAuthnRequest); - - Logger.trace("Initialize VelocityEngine..."); - - VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine(); - -// HTTPPostEncoder encoder = new HTTPPostEncoder(velocityEngine, "/templates/saml2-post-binding.vm"); - HTTPPostEncoder encoder = new HTTPPostEncoder(velocityEngine, "/saml2-post-binding-moa.vm"); - - Logger.trace("HTTP-Post encode SAMLMessageContext..."); - encoder.encode(samlMessageContext); - } - - - -} diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java index f44f21db9..aa97c548a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java @@ -338,9 +338,9 @@ public class AuthConfigurationProvider extends ConfigurationProvider { //Initialize OpenSAML for STORK - Logger.info("Starting initialization of OpenSAML..."); - STORKBootstrap.bootstrap(); - Logger.debug("OpenSAML successfully initialized"); +// Logger.info("Starting initialization of OpenSAML..."); +// STORKBootstrap.bootstrap(); +// Logger.debug("OpenSAML successfully initialized"); String legacyconfig = props.getProperty("configuration.xml.legacy"); -- cgit v1.2.3 From ae5214a3fdafeb1a859287f96f657783187e57d6 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Wed, 15 Jan 2014 15:19:15 +0100 Subject: fixed merge issue --- id/server/moa-id-commons/pom.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/id/server/moa-id-commons/pom.xml b/id/server/moa-id-commons/pom.xml index 94726fa16..c3e850b11 100644 --- a/id/server/moa-id-commons/pom.xml +++ b/id/server/moa-id-commons/pom.xml @@ -62,7 +62,11 @@ hyperjaxb3-ejb-runtime 0.5.6 - + + org.jvnet.hyperjaxb3 + maven-hyperjaxb3-plugin + 0.5.6 + mysql mysql-connector-java -- cgit v1.2.3 From 8276884b9c45315df5fa951ce53b3d35f4983b22 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Wed, 15 Jan 2014 17:04:02 +0100 Subject: fix load stork config from database --- .settings/org.eclipse.jdt.core.prefs | 7 ------- .../moa/id/config/auth/AuthConfigurationProvider.java | 10 +++------- 2 files changed, 3 insertions(+), 14 deletions(-) delete mode 100644 .settings/org.eclipse.jdt.core.prefs diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 638b39a15..000000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Thu Jan 03 11:06:02 CET 2013 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.source=1.3 diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java index aa97c548a..8de47f5f6 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java @@ -430,12 +430,8 @@ public class AuthConfigurationProvider extends ConfigurationProvider { ForeignIdentities foreign = auth.getForeignIdentities(); if (foreign == null ) { Logger.warn("Error in MOA-ID Configuration. No STORK configuration found."); - - } - //TODO: commented because npe was thrown - //else - //storkconfig = new STORKConfig(foreign.getSTORK(), props, rootConfigFileDir); - + } else + storkconfig = new STORKConfig(foreign.getSTORK(), props, rootConfigFileDir); //load Chaining modes ChainingModes cm = moaidconfig.getChainingModes(); @@ -1007,4 +1003,4 @@ public class AuthConfigurationProvider extends ConfigurationProvider { return moasp; } -} \ No newline at end of file +} -- cgit v1.2.3 From 6c7a6f8e222e4fb39a11c220b63e785f2037d428 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 16 Jan 2014 08:55:06 +0100 Subject: fix added real source of stork modules --- id/server/stork2-commons/Releases | 40 + id/server/stork2-commons/pom.xml | 183 ++ id/server/stork2-commons/src/.svn/all-wcprops | 5 + id/server/stork2-commons/src/.svn/entries | 34 + id/server/stork2-commons/src/main/.svn/all-wcprops | 5 + id/server/stork2-commons/src/main/.svn/entries | 37 + .../src/main/config/.svn/all-wcprops | 5 + .../stork2-commons/src/main/config/.svn/entries | 31 + .../src/main/config/embedded/.svn/all-wcprops | 11 + .../src/main/config/embedded/.svn/entries | 62 + .../.svn/text-base/pepsUtil.properties.svn-base | 232 ++ .../src/main/config/embedded/pepsUtil.properties | 232 ++ .../stork2-commons/src/main/java/.svn/all-wcprops | 5 + .../stork2-commons/src/main/java/.svn/entries | 31 + .../src/main/java/eu/.svn/all-wcprops | 5 + .../stork2-commons/src/main/java/eu/.svn/entries | 31 + .../src/main/java/eu/stork/.svn/all-wcprops | 5 + .../src/main/java/eu/stork/.svn/entries | 31 + .../src/main/java/eu/stork/peps/.svn/all-wcprops | 5 + .../src/main/java/eu/stork/peps/.svn/entries | 31 + .../main/java/eu/stork/peps/auth/.svn/all-wcprops | 5 + .../src/main/java/eu/stork/peps/auth/.svn/entries | 34 + .../eu/stork/peps/auth/commons/.svn/all-wcprops | 167 ++ .../java/eu/stork/peps/auth/commons/.svn/entries | 949 +++++++ .../text-base/AttributeConstants.java.svn-base | 72 + .../.svn/text-base/AttributeProvider.java.svn-base | 74 + .../text-base/AttributeProvidersMap.java.svn-base | 94 + .../.svn/text-base/AttributeSource.java.svn-base | 119 + .../.svn/text-base/AttributeUtil.java.svn-base | 231 ++ .../.svn/text-base/CitizenConsent.java.svn-base | 123 + .../commons/.svn/text-base/Country.java.svn-base | 95 + .../.svn/text-base/CountryCodes.java.svn-base | 79 + .../commons/.svn/text-base/DateUtil.java.svn-base | 169 ++ .../text-base/IAttributeProvidersMap.java.svn-base | 82 + .../text-base/IPersonalAttributeList.java.svn-base | 140 + .../.svn/text-base/IStorkLogger.java.svn-base | 239 ++ .../.svn/text-base/IStorkSession.java.svn-base | 85 + .../commons/.svn/text-base/Linker.java.svn-base | 173 ++ .../.svn/text-base/PEPSErrors.java.svn-base | 348 +++ .../.svn/text-base/PEPSParameters.java.svn-base | 511 ++++ .../commons/.svn/text-base/PEPSUtil.java.svn-base | 353 +++ .../.svn/text-base/PEPSValues.java.svn-base | 325 +++ .../.svn/text-base/PersonalAttribute.java.svn-base | 323 +++ .../text-base/PersonalAttributeList.java.svn-base | 305 ++ .../text-base/STORKAttrQueryRequest.java.svn-base | 426 +++ .../text-base/STORKAttrQueryResponse.java.svn-base | 301 ++ .../.svn/text-base/STORKAuthnRequest.java.svn-base | 495 ++++ .../text-base/STORKAuthnResponse.java.svn-base | 309 ++ .../.svn/text-base/STORKStatusCode.java.svn-base | 68 + .../text-base/STORKSubStatusCode.java.svn-base | 71 + .../.svn/text-base/package-info.java.svn-base | 9 + .../peps/auth/commons/AttributeConstants.java | 72 + .../stork/peps/auth/commons/AttributeProvider.java | 74 + .../peps/auth/commons/AttributeProvidersMap.java | 94 + .../stork/peps/auth/commons/AttributeSource.java | 119 + .../eu/stork/peps/auth/commons/AttributeUtil.java | 231 ++ .../eu/stork/peps/auth/commons/CitizenConsent.java | 123 + .../java/eu/stork/peps/auth/commons/Country.java | 95 + .../eu/stork/peps/auth/commons/CountryCodes.java | 79 + .../java/eu/stork/peps/auth/commons/DateUtil.java | 169 ++ .../peps/auth/commons/IAttributeProvidersMap.java | 82 + .../peps/auth/commons/IPersonalAttributeList.java | 140 + .../eu/stork/peps/auth/commons/IStorkLogger.java | 239 ++ .../eu/stork/peps/auth/commons/IStorkSession.java | 85 + .../java/eu/stork/peps/auth/commons/Linker.java | 173 ++ .../eu/stork/peps/auth/commons/PEPSErrors.java | 348 +++ .../eu/stork/peps/auth/commons/PEPSParameters.java | 511 ++++ .../java/eu/stork/peps/auth/commons/PEPSUtil.java | 353 +++ .../eu/stork/peps/auth/commons/PEPSValues.java | 325 +++ .../stork/peps/auth/commons/PersonalAttribute.java | 323 +++ .../peps/auth/commons/PersonalAttributeList.java | 305 ++ .../peps/auth/commons/STORKAttrQueryRequest.java | 426 +++ .../peps/auth/commons/STORKAttrQueryResponse.java | 301 ++ .../stork/peps/auth/commons/STORKAuthnRequest.java | 495 ++++ .../peps/auth/commons/STORKAuthnResponse.java | 309 ++ .../stork/peps/auth/commons/STORKStatusCode.java | 68 + .../peps/auth/commons/STORKSubStatusCode.java | 71 + .../peps/auth/commons/exceptions/.svn/all-wcprops | 53 + .../peps/auth/commons/exceptions/.svn/entries | 300 ++ .../text-base/AbstractPEPSException.java.svn-base | 173 ++ .../.svn/text-base/CPEPSException.java.svn-base | 143 + .../InternalErrorPEPSException.java.svn-base | 74 + .../InvalidParameterPEPSException.java.svn-base | 54 + .../InvalidSessionPEPSException.java.svn-base | 46 + .../text-base/SecurityPEPSException.java.svn-base | 67 + .../text-base/StorkPEPSException.java.svn-base | 53 + .../.svn/text-base/package-info.java.svn-base | 7 + .../commons/exceptions/AbstractPEPSException.java | 173 ++ .../auth/commons/exceptions/CPEPSException.java | 143 + .../exceptions/InternalErrorPEPSException.java | 74 + .../exceptions/InvalidParameterPEPSException.java | 54 + .../exceptions/InvalidSessionPEPSException.java | 46 + .../commons/exceptions/SecurityPEPSException.java | 67 + .../commons/exceptions/StorkPEPSException.java | 53 + .../peps/auth/commons/exceptions/package-info.java | 7 + .../eu/stork/peps/auth/commons/package-info.java | 9 + .../eu/stork/peps/auth/specific/.svn/all-wcprops | 41 + .../java/eu/stork/peps/auth/specific/.svn/entries | 232 ++ .../.svn/text-base/IAUService.java.svn-base | 183 ++ .../text-base/ICheckAttributeValue.java.svn-base | 37 + .../.svn/text-base/IDeriveAttribute.java.svn-base | 40 + .../.svn/text-base/INormaliseValue.java.svn-base | 35 + .../text-base/ITranslatorService.java.svn-base | 100 + .../.svn/text-base/package-info.java.svn-base | 8 + .../eu/stork/peps/auth/specific/IAUService.java | 183 ++ .../peps/auth/specific/ICheckAttributeValue.java | 37 + .../stork/peps/auth/specific/IDeriveAttribute.java | 40 + .../stork/peps/auth/specific/INormaliseValue.java | 35 + .../peps/auth/specific/ITranslatorService.java | 100 + .../eu/stork/peps/auth/specific/package-info.java | 8 + .../src/main/resources/.svn/all-wcprops | 11 + .../stork2-commons/src/main/resources/.svn/entries | 62 + .../resources/.svn/text-base/log4j.xml.svn-base | 19 + .../stork2-commons/src/main/resources/log4j.xml | 19 + id/server/stork2-commons/src/test/.svn/all-wcprops | 5 + id/server/stork2-commons/src/test/.svn/entries | 34 + .../stork2-commons/src/test/java/.svn/all-wcprops | 5 + .../stork2-commons/src/test/java/.svn/entries | 31 + .../src/test/java/eu/.svn/all-wcprops | 5 + .../stork2-commons/src/test/java/eu/.svn/entries | 31 + .../src/test/java/eu/stork/.svn/all-wcprops | 5 + .../src/test/java/eu/stork/.svn/entries | 31 + .../src/test/java/eu/stork/peps/.svn/all-wcprops | 5 + .../src/test/java/eu/stork/peps/.svn/entries | 31 + .../test/java/eu/stork/peps/tests/.svn/all-wcprops | 41 + .../src/test/java/eu/stork/peps/tests/.svn/entries | 232 ++ .../text-base/AttributeUtilTestCase.java.svn-base | 537 ++++ .../.svn/text-base/DateUtilTestCase.java.svn-base | 294 ++ .../.svn/text-base/PEPSUtilTestCase.java.svn-base | 553 ++++ .../PersonalAttributeListTestCase.java.svn-base | 557 ++++ .../PersonalAttributeTestCase.java.svn-base | 182 ++ .../.svn/text-base/package-info.java.svn-base | 5 + .../eu/stork/peps/tests/AttributeUtilTestCase.java | 537 ++++ .../java/eu/stork/peps/tests/DateUtilTestCase.java | 294 ++ .../java/eu/stork/peps/tests/PEPSUtilTestCase.java | 553 ++++ .../peps/tests/PersonalAttributeListTestCase.java | 557 ++++ .../peps/tests/PersonalAttributeTestCase.java | 182 ++ .../java/eu/stork/peps/tests/package-info.java | 5 + .../src/test/resources/.svn/all-wcprops | 11 + .../stork2-commons/src/test/resources/.svn/entries | 62 + .../resources/.svn/text-base/log4j.xml.svn-base | 19 + .../stork2-commons/src/test/resources/log4j.xml | 19 + .../build/classes/.svn/all-wcprops | 5 + .../stork2-saml-engine/build/classes/.svn/entries | 34 + .../build/classes/main/.svn/all-wcprops | 5 + .../build/classes/main/.svn/entries | 31 + .../build/classes/main/java/.svn/all-wcprops | 5 + .../build/classes/main/java/.svn/entries | 34 + .../classes/main/java/META-INF/.svn/all-wcprops | 11 + .../build/classes/main/java/META-INF/.svn/entries | 62 + .../META-INF/.svn/text-base/MANIFEST.MF.svn-base | 3 + .../build/classes/main/java/META-INF/MANIFEST.MF | 3 + .../build/classes/main/java/eu/.svn/all-wcprops | 5 + .../build/classes/main/java/eu/.svn/entries | 31 + .../classes/main/java/eu/stork/.svn/all-wcprops | 5 + .../build/classes/main/java/eu/stork/.svn/entries | 31 + .../main/java/eu/stork/peps/.svn/all-wcprops | 5 + .../classes/main/java/eu/stork/peps/.svn/entries | 37 + .../main/java/eu/stork/peps/auth/.svn/all-wcprops | 5 + .../main/java/eu/stork/peps/auth/.svn/entries | 31 + .../eu/stork/peps/auth/engine/.svn/all-wcprops | 35 + .../java/eu/stork/peps/auth/engine/.svn/entries | 201 ++ .../engine/.svn/text-base/SAMLEngine.java.svn-base | 409 +++ .../.svn/text-base/SAMLEngineUtils.java.svn-base | 833 ++++++ .../.svn/text-base/STORKSAMLEngine.java.svn-base | 2983 ++++++++++++++++++++ .../.svn/text-base/X509PrincipalUtil.java.svn-base | 69 + .../.svn/text-base/package-info.java.svn-base | 19 + .../eu/stork/peps/auth/engine/SAMLEngine.class | Bin 0 -> 8470 bytes .../stork/peps/auth/engine/SAMLEngineUtils.class | Bin 0 -> 9902 bytes .../stork/peps/auth/engine/STORKSAMLEngine.class | Bin 0 -> 10692 bytes .../stork/peps/auth/engine/X509PrincipalUtil.class | Bin 0 -> 2286 bytes .../stork/peps/auth/engine/core/.svn/all-wcprops | 119 + .../eu/stork/peps/auth/engine/core/.svn/entries | 680 +++++ .../AuthenticationAttributes.java.svn-base | 57 + .../text-base/CitizenCountryCode.java.svn-base | 56 + .../text-base/EIDCrossBorderShare.java.svn-base | 58 + .../text-base/EIDCrossSectorShare.java.svn-base | 56 + .../.svn/text-base/EIDSectorShare.java.svn-base | 57 + .../core/.svn/text-base/QAAAttribute.java.svn-base | 63 + .../text-base/RequestedAttribute.java.svn-base | 140 + .../text-base/RequestedAttributes.java.svn-base | 51 + .../core/.svn/text-base/SAMLCore.java.svn-base | 98 + .../.svn/text-base/SAMLEngineSignI.java.svn-base | 88 + .../.svn/text-base/SPApplication.java.svn-base | 56 + .../core/.svn/text-base/SPCountry.java.svn-base | 56 + .../engine/core/.svn/text-base/SPID.java.svn-base | 56 + .../.svn/text-base/SPInformation.java.svn-base | 56 + .../.svn/text-base/SPInstitution.java.svn-base | 56 + .../core/.svn/text-base/SPSector.java.svn-base | 56 + .../.svn/text-base/STORKSAMLCore.java.svn-base | 508 ++++ .../VIDPAuthenticationAttributes.java.svn-base | 72 + .../core/.svn/text-base/package-info.java.svn-base | 19 + .../engine/core/AuthenticationAttributes.class | Bin 0 -> 1165 bytes .../peps/auth/engine/core/CitizenCountryCode.class | Bin 0 -> 991 bytes .../auth/engine/core/EIDCrossBorderShare.class | Bin 0 -> 997 bytes .../auth/engine/core/EIDCrossSectorShare.class | Bin 0 -> 998 bytes .../peps/auth/engine/core/EIDSectorShare.class | Bin 0 -> 943 bytes .../stork/peps/auth/engine/core/QAAAttribute.class | Bin 0 -> 1071 bytes .../peps/auth/engine/core/RequestedAttribute.class | Bin 0 -> 1926 bytes .../auth/engine/core/RequestedAttributes.class | Bin 0 -> 953 bytes .../eu/stork/peps/auth/engine/core/SAMLCore.class | Bin 0 -> 1279 bytes .../peps/auth/engine/core/SAMLEngineSignI.class | Bin 0 -> 1413 bytes .../peps/auth/engine/core/SPApplication.class | Bin 0 -> 961 bytes .../eu/stork/peps/auth/engine/core/SPCountry.class | Bin 0 -> 937 bytes .../java/eu/stork/peps/auth/engine/core/SPID.class | Bin 0 -> 907 bytes .../peps/auth/engine/core/SPInformation.class | Bin 0 -> 1025 bytes .../peps/auth/engine/core/SPInstitution.class | Bin 0 -> 961 bytes .../eu/stork/peps/auth/engine/core/SPSector.class | Bin 0 -> 931 bytes .../peps/auth/engine/core/STORKSAMLCore.class | Bin 0 -> 6958 bytes .../engine/core/VIDPAuthenticationAttributes.class | Bin 0 -> 1318 bytes .../peps/auth/engine/core/impl/.svn/all-wcprops | 395 +++ .../stork/peps/auth/engine/core/impl/.svn/entries | 2238 +++++++++++++++ .../AuthenticationAttributesBuilder.java.svn-base | 56 + .../AuthenticationAttributesImpl.java.svn-base | 109 + ...uthenticationAttributesMarshaller.java.svn-base | 30 + ...henticationAttributesUnmarshaller.java.svn-base | 54 + .../CitizenCountryCodeBuilder.java.svn-base | 50 + .../text-base/CitizenCountryCodeImpl.java.svn-base | 82 + .../CitizenCountryCodeMarshaller.java.svn-base | 45 + .../CitizenCountryCodeUnmarshaller.java.svn-base | 41 + .../EIDCrossBorderShareBuilder.java.svn-base | 52 + .../EIDCrossBorderShareImpl.java.svn-base | 87 + .../EIDCrossBorderShareMarshaller.java.svn-base | 47 + .../EIDCrossBorderShareUnmarshaller.java.svn-base | 43 + .../EIDCrossSectorShareBuilder.java.svn-base | 52 + .../EIDCrossSectorShareImpl.java.svn-base | 89 + .../EIDCrossSectorShareMarshaller.java.svn-base | 46 + .../EIDCrossSectorShareUnmarshaller.java.svn-base | 47 + .../text-base/EIDSectorShareBuilder.java.svn-base | 51 + .../text-base/EIDSectorShareImpl.java.svn-base | 85 + .../EIDSectorShareMarshaller.java.svn-base | 46 + .../EIDSectorShareUnmarshaller.java.svn-base | 47 + .../text-base/QAAAttributeBuilder.java.svn-base | 52 + .../.svn/text-base/QAAAttributeImpl.java.svn-base | 84 + .../text-base/QAAAttributeMarshaller.java.svn-base | 45 + .../QAAAttributeUnmarshaller.java.svn-base | 41 + .../RequestedAttributeBuilder.java.svn-base | 54 + .../text-base/RequestedAttributeImpl.java.svn-base | 220 ++ .../RequestedAttributeMarshaller.java.svn-base | 89 + .../RequestedAttributeUnmarshaller.java.svn-base | 96 + .../RequestedAttributesBuilder.java.svn-base | 54 + .../RequestedAttributesImpl.java.svn-base | 95 + .../RequestedAttributesMarshaller.java.svn-base | 33 + .../RequestedAttributesUnmarshaller.java.svn-base | 52 + .../text-base/SPApplicationBuilder.java.svn-base | 51 + .../.svn/text-base/SPApplicationImpl.java.svn-base | 84 + .../SPApplicationMarshaller.java.svn-base | 46 + .../SPApplicationUnmarshaller.java.svn-base | 42 + .../.svn/text-base/SPCountryBuilder.java.svn-base | 52 + .../.svn/text-base/SPCountryImpl.java.svn-base | 82 + .../text-base/SPCountryMarshaller.java.svn-base | 45 + .../text-base/SPCountryUnmarshaller.java.svn-base | 42 + .../impl/.svn/text-base/SPIDBuilder.java.svn-base | 50 + .../impl/.svn/text-base/SPIDImpl.java.svn-base | 82 + .../.svn/text-base/SPIDMarshaller.java.svn-base | 45 + .../.svn/text-base/SPIDUnmarshaller.java.svn-base | 41 + .../text-base/SPInformationBuilder.java.svn-base | 41 + .../.svn/text-base/SPInformationImpl.java.svn-base | 110 + .../SPInformationMarshaller.java.svn-base | 33 + .../SPInformationUnmarshaller.java.svn-base | 52 + .../text-base/SPInstitutionBuilder.java.svn-base | 51 + .../.svn/text-base/SPInstitutionImpl.java.svn-base | 84 + .../SPInstitutionMarshaller.java.svn-base | 46 + .../SPInstitutionUnmarshaller.java.svn-base | 41 + .../.svn/text-base/SPSectorBuilder.java.svn-base | 50 + .../impl/.svn/text-base/SPSectorImpl.java.svn-base | 84 + .../text-base/SPSectorMarshaller.java.svn-base | 45 + .../text-base/SPSectorUnmarshaller.java.svn-base | 42 + .../core/impl/.svn/text-base/SignHW.java.svn-base | 399 +++ .../.svn/text-base/SignModuleFactory.java.svn-base | 64 + .../core/impl/.svn/text-base/SignP12.java.svn-base | 468 +++ .../core/impl/.svn/text-base/SignSW.java.svn-base | 423 +++ ...DPAuthenticationAttributesBuilder.java.svn-base | 41 + .../VIDPAuthenticationAttributesImpl.java.svn-base | 132 + ...uthenticationAttributesMarshaller.java.svn-base | 33 + ...henticationAttributesUnmarshaller.java.svn-base | 55 + .../impl/.svn/text-base/package-info.java.svn-base | 19 + .../impl/AuthenticationAttributesBuilder.class | Bin 0 -> 1714 bytes .../core/impl/AuthenticationAttributesImpl.class | Bin 0 -> 3821 bytes .../impl/AuthenticationAttributesMarshaller.class | Bin 0 -> 845 bytes .../AuthenticationAttributesUnmarshaller.class | Bin 0 -> 1971 bytes .../core/impl/CitizenCountryCodeBuilder.class | Bin 0 -> 1630 bytes .../engine/core/impl/CitizenCountryCodeImpl.class | Bin 0 -> 2395 bytes .../core/impl/CitizenCountryCodeMarshaller.class | Bin 0 -> 1674 bytes .../core/impl/CitizenCountryCodeUnmarshaller.class | Bin 0 -> 1379 bytes .../core/impl/EIDCrossBorderShareBuilder.class | Bin 0 -> 1644 bytes .../engine/core/impl/EIDCrossBorderShareImpl.class | Bin 0 -> 2407 bytes .../core/impl/EIDCrossBorderShareMarshaller.class | Bin 0 -> 1681 bytes .../impl/EIDCrossBorderShareUnmarshaller.class | Bin 0 -> 1386 bytes .../core/impl/EIDCrossSectorShareBuilder.class | Bin 0 -> 1594 bytes .../engine/core/impl/EIDCrossSectorShareImpl.class | Bin 0 -> 2407 bytes .../core/impl/EIDCrossSectorShareMarshaller.class | Bin 0 -> 1681 bytes .../impl/EIDCrossSectorShareUnmarshaller.class | Bin 0 -> 1474 bytes .../engine/core/impl/EIDSectorShareBuilder.class | Bin 0 -> 1574 bytes .../auth/engine/core/impl/EIDSectorShareImpl.class | Bin 0 -> 2347 bytes .../core/impl/EIDSectorShareMarshaller.class | Bin 0 -> 1690 bytes .../core/impl/EIDSectorShareUnmarshaller.class | Bin 0 -> 1439 bytes .../engine/core/impl/QAAAttributeBuilder.class | Bin 0 -> 1546 bytes .../auth/engine/core/impl/QAAAttributeImpl.class | Bin 0 -> 2311 bytes .../engine/core/impl/QAAAttributeMarshaller.class | Bin 0 -> 1632 bytes .../core/impl/QAAAttributeUnmarshaller.class | Bin 0 -> 1337 bytes .../core/impl/RequestedAttributeBuilder.class | Bin 0 -> 1630 bytes .../engine/core/impl/RequestedAttributeImpl.class | Bin 0 -> 5272 bytes .../core/impl/RequestedAttributeMarshaller.class | Bin 0 -> 2206 bytes .../core/impl/RequestedAttributeUnmarshaller.class | Bin 0 -> 2875 bytes .../core/impl/RequestedAttributesBuilder.class | Bin 0 -> 1644 bytes .../engine/core/impl/RequestedAttributesImpl.class | Bin 0 -> 3807 bytes .../core/impl/RequestedAttributesMarshaller.class | Bin 0 -> 830 bytes .../impl/RequestedAttributesUnmarshaller.class | Bin 0 -> 1896 bytes .../engine/core/impl/SPApplicationBuilder.class | Bin 0 -> 1560 bytes .../auth/engine/core/impl/SPApplicationImpl.class | Bin 0 -> 2335 bytes .../engine/core/impl/SPApplicationMarshaller.class | Bin 0 -> 1639 bytes .../core/impl/SPApplicationUnmarshaller.class | Bin 0 -> 1344 bytes .../auth/engine/core/impl/SPCountryBuilder.class | Bin 0 -> 1504 bytes .../peps/auth/engine/core/impl/SPCountryImpl.class | Bin 0 -> 2287 bytes .../engine/core/impl/SPCountryMarshaller.class | Bin 0 -> 1611 bytes .../engine/core/impl/SPCountryUnmarshaller.class | Bin 0 -> 1316 bytes .../peps/auth/engine/core/impl/SPIDBuilder.class | Bin 0 -> 1434 bytes .../peps/auth/engine/core/impl/SPIDImpl.class | Bin 0 -> 2227 bytes .../auth/engine/core/impl/SPIDMarshaller.class | Bin 0 -> 1576 bytes .../auth/engine/core/impl/SPIDUnmarshaller.class | Bin 0 -> 1281 bytes .../engine/core/impl/SPInformationBuilder.class | Bin 0 -> 1716 bytes .../auth/engine/core/impl/SPInformationImpl.class | Bin 0 -> 3234 bytes .../engine/core/impl/SPInformationMarshaller.class | Bin 0 -> 812 bytes .../core/impl/SPInformationUnmarshaller.class | Bin 0 -> 1798 bytes .../engine/core/impl/SPInstitutionBuilder.class | Bin 0 -> 1560 bytes .../auth/engine/core/impl/SPInstitutionImpl.class | Bin 0 -> 2335 bytes .../engine/core/impl/SPInstitutionMarshaller.class | Bin 0 -> 1639 bytes .../core/impl/SPInstitutionUnmarshaller.class | Bin 0 -> 1344 bytes .../auth/engine/core/impl/SPSectorBuilder.class | Bin 0 -> 1490 bytes .../peps/auth/engine/core/impl/SPSectorImpl.class | Bin 0 -> 2005 bytes .../auth/engine/core/impl/SPSectorMarshaller.class | Bin 0 -> 1604 bytes .../engine/core/impl/SPSectorUnmarshaller.class | Bin 0 -> 1309 bytes .../stork/peps/auth/engine/core/impl/SignHW.class | Bin 0 -> 9658 bytes .../auth/engine/core/impl/SignModuleFactory.class | Bin 0 -> 1603 bytes .../stork/peps/auth/engine/core/impl/SignP12.class | Bin 0 -> 9402 bytes .../stork/peps/auth/engine/core/impl/SignSW.class | Bin 0 -> 9522 bytes .../impl/VIDPAuthenticationAttributesBuilder.class | Bin 0 -> 1914 bytes .../impl/VIDPAuthenticationAttributesImpl.class | Bin 0 -> 4627 bytes .../VIDPAuthenticationAttributesMarshaller.class | Bin 0 -> 857 bytes .../VIDPAuthenticationAttributesUnmarshaller.class | Bin 0 -> 2157 bytes .../peps/auth/engine/core/impl/package-info.class | Bin 0 -> 151 bytes .../stork/peps/auth/engine/core/package-info.class | Bin 0 -> 146 bytes .../auth/engine/core/validator/.svn/all-wcprops | 23 + .../peps/auth/engine/core/validator/.svn/entries | 130 + .../ExtensionsSchemaValidator.java.svn-base | 61 + .../QAAAttributeSchemaValidator.java.svn-base | 65 + .../.svn/text-base/package-info.java.svn-base | 19 + .../core/validator/ExtensionsSchemaValidator.class | Bin 0 -> 2084 bytes .../validator/QAAAttributeSchemaValidator.class | Bin 0 -> 2209 bytes .../auth/engine/core/validator/package-info.class | Bin 0 -> 156 bytes .../eu/stork/peps/auth/engine/package-info.class | Bin 0 -> 141 bytes .../eu/stork/peps/configuration/.svn/all-wcprops | 41 + .../java/eu/stork/peps/configuration/.svn/entries | 232 ++ .../text-base/ConfigurationCreator.java.svn-base | 127 + .../text-base/ConfigurationEngine.java.svn-base | 69 + .../text-base/ConfigurationReader.java.svn-base | 224 ++ .../text-base/ConfigurationSingleton.java.svn-base | 74 + .../.svn/text-base/InstanceEngine.java.svn-base | 70 + .../.svn/text-base/package-info.java.svn-base | 19 + .../peps/configuration/ConfigurationCreator.class | Bin 0 -> 2116 bytes .../peps/configuration/ConfigurationEngine.class | Bin 0 -> 1278 bytes .../peps/configuration/ConfigurationReader.class | Bin 0 -> 2565 bytes .../configuration/ConfigurationSingleton.class | Bin 0 -> 2003 bytes .../stork/peps/configuration/InstanceEngine.class | Bin 0 -> 1347 bytes .../eu/stork/peps/configuration/package-info.class | Bin 0 -> 143 bytes .../java/eu/stork/peps/exceptions/.svn/all-wcprops | 29 + .../java/eu/stork/peps/exceptions/.svn/entries | 164 ++ .../text-base/SAMLEngineException.java.svn-base | 57 + .../STORKSAMLEngineException.java.svn-base | 135 + .../STORKSAMLEngineRuntimeException.java.svn-base | 56 + .../.svn/text-base/package-info.java.svn-base | 19 + .../peps/exceptions/SAMLEngineException.class | Bin 0 -> 828 bytes .../peps/exceptions/STORKSAMLEngineException.class | Bin 0 -> 1585 bytes .../STORKSAMLEngineRuntimeException.class | Bin 0 -> 871 bytes .../eu/stork/peps/exceptions/package-info.class | Bin 0 -> 140 bytes .../build/classes/test/.svn/all-wcprops | 5 + .../build/classes/test/.svn/entries | 34 + .../build/classes/test/java/.svn/all-wcprops | 5 + .../build/classes/test/java/.svn/entries | 31 + .../build/classes/test/java/eu/.svn/all-wcprops | 5 + .../build/classes/test/java/eu/.svn/entries | 31 + .../classes/test/java/eu/stork/.svn/all-wcprops | 5 + .../build/classes/test/java/eu/stork/.svn/entries | 31 + .../test/java/eu/stork/peps/.svn/all-wcprops | 5 + .../classes/test/java/eu/stork/peps/.svn/entries | 31 + .../test/java/eu/stork/peps/test/.svn/all-wcprops | 5 + .../test/java/eu/stork/peps/test/.svn/entries | 31 + .../eu/stork/peps/test/simple/.svn/all-wcprops | 47 + .../java/eu/stork/peps/test/simple/.svn/entries | 266 ++ .../.svn/text-base/SSETestUtils.java.svn-base | 173 ++ .../.svn/text-base/SimpleBaseTest.java.svn-base | 62 + .../StorkAttrQueryRequestTest.java.svn-base | 790 ++++++ .../StorkAttrQueryResponseTest.java.svn-base | 920 ++++++ .../text-base/StorkAuthRequestTest.java.svn-base | 966 +++++++ .../.svn/text-base/StorkResponseTest.java.svn-base | 931 ++++++ .../.svn/text-base/package-info.java.svn-base | 20 + .../eu/stork/peps/test/simple/SSETestUtils.class | Bin 0 -> 2462 bytes .../eu/stork/peps/test/simple/SimpleBaseTest.class | Bin 0 -> 1811 bytes .../test/simple/StorkAttrQueryRequestTest.class | Bin 0 -> 9633 bytes .../test/simple/StorkAttrQueryResponseTest.class | Bin 0 -> 8908 bytes .../peps/test/simple/StorkAuthRequestTest.class | Bin 0 -> 10053 bytes .../stork/peps/test/simple/StorkResponseTest.class | Bin 0 -> 9361 bytes .../eu/stork/peps/test/simple/package-info.class | Bin 0 -> 141 bytes .../build/classes/test/resources/.svn/all-wcprops | 101 + .../build/classes/test/resources/.svn/entries | 575 ++++ .../.svn/prop-base/keyStoreCountry0.jks.svn-base | 5 + .../.svn/prop-base/keyStoreCountry1.jks.svn-base | 5 + .../.svn/prop-base/keyStoreCountry2.jks.svn-base | 5 + .../.svn/prop-base/keyStoreCountry3.jks.svn-base | 5 + .../.svn/text-base/SamlEngine.xml.svn-base | 63 + .../.svn/text-base/SignModule_Conf0.xml.svn-base | 12 + .../.svn/text-base/SignModule_Conf1.xml.svn-base | 12 + .../.svn/text-base/SignModule_Conf2.xml.svn-base | 12 + .../.svn/text-base/SignModule_Conf3.xml.svn-base | 12 + .../.svn/text-base/SignModule_P11.xml.svn-base | 11 + .../text-base/StorkSamlEngine_Conf0.xml.svn-base | 91 + .../text-base/StorkSamlEngine_Conf1.xml.svn-base | 91 + .../text-base/StorkSamlEngine_Conf2.xml.svn-base | 64 + .../text-base/StorkSamlEngine_Conf3.xml.svn-base | 61 + .../.svn/text-base/keyStoreCountry0.jks.svn-base | Bin 0 -> 1376 bytes .../.svn/text-base/keyStoreCountry1.jks.svn-base | Bin 0 -> 1313 bytes .../.svn/text-base/keyStoreCountry2.jks.svn-base | Bin 0 -> 1313 bytes .../.svn/text-base/keyStoreCountry3.jks.svn-base | Bin 0 -> 1313 bytes .../.svn/text-base/logback-test.xml.svn-base | 23 + .../resources/.svn/text-base/p11Conf.cfg.svn-base | 24 + .../build/classes/test/resources/SamlEngine.xml | 63 + .../classes/test/resources/SignModule_Conf0.xml | 12 + .../classes/test/resources/SignModule_Conf1.xml | 12 + .../classes/test/resources/SignModule_Conf2.xml | 12 + .../classes/test/resources/SignModule_Conf3.xml | 12 + .../classes/test/resources/SignModule_P11.xml | 11 + .../test/resources/StorkSamlEngine_Conf0.xml | 91 + .../test/resources/StorkSamlEngine_Conf1.xml | 91 + .../test/resources/StorkSamlEngine_Conf2.xml | 64 + .../test/resources/StorkSamlEngine_Conf3.xml | 61 + .../classes/test/resources/data/.svn/all-wcprops | 5 + .../build/classes/test/resources/data/.svn/entries | 31 + .../test/resources/data/eu/.svn/all-wcprops | 5 + .../classes/test/resources/data/eu/.svn/entries | 31 + .../test/resources/data/eu/stork/.svn/all-wcprops | 5 + .../test/resources/data/eu/stork/.svn/entries | 31 + .../data/eu/stork/STORKSAMLEngine/.svn/all-wcprops | 41 + .../data/eu/stork/STORKSAMLEngine/.svn/entries | 232 ++ .../.svn/text-base/AttrQueryRequest.xml.svn-base | 11 + .../AttrQueryRequestTagDelete.xml.svn-base | 15 + .../.svn/text-base/AttrQueryResponse.xml.svn-base | 10 + .../.svn/text-base/AuthnRequest.xml.svn-base | 26 + .../text-base/AuthnRequestTagDelete.xml.svn-base | 14 + .../AuthnRequestTagDeleteEncoded.xml.svn-base | 14 + .../eu/stork/STORKSAMLEngine/AttrQueryRequest.xml | 11 + .../STORKSAMLEngine/AttrQueryRequestTagDelete.xml | 15 + .../eu/stork/STORKSAMLEngine/AttrQueryResponse.xml | 10 + .../data/eu/stork/STORKSAMLEngine/AuthnRequest.xml | 26 + .../STORKSAMLEngine/AuthnRequestTagDelete.xml | 14 + .../AuthnRequestTagDeleteEncoded.xml | 14 + .../classes/test/resources/keyStoreCountry0.jks | Bin 0 -> 1376 bytes .../classes/test/resources/keyStoreCountry1.jks | Bin 0 -> 1313 bytes .../classes/test/resources/keyStoreCountry2.jks | Bin 0 -> 1313 bytes .../classes/test/resources/keyStoreCountry3.jks | Bin 0 -> 1313 bytes .../build/classes/test/resources/logback-test.xml | 23 + .../build/classes/test/resources/p11Conf.cfg | 24 + id/server/stork2-saml-engine/pom.xml | 194 ++ id/server/stork2-saml-engine/src/.svn/all-wcprops | 5 + id/server/stork2-saml-engine/src/.svn/entries | 34 + .../stork2-saml-engine/src/main/.svn/all-wcprops | 5 + id/server/stork2-saml-engine/src/main/.svn/entries | 31 + .../src/main/java/.svn/all-wcprops | 5 + .../stork2-saml-engine/src/main/java/.svn/entries | 34 + .../src/main/java/META-INF/.svn/all-wcprops | 11 + .../src/main/java/META-INF/.svn/entries | 62 + .../META-INF/.svn/text-base/MANIFEST.MF.svn-base | 3 + .../src/main/java/META-INF/MANIFEST.MF | 3 + .../src/main/java/eu/.svn/all-wcprops | 5 + .../src/main/java/eu/.svn/entries | 31 + .../src/main/java/eu/stork/.svn/all-wcprops | 5 + .../src/main/java/eu/stork/.svn/entries | 31 + .../src/main/java/eu/stork/peps/.svn/all-wcprops | 5 + .../src/main/java/eu/stork/peps/.svn/entries | 37 + .../main/java/eu/stork/peps/auth/.svn/all-wcprops | 5 + .../src/main/java/eu/stork/peps/auth/.svn/entries | 31 + .../eu/stork/peps/auth/engine/.svn/all-wcprops | 35 + .../java/eu/stork/peps/auth/engine/.svn/entries | 201 ++ .../engine/.svn/text-base/SAMLEngine.java.svn-base | 409 +++ .../.svn/text-base/SAMLEngineUtils.java.svn-base | 833 ++++++ .../.svn/text-base/STORKSAMLEngine.java.svn-base | 2983 ++++++++++++++++++++ .../.svn/text-base/X509PrincipalUtil.java.svn-base | 69 + .../.svn/text-base/package-info.java.svn-base | 19 + .../java/eu/stork/peps/auth/engine/SAMLEngine.java | 409 +++ .../eu/stork/peps/auth/engine/SAMLEngineUtils.java | 833 ++++++ .../eu/stork/peps/auth/engine/STORKSAMLEngine.java | 2983 ++++++++++++++++++++ .../stork/peps/auth/engine/X509PrincipalUtil.java | 69 + .../stork/peps/auth/engine/core/.svn/all-wcprops | 119 + .../eu/stork/peps/auth/engine/core/.svn/entries | 680 +++++ .../AuthenticationAttributes.java.svn-base | 57 + .../text-base/CitizenCountryCode.java.svn-base | 56 + .../text-base/EIDCrossBorderShare.java.svn-base | 58 + .../text-base/EIDCrossSectorShare.java.svn-base | 56 + .../.svn/text-base/EIDSectorShare.java.svn-base | 57 + .../core/.svn/text-base/QAAAttribute.java.svn-base | 63 + .../text-base/RequestedAttribute.java.svn-base | 140 + .../text-base/RequestedAttributes.java.svn-base | 51 + .../core/.svn/text-base/SAMLCore.java.svn-base | 98 + .../.svn/text-base/SAMLEngineSignI.java.svn-base | 88 + .../.svn/text-base/SPApplication.java.svn-base | 56 + .../core/.svn/text-base/SPCountry.java.svn-base | 56 + .../engine/core/.svn/text-base/SPID.java.svn-base | 56 + .../.svn/text-base/SPInformation.java.svn-base | 56 + .../.svn/text-base/SPInstitution.java.svn-base | 56 + .../core/.svn/text-base/SPSector.java.svn-base | 56 + .../.svn/text-base/STORKSAMLCore.java.svn-base | 508 ++++ .../VIDPAuthenticationAttributes.java.svn-base | 72 + .../core/.svn/text-base/package-info.java.svn-base | 19 + .../auth/engine/core/AuthenticationAttributes.java | 57 + .../peps/auth/engine/core/CitizenCountryCode.java | 56 + .../peps/auth/engine/core/EIDCrossBorderShare.java | 58 + .../peps/auth/engine/core/EIDCrossSectorShare.java | 56 + .../peps/auth/engine/core/EIDSectorShare.java | 57 + .../stork/peps/auth/engine/core/QAAAttribute.java | 63 + .../peps/auth/engine/core/RequestedAttribute.java | 140 + .../peps/auth/engine/core/RequestedAttributes.java | 51 + .../eu/stork/peps/auth/engine/core/SAMLCore.java | 98 + .../peps/auth/engine/core/SAMLEngineSignI.java | 88 + .../stork/peps/auth/engine/core/SPApplication.java | 56 + .../eu/stork/peps/auth/engine/core/SPCountry.java | 56 + .../java/eu/stork/peps/auth/engine/core/SPID.java | 56 + .../stork/peps/auth/engine/core/SPInformation.java | 56 + .../stork/peps/auth/engine/core/SPInstitution.java | 56 + .../eu/stork/peps/auth/engine/core/SPSector.java | 56 + .../stork/peps/auth/engine/core/STORKSAMLCore.java | 508 ++++ .../engine/core/VIDPAuthenticationAttributes.java | 72 + .../peps/auth/engine/core/impl/.svn/all-wcprops | 395 +++ .../stork/peps/auth/engine/core/impl/.svn/entries | 2238 +++++++++++++++ .../AuthenticationAttributesBuilder.java.svn-base | 56 + .../AuthenticationAttributesImpl.java.svn-base | 109 + ...uthenticationAttributesMarshaller.java.svn-base | 30 + ...henticationAttributesUnmarshaller.java.svn-base | 54 + .../CitizenCountryCodeBuilder.java.svn-base | 50 + .../text-base/CitizenCountryCodeImpl.java.svn-base | 82 + .../CitizenCountryCodeMarshaller.java.svn-base | 45 + .../CitizenCountryCodeUnmarshaller.java.svn-base | 41 + .../EIDCrossBorderShareBuilder.java.svn-base | 52 + .../EIDCrossBorderShareImpl.java.svn-base | 87 + .../EIDCrossBorderShareMarshaller.java.svn-base | 47 + .../EIDCrossBorderShareUnmarshaller.java.svn-base | 43 + .../EIDCrossSectorShareBuilder.java.svn-base | 52 + .../EIDCrossSectorShareImpl.java.svn-base | 89 + .../EIDCrossSectorShareMarshaller.java.svn-base | 46 + .../EIDCrossSectorShareUnmarshaller.java.svn-base | 47 + .../text-base/EIDSectorShareBuilder.java.svn-base | 51 + .../text-base/EIDSectorShareImpl.java.svn-base | 85 + .../EIDSectorShareMarshaller.java.svn-base | 46 + .../EIDSectorShareUnmarshaller.java.svn-base | 47 + .../text-base/QAAAttributeBuilder.java.svn-base | 52 + .../.svn/text-base/QAAAttributeImpl.java.svn-base | 84 + .../text-base/QAAAttributeMarshaller.java.svn-base | 45 + .../QAAAttributeUnmarshaller.java.svn-base | 41 + .../RequestedAttributeBuilder.java.svn-base | 54 + .../text-base/RequestedAttributeImpl.java.svn-base | 220 ++ .../RequestedAttributeMarshaller.java.svn-base | 89 + .../RequestedAttributeUnmarshaller.java.svn-base | 96 + .../RequestedAttributesBuilder.java.svn-base | 54 + .../RequestedAttributesImpl.java.svn-base | 95 + .../RequestedAttributesMarshaller.java.svn-base | 33 + .../RequestedAttributesUnmarshaller.java.svn-base | 52 + .../text-base/SPApplicationBuilder.java.svn-base | 51 + .../.svn/text-base/SPApplicationImpl.java.svn-base | 84 + .../SPApplicationMarshaller.java.svn-base | 46 + .../SPApplicationUnmarshaller.java.svn-base | 42 + .../.svn/text-base/SPCountryBuilder.java.svn-base | 52 + .../.svn/text-base/SPCountryImpl.java.svn-base | 82 + .../text-base/SPCountryMarshaller.java.svn-base | 45 + .../text-base/SPCountryUnmarshaller.java.svn-base | 42 + .../impl/.svn/text-base/SPIDBuilder.java.svn-base | 50 + .../impl/.svn/text-base/SPIDImpl.java.svn-base | 82 + .../.svn/text-base/SPIDMarshaller.java.svn-base | 45 + .../.svn/text-base/SPIDUnmarshaller.java.svn-base | 41 + .../text-base/SPInformationBuilder.java.svn-base | 41 + .../.svn/text-base/SPInformationImpl.java.svn-base | 110 + .../SPInformationMarshaller.java.svn-base | 33 + .../SPInformationUnmarshaller.java.svn-base | 52 + .../text-base/SPInstitutionBuilder.java.svn-base | 51 + .../.svn/text-base/SPInstitutionImpl.java.svn-base | 84 + .../SPInstitutionMarshaller.java.svn-base | 46 + .../SPInstitutionUnmarshaller.java.svn-base | 41 + .../.svn/text-base/SPSectorBuilder.java.svn-base | 50 + .../impl/.svn/text-base/SPSectorImpl.java.svn-base | 84 + .../text-base/SPSectorMarshaller.java.svn-base | 45 + .../text-base/SPSectorUnmarshaller.java.svn-base | 42 + .../core/impl/.svn/text-base/SignHW.java.svn-base | 399 +++ .../.svn/text-base/SignModuleFactory.java.svn-base | 64 + .../core/impl/.svn/text-base/SignP12.java.svn-base | 468 +++ .../core/impl/.svn/text-base/SignSW.java.svn-base | 423 +++ ...DPAuthenticationAttributesBuilder.java.svn-base | 41 + .../VIDPAuthenticationAttributesImpl.java.svn-base | 132 + ...uthenticationAttributesMarshaller.java.svn-base | 33 + ...henticationAttributesUnmarshaller.java.svn-base | 55 + .../impl/.svn/text-base/package-info.java.svn-base | 19 + .../core/impl/AuthenticationAttributesBuilder.java | 56 + .../core/impl/AuthenticationAttributesImpl.java | 109 + .../impl/AuthenticationAttributesMarshaller.java | 30 + .../impl/AuthenticationAttributesUnmarshaller.java | 54 + .../core/impl/CitizenCountryCodeBuilder.java | 50 + .../engine/core/impl/CitizenCountryCodeImpl.java | 82 + .../core/impl/CitizenCountryCodeMarshaller.java | 45 + .../core/impl/CitizenCountryCodeUnmarshaller.java | 41 + .../core/impl/EIDCrossBorderShareBuilder.java | 52 + .../engine/core/impl/EIDCrossBorderShareImpl.java | 87 + .../core/impl/EIDCrossBorderShareMarshaller.java | 47 + .../core/impl/EIDCrossBorderShareUnmarshaller.java | 43 + .../core/impl/EIDCrossSectorShareBuilder.java | 52 + .../engine/core/impl/EIDCrossSectorShareImpl.java | 89 + .../core/impl/EIDCrossSectorShareMarshaller.java | 46 + .../core/impl/EIDCrossSectorShareUnmarshaller.java | 47 + .../engine/core/impl/EIDSectorShareBuilder.java | 51 + .../auth/engine/core/impl/EIDSectorShareImpl.java | 85 + .../engine/core/impl/EIDSectorShareMarshaller.java | 46 + .../core/impl/EIDSectorShareUnmarshaller.java | 47 + .../auth/engine/core/impl/QAAAttributeBuilder.java | 52 + .../auth/engine/core/impl/QAAAttributeImpl.java | 84 + .../engine/core/impl/QAAAttributeMarshaller.java | 45 + .../engine/core/impl/QAAAttributeUnmarshaller.java | 41 + .../core/impl/RequestedAttributeBuilder.java | 54 + .../engine/core/impl/RequestedAttributeImpl.java | 220 ++ .../core/impl/RequestedAttributeMarshaller.java | 89 + .../core/impl/RequestedAttributeUnmarshaller.java | 96 + .../core/impl/RequestedAttributesBuilder.java | 54 + .../engine/core/impl/RequestedAttributesImpl.java | 95 + .../core/impl/RequestedAttributesMarshaller.java | 33 + .../core/impl/RequestedAttributesUnmarshaller.java | 52 + .../engine/core/impl/SPApplicationBuilder.java | 51 + .../auth/engine/core/impl/SPApplicationImpl.java | 84 + .../engine/core/impl/SPApplicationMarshaller.java | 46 + .../core/impl/SPApplicationUnmarshaller.java | 42 + .../auth/engine/core/impl/SPCountryBuilder.java | 52 + .../peps/auth/engine/core/impl/SPCountryImpl.java | 82 + .../auth/engine/core/impl/SPCountryMarshaller.java | 45 + .../engine/core/impl/SPCountryUnmarshaller.java | 42 + .../peps/auth/engine/core/impl/SPIDBuilder.java | 50 + .../stork/peps/auth/engine/core/impl/SPIDImpl.java | 82 + .../peps/auth/engine/core/impl/SPIDMarshaller.java | 45 + .../auth/engine/core/impl/SPIDUnmarshaller.java | 41 + .../engine/core/impl/SPInformationBuilder.java | 41 + .../auth/engine/core/impl/SPInformationImpl.java | 110 + .../engine/core/impl/SPInformationMarshaller.java | 33 + .../core/impl/SPInformationUnmarshaller.java | 52 + .../engine/core/impl/SPInstitutionBuilder.java | 51 + .../auth/engine/core/impl/SPInstitutionImpl.java | 84 + .../engine/core/impl/SPInstitutionMarshaller.java | 46 + .../core/impl/SPInstitutionUnmarshaller.java | 41 + .../auth/engine/core/impl/SPSectorBuilder.java | 50 + .../peps/auth/engine/core/impl/SPSectorImpl.java | 84 + .../auth/engine/core/impl/SPSectorMarshaller.java | 45 + .../engine/core/impl/SPSectorUnmarshaller.java | 42 + .../stork/peps/auth/engine/core/impl/SignHW.java | 399 +++ .../auth/engine/core/impl/SignModuleFactory.java | 64 + .../stork/peps/auth/engine/core/impl/SignP12.java | 468 +++ .../stork/peps/auth/engine/core/impl/SignSW.java | 423 +++ .../impl/VIDPAuthenticationAttributesBuilder.java | 41 + .../impl/VIDPAuthenticationAttributesImpl.java | 132 + .../VIDPAuthenticationAttributesMarshaller.java | 33 + .../VIDPAuthenticationAttributesUnmarshaller.java | 55 + .../peps/auth/engine/core/impl/package-info.java | 19 + .../stork/peps/auth/engine/core/package-info.java | 19 + .../auth/engine/core/validator/.svn/all-wcprops | 23 + .../peps/auth/engine/core/validator/.svn/entries | 130 + .../ExtensionsSchemaValidator.java.svn-base | 61 + .../QAAAttributeSchemaValidator.java.svn-base | 65 + .../.svn/text-base/package-info.java.svn-base | 19 + .../core/validator/ExtensionsSchemaValidator.java | 61 + .../validator/QAAAttributeSchemaValidator.java | 65 + .../auth/engine/core/validator/package-info.java | 19 + .../eu/stork/peps/auth/engine/package-info.java | 19 + .../eu/stork/peps/configuration/.svn/all-wcprops | 41 + .../java/eu/stork/peps/configuration/.svn/entries | 232 ++ .../text-base/ConfigurationCreator.java.svn-base | 127 + .../text-base/ConfigurationEngine.java.svn-base | 69 + .../text-base/ConfigurationReader.java.svn-base | 224 ++ .../text-base/ConfigurationSingleton.java.svn-base | 74 + .../.svn/text-base/InstanceEngine.java.svn-base | 70 + .../.svn/text-base/package-info.java.svn-base | 19 + .../peps/configuration/ConfigurationCreator.java | 127 + .../peps/configuration/ConfigurationEngine.java | 69 + .../peps/configuration/ConfigurationReader.java | 225 ++ .../peps/configuration/ConfigurationSingleton.java | 74 + .../stork/peps/configuration/InstanceEngine.java | 70 + .../eu/stork/peps/configuration/package-info.java | 19 + .../java/eu/stork/peps/exceptions/.svn/all-wcprops | 29 + .../java/eu/stork/peps/exceptions/.svn/entries | 164 ++ .../text-base/SAMLEngineException.java.svn-base | 57 + .../STORKSAMLEngineException.java.svn-base | 135 + .../STORKSAMLEngineRuntimeException.java.svn-base | 56 + .../.svn/text-base/package-info.java.svn-base | 19 + .../stork/peps/exceptions/SAMLEngineException.java | 57 + .../peps/exceptions/STORKSAMLEngineException.java | 135 + .../STORKSAMLEngineRuntimeException.java | 56 + .../eu/stork/peps/exceptions/package-info.java | 19 + .../stork2-saml-engine/src/test/.svn/all-wcprops | 5 + id/server/stork2-saml-engine/src/test/.svn/entries | 34 + .../src/test/java/.svn/all-wcprops | 5 + .../stork2-saml-engine/src/test/java/.svn/entries | 31 + .../src/test/java/META-INF/MANIFEST.MF | 3 + .../src/test/java/eu/.svn/all-wcprops | 5 + .../src/test/java/eu/.svn/entries | 31 + .../src/test/java/eu/stork/.svn/all-wcprops | 5 + .../src/test/java/eu/stork/.svn/entries | 31 + .../src/test/java/eu/stork/peps/.svn/all-wcprops | 5 + .../src/test/java/eu/stork/peps/.svn/entries | 31 + .../test/java/eu/stork/peps/test/.svn/all-wcprops | 5 + .../src/test/java/eu/stork/peps/test/.svn/entries | 31 + .../eu/stork/peps/test/simple/.svn/all-wcprops | 47 + .../java/eu/stork/peps/test/simple/.svn/entries | 266 ++ .../.svn/text-base/SSETestUtils.java.svn-base | 173 ++ .../.svn/text-base/SimpleBaseTest.java.svn-base | 62 + .../StorkAttrQueryRequestTest.java.svn-base | 790 ++++++ .../StorkAttrQueryResponseTest.java.svn-base | 920 ++++++ .../text-base/StorkAuthRequestTest.java.svn-base | 966 +++++++ .../.svn/text-base/StorkResponseTest.java.svn-base | 931 ++++++ .../.svn/text-base/package-info.java.svn-base | 20 + .../eu/stork/peps/test/simple/SSETestUtils.java | 173 ++ .../eu/stork/peps/test/simple/SimpleBaseTest.java | 62 + .../test/simple/StorkAttrQueryRequestTest.java | 790 ++++++ .../test/simple/StorkAttrQueryResponseTest.java | 920 ++++++ .../peps/test/simple/StorkAuthRequestTest.java | 966 +++++++ .../stork/peps/test/simple/StorkResponseTest.java | 931 ++++++ .../eu/stork/peps/test/simple/package-info.java | 20 + .../src/test/resources/.svn/all-wcprops | 101 + .../src/test/resources/.svn/entries | 575 ++++ .../.svn/prop-base/keyStoreCountry0.jks.svn-base | 5 + .../.svn/prop-base/keyStoreCountry1.jks.svn-base | 5 + .../.svn/prop-base/keyStoreCountry2.jks.svn-base | 5 + .../.svn/prop-base/keyStoreCountry3.jks.svn-base | 5 + .../.svn/text-base/SamlEngine.xml.svn-base | 63 + .../.svn/text-base/SignModule_Conf0.xml.svn-base | 12 + .../.svn/text-base/SignModule_Conf1.xml.svn-base | 12 + .../.svn/text-base/SignModule_Conf2.xml.svn-base | 12 + .../.svn/text-base/SignModule_Conf3.xml.svn-base | 12 + .../.svn/text-base/SignModule_P11.xml.svn-base | 11 + .../text-base/StorkSamlEngine_Conf0.xml.svn-base | 91 + .../text-base/StorkSamlEngine_Conf1.xml.svn-base | 91 + .../text-base/StorkSamlEngine_Conf2.xml.svn-base | 64 + .../text-base/StorkSamlEngine_Conf3.xml.svn-base | 61 + .../.svn/text-base/keyStoreCountry0.jks.svn-base | Bin 0 -> 1376 bytes .../.svn/text-base/keyStoreCountry1.jks.svn-base | Bin 0 -> 1313 bytes .../.svn/text-base/keyStoreCountry2.jks.svn-base | Bin 0 -> 1313 bytes .../.svn/text-base/keyStoreCountry3.jks.svn-base | Bin 0 -> 1313 bytes .../.svn/text-base/logback-test.xml.svn-base | 23 + .../resources/.svn/text-base/p11Conf.cfg.svn-base | 24 + .../src/test/resources/SamlEngine.xml | 81 + .../src/test/resources/SignModule_Conf0.xml | 12 + .../src/test/resources/SignModule_Conf1.xml | 12 + .../src/test/resources/SignModule_Conf2.xml | 12 + .../src/test/resources/SignModule_Conf3.xml | 12 + .../src/test/resources/SignModule_P11.xml | 11 + .../src/test/resources/SignModule_demo.xml | 12 + .../src/test/resources/StorkSamlEngine_Conf0.xml | 91 + .../src/test/resources/StorkSamlEngine_Conf1.xml | 91 + .../src/test/resources/StorkSamlEngine_Conf2.xml | 64 + .../src/test/resources/StorkSamlEngine_Conf3.xml | 61 + .../src/test/resources/StorkSamlEngine_demo.xml | 91 + .../src/test/resources/data/.svn/all-wcprops | 5 + .../src/test/resources/data/.svn/entries | 31 + .../src/test/resources/data/eu/.svn/all-wcprops | 5 + .../src/test/resources/data/eu/.svn/entries | 31 + .../test/resources/data/eu/stork/.svn/all-wcprops | 5 + .../src/test/resources/data/eu/stork/.svn/entries | 31 + .../data/eu/stork/STORKSAMLEngine/.svn/all-wcprops | 41 + .../data/eu/stork/STORKSAMLEngine/.svn/entries | 232 ++ .../.svn/text-base/AttrQueryRequest.xml.svn-base | 11 + .../AttrQueryRequestTagDelete.xml.svn-base | 15 + .../.svn/text-base/AttrQueryResponse.xml.svn-base | 10 + .../.svn/text-base/AuthnRequest.xml.svn-base | 26 + .../text-base/AuthnRequestTagDelete.xml.svn-base | 14 + .../AuthnRequestTagDeleteEncoded.xml.svn-base | 14 + .../eu/stork/STORKSAMLEngine/AttrQueryRequest.xml | 11 + .../STORKSAMLEngine/AttrQueryRequestTagDelete.xml | 15 + .../eu/stork/STORKSAMLEngine/AttrQueryResponse.xml | 10 + .../data/eu/stork/STORKSAMLEngine/AuthnRequest.xml | 26 + .../STORKSAMLEngine/AuthnRequestTagDelete.xml | 14 + .../AuthnRequestTagDeleteEncoded.xml | 14 + .../src/test/resources/keyStoreCountry0.jks | Bin 0 -> 1376 bytes .../src/test/resources/keyStoreCountry1.jks | Bin 0 -> 1313 bytes .../src/test/resources/keyStoreCountry2.jks | Bin 0 -> 1313 bytes .../src/test/resources/keyStoreCountry3.jks | Bin 0 -> 1313 bytes .../src/test/resources/logback-test.xml | 23 + .../src/test/resources/p11Conf.cfg | 24 + .../src/test/resources/storkDemoKeys.jks | Bin 0 -> 4592 bytes 787 files changed, 83709 insertions(+) create mode 100644 id/server/stork2-commons/Releases create mode 100644 id/server/stork2-commons/pom.xml create mode 100644 id/server/stork2-commons/src/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/.svn/entries create mode 100644 id/server/stork2-commons/src/main/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/.svn/entries create mode 100644 id/server/stork2-commons/src/main/config/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/config/.svn/entries create mode 100644 id/server/stork2-commons/src/main/config/embedded/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/config/embedded/.svn/entries create mode 100644 id/server/stork2-commons/src/main/config/embedded/.svn/text-base/pepsUtil.properties.svn-base create mode 100644 id/server/stork2-commons/src/main/config/embedded/pepsUtil.properties create mode 100644 id/server/stork2-commons/src/main/java/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/java/.svn/entries create mode 100644 id/server/stork2-commons/src/main/java/eu/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/java/eu/.svn/entries create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/.svn/entries create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/entries create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/entries create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/entries create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeConstants.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvider.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvidersMap.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeSource.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeUtil.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CitizenConsent.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Country.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CountryCodes.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/DateUtil.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IAttributeProvidersMap.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IPersonalAttributeList.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkLogger.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkSession.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Linker.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSErrors.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSParameters.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSUtil.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSValues.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttribute.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttributeList.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryRequest.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryResponse.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnRequest.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnResponse.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKStatusCode.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKSubStatusCode.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeConstants.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Country.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CountryCodes.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/DateUtil.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IStorkLogger.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IStorkSession.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKStatusCode.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKSubStatusCode.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/entries create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/AbstractPEPSException.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/CPEPSException.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InternalErrorPEPSException.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidParameterPEPSException.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidSessionPEPSException.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/SecurityPEPSException.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/StorkPEPSException.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/AbstractPEPSException.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/CPEPSException.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InternalErrorPEPSException.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidParameterPEPSException.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidSessionPEPSException.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/SecurityPEPSException.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/StorkPEPSException.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/package-info.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/package-info.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/entries create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IAUService.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ICheckAttributeValue.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IDeriveAttribute.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/INormaliseValue.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ITranslatorService.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ICheckAttributeValue.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IDeriveAttribute.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/INormaliseValue.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/package-info.java create mode 100644 id/server/stork2-commons/src/main/resources/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/main/resources/.svn/entries create mode 100644 id/server/stork2-commons/src/main/resources/.svn/text-base/log4j.xml.svn-base create mode 100644 id/server/stork2-commons/src/main/resources/log4j.xml create mode 100644 id/server/stork2-commons/src/test/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/test/.svn/entries create mode 100644 id/server/stork2-commons/src/test/java/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/test/java/.svn/entries create mode 100644 id/server/stork2-commons/src/test/java/eu/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/test/java/eu/.svn/entries create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/.svn/entries create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/entries create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/entries create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/AttributeUtilTestCase.java.svn-base create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/DateUtilTestCase.java.svn-base create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PEPSUtilTestCase.java.svn-base create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeListTestCase.java.svn-base create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeTestCase.java.svn-base create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/package-info.java create mode 100644 id/server/stork2-commons/src/test/resources/.svn/all-wcprops create mode 100644 id/server/stork2-commons/src/test/resources/.svn/entries create mode 100644 id/server/stork2-commons/src/test/resources/.svn/text-base/log4j.xml.svn-base create mode 100644 id/server/stork2-commons/src/test/resources/log4j.xml create mode 100644 id/server/stork2-saml-engine/build/classes/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/META-INF/MANIFEST.MF create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngine.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLCore.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPApplication.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPCountry.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPID.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInformation.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInstitution.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPSector.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/package-info.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/package-info.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/package-info.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/package-info.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationCreator.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationEngine.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationReader.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationSingleton.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/InstanceEngine.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/package-info.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/SAMLEngineException.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.class create mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/package-info.class create mode 100644 id/server/stork2-saml-engine/build/classes/test/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class create mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SamlEngine.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_P11.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/logback-test.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/p11Conf.cfg.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SamlEngine.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf0.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf1.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf2.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf3.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_P11.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf0.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf1.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf2.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf3.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry0.jks create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry1.jks create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry2.jks create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry3.jks create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/logback-test.xml create mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/p11Conf.cfg create mode 100644 id/server/stork2-saml-engine/pom.xml create mode 100644 id/server/stork2-saml-engine/src/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/META-INF/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/META-INF/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/META-INF/MANIFEST.MF create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLCore.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPApplication.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPCountry.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPID.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInformation.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInstitution.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPSector.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/package-info.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/package-info.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/package-info.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/package-info.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationEngine.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationSingleton.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/InstanceEngine.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/package-info.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/package-info.java create mode 100644 id/server/stork2-saml-engine/src/test/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks create mode 100644 id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jks create mode 100644 id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jks create mode 100644 id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jks create mode 100644 id/server/stork2-saml-engine/src/test/resources/logback-test.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg create mode 100644 id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks diff --git a/id/server/stork2-commons/Releases b/id/server/stork2-commons/Releases new file mode 100644 index 000000000..00e3d806d --- /dev/null +++ b/id/server/stork2-commons/Releases @@ -0,0 +1,40 @@ +Created 06-04-2011 + +Branch : STORKCommons_0_5_UPDATE_06042011 +Date : 06-04-2011 +Changes: No changes. + +Branch : STORKCommons_0_5_UPDATE_07072011 +Date : 07-07-2011 +Changes: Inserted constants to HttpOnly HTTP Header. + +Branch : STORKCommons_0_6 +Date : 07-11-2011 +Changes: Improved error exception handling (few changes on the exception classes). + Improved Constansts (unused removed, others added). + Unit Tests include (almost all the code is cover). + Fix some minor bugs found on unit tests. + New Copyright License added. + PEPUtils refactored. + Improved error code message (three kind of messages: to citizen, admin and saml token). + +Branch : STORKCommons_0_6_1 +Date : 28-11-2011 +Changes: Removed unnecessary javadoc package file. + Updated pepsUtils.properties file (check attribute value had old error message) + +Branch : STORKCommons_0_9 +Date : 02-12-2011 +Changes: Updated Version to 0.9 + +Branch : STORKCommons_1_0 +Date : 02-12-2011 +Changes: Updated Version to 1.0 + +Branch : STORKCommons_1_1_0 +Date : 01-11-2013 +Changes: Updated Version to 1.1.0 + Dependencies updated + Business Logic Part I changes + SAML Engine Changes merged (from SamlEngine/1.1.0/Commons branch to be easier to merge this branch with trunk) + Fixed some errors on Test Case \ No newline at end of file diff --git a/id/server/stork2-commons/pom.xml b/id/server/stork2-commons/pom.xml new file mode 100644 index 000000000..1fa6f538d --- /dev/null +++ b/id/server/stork2-commons/pom.xml @@ -0,0 +1,183 @@ + + 4.0.0 + eu.stork + stork-commons + jar + Stork Commons + + UTF-8 + 1.1.0 + + ${stork.version} + + The STORKCommons library provides beans, Java Interfaces and utility classes to integrate PEPS and SAML Engine. + + + + + + joda-time + joda-time + 2.3 + + + + + log4j + log4j + 1.2.17 + + + javax.jms + jms + + + com.sun.jdmk + jmxtools + + + com.sun.jmx + jmxri + + + mail + javax.mail + + + + + + + org.bouncycastle + bcprov-jdk16 + 1.46 + + + + + + javax.servlet + servlet-api + 2.5 + provided + + + + commons-lang + commons-lang + 2.6 + jar + compile + + + junit + junit + 4.11 + test + + + + + stork-commons + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.6 + 1.6 + + + + org.apache.maven.plugins + maven-surefire-plugin + + reversealphabetical + false + + reversealphabetical + **/PEPSUtilTest.java + **/PersonalAttributeTestCase.java + **/PersonalAttributeListTestCase.java + **/DateUtilTestCase.java + **/AttributeUtilTest.java + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + http://commons.apache.org/lang/api/ + http://java.sun.com/j2se/1.6.0/docs/api/ + http://www.bouncycastle.org/docs/docs1.6/ + http://docs.oracle.com/javase/6/docs/api/ + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + verify + + jar-no-fork + + + + + + + + src/test/resources + + log4j.xml + + + + + + + embedded + + + + ${project.basedir}/src/main/resources + + + ${project.basedir}/src/main/config/embedded + + + + + + metrics + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.5.1 + + + html + xml + + + + + + + + diff --git a/id/server/stork2-commons/src/.svn/all-wcprops b/id/server/stork2-commons/src/.svn/all-wcprops new file mode 100644 index 000000000..8c9f999e7 --- /dev/null +++ b/id/server/stork2-commons/src/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 49 +/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src +END diff --git a/id/server/stork2-commons/src/.svn/entries b/id/server/stork2-commons/src/.svn/entries new file mode 100644 index 000000000..8bea20479 --- /dev/null +++ b/id/server/stork2-commons/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-05T18:15:46.189390Z +105 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +test +dir + +main +dir + diff --git a/id/server/stork2-commons/src/main/.svn/all-wcprops b/id/server/stork2-commons/src/main/.svn/all-wcprops new file mode 100644 index 000000000..05728e427 --- /dev/null +++ b/id/server/stork2-commons/src/main/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 53 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main +END diff --git a/id/server/stork2-commons/src/main/.svn/entries b/id/server/stork2-commons/src/main/.svn/entries new file mode 100644 index 000000000..1e58ea7f9 --- /dev/null +++ b/id/server/stork2-commons/src/main/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +java +dir + +config +dir + +resources +dir + diff --git a/id/server/stork2-commons/src/main/config/.svn/all-wcprops b/id/server/stork2-commons/src/main/config/.svn/all-wcprops new file mode 100644 index 000000000..a43da4e7f --- /dev/null +++ b/id/server/stork2-commons/src/main/config/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 60 +/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/config +END diff --git a/id/server/stork2-commons/src/main/config/.svn/entries b/id/server/stork2-commons/src/main/config/.svn/entries new file mode 100644 index 000000000..fc29ea9af --- /dev/null +++ b/id/server/stork2-commons/src/main/config/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/config +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-28T11:11:01.095477Z +73 +emlelisst + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +embedded +dir + diff --git a/id/server/stork2-commons/src/main/config/embedded/.svn/all-wcprops b/id/server/stork2-commons/src/main/config/embedded/.svn/all-wcprops new file mode 100644 index 000000000..77e2a8338 --- /dev/null +++ b/id/server/stork2-commons/src/main/config/embedded/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 69 +/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/config/embedded +END +pepsUtil.properties +K 25 +svn:wc:ra_dav:version-url +V 89 +/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/config/embedded/pepsUtil.properties +END diff --git a/id/server/stork2-commons/src/main/config/embedded/.svn/entries b/id/server/stork2-commons/src/main/config/embedded/.svn/entries new file mode 100644 index 000000000..bd9b1843e --- /dev/null +++ b/id/server/stork2-commons/src/main/config/embedded/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/config/embedded +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-28T11:11:01.095477Z +73 +emlelisst + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +pepsUtil.properties +file + + + + +2013-12-20T12:27:56.666475Z +ea19345b61bd574891578c684550a2e8 +2013-10-28T11:11:01.095477Z +73 +emlelisst + + + + + + + + + + + + + + + + + + + + + +6770 + diff --git a/id/server/stork2-commons/src/main/config/embedded/.svn/text-base/pepsUtil.properties.svn-base b/id/server/stork2-commons/src/main/config/embedded/.svn/text-base/pepsUtil.properties.svn-base new file mode 100644 index 000000000..eba0674e8 --- /dev/null +++ b/id/server/stork2-commons/src/main/config/embedded/.svn/text-base/pepsUtil.properties.svn-base @@ -0,0 +1,232 @@ +#Max allowed params size +validation.active=true +max.spUrl.size=150 +max.attrList.size=20000 +max.invalidAttributeList.size=20000 +max.attrName.size=100 +max.callback.size=300 +max.idp.url.size=300 +max.atp.url.size=300 +max.attrValue.size=20000 +max.attrType.size=25 +max.spId.size=40 +max.providerName.size=128 +max.spName.size=25 +max.country.size=150 +max.qaaLevel.size=1 +max.spQaaLevel.size=1 +max.errorCode.size=5 +max.errorMessage.size=300 +max.username.size=30 +max.spepsRedirectUrl.size=300 +max.speps.redirectUrl.size=300 +max.cpeps.redirectUrl.size=300 +max.cpepsRedirectUrl.size=300 +max.spepsAssertionUrl.size=300 +max.SAMLRequest.size=131072 +max.SAMLResponse.size=131072 +max.RelayState.size=80 +max.remoteAddr.size=300 +max.remoteHost.size=300 +max.localAddr.size=300 +max.localName.size=300 + +#ERROR codes/messages (accordingly to specification) + +#CountrySelector Interface errors +spCountrySelector.invalidSPQAA.code=0000001 +spCountrySelector.invalidSPQAA.message=invalid.spQAA.parameter + +spCountrySelector.invalidQaaSPid.code=0000001 +spCountrySelector.invalidQaaSPid.message=invalid.spQAAId.parameter + +spCountrySelector.invalidSpId.code=000002 +spCountrySelector.invalidSpId.message=invalid.spId.parameter + +spCountrySelector.invalidSpURL.code=000003 +spCountrySelector.invalidSpURL.message=invalid.spUrl.parameter + +domain.CountrySelectorAction.code=000003 +domain.CountrySelectorAction.message=invalid.cs.domain + +requests.CountrySelectorAction.code=000004 +requests.CountrySelectorAction.message=reached.max.requests.cs + +spCountrySelector.spNotAllowed.code=000006 +spCountrySelector.spNotAllowed.message=attr.access.deny + +spCountrySelector.invalidAttr.code=000007 +spCountrySelector.invalidAttr.message=invalid.spAttr.parameter + +spCountrySelector.invalidProviderName.code=000008 +spCountrySelector.invalidProviderName.message=invalid.spProvidername.parameter + +spCountrySelector.errorCreatingSAML.code=203001 +spCountrySelector.errorCreatingSAML.message=error.create.sp.saml + +spepsSAMLRequest.code=203001 +spepsSAMLRequest.message=error.create.saml.speps + +#ServiceProvider Interface errors +sProviderAction.invalidSPQAA.code=200001 +sProviderAction.invalidSPQAA.message=invalid.sp.qaa + +sProviderAction.invalidSPQAAId.code=200001 +sProviderAction.invalidSPQAAId.message=invalid.sp.qaaid + +sProviderAction.invalidSPId.code=200002 +sProviderAction.invalidSPId.message=invalid.sp.id + +domain.ServiceProviderAction.code=200003 +domain.ServiceProviderAction.message=invalid.sp.domain + +sProviderAction.invalidSPDomain.code=200003 +sProviderAction.invalidSPDomain.message=invalid.sp.domain + +sProviderAction.invalidCountry.code=200004 +sProviderAction.invalidCountry.message=invalid.sp.country + +sProviderAction.spNotAllowed.code=200005 +sProviderAction.spNotAllowed.message=sp.not.allowed + +sProviderAction.invalidSaml.code=200006 +sProviderAction.invalidSaml.message=invalid.sp.samlrequest + +sProviderAction.invalidSPProviderName.code=200007 +sProviderAction.invalidSPProviderName.message=sp.not.identified + +sProviderAction.invalidSPRedirect.code=200008 +sProviderAction.invalidSPRedirect.message=invalid.sp.redirectUrl + +sProviderAction.invalidRelayState.code=200009 +sProviderAction.invalidRelayState.message=invalid.sp.relaystate + +sProviderAction.invalidAttr.code=200011 +sProviderAction.invalidAttr.message=invalid.sp.attr + +requests.ServiceProviderAction.code=200012 +requests.ServiceProviderAction.message=reached.max.requests.sp + +sProviderAction.invalidSPAlias.code=203003 +sProviderAction.invalidSPAlias.message=invalid.sp.alias + +sProviderAction.errorCreatingSAML.code=203001 +sProviderAction.errorCreatingSAML.message=error.create.saml.speps + +#Internal Error +internalError.code=203001 +internalError.message=internalError + +attrList.code=202005 +attrList.message=invalid.attrList.parameter + +missing.sessionId.code=203010 +missing.sessionId.message=missing.session.id + +sessionError.code=203011 +sessionError.message=invalid.session.id + +invalid.sessionId.code=203011 +invalid.sessionId.message=invalid.session.id + +invalid.session.code=203012 +invalid.session.message=invalid.session + +callback.code=203006 +callback.message=invalid.callback.url + +idp.url.code=203006 +idp.url.message=invalid.idp.url + +IdPSAMLResponse.code=002001 +IdPSAMLResponse.message=invalid.idp.response + +authenticationFailed.code=003002 +authenticationFailed.message=authentication.failed + +username.code=003002 +username.message=authentication.failed + +invalidAttributeList.code=203001 +invalidAttributeList.message=invalid.attrlist + +invalidAttributeValue.code=203001 +invalidAttributeValue.message=invalid.attr.value + +attVerification.mandatory.code=202010 +attVerification.mandatory.message=missing.mandatory.attr + +attrValue.verification.code=203008 +attrValue.verification.message=invalid.stork.attrValue + +cpepsSAMLResponse.code=202011 +cpepsSAMLResponse.message=error.gen.cpeps.saml + +AtPSAMLResponse.code=202009 +AtPSAMLResponse.message=error.gen.atp.saml + +atp.url.code=203006 +atp.url.message=invalid.atp.url + +hash.error.code=203001 +hash.error.message=error.hash + +qaaLevel.code=203006 +qaaLevel.message=invalid.cpeps.qaalevel + +SAMLRequest.code=203001 +SAMLRequest.message=invalid.SAMLRequest + +#Colleague Request Interface errors + +colleagueRequest.invalidSAML.code=201002 +colleagueRequest.invalidSAML.message=invalid.speps.samlrequest + +colleagueRequest.invalidCountryCode.code=002001 +colleagueRequest.invalidCountryCode.message=country.cpeps.nomatch + +colleagueRequest.errorCreatingSAML.code=203001 +colleagueRequest.errorCreatingSAML.message=error.create.saml.cpeps + +colleagueRequest.invalidQaa.code=202004 +colleagueRequest.invalidQaa.message=invalid.requested.cpeps.qaalevel + +colleagueRequest.attrNull.code=202005 +colleagueRequest.attrNull.message=invalid.requested.attrlist.cpeps + +colleagueRequest.invalidRedirect.code=202001 +colleagueRequest.invalidRedirect.message=invalid.redirecturl.cpeps + +colleagueRequest.invalidDestUrl.code=203006 +colleagueRequest.invalidDestUrl.message=invalid.cpeps.destUrl + +cpepsRedirectUrl.code=203006 +cpepsRedirectUrl.message=invalid.cpeps.redirectUrl + +#Citizen Consent Interfaces errors + +citizenResponse.mandatory.code=202007 +citizenResponse.mandatory.message=no.consent.mand.attr + +cPeps.attrNull.code=202005 +cPeps.attrNull.message=invalid.attrList.cpeps + +citizenNoConsent.mandatory.code=202012 +citizenNoConsent.mandatory.message=no.consent.val.mand.attr + +#Colleague Response Interface errors + +colleagueResponse.invalidSAML.code=202002 +colleagueResponse.invalidSAML.message=invalid.cpeps.samlresp + +auRequestIdError.code=201005 +auRequestIdError.message=invalid.speps.saml.id + +audienceRestrictionError.code=201004 +audienceRestrictionError.message=speps.saml.condition.notmet + +spepsSAMLResponse.code=200010 +spepsSAMLResponse.message=error.gen.speps.saml + +#Hash Digests +hashDigest.className=org.bouncycastle.crypto.digests.SHA512Digest diff --git a/id/server/stork2-commons/src/main/config/embedded/pepsUtil.properties b/id/server/stork2-commons/src/main/config/embedded/pepsUtil.properties new file mode 100644 index 000000000..eba0674e8 --- /dev/null +++ b/id/server/stork2-commons/src/main/config/embedded/pepsUtil.properties @@ -0,0 +1,232 @@ +#Max allowed params size +validation.active=true +max.spUrl.size=150 +max.attrList.size=20000 +max.invalidAttributeList.size=20000 +max.attrName.size=100 +max.callback.size=300 +max.idp.url.size=300 +max.atp.url.size=300 +max.attrValue.size=20000 +max.attrType.size=25 +max.spId.size=40 +max.providerName.size=128 +max.spName.size=25 +max.country.size=150 +max.qaaLevel.size=1 +max.spQaaLevel.size=1 +max.errorCode.size=5 +max.errorMessage.size=300 +max.username.size=30 +max.spepsRedirectUrl.size=300 +max.speps.redirectUrl.size=300 +max.cpeps.redirectUrl.size=300 +max.cpepsRedirectUrl.size=300 +max.spepsAssertionUrl.size=300 +max.SAMLRequest.size=131072 +max.SAMLResponse.size=131072 +max.RelayState.size=80 +max.remoteAddr.size=300 +max.remoteHost.size=300 +max.localAddr.size=300 +max.localName.size=300 + +#ERROR codes/messages (accordingly to specification) + +#CountrySelector Interface errors +spCountrySelector.invalidSPQAA.code=0000001 +spCountrySelector.invalidSPQAA.message=invalid.spQAA.parameter + +spCountrySelector.invalidQaaSPid.code=0000001 +spCountrySelector.invalidQaaSPid.message=invalid.spQAAId.parameter + +spCountrySelector.invalidSpId.code=000002 +spCountrySelector.invalidSpId.message=invalid.spId.parameter + +spCountrySelector.invalidSpURL.code=000003 +spCountrySelector.invalidSpURL.message=invalid.spUrl.parameter + +domain.CountrySelectorAction.code=000003 +domain.CountrySelectorAction.message=invalid.cs.domain + +requests.CountrySelectorAction.code=000004 +requests.CountrySelectorAction.message=reached.max.requests.cs + +spCountrySelector.spNotAllowed.code=000006 +spCountrySelector.spNotAllowed.message=attr.access.deny + +spCountrySelector.invalidAttr.code=000007 +spCountrySelector.invalidAttr.message=invalid.spAttr.parameter + +spCountrySelector.invalidProviderName.code=000008 +spCountrySelector.invalidProviderName.message=invalid.spProvidername.parameter + +spCountrySelector.errorCreatingSAML.code=203001 +spCountrySelector.errorCreatingSAML.message=error.create.sp.saml + +spepsSAMLRequest.code=203001 +spepsSAMLRequest.message=error.create.saml.speps + +#ServiceProvider Interface errors +sProviderAction.invalidSPQAA.code=200001 +sProviderAction.invalidSPQAA.message=invalid.sp.qaa + +sProviderAction.invalidSPQAAId.code=200001 +sProviderAction.invalidSPQAAId.message=invalid.sp.qaaid + +sProviderAction.invalidSPId.code=200002 +sProviderAction.invalidSPId.message=invalid.sp.id + +domain.ServiceProviderAction.code=200003 +domain.ServiceProviderAction.message=invalid.sp.domain + +sProviderAction.invalidSPDomain.code=200003 +sProviderAction.invalidSPDomain.message=invalid.sp.domain + +sProviderAction.invalidCountry.code=200004 +sProviderAction.invalidCountry.message=invalid.sp.country + +sProviderAction.spNotAllowed.code=200005 +sProviderAction.spNotAllowed.message=sp.not.allowed + +sProviderAction.invalidSaml.code=200006 +sProviderAction.invalidSaml.message=invalid.sp.samlrequest + +sProviderAction.invalidSPProviderName.code=200007 +sProviderAction.invalidSPProviderName.message=sp.not.identified + +sProviderAction.invalidSPRedirect.code=200008 +sProviderAction.invalidSPRedirect.message=invalid.sp.redirectUrl + +sProviderAction.invalidRelayState.code=200009 +sProviderAction.invalidRelayState.message=invalid.sp.relaystate + +sProviderAction.invalidAttr.code=200011 +sProviderAction.invalidAttr.message=invalid.sp.attr + +requests.ServiceProviderAction.code=200012 +requests.ServiceProviderAction.message=reached.max.requests.sp + +sProviderAction.invalidSPAlias.code=203003 +sProviderAction.invalidSPAlias.message=invalid.sp.alias + +sProviderAction.errorCreatingSAML.code=203001 +sProviderAction.errorCreatingSAML.message=error.create.saml.speps + +#Internal Error +internalError.code=203001 +internalError.message=internalError + +attrList.code=202005 +attrList.message=invalid.attrList.parameter + +missing.sessionId.code=203010 +missing.sessionId.message=missing.session.id + +sessionError.code=203011 +sessionError.message=invalid.session.id + +invalid.sessionId.code=203011 +invalid.sessionId.message=invalid.session.id + +invalid.session.code=203012 +invalid.session.message=invalid.session + +callback.code=203006 +callback.message=invalid.callback.url + +idp.url.code=203006 +idp.url.message=invalid.idp.url + +IdPSAMLResponse.code=002001 +IdPSAMLResponse.message=invalid.idp.response + +authenticationFailed.code=003002 +authenticationFailed.message=authentication.failed + +username.code=003002 +username.message=authentication.failed + +invalidAttributeList.code=203001 +invalidAttributeList.message=invalid.attrlist + +invalidAttributeValue.code=203001 +invalidAttributeValue.message=invalid.attr.value + +attVerification.mandatory.code=202010 +attVerification.mandatory.message=missing.mandatory.attr + +attrValue.verification.code=203008 +attrValue.verification.message=invalid.stork.attrValue + +cpepsSAMLResponse.code=202011 +cpepsSAMLResponse.message=error.gen.cpeps.saml + +AtPSAMLResponse.code=202009 +AtPSAMLResponse.message=error.gen.atp.saml + +atp.url.code=203006 +atp.url.message=invalid.atp.url + +hash.error.code=203001 +hash.error.message=error.hash + +qaaLevel.code=203006 +qaaLevel.message=invalid.cpeps.qaalevel + +SAMLRequest.code=203001 +SAMLRequest.message=invalid.SAMLRequest + +#Colleague Request Interface errors + +colleagueRequest.invalidSAML.code=201002 +colleagueRequest.invalidSAML.message=invalid.speps.samlrequest + +colleagueRequest.invalidCountryCode.code=002001 +colleagueRequest.invalidCountryCode.message=country.cpeps.nomatch + +colleagueRequest.errorCreatingSAML.code=203001 +colleagueRequest.errorCreatingSAML.message=error.create.saml.cpeps + +colleagueRequest.invalidQaa.code=202004 +colleagueRequest.invalidQaa.message=invalid.requested.cpeps.qaalevel + +colleagueRequest.attrNull.code=202005 +colleagueRequest.attrNull.message=invalid.requested.attrlist.cpeps + +colleagueRequest.invalidRedirect.code=202001 +colleagueRequest.invalidRedirect.message=invalid.redirecturl.cpeps + +colleagueRequest.invalidDestUrl.code=203006 +colleagueRequest.invalidDestUrl.message=invalid.cpeps.destUrl + +cpepsRedirectUrl.code=203006 +cpepsRedirectUrl.message=invalid.cpeps.redirectUrl + +#Citizen Consent Interfaces errors + +citizenResponse.mandatory.code=202007 +citizenResponse.mandatory.message=no.consent.mand.attr + +cPeps.attrNull.code=202005 +cPeps.attrNull.message=invalid.attrList.cpeps + +citizenNoConsent.mandatory.code=202012 +citizenNoConsent.mandatory.message=no.consent.val.mand.attr + +#Colleague Response Interface errors + +colleagueResponse.invalidSAML.code=202002 +colleagueResponse.invalidSAML.message=invalid.cpeps.samlresp + +auRequestIdError.code=201005 +auRequestIdError.message=invalid.speps.saml.id + +audienceRestrictionError.code=201004 +audienceRestrictionError.message=speps.saml.condition.notmet + +spepsSAMLResponse.code=200010 +spepsSAMLResponse.message=error.gen.speps.saml + +#Hash Digests +hashDigest.className=org.bouncycastle.crypto.digests.SHA512Digest diff --git a/id/server/stork2-commons/src/main/java/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/.svn/all-wcprops new file mode 100644 index 000000000..52b0d1aa6 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 58 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java +END diff --git a/id/server/stork2-commons/src/main/java/.svn/entries b/id/server/stork2-commons/src/main/java/.svn/entries new file mode 100644 index 000000000..cc94ba4ff --- /dev/null +++ b/id/server/stork2-commons/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +eu +dir + diff --git a/id/server/stork2-commons/src/main/java/eu/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/.svn/all-wcprops new file mode 100644 index 000000000..b792be687 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 61 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu +END diff --git a/id/server/stork2-commons/src/main/java/eu/.svn/entries b/id/server/stork2-commons/src/main/java/eu/.svn/entries new file mode 100644 index 000000000..d746a275b --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +stork +dir + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/.svn/all-wcprops new file mode 100644 index 000000000..bfb5156c8 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 67 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork +END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/.svn/entries new file mode 100644 index 000000000..081cc291c --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +peps +dir + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/all-wcprops new file mode 100644 index 000000000..10f18802a --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 72 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps +END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/entries new file mode 100644 index 000000000..d8fcce9b6 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +auth +dir + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/all-wcprops new file mode 100644 index 000000000..479002e28 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 77 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth +END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/entries new file mode 100644 index 000000000..c90333736 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps/auth +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +commons +dir + +specific +dir + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/all-wcprops new file mode 100644 index 000000000..5c34d72e7 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/all-wcprops @@ -0,0 +1,167 @@ +K 25 +svn:wc:ra_dav:version-url +V 85 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons +END +CitizenConsent.java +K 25 +svn:wc:ra_dav:version-url +V 105 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java +END +AttributeProvidersMap.java +K 25 +svn:wc:ra_dav:version-url +V 112 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java +END +AttributeConstants.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeConstants.java +END +AttributeUtil.java +K 25 +svn:wc:ra_dav:version-url +V 104 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java +END +STORKStatusCode.java +K 25 +svn:wc:ra_dav:version-url +V 106 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKStatusCode.java +END +STORKAttrQueryResponse.java +K 25 +svn:wc:ra_dav:version-url +V 113 +/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java +END +PersonalAttributeList.java +K 25 +svn:wc:ra_dav:version-url +V 112 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java +END +Country.java +K 25 +svn:wc:ra_dav:version-url +V 98 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/Country.java +END +PEPSErrors.java +K 25 +svn:wc:ra_dav:version-url +V 101 +/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java +END +PEPSUtil.java +K 25 +svn:wc:ra_dav:version-url +V 99 +/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java +END +PersonalAttribute.java +K 25 +svn:wc:ra_dav:version-url +V 108 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java +END +IAttributeProvidersMap.java +K 25 +svn:wc:ra_dav:version-url +V 113 +/CITnet/svn/STORK2/!svn/ver/31/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java +END +IStorkLogger.java +K 25 +svn:wc:ra_dav:version-url +V 103 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/IStorkLogger.java +END +DateUtil.java +K 25 +svn:wc:ra_dav:version-url +V 99 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/DateUtil.java +END +STORKAuthnRequest.java +K 25 +svn:wc:ra_dav:version-url +V 108 +/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java +END +STORKSubStatusCode.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKSubStatusCode.java +END +IPersonalAttributeList.java +K 25 +svn:wc:ra_dav:version-url +V 113 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java +END +AttributeProvider.java +K 25 +svn:wc:ra_dav:version-url +V 108 +/CITnet/svn/STORK2/!svn/ver/31/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java +END +IStorkSession.java +K 25 +svn:wc:ra_dav:version-url +V 104 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/IStorkSession.java +END +CountryCodes.java +K 25 +svn:wc:ra_dav:version-url +V 103 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/CountryCodes.java +END +STORKAuthnResponse.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 103 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/package-info.java +END +AttributeSource.java +K 25 +svn:wc:ra_dav:version-url +V 106 +/CITnet/svn/STORK2/!svn/ver/31/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java +END +Linker.java +K 25 +svn:wc:ra_dav:version-url +V 97 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/Linker.java +END +PEPSValues.java +K 25 +svn:wc:ra_dav:version-url +V 101 +/CITnet/svn/STORK2/!svn/ver/31/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java +END +PEPSParameters.java +K 25 +svn:wc:ra_dav:version-url +V 105 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java +END +STORKAttrQueryRequest.java +K 25 +svn:wc:ra_dav:version-url +V 112 +/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java +END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/entries new file mode 100644 index 000000000..78c1138bc --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/entries @@ -0,0 +1,949 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps/auth/commons +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +AttributeSource.java +file + + + + +2013-12-20T12:27:56.638475Z +0f5436915d275475d2e30e1ac8aa9916 +2013-10-10T17:38:31.956327Z +31 +emlelisst + + + + + + + + + + + + + + + + + + + + + +2576 + +Linker.java +file + + + + +2013-12-20T12:27:56.638475Z +7e2de1580308d3fa7c91f95eed36fcff +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +4707 + +package-info.java +file + + + + +2013-12-20T12:27:56.638475Z +8d8068e217f10425f76a8d37192ccd80 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +277 + +PEPSValues.java +file + + + + +2013-12-20T12:27:56.638475Z +95c122e156ff030f46dd02bacaef7b2a +2013-10-10T17:38:31.956327Z +31 +emlelisst + + + + + + + + + + + + + + + + + + + + + +7515 + +PEPSParameters.java +file + + + + +2013-12-20T12:27:56.638475Z +3bbae3c0d36d323b2551d8735becbbf3 +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +12811 + +STORKAttrQueryRequest.java +file + + + + +2013-12-20T12:27:56.638475Z +f24b34d7b7778b050000759b8e51e135 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +10086 + +CitizenConsent.java +file + + + + +2013-12-20T12:27:56.638475Z +65152dd2df078e7d9ba767293ee3089e +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3419 + +AttributeProvidersMap.java +file + + + + +2013-12-20T12:27:56.638475Z +dd0a71bc5e428238622d01103d1ff592 +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +2570 + +AttributeConstants.java +file + + + + +2013-12-20T12:27:56.638475Z +940dcb9e93ede62e221f4b25abd6576b +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1831 + +exceptions +dir + +AttributeUtil.java +file + + + + +2013-12-20T12:27:56.638475Z +fa7359e18bb73f5e6a40a10602334001 +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +7921 + +STORKStatusCode.java +file + + + + +2013-12-20T12:27:56.638475Z +771689c75a8263c7e3966e820d59025e +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1906 + +STORKAttrQueryResponse.java +file + + + + +2013-12-20T12:27:56.638475Z +7f38f84cce71009e69f5b122cc56b9a4 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +6750 + +PersonalAttributeList.java +file + + + + +2013-12-20T12:27:56.638475Z +6d50cc23699503bb7a1444c9a16cff8c +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +9413 + +Country.java +file + + + + +2013-12-20T12:27:56.638475Z +9cbde5f25b646d02dae7ccf424906b4a +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +2208 + +PEPSErrors.java +file + + + + +2013-12-20T12:27:56.638475Z +8cd32a1d957e59b567eeb14ac9d989b6 +2013-10-28T11:11:01.095477Z +73 +emlelisst + + + + + + + + + + + + + + + + + + + + + +10810 + +PEPSUtil.java +file + + + + +2013-12-20T12:27:56.634475Z +54dfabdb89ec6069a2ec2e33c8d925d6 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +11507 + +PersonalAttribute.java +file + + + + +2013-12-20T12:27:56.634475Z +76a8ff69fd13e5f67f1404249ca1d8a1 +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +8471 + +IAttributeProvidersMap.java +file + + + + +2013-12-20T12:27:56.634475Z +225257e8d6d7b9e6bcc4bea2463c33be +2013-10-10T17:38:31.956327Z +31 +emlelisst + + + + + + + + + + + + + + + + + + + + + +2534 + +IStorkLogger.java +file + + + + +2013-12-20T12:27:56.634475Z +f15979b29f52d1674103528aed914ae7 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +4766 + +DateUtil.java +file + + + + +2013-12-20T12:27:56.634475Z +59f9cd2a3d1169a0f1a797b28719921a +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +5702 + +STORKAuthnRequest.java +file + + + + +2013-12-20T12:27:56.634475Z +3f36e65f0c4f1c7df753784b2e64f00b +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +11269 + +STORKSubStatusCode.java +file + + + + +2013-12-20T12:27:56.634475Z +65e615e0119d4125d5f4f58af8bcd18b +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2181 + +IPersonalAttributeList.java +file + + + + +2013-12-20T12:27:56.634475Z +8a39da025b26fd5782611eeadeb69e03 +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +4664 + +AttributeProvider.java +file + + + + +2013-12-20T12:27:56.634475Z +a16d3c5a83ced423ccc22f1d841c3575 +2013-10-10T17:38:31.956327Z +31 +emlelisst + + + + + + + + + + + + + + + + + + + + + +1525 + +IStorkSession.java +file + + + + +2013-12-20T12:27:56.634475Z +5a8701b1fd27998d5cf3280a5c99bcb0 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2745 + +CountryCodes.java +file + + + + +2013-12-20T12:27:56.638475Z +f91b0f8df0b2a68fe1b900d425257c23 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3527 + +STORKAuthnResponse.java +file + + + + +2013-12-20T12:27:56.638475Z +413495295761fd9c49a0b1e50befc68f +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +6797 + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeConstants.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeConstants.java.svn-base new file mode 100644 index 000000000..09769641c --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeConstants.java.svn-base @@ -0,0 +1,72 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains all the STORK PEPS, Commons and Specific errors + * constant identifiers. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.2 $, $Date: 2010-11-17 05:15:28 $ + */ +public enum AttributeConstants { + + /** + * Represents the attribute's name index. + */ + ATTR_NAME_INDEX(0), + /** + * Represents the attribute's type index. + */ + ATTR_TYPE_INDEX(1), + /** + * Represents the attribute's value index. + */ + ATTR_VALUE_INDEX(2), + /** + * Represents the attribute's status index. + */ + ATTR_STATUS_INDEX(3), + /** + * Represents the number of allowed tuples. + */ + NUMBER_TUPLES(4); + + /** + * Represents the constant's value. + */ + private int attribute; + + /** + * Solo Constructor. + * + * @param attr The Attribute Constant value. + */ + AttributeConstants(final int attr) { + + this.attribute = attr; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public int intValue() { + + return attribute; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvider.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvider.java.svn-base new file mode 100644 index 000000000..013f4caf3 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvider.java.svn-base @@ -0,0 +1,74 @@ +package eu.stork.peps.auth.commons; + +/** + * This class is a bean used to store the information relative to the Attribute Provider. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.00 $, $Date: 2013-09-17 $ + */ +public final class AttributeProvider { + + /** + * Provider Id. + */ + private String providerId; + + /** + * Provider Name. + */ + private String providerName; + + /** + * Attribute Provider Constructor. + * + * @param pId Id of the Attribute Provider. + * @param pName Name of the Attribute Provider. + */ + public AttributeProvider(final String pId, final String pName) { + + this.providerId = pId; + this.providerName = pName; + } + + /** + * Getter for the providerId value. + * + * @return The providerId value. + */ + public String getProviderId() { + + return providerId; + } + + /** + * Setter for the providerId value. + * + * @param pId Id of the Attribute Provider. + */ + public void setProviderId(final String pId) { + + this.providerId = pId; + } + + /** + * Getter for the providerName value. + * + * @return The providerName value. + */ + public String getProviderName() { + + return providerName; + } + + /** + * Setter for the providerName value. + * + * @param name Name of the Attribute Provider. + */ + public void setProviderName(final String name) { + + this.providerName = name; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvidersMap.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvidersMap.java.svn-base new file mode 100644 index 000000000..8806ba866 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvidersMap.java.svn-base @@ -0,0 +1,94 @@ +package eu.stork.peps.auth.commons; + +import java.util.Iterator; +import java.util.LinkedHashMap; + +import org.apache.log4j.Logger; + +/** + * Implementation of the AttributeProviderMap using a LinkedHashMap. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.01 $, $Date: 2013-09-20 $ + * + * @see LinkedHashMap + */ +public class AttributeProvidersMap extends LinkedHashMap + implements IAttributeProvidersMap { + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(AttributeProvidersMap.class.getName()); + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 8949081185106296122L; + + /** + * {@inheritDoc} + */ + @Override + public IPersonalAttributeList get(AttributeSource key) { + return this.get((Object) key); + } + + /** + * {@inheritDoc} + */ + @Override + public IPersonalAttributeList remove(AttributeSource key) { + return this.remove((Object) key); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean containsKey(AttributeSource key) { + return this.containsKey((Object) key); + } + + /** + * {@inheritDoc} + */ + @Override + public Iterator keyIterator() { + return this.keySet().iterator(); + } + + public void trace() { + Iterator iterator; + Iterator iterator2; + AttributeSource source; + IPersonalAttributeList pal; + PersonalAttribute pa; + + iterator = this.keyIterator(); + LOG.trace("Start dumping of AttributeProvidersMap\n======================="); + while (iterator.hasNext()) { + source = iterator.next(); + + LOG.trace("Source details: type [" + source.getSourceType() + "], URL [" + source.getProviderURL() + "]"); + + if(source.getSourceType() == AttributeSource.SOURCE_LOCAL_APROVIDER) + LOG.trace("-> Attribute Provider: ID [" + source.getProvider().getProviderId() + "], name [" + source.getProvider().getProviderName() + "]"); + else + LOG.trace("-> Country: ID [" + source.getCountry().getCountryId() + "], name [" + source.getCountry().getCountryName() + "]"); + + pal = this.get(source); + LOG.trace("++++++++=>"); + iterator2 = pal.iterator(); + while (iterator2.hasNext()) { + pa = iterator2.next(); + + LOG.trace("-> Citizen Attribute: name [" + pa.getName() + "], name [" + pa.isRequired() + "]"); + } + LOG.trace("<=++++++++"); + + LOG.trace("-----------------------"); + } + LOG.trace("END\n======================="); + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeSource.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeSource.java.svn-base new file mode 100644 index 000000000..4b9dc33e9 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeSource.java.svn-base @@ -0,0 +1,119 @@ +package eu.stork.peps.auth.commons; + +/** + * This class is a bean used to store the information relative to the Attribute Source (either AttributeProvider or Country). + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.00 $, $Date: 2013-09-19 $ + */ +public final class AttributeSource { + public static final int SOURCE_LOCAL_APROVIDER = 1; + public static final int SOURCE_REMOTE_COUNTRY = 2; + + /** + * Provider source. + */ + private int sourceType; + + /** + * Provider URL. + */ + private String providerURL; + + /** + * The local Attribute Provider. + */ + private AttributeProvider provider; + + /** + * The remote Country. + */ + private Country country; + + /** + * Attribute Source Constructor. + * + * @param provider The local Attribute Provider. + * @param pURL URL of the Attribute Provider. + */ + public AttributeSource(final AttributeProvider provider, final String pURL) { + this.setSourceType(SOURCE_LOCAL_APROVIDER); + + this.setProvider(provider); + this.setProviderURL(pURL); + } + + /** + * Attribute Source Constructor. + * + * @param country The remote Country. + * @param pURL URL of the Country. + */ + public AttributeSource(final Country country, final String pURL) { + this.setSourceType(SOURCE_REMOTE_COUNTRY); + + this.setCountry(country); + this.setProviderURL(pURL); + } + + /** + * @param sourceType the sourceType to set + */ + public void setSourceType(int sourceType) { + this.sourceType = sourceType; + } + + /** + * @return the sourceType + */ + public int getSourceType() { + return sourceType; + } + + /** + * @param providerURL the providerURL to set + */ + public void setProviderURL(String providerURL) { + this.providerURL = providerURL; + } + + /** + * @return the providerURL + */ + public String getProviderURL() { + return providerURL; + } + + /** + * @param provider the provider to set + */ + public void setProvider(AttributeProvider provider) { + this.setSourceType(SOURCE_LOCAL_APROVIDER); + + this.provider = provider; + } + + /** + * @return the provider + */ + public AttributeProvider getProvider() { + return provider; + } + + /** + * @param country the country to set + */ + public void setCountry(Country country) { + this.setSourceType(SOURCE_REMOTE_COUNTRY); + + this.country = country; + } + + /** + * @return the country + */ + public Country getCountry() { + return country; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeUtil.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeUtil.java.svn-base new file mode 100644 index 000000000..84e3576e5 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeUtil.java.svn-base @@ -0,0 +1,231 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.commons.lang.StringUtils; + +/** + * This class holds static helper methods. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.5 $, $Date: 2010-12-15 23:19:59 $ + */ +public final class AttributeUtil { + + /** + * Private constructor. Prevents the class from being instantiated. + */ + private AttributeUtil() { + // empty constructor + } + + /** + * Safe escape any given string. + * + * @param value The HTTP Value to escaped. + * + * @return The value escaped value. + */ + public static String escape(final String value) { + + final String attrSep = PEPSValues.ATTRIBUTE_SEP.toString(); + final String attrTupleSep = PEPSValues.ATTRIBUTE_TUPLE_SEP.toString(); + final String attrValueSep = PEPSValues.ATTRIBUTE_VALUE_SEP.toString(); + + final String escAttrSep = "%" + (int) attrSep.charAt(0); + final String escAttrTupleSep = "%" + (int) attrTupleSep.charAt(0); + final String escAttrValueSep = "%" + (int) attrValueSep.charAt(0); + + return value.replace(attrSep, escAttrSep) + .replace(attrTupleSep, escAttrTupleSep) + .replace(attrValueSep, escAttrValueSep); + } + + /** + * Unescape any given string. + * + * @param value The HTTP Value to be unescaped. + * + * @return The value unescaped value. + */ + public static String unescape(final String value) { + final String attrSep = PEPSValues.ATTRIBUTE_SEP.toString(); + final String attrTupleSep = PEPSValues.ATTRIBUTE_TUPLE_SEP.toString(); + final String attrValueSep = PEPSValues.ATTRIBUTE_VALUE_SEP.toString(); + + final String escAttrSep = "%" + (int) attrSep.charAt(0); + final String escAttrTupleSep = "%" + (int) attrTupleSep.charAt(0); + final String escAttrValueSep = "%" + (int) attrValueSep.charAt(0); + + return value.replace(escAttrSep, attrSep) + .replace(escAttrTupleSep, attrTupleSep) + .replace(escAttrValueSep, attrValueSep); + } + + /** + * Appends the string representation of an object to a StringBuilder. + * + * @param strBuilder The StringBuilder to append to. + * @param val The string representation of an object. + */ + public static void appendIfNotNull(final StringBuilder strBuilder, + final Object val) { + + if (val != null) { + strBuilder.append(val); + } + } + + /** + * Given a separator and a list of strings, joins the list, as a string, + * separated by the separator string. + * + * @param list The list of strings to join. + * @param separator The separator string. + * @return the list, as a string, separated by the separator string. + */ + public static String listToString(final List list, + final String separator) { + + final StringBuilder strBuilder = new StringBuilder(); + for (final String s : list) { + if (!StringUtils.isEmpty(s)) { + strBuilder.append(AttributeUtil.escape(s) + separator); + } + } + return strBuilder.toString(); + } + + /** + * Given a separator and a map of strings to strings, joins the map, as a + * string, separated by the separator string with the pair key/value + * concatenated with a '='. + * + * @param map The map of strings to join. + * @param separator The separator string. + * + * @return the map of strings, as a string, separated by the separator string + * with the pair key/value concatenated with a '='. + */ + public static String mapToString(final Map map, + final String separator) { + + final StringBuilder strBuilder = new StringBuilder(); + final Iterator> valuesIt = map.entrySet().iterator(); + while (valuesIt.hasNext()) { + final Entry entry = valuesIt.next(); + strBuilder.append(entry.getKey()); + strBuilder.append('='); + strBuilder.append(AttributeUtil.escape(entry.getValue())); + strBuilder.append(separator); + } + return strBuilder.toString(); + } + + /** + * Validates the attribute value format. + * + * @param value The attribute value to validate. + * + * @return true if value has a valid format. + */ + public static boolean isValidValue(final String value) { + boolean retVal = false; + if (value != null && value.charAt(0) == '[' && value.endsWith("]")) { + final String tmpAttrValue = value.substring(1, value.length() - 1); + final String[] vals = + tmpAttrValue.split(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + if (tmpAttrValue.length() >= 0 + || (vals.length > 0 && vals[0].length() > 0)) { + retVal = true; + } + } + return retVal; + } + + /** + * Validates the attribute type value. It's case insensitive. E.g. return true + * value to: a) "true", "TRUE", "True", ... b) "false", "FALSE", "False", ... + * + * @param type The attribute type value. + * + * @return true if type has a true or false (case insensitive) value. + */ + public static boolean isValidType(final String type) { + return StringUtils.isNotEmpty(type) && (PEPSValues.TRUE.toString().equalsIgnoreCase(type) || PEPSValues.FALSE.toString().equalsIgnoreCase(type)) ; + } + + /** + * Validates the Personal attribute tuple. E.g. name:type:[value]:status + * + * @param tuples The Personal attribute's tuple. + * + * @return true if the tuples' format is valid. + * + * @see PEPSUtil#validateParameter(String, String, String) + * @see String#equalsIgnoreCase(String) + */ + public static boolean hasValidTuples(final String[] tuples) { + boolean retVal = false; + + int numberTuples = AttributeConstants.NUMBER_TUPLES.intValue(); + if (tuples != null && tuples.length == numberTuples) { + // validate attrName + final int attrNameIndex = AttributeConstants.ATTR_NAME_INDEX.intValue(); + final int attrTypeIndex = AttributeConstants.ATTR_TYPE_INDEX.intValue(); + final int attrValueIndex = AttributeConstants.ATTR_VALUE_INDEX.intValue(); + + retVal = + StringUtils.isNotEmpty(tuples[attrNameIndex]) + && StringUtils.isNotEmpty(tuples[attrTypeIndex]) + && StringUtils.isNotEmpty(tuples[attrValueIndex]) + && AttributeUtil.isValidType(tuples[attrTypeIndex]) + && AttributeUtil.isValidValue(tuples[attrValueIndex]); + } + return retVal; + } + + /** + * Check if all mandatory attributes have values. + * + * @param personalAttrList The Personal Attributes List. + * + * @return true if all mandatory attributes have values, false if at least one + * attribute doesn't have value. + */ + public static boolean checkMandatoryAttributes( + final IPersonalAttributeList personalAttrList) { + + final Iterator itAttributes = + personalAttrList.values().iterator(); + boolean retVal = true; + while (itAttributes.hasNext() && retVal) { + final PersonalAttribute attr = itAttributes.next(); + if (attr.isRequired() + && !STORKStatusCode.STATUS_AVAILABLE.toString() + .equals(attr.getStatus())) { + retVal = false; + } + } + return retVal; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CitizenConsent.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CitizenConsent.java.svn-base new file mode 100644 index 000000000..2245178f4 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CitizenConsent.java.svn-base @@ -0,0 +1,123 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.ArrayList; +import java.util.List; + +/** + * This class is a bean used to store the information relative to the Citizen + * Consent. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class CitizenConsent { + + /** + * Mandatory attributes list. + */ + private List mandatoryList; + + /** + * Optional attributes list. + */ + private List optionalList; + + /** + * Citizen Consent default Constructor. + */ + public CitizenConsent() { + this.mandatoryList = new ArrayList(); + this.optionalList = new ArrayList(); + } + + /** + * Getter for the mandatoryList value. + * + * @return The mandatoryList value. + */ + public List getMandatoryList() { + return this.mandatoryList; + } + + /** + * Setter for the mandatoryList value. + * + * @param mandatoryAttrList Mandatory parameters list. + */ + public void setMandatoryList(final List mandatoryAttrList) { + this.mandatoryList = mandatoryAttrList; + } + + /** + * Setter for some mandatoryAttribute. Adds the input parameter to the + * mandatoryList. + * + * @param mandatoryAttr Attribute to add to the mandatoryList. + */ + public void setMandatoryAttribute(final String mandatoryAttr) { + this.mandatoryList.add(mandatoryAttr); + } + + /** + * Getter for the optionalList value. + * + * @return The optionalList value. + */ + public List getOptionalList() { + return optionalList; + } + + /** + * Setter for the optionalList value. + * + * @param optAttrList Optional parameters list. + */ + public void setOptionalList(final List optAttrList) { + this.optionalList = optAttrList; + } + + /** + * Setter for some optionalAttr. Adds the input parameter to the optionalList. + * + * @param optionalAttr Attribute to add to the optionalList. + */ + public void setOptionalAttribute(final String optionalAttr) { + this.optionalList.add(optionalAttr); + } + + /** + * Returns a string in the following format. "Mandatory attributes: + * mandatoryAttr1;mandatoryAttr2;mandatoryAttrN Optional attributes: + * optionalAttr1;optionalAttr2;optionalAttrN" + * + * @return {@inheritDoc} + */ + public String toString() { + final StringBuilder strbldr = new StringBuilder(); + strbldr.append("Mandatory attributes: "); + for (String str : mandatoryList) { + strbldr.append(str + ";"); + } + strbldr.append(" Optional attributes: "); + for (String str : optionalList) { + strbldr.append(str + ";"); + } + return strbldr.toString(); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Country.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Country.java.svn-base new file mode 100644 index 000000000..001f9317a --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Country.java.svn-base @@ -0,0 +1,95 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; + +/** + * This class is a bean used to store the information relative to the Country. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.10 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class Country implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1135994036496370993L; + +/** + * Country Id. + */ + private String countryId; + + /** + * Country Name. + */ + private String countryName; + + /** + * Country Constructor. + * + * @param cId Id of the Country. + * @param cName Name of the Country. + */ + public Country(final String cId, final String cName) { + + this.countryId = cId; + this.countryName = cName; + } + + /** + * Getter for the countryId value. + * + * @return The countryId value. + */ + public String getCountryId() { + + return countryId; + } + + /** + * Setter for the countryId value. + * + * @param cId Id of the Country. + */ + public void setCountryId(final String cId) { + + this.countryId = cId; + } + + /** + * Getter for the countryName value. + * + * @return The countryName value. + */ + public String getCountryName() { + + return countryName; + } + + /** + * Setter for the countryName value. + * + * @param name Name of the Country. + */ + public void setCountryName(final String name) { + + this.countryName = name; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CountryCodes.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CountryCodes.java.svn-base new file mode 100644 index 000000000..54345f3ea --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CountryCodes.java.svn-base @@ -0,0 +1,79 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.Arrays; +import java.util.List; + +/** + * This class contains all the ISO 3166-1 Alpha 3 Country Codes. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.2 $, $Date: 2011-04-14 00:24:56 $ + */ +public final class CountryCodes { + + /** + * Private Constructor. + */ + private CountryCodes() { + + } + + /** + * ISO 3166-1 Alpha 3 Country Codes. + */ + private static List countrysAlpha3 = Arrays.asList("ABW", "AFG", + "AGO", "AIA", "ALA", "ALB", "AND", "ANT", "ARE", "ARG", "ARM", "ASM", + "ATA", "ATF", "ATG", "AUS", "AUT", "AZE", "BDI", "BEL", "BEN", "BES", + "BFA", "BGD", "BGR", "BHR", "BHS", "BIH", "BLM", "BLR", "BLZ", "BMU", + "BOL", "BRA", "BRB", "BRN", "BTN", "BUR", "BVT", "BWA", "BYS", "CAF", + "CAN", "CCK", "CHE", "CHL", "CHN", "CIV", "CMR", "COD", "COG", "COK", + "COL", "COM", "CPV", "CRI", "CSK", "CUB", "CUW", "CXR", "CYM", "CYP", + "CZE", "DEU", "DJI", "DMA", "DNK", "DOM", "DZA", "ECU", "EGY", "ERI", + "ESH", "ESP", "EST", "ETH", "FIN", "FJI", "FLK", "FRA", "FRO", "FSM", + "GAB", "GBR", "GEO", "GGY", "GHA", "GIB", "GIN", "GLP", "GMB", "GNB", + "GNQ", "GRC", "GRD", "GRL", "GTM", "GUF", "GUM", "GUY", "HKG", "HMD", + "HND", "HRV", "HTI", "HUN", "IDN", "IMN", "IND", "IOT", "IRL", "IRN", + "IRQ", "ISL", "ISR", "ITA", "JAM", "JEY", "JOR", "JPN", "KAZ", "KEN", + "KGZ", "KHM", "KIR", "KNA", "KOR", "KWT", "LAO", "LBN", "LBR", "LBY", + "LCA", "LIE", "LKA", "LSO", "LTU", "LUX", "LVA", "MAC", "MAF", "MAR", + "MCO", "MDA", "MDG", "MDV", "MEX", "MHL", "MKD", "MLI", "MLT", "MMR", + "MNE", "MNG", "MNP", "MOZ", "MRT", "MSR", "MTQ", "MUS", "MWI", "MYS", + "MYT", "NAM", "NCL", "NER", "NFK", "NGA", "NIC", "NIU", "NLD", "NOR", + "NPL", "NRU", "NZL", "OMN", "PAK", "PAN", "PCN", "PER", "PHL", "PLW", + "PNG", "POL", "PRI", "PRK", "PRT", "PRY", "PSE", "PYF", "QAT", "REU", + "ROM", "ROU", "RUS", "RWA", "SAU", "SCG", "SDN", "SEN", "SGP", "SGS", + "SHN", "SJM", "SLB", "SLE", "SLV", "SMR", "SOM", "SPM", "SRB", "STP", + "SUR", "SVK", "SVN", "SXW", "SWE", "SWZ", "SYC", "SYR", "TCA", "TCD", + "TGO", "THA", "TJK", "TKL", "TKM", "TLS", "TMP", "TON", "TTO", "TUN", + "TUR", "TUV", "TWN", "TZA", "UGA", "UKR", "UMI", "URY", "USA", "UZB", + "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF", "WSM", "YEM", + "YUG", "ZAF", "ZAR", "ZMB", "ZWE"); + + /** + * Searches the CountryCode (3166-1 alpha3 format) an return true if it + * exists. + * + * @param countryCode The Country code to search. + * + * @return true if the CountryCode exists, false otherwise. + */ + public static boolean hasCountryCodeAlpha3(final String countryCode) { + + return CountryCodes.countrysAlpha3.contains(countryCode); + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/DateUtil.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/DateUtil.java.svn-base new file mode 100644 index 000000000..9c0bd6775 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/DateUtil.java.svn-base @@ -0,0 +1,169 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.sql.Timestamp; +import java.util.GregorianCalendar; + +import org.apache.log4j.Logger; +import org.joda.time.DateTime; +import org.joda.time.Years; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +import eu.stork.peps.auth.commons.exceptions.SecurityPEPSException; + +/** + * This class holds static helper methods for Date Operations. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.4 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class DateUtil { + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(DateUtil.class.getName()); + + /** + * yyyy Date format size. + */ + private static final int YEAR_DATE_SIZE = 4; + + /** + * yyyyMM Date format size. + */ + private static final int MONTH_DATE_SIZE = 6; + + /** + * Private constructor. Prevents the class from being instantiated. + */ + private DateUtil() { + // empty constructor + } + + /** + * Fulfils dateValue with a valid date. The following roles are applied: a) If + * the dateValue only contains the year then fulfils with last year's day. + * e.g. this method returns 19951231 to the 1995 dateValue. b) If the + * dateValue contains the year and the month then fulfils with last month's + * day. e.g. this method returns 19950630 to the 199505 dateValue. + * + * @param dateValue The date to be fulfilled. + * + * @return The dateValue fulfilled. + */ + private static String fulfilDate(final String dateValue) { + + final StringBuffer strBuf = new StringBuffer(); + strBuf.append(dateValue); + // if the IdP just provides the year then we must fullfil the date. + if (dateValue.length() == YEAR_DATE_SIZE) { + strBuf.append(PEPSValues.LAST_MONTH.toString()); + } + // if the IdP provides the year and the month then we must fullfil the + // date. + if (dateValue.length() == MONTH_DATE_SIZE + || strBuf.length() == MONTH_DATE_SIZE) { + // IdP doesn't provide the day, so we will use DateTime to + // calculate it. + final String noDayCons = PEPSValues.NO_DAY_DATE_FORMAT.toString(); + final DateTimeFormatter fmt = DateTimeFormat.forPattern(noDayCons); + final DateTime dateTime = fmt.parseDateTime(strBuf.toString()); + // Append the last month's day. + strBuf.append(dateTime.dayOfMonth().withMaximumValue().getDayOfMonth()); + } + + return strBuf.toString(); + } + + /** + * Validates the dateValue format: a) if has a valid size; b) if has a numeric + * value; Note: dateValue must have the format yyyyMMdd. + * + * @param dateValueTmp The date to be validated. + * @param pattern The accepted date format. + * + * @return true if the date has a valid format. + */ + public static boolean isValidFormatDate(final String dateValueTmp, + final String pattern) { + + boolean retVal = true; + try { + final String dateValue = DateUtil.fulfilDate(dateValueTmp); + + final DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern); + fmt.parseDateTime(dateValue); + } catch (final Exception e) { + // We catch Exception because we only have to return false + // value! + retVal = false; + } + return retVal; + } + + /** + * Calculates the age for a given date string. + * + * @param dateVal The date to be validated. + * @param now The current date. + * @param pattern The date pattern. + * + * @return The age value. + */ + public static int calculateAge(final String dateVal, final DateTime now, + final String pattern) { + + if (DateUtil.isValidFormatDate(dateVal, pattern)) { + try { + final String dateValueTemp = DateUtil.fulfilDate(dateVal); + final DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern); + final DateTime dateTime = fmt.parseDateTime(dateValueTemp); + // Calculating age + final Years age = Years.yearsBetween(dateTime, now); + + return age.getYears(); + } catch (final IllegalArgumentException e) { + LOG.warn("Invalid date format (" + pattern + + ") or an invalid dateValue."); + throw new SecurityPEPSException( + PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorCode()), + PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorMessage()), + e); + } + } else { + LOG.warn("Couldn't calculate Age, invalid date!"); + throw new SecurityPEPSException( + PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorCode()), + PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorMessage())); + } + + } + + /** + * Generates the current timestamp. + * + * @return timestamp The current timestamp + */ + public static Timestamp currentTimeStamp() { + final GregorianCalendar cal = new GregorianCalendar(); + final long millis = cal.getTimeInMillis(); + return new Timestamp(millis); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IAttributeProvidersMap.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IAttributeProvidersMap.java.svn-base new file mode 100644 index 000000000..733399ca3 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IAttributeProvidersMap.java.svn-base @@ -0,0 +1,82 @@ +package eu.stork.peps.auth.commons; + +import java.util.Iterator; + +/** + * Interface for Attributes Providers map. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.00 $, $Date: 2013-09-20 $ + */ +public interface IAttributeProvidersMap { + + /** + * Returns the object associated the the given key. + * + * @param key with which the specified value is to be associated. + * + * @return The object associated the the given key. + */ + IPersonalAttributeList get(AttributeSource key); + + /** + * Associates a key to a value, and inserts them in the session object. + * + * @param key with which the specified value is to be associated. + * @param value to be associated with the specified key. + * + * @return previous value associated with specified key, or null if there was + * no mapping for key. A null return can also indicate that the map + * previously associated null with the specified key. + */ + Object put(AttributeSource key, IPersonalAttributeList value); + + /** + * Removes the mapping for this key. + * + * @param key with which the specified value is to be associated. + * + * @return previous value associated with specified key, or null if there was + * no mapping for key. A null return can also indicate that the map + * previously associated null with the specified key. + */ + IPersonalAttributeList remove(AttributeSource key); + + /** + * Returns the number of key-value mappings in this map. + * + * @return the number of key-value mappings in this map. + */ + int size(); + + /** + * Returns true if this map contains a mapping for the specified key. + * + * @param key with which the specified value is to be associated. + * + * @return true if this map contains a mapping for the specified key. + */ + boolean containsKey(AttributeSource key); + + /** + * Removes all mappings from this map. + */ + void clear(); + + /** + * Returns true if this map contains no key-value mappings. + * + * @return true if this map contains no key-value mappings. + */ + boolean isEmpty(); + + /** + * Returns an Iterator of the keys contained in this map. The implementation must + * take care in order for the Iterator to have predictable order of the returned + * keys. + * + * @return an iterator of the keys contained in this map + */ + Iterator keyIterator(); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IPersonalAttributeList.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IPersonalAttributeList.java.svn-base new file mode 100644 index 000000000..83b8e57fe --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IPersonalAttributeList.java.svn-base @@ -0,0 +1,140 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.Collection; +import java.util.Iterator; + +/** + * Interface for {@link PersonalAttributeList}. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.16 $, $Date: 2010-11-17 05:15:28 $ + * + * @see PersonalAttribute + */ +@SuppressWarnings("PMD.CloneMethodMustImplementCloneable") +public interface IPersonalAttributeList extends Iterable, + Cloneable { + + /** + * Associates the specified value with the specified key in this Personal + * Attribute List. + * + * @param key with which the specified value is to be associated. + * @param value to be associated with the specified key. + * + * @return the previous value associated with key, or null if there was no + * mapping for key. + * + * @see PersonalAttribute + */ + PersonalAttribute put(String key, PersonalAttribute value); + + /** + * Returns the value to which the specified key is mapped, or null if this map + * contains no mapping for the key. + * + * @param key whose associated value is to be returned. + * + * @return The value to which the specified key is mapped, or null if this map + * contains no mapping for the key. + * + * @see PersonalAttribute + */ + PersonalAttribute get(Object key); + + /** + * Adds to the PersonalAttributeList the given PersonalAttribute. It sets the + * attribute name as the key to the attribute value. + * + * @param value PersonalAttribute to add to the PersonalAttributeList + */ + void add(PersonalAttribute value); + + /** + * Get the size of the Personal Attribute List. + * + * @return size of the Personal Attribute List. + */ + int size(); + + /** + * Checks if the Personal Attribute List contains the given key. + * + * @param key with which the specified value is to be associated. + * + * @return true if the Personal Attribute List contains the given key, false + * otherwise. + */ + boolean containsKey(Object key); + + /** + * Getter for the iterator of the Personal Attribute List values. + * + * @return The iterator for the Personal Attribute List values. + * + * @see PersonalAttribute + */ + Iterator iterator(); + + /** + * Creates a Personal Attribute List from a String representing an Attribute + * List. + * + * @param attrList String Object representing the attribute list. + */ + void populate(String attrList); + + /** + * Removes the mapping for this key from this map if present. + * + * @param key key whose mapping is to be removed from the map. + * @return previous value associated with specified key, or null if + * there was no mapping for key. A null return can also + * indicate that the map previously associated null with the + * specified key. + */ + PersonalAttribute remove(Object key); + + /** + * Returns a collection view of the values contained in this map. The + * collection is backed by the map, so changes to the map are reflected in the + * collection, and vice-versa. The collection supports element removal, which + * removes the corresponding mapping from this map, via the + * Iterator.remove, Collection.remove, removeAll, + * retainAll, and clear operations. It does not support the + * add or addAll operations. + * + * @return a collection view of the values contained in this map. + */ + Collection values(); + + /** + * Returns true if this map contains no key-value mappings. + * + * @return true if this map contains no key-value mappings. + */ + boolean isEmpty(); + + /** + * Returns a copy of this IPersonalAttributeList instance. + * + * @return The copy of this IPersonalAttributeList. + */ + Object clone() throws CloneNotSupportedException; + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkLogger.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkLogger.java.svn-base new file mode 100644 index 000000000..33eb618f0 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkLogger.java.svn-base @@ -0,0 +1,239 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * Interface for stork logging. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.10 $, $Date: 2011-02-17 22:44:34 $ + */ +public interface IStorkLogger { + + /** + * Getter for SpApplication. + * + * @return The SpApplication value. + */ + String getSpApplication(); + + /** + * Setter for SpApplication. + * + * @param spApplication The SP Application. + */ + void setSpApplication(String spApplication); + + /** + * Getter for ProviderName. + * + * @return The ProviderName value. + */ + String getProviderName(); + + /** + * Setter for ProviderName. + * + * @param providerName The provider name. + */ + void setProviderName(String providerName); + + /** + * + * Getter for Origin. + * + * @return The Origin value. + * + */ + String getOrigin(); + + /** + * Setter for Origin. + * + * @param origin The origin. + */ + void setOrigin(String origin); + + /** + * + * Getter for QAA Level. + * + * @return The QAA Level value. + * + */ + int getQaaLevel(); + + /** + * Setter for QAA Level. + * + * @param qaaLevel The qaa level. + */ + void setQaaLevel(int qaaLevel); + + /** + * + * Getter for timestamp. + * + * @return The timestamp value. + * + */ + String getTimestamp(); + + /** + * Setter for timestamp. + * + * @param timestamp The request's timestamp. + */ + void setTimestamp(String timestamp); + + /** + * Getter for InResponseTo. + * + * @return The InResponseTo value. + */ + String getInResponseTo(); + + /** + * Setter for InResponseTo. + * + * @param inResponseTo The Saml's response id. + */ + void setInResponseTo(String inResponseTo); + + /** + * Getter for InResponseToSPReq. + * + * @return The InResponseToSPReq value. + */ + String getInResponseToSPReq(); + + /** + * Setter for InResponseToSPRequ. + * + * @param inResponseToSPReq The Saml's response id. + */ + void setInResponseToSPReq(String inResponseToSPReq); + + /** + * Getter for opType. + * + * @return The opType value. + */ + String getOpType(); + + /** + * Setter for opType. + * + * @param opType The operation type. + */ + void setOpType(String opType); + + /** + * Getter for destination. + * + * @return The destination value. + */ + String getDestination(); + + /** + * Setter for destinationIp. + * + * @param destination The remote IP. + */ + void setDestination(String destination); + + /** + * Getter for message or assertion consumer. + * + * @return The message or assertion consumer. + */ + String getMessage(); + + /** + * Setter for message or assertion consumer. + * + * @param message or assertion consumer. + */ + void setMessage(String message); + + /** + * Getter for country. + * + * @return The country value. + */ + String getCountry(); + + /** + * Setter for country. + * + * @param country The country. + */ + void setCountry(String country); + + /** + * Getter for samlHash. + * + * @return The samlHash value. + */ + byte[] getSamlHash(); + + /** + * Setter for samlHash. + * + * @param samlHash the encrypted SAML token + */ + void setSamlHash(byte[] samlHash); + + /** + * Getter for msgId. + * + * @return the msgId + */ + String getMsgId(); + + /** + * Setter for msgId. + * + * @param msgId the ID of the originator of this message + */ + void setMsgId(String msgId); + + /** + * Getter for sPMsgId. + * + * @return the sPMsgId + */ + String getSPMsgId(); + + /** + * Setter for sPMsgId. + * + * @param sPMsgId the ID of the originator of this message + */ + void setSPMsgId(String sPMsgId); + + /** + * The format of the returned String must be the following: + * "requestCounter#ddMMMyyyykk:mm:ss#opType#originIp#originName + * #destinationIp#destinationName#samlHash#[originatorName#msgId#]" + * + * The values enclosed in '[]' only apply when logging responses. + * + * @return {@inheritDoc} + */ + @Override + String toString(); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkSession.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkSession.java.svn-base new file mode 100644 index 000000000..f38b41838 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkSession.java.svn-base @@ -0,0 +1,85 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * Interface for stork session. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.9 $, $Date: 2010-11-17 05:15:28 $ + */ +public interface IStorkSession { + + /** + * Returns the object associated the the given key. + * + * @param key with which the specified value is to be associated. + * + * @return The object associated the the given key. + */ + Object get(Object key); + + /** + * Associates a key to a value, and inserts them in the session object. + * + * @param key with which the specified value is to be associated. + * @param value to be associated with the specified key. + * + * @return previous value associated with specified key, or null if there was + * no mapping for key. A null return can also indicate that the map + * previously associated null with the specified key. + */ + Object put(String key, Object value); + + /** + * Removes the mapping for this key. + * + * @param key with which the specified value is to be associated. + * + * @return previous value associated with specified key, or null if there was + * no mapping for key. A null return can also indicate that the map + * previously associated null with the specified key. + */ + Object remove(Object key); + + /** + * Returns the number of key-value mappings in this map. + * + * @return the number of key-value mappings in this map. + */ + int size(); + + /** + * Returns true if this map contains a mapping for the specified key. + * + * @param key with which the specified value is to be associated. + * + * @return true if this map contains a mapping for the specified key. + */ + boolean containsKey(Object key); + + /** + * Removes all mappings from this map. + */ + void clear(); + + /** + * Returns true if this map contains no key-value mappings. + * + * @return true if this map contains no key-value mappings. + */ + boolean isEmpty(); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Linker.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Linker.java.svn-base new file mode 100644 index 000000000..43d3adaa9 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Linker.java.svn-base @@ -0,0 +1,173 @@ +package eu.stork.peps.auth.commons; + +import java.util.Iterator; + +/** + * This class is a bean used to store the information of Attribute Providers, the Attribute + * List to be requested, the Assertions returned by the Attribute Providers and the values + * that each Attribute has. This information along with the current status of the Linker (the + * attribute providers that were queried and the remaining providers) is used by the PEPS + * actions in order to complete the Attribute gathering. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.20 $, $Date: 2013-10-28 $ + */ +public final class Linker { + /** + * Attributes Providers map. + */ + private IAttributeProvidersMap attributeProvidersMap; + + /** + * The current index of local (domestic) Attribute Providers. + */ + private int localIndex; + + /** + * The current index of remote (foreign) Attribute Providers - countries. + */ + private int remoteIndex; + + /** + * Constructs an empty Linker object. + */ + public Linker() { + localIndex = 0; + remoteIndex = 0; + } + + /** + * Based on the internal state of the Linker it returns the next local Attribute Source + * + * @return The next Attribute Source or null if not found + * + * @see AttributeSource + */ + public AttributeSource getNextLocalProvider() { + Iterator iterator; + AttributeSource source, found; + int curIndex = 0; + + found = null; + + if ( attributeProvidersMap!=null && !attributeProvidersMap.isEmpty() ) { + iterator = attributeProvidersMap.keyIterator(); + while (iterator.hasNext()) { + source = iterator.next(); + + if ( source.getSourceType()==AttributeSource.SOURCE_LOCAL_APROVIDER ) { + if ( curIndex>=localIndex ) { + found = source; + + break; + } + + curIndex++; + } + } + } + + return found; + } + + /** + * Based on the internal state of the Linker it returns the next remote Attribute Source + * + * @return The next Attribute Source or null if not found + * + * @see AttributeSource + */ + public AttributeSource getNextRemoteProvider() { + Iterator iterator; + AttributeSource source, found; + int curIndex = 0; + + found = null; + + if ( attributeProvidersMap !=null && !attributeProvidersMap.isEmpty() ) { + iterator = attributeProvidersMap.keyIterator(); + while (iterator.hasNext()) { + source = iterator.next(); + + if ( source.getSourceType()==AttributeSource.SOURCE_REMOTE_COUNTRY ) { + if ( curIndex>=remoteIndex ) { + found = source; + + break; + } + + curIndex++; + } + } + } + + return found; + } + + /** + * It updates the Linker with the values returned by the Attribute Source. It also advances + * to the next index in order to mark this attribute source as completed. + * + * @param source The Attribute Source that was queried for attribute values. + * @param attrResponse The attrResponse returned by the Attribute Source that contains the attribute values. + * + * @see AttributeSource, STORKAttrQueryResponse + */ + public void setProviderReponse(AttributeSource source, STORKAttrQueryResponse attrResponse) { + if ( source.getSourceType()==AttributeSource.SOURCE_REMOTE_COUNTRY ) + remoteIndex++; + else + localIndex++; + + //TODO How to store Assertions (format: byte, base64 string, entire object?) + + this.attributeProvidersMap.put(source, attrResponse.getPersonalAttributeList()); + } + + /** + * Reset the internal state of the local Attribute Source in order to start over. + */ + public void resetLocalIndex() { + localIndex = 0; + } + + /** + * Reset the internal state of the remote Attribute Source in order to start over. + */ + public void resetRemoteIndex() { + remoteIndex = 0; + } + + /** + * Setter for attributeProvidersMap. + * + * @param attributeProvidersMap The attributeProvidersMap to set. + */ + public void setAttributeProvidersMap(IAttributeProvidersMap attributeProvidersMap) { + this.attributeProvidersMap = attributeProvidersMap; + } + + /** + * Getter for attributeProvidersMap. + * + * @return attributeProvidersMap + */ + public IAttributeProvidersMap getAttributeProvidersMap() { + return attributeProvidersMap; + } + + /** + * Returns the Personal Attribute list of the provided Attribute Source. + * + * @return The IPersonalAttributeList assosiated with this source or null if empty + * + * @see IPersonalAttributeList + */ + public IPersonalAttributeList getProviderAttributes(AttributeSource source) { + if ( attributeProvidersMap.containsKey(source) ) + return attributeProvidersMap.get(source); + else + return null; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSErrors.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSErrors.java.svn-base new file mode 100644 index 000000000..3aa549a06 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSErrors.java.svn-base @@ -0,0 +1,348 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains all the STORK PEPS, Commons and Specific errors + * constant identifiers. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.10 $, $Date: 2011-02-17 22:44:34 $ + */ +public enum PEPSErrors { + + /** + * Represents the 'authenticationFailed' constant error identifier. + */ + AUTHENTICATION_FAILED_ERROR("authenticationFailed"), + /** + * Represents the 'spCountrySelector.errorCreatingSAML' constant error + * identifier. + */ + SP_COUNTRY_SELECTOR_ERROR_CREATE_SAML("spCountrySelector.errorCreatingSAML"), + /** + * Represents the 'spCountrySelector.destNull' constant error identifier. + */ + SP_COUNTRY_SELECTOR_DESTNULL("spCountrySelector.destNull"), + /** + * Represents the 'spCountrySelector.invalidAttr' constant error identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_ATTR("spCountrySelector.invalidAttr"), + /** + * Represents the 'spCountrySelector.invalidProviderName' constant error + * identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_PROVIDER_NAME( + "spCountrySelector.invalidProviderName"), + /** + * Represents the 'spCountrySelector.invalidQaaSPid' constant error + * identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_QAASPID("spCountrySelector.invalidQaaSPid"), + /** + * Represents the 'spCountrySelector.invalidSpId' constant error identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_SPID("spCountrySelector.invalidSpId"), + /** + * Represents the 'spCountrySelector.invalidSPQAA' constant error identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_SPQAA("spCountrySelector.invalidSPQAA"), + /** + * Represents the 'spCountrySelector.invalidSpURL' constant error identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_SPURL("spCountrySelector.invalidSpURL"), + /** + * Represents the 'spCountrySelector.spNotAllowed' constant error identifier. + */ + SP_COUNTRY_SELECTOR_SPNOTALLOWED("spCountrySelector.spNotAllowed"), + + /** + * Represents the 'sProviderAction.errorCreatingSAML' constant error + * identifier. + */ + SPROVIDER_SELECTOR_ERROR_CREATE_SAML("sProviderAction.errorCreatingSAML"), + /** + * Represents the 'sProviderAction.attr' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_ATTR("sProviderAction.invalidAttr"), + /** + * Represents the 'sProviderAction.country' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_COUNTRY("sProviderAction.invalidCountry"), + /** + * Represents the 'sProviderAction.relayState' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_RELAY_STATE("sProviderAction.invalidRelayState"), + /** + * Represents the 'sProviderAction.saml' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SAML("sProviderAction.invalidSaml"), + /** + * Represents the 'sProviderAction.spAlias' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPALIAS("sProviderAction.invalidSPAlias"), + /** + * Represents the 'sProviderAction.spDomain' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPDOMAIN("sProviderAction.invalidSPDomain"), + /** + * Represents the 'sProviderAction.spId' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPID("sProviderAction.invalidSPId"), + /** + * Represents the 'sProviderAction.spQAA' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPQAA("sProviderAction.invalidSPQAA"), + /** + * Represents the 'sProviderAction.spQAAId' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPQAAID("sProviderAction.invalidSPQAAId"), + /** + * Represents the 'sProviderAction.spRedirect' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPREDIRECT("sProviderAction.invalidSPRedirect"), + /** + * Represents the 'sProviderAction.invalidSPProviderName' constant error + * identifier. + */ + SPROVIDER_SELECTOR_INVALID_SP_PROVIDERNAME( + "sProviderAction.invalidSPProviderName"), + /** + * Represents the 'sProviderAction.spNotAllowed' constant error identifier. + */ + SPROVIDER_SELECTOR_SPNOTALLOWED("sProviderAction.spNotAllowed"), + + + /** + * Represents the 'internalError' constant error identifier. + */ + INTERNAL_ERROR("internalError"), + + /** + * Represents the 'colleagueRequest.attrNull' constant error identifier. + */ + COLLEAGUE_REQ_ATTR_NULL("colleagueRequest.attrNull"), + /** + * Represents the 'colleagueRequest.errorCreatingSAML' constant error + * identifier. + */ + COLLEAGUE_REQ_ERROR_CREATE_SAML("colleagueRequest.errorCreatingSAML"), + /** + * Represents the 'colleagueRequest.invalidCountryCode' constant error + * identifier. + */ + COLLEAGUE_REQ_INVALID_COUNTRYCODE("colleagueRequest.invalidCountryCode"), + /** + * Represents the 'colleagueRequest.invalidDestUrl' constant error identifier. + */ + COLLEAGUE_REQ_INVALID_DEST_URL("colleagueRequest.invalidDestUrl"), + /** + * Represents the 'colleagueRequest.invalidQaa' constant error identifier. + */ + COLLEAGUE_REQ_INVALID_QAA("colleagueRequest.invalidQaa"), + /** + * Represents the 'colleagueRequest.invalidRedirect' constant error + * identifier. + */ + COLLEAGUE_REQ_INVALID_REDIRECT("colleagueRequest.invalidRedirect"), + /** + * Represents the 'colleagueRequest.invalidSAML' constant error identifier. + */ + COLLEAGUE_REQ_INVALID_SAML("colleagueRequest.invalidSAML"), + + + /** + * Represents the 'cpepsRedirectUrl' constant error identifier. + */ + CPEPS_REDIRECT_URL("cpepsRedirectUrl"), + /** + * Represents the 'spepsRedirectUrl' constant error identifier. + */ + SPEPS_REDIRECT_URL("spepsRedirectUrl"), + /** + * Represents the 'sProviderAction.invCountry' constant error identifier. + */ + SP_ACTION_INV_COUNTRY("sProviderAction.invCountry"), + + /** + * Represents the 'providernameAlias.invalid' constant error identifier. + */ + PROVIDER_ALIAS_INVALID("providernameAlias.invalid"), + + + /** + * Represents the 'cPeps.attrNull' constant error identifier. + */ + CPEPS_ATTR_NULL("cPeps.attrNull"), + + /** + * Represents the 'colleagueResponse.invalidSAML' constant error identifier. + */ + COLLEAGUE_RESP_INVALID_SAML("colleagueResponse.invalidSAML"), + + /** + * Represents the 'citizenNoConsent.mandatory' constant error identifier. + */ + CITIZEN_NO_CONSENT_MANDATORY("citizenNoConsent.mandatory"), + /** + * Represents the 'citizenResponse.mandatory' constant error identifier. + */ + CITIZEN_RESPONSE_MANDATORY("citizenResponse.mandatory"), + /** + * Represents the 'attVerification.mandatory' constant error identifier. + */ + ATT_VERIFICATION_MANDATORY("attVerification.mandatory"), + /** + * Represents the 'attrValue.verification' constant error identifier. + */ + ATTR_VALUE_VERIFICATION("attrValue.verification"), + + /** + * Represents the 'audienceRestrictionError' constant error identifier. + */ + AUDIENCE_RESTRICTION("audienceRestrictionError"), + /** + * Represents the 'auRequestIdError' constant error identifier. + */ + AU_REQUEST_ID("auRequestIdError"), + /** + * Represents the 'domain' constant error identifier. + */ + DOMAIN("domain"), + /** + * Represents the 'hash.error' constant error identifier. + */ + HASH_ERROR("hash.error"), + /** + * Represents the 'invalidAttributeList' constant error identifier. + */ + INVALID_ATTRIBUTE_LIST("invalidAttributeList"), + /** + * Represents the 'invalidAttributeValue' constant error identifier. + */ + INVALID_ATTRIBUTE_VALUE("invalidAttributeValue"), + /** + * Represents the 'qaaLevel' constant error identifier. + */ + QAALEVEL("qaaLevel"), + /** + * Represents the 'requests' constant error identifier. + */ + REQUESTS("requests"), + /** + * Represents the 'SPSAMLRequest' constant error identifier. + */ + SP_SAML_REQUEST("SPSAMLRequest"), + /** + * Represents the 'spepsSAMLRequest' constant error identifier. + */ + SPEPS_SAML_REQUEST("spepsSAMLRequest"), + /** + * Represents the 'IdPSAMLResponse' constant error identifier. + */ + IDP_SAML_RESPONSE("IdPSAMLResponse"), + /** + * Represents the 'cpepsSAMLResponse' constant error identifier. + */ + CPEPS_SAML_RESPONSE("cpepsSAMLResponse"), + /** + * Represents the 'cpepsSAMLResponse' constant error identifier. + */ + SPEPS_SAML_RESPONSE("spepsSAMLResponse"), + /** + * Represents the 'session' constant error identifier. + */ + SESSION("session"), + /** + * Represents the 'invalid.session' constant error identifier. + */ + INVALID_SESSION("invalid.session"), + /** + * Represents the 'invalid.sessionId' constant error identifier. + */ + INVALID_SESSION_ID("invalid.sessionId"), + /** + * Represents the 'missing.sessionId' constant error identifier. + */ + MISSING_SESSION_ID("sessionError"), + /** + * Represents the 'AtPSAMLResponse' constant error identifier. + */ + ATP_SAML_RESPONSE("AtPSAMLResponse"); + + /** + * Represents the constant's value. + */ + private String error; + + /** + * Solo Constructor. + * + * @param nError The Constant error value. + */ + PEPSErrors(final String nError) { + this.error = nError; + } + + /** + * Construct the errorCode Constant value. + * + * @return The errorCode Constant. + */ + public String errorCode() { + return error + ".code"; + } + + /** + * Construct the errorCode Constant value with the given code text. + * + * @param text the code text to append to the constant. + * + * @return The errorCode Constant for the given code text. + */ + public String errorCode(final String text) { + return error + "." + text + ".code"; + } + + /** + * Construct the errorMessage constant value. + * + * @return The errorMessage constant. + */ + public String errorMessage() { + return error + ".message"; + } + + /** + * Construct the errorMessage Constant value with the given message text. + * + * @param text the message text to append to the constant. + * + * @return The errorMessage Constant for the given text. + */ + public String errorMessage(final String text) { + return error + "." + text + ".message"; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + return error; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSParameters.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSParameters.java.svn-base new file mode 100644 index 000000000..37b204351 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSParameters.java.svn-base @@ -0,0 +1,511 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains all the STORK PEPS, Commons and Specific Parameters. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.13 $, $Date: 2011-07-07 20:48:45 $ + */ +public enum PEPSParameters { + + /** + * Represents the 'apId' parameter constant. + */ + AP_ID("apId"), + /** + * Represents the 'apUrl' parameter constant. + */ + AP_URL("apUrl"), + /** + * Represents the 'ap.number' parameter constant. + */ + AP_NUMBER("ap.number"), + + /** + * Represents the 'assertionConsumerServiceURL' parameter constant. + */ + ASSERTION_CONSUMER_S_URL("assertionConsumerServiceURL"), + + /** + * Represents the 'auth' parameter constant. + */ + AUTHENTICATION("auth"), + + /** + * Represents the 'auth-on-behalf-of' parameter constant. + */ + AUTHENTICATION_ON_BEHALF_OF("auth-on-behalf-of"), + + /** + * Represents the 'attr' parameter constant. + */ + ATTRIBUTE("attr"), + /** + * Represents the 'attrName' parameter constant. + */ + ATTRIBUTE_NAME("attrName"), + /** + * Represents the 'attrStatus' parameter constant. + */ + ATTRIBUTE_STATUS("attrStatus"), + /** + * Represents the 'attrType' parameter constant. + */ + ATTRIBUTE_TYPE("attrType"), + /** + * Represents the 'attrValue' parameter constant. + */ + ATTRIBUTE_VALUE("attrValue"), + /** + * Represents the 'attrList' parameter constant. + */ + ATTRIBUTE_LIST("attrList"), + /** + * Represents the 'attrTuple' parameter constant. + */ + ATTRIBUTE_TUPLE("attrTuple"), + /** + * Represents the 'attribute-missing' parameter constant. + */ + ATTRIBUTE_MISSING("attribute-missing"), + /** + * Represents the 'attributesNotAllowed' parameter constant. + */ + ATTRIBUTES_NOT_ALLOWED("attributesNotAllowed"), + /** + * Represents the 'authnRequest' parameter constant. + */ + AUTH_REQUEST("authnRequest"), + + /** + * Represents the 'attrValue.number' parameter constant. + */ + ATTR_VALUE_NUMBER("attrValue.number"), + + /** + * Represents the 'derivation.date.format' parameter constant. + */ + DERIVATION_DATE_FORMAT("derivation.date.format"), + /** + * Represents the 'deriveAttr.number' parameter constant. + */ + DERIVE_ATTRIBUTE_NUMBER("deriveAttr.number"), + + /** + * Represents the complex attributes parameter constant. + */ + COMPLEX_ADDRESS_VALUE("canonicalResidenceAddress"), + COMPLEX_NEWATTRIBUTE_VALUE("newAttribute2"), + COMPLEX_HASDEGREE_VALUE("hasDegree"), + COMPLEX_MANDATECONTENT_VALUE("mandateContent"), + /** + * Represents the 'consent-type' parameter constant. + */ + CONSENT_TYPE("consent-type"), + /** + * Represents the 'consent-value' parameter constant. + */ + CONSENT_VALUE("consent-value"), + /** + * Represents the 'country' parameter constant. + */ + COUNTRY("country"), + /** + * Represents the 'countryOrigin' parameter constant. + */ + COUNTRY_ORIGIN("countryOrigin"), + + /** + * Represents the 'cpepsURL' parameter constant. + */ + CPEPS_URL("cpepsURL"), + /** + * Represents the 'callback' parameter constant. + */ + CPEPS_CALLBACK("callback"), + /** + * Represents the 'peps.specificidpredirect.url' parameter constant. + */ + CPEPS_IDP_CALLBACK_VALUE("peps.specificidpredirect.url"), + /** + * Represents the 'peps.specificapredirect.url' parameter constant. + */ + CPEPS_AP_CALLBACK_VALUE("peps.specificapredirect.url"), + + /** + * Represents the 'errorCode' parameter constant. + */ + ERROR_CODE("errorCode"), + /** + * Represents the 'subCode' parameter constant. + */ + ERROR_SUBCODE("subCode"), + /** + * Represents the 'errorMessage' parameter constant. + */ + ERROR_MESSAGE("errorMessage"), + /** + * Represents the 'errorRedirectUrl' parameter constant. + */ + ERROR_REDIRECT_URL("errorRedirectUrl"), + + /** + * errorRedirectUrl Represents the 'external-authentication' parameter + * constant. + */ + EXTERNAL_AUTH("external-authentication"), + /** + * Represents the 'external-ap' parameter constant. + */ + EXTERNAL_AP("external-ap"), + /** + * Represents the 'external-sig-module' parameter constant. + */ + EXT_SIG_CREATOR_MOD("external-sig-module"), + + /** + * Represents the 'http-x-forwarded-for' parameter constant. + */ + HTTP_X_FORWARDED_FOR("http-x-forwarded-for"), + + /** + * Represents the 'idp.url' parameter constant. + */ + IDP_URL("idp.url"), + /** + * Represents the 'idpAUB.url' parameter constant. + */ + IDPAUB_URL("idpAUB.url"), + /** + * Represents the 'internal-authentication' parameter constant. + */ + INTERNAL_AUTH("internal-authentication"), + /** + * Represents the 'internal-ap' parameter constant. + */ + INTERNAL_AP("internal-ap"), + + /** + * Represents the 'samlIssuer' parameter constant. + */ + ISSUER("samlIssuer"), + /** + * Represents the 'samlIssuer.idp' parameter constant. + */ + ISSUER_IDP("samlIssuer.idp"), + /** + * Represents the 'samlIssuer.atp' parameter constant. + */ + ISSUER_ATP("samlIssuer.atp"), + + /** + * Represents the 'mandatory' parameter constant. + */ + MANDATORY("mandatory"), + /** + * Represents the 'mandatoryAttributeMissing' parameter constant. + */ + MANDATORY_ATTR_MISSING("mandatoryAttributeMissing"), + /** + * Represents the 'mandatoryConsentAttrMissing' parameter constant. + */ + MANDATORY_CONSENT_MISSING("mandatoryConsentAttrMissing"), + /** + * Represents the 'optional' parameter constant. + */ + OPTIONAL("optional"), + + /** + * Represents the 'no-consent-type' parameter constant. + */ + NO_CONSENT_TYPE("no-consent-type"), + /** + * Represents the 'no-consent-value' parameter constant. + */ + NO_CONSENT_VALUE("no-consent-value"), + + /** + * Represents the 'provider.name' parameter constant. + */ + PROVIDER_NAME_VALUE("providerName"), + /** + * Represents the 'cpeps.askconsent' parameter constant. + */ + PEPS_ASK_CONSENT("cpeps.askconsent"), + /** + * Represents the 'cpeps.askconsentvalue' parameter constant. + */ + PEPS_ASK_CONSENT_VALUE("cpeps.askconsentvalue"), + /** + * Represents the 'pepsAuth' parameter constant. + */ + PEPS_AUTH_CONSENT("pepsAuth"), + /** + * Represents the 'validation.bypass' parameter constant. + */ + PEPS_BYPASS("validation.bypass"), + /** + * Represents the 'cpeps.number' parameter constant. + */ + PEPS_NUMBER("cpeps.number"), + /** + * Represents the 'cpeps.specificapredirect.url' parameter constant. + */ + PEPS_SPECIFIC_URL("cpeps.specificapredirect.url"), + + /** + * Represents the 'qaaLevel' parameter constant. + */ + QAALEVEL("qaaLevel"), + + /** + * Represents the 'speps.redirectUrl' parameter constant. + */ + SPEPS_REDIRECT_URL("speps.redirectUrl"), + + /** + * Represents the 'sp.redirectUrl' parameter constant. + */ + SP_REDIRECT_URL("sp.redirectUrl"), + /** + * Represents the 'cpeps.redirectUrl' parameter constant. + */ + CPEPS_REDIRECT_URL("cpeps.redirectUrl"), + /** + * Represents the 'RelayState' parameter constant. + */ + RELAY_STATE("RelayState"), + /** + * Represents the 'remoteAddr' parameter constant. + */ + REMOTE_ADDR("remoteAddr"), + /** + * Represents the 'remoteUser' parameter constant. + */ + REMOTE_USER("remoteUser"), + + /** + * Represents the 'SAMLRequest' parameter constant. + */ + SAML_REQUEST("SAMLRequest"), + /** + * Represents the 'SAMLResponse' parameter constant. + */ + SAML_RESPONSE("SAMLResponse"), + /** + * Represents the 'SAMLFail' parameter constant. + */ + SAML_TOKEN_FAIL("SAMLFail"), + /** + * Represents the 'TokenId' parameter constant. + */ + SAML_TOKEN_ID("TokenId"), + /** + * Represents the 'inResponseTo' parameter constant. + */ + SAML_IN_RESPONSE_TO("inResponseTo"), + /** + * Represents the 'inResponseTo.idp' parameter constant. + */ + SAML_IN_RESPONSE_TO_IDP("inResponseTo.idp"), + /** + * Represents the 'inResponseTo.atp' parameter constant. + */ + SAML_IN_RESPONSE_TO_ATP("inResponseTo.atp"), + /** + * Represents the 'SignatureResponse' parameter constant. + */ + SIGNATURE_RESPONSE("SignatureResponse"), + + /** + * Represents the 'cPepsSession' parameter constant. + */ + SESSION_ID_URL("cPepsSession"), + /** + * Represents the 'spId' parameter constant. + */ + SP_ID("spId"), + /** + * Represents the 'spQaaLevel' parameter constant. + */ + SP_QAALEVEL("spQaaLevel"), + /** + * Represents the 'spUrl' parameter constant. + */ + SP_URL("spUrl"), + + /** + * Represents the 'allow.derivation.all' parameter constant. + */ + SPECIFIC_ALLOW_DERIVATION_ALL("allow.derivation.all"), + /** + * Represents the ''allow.unknowns parameter constant. + */ + SPECIFIC_ALLOW_UNKNOWNS("allow.unknowns"), + /** + * Represents the 'derivation.date.separator' parameter constant. + */ + SPECIFIC_DERIVATION_DATE_SEP("derivation.date.separator"), + /** + * Represents the 'derivation.month.position' parameter constant. + */ + SPECIFIC_DERIVATION_MONTH_POS("derivation.month.position"), + /** + * Represents the 'derivation.day.position' parameter constant. + */ + SPECIFIC_DERIVATION_DAY_POS("derivation.day.position"), + /** + * Represents the 'derivation.year.position' parameter constant. + */ + SPECIFIC_DERIVATION_YEAR_POS("derivation.year.position"), + + /** + * sp.authorized.parameters Represents the '' parameter constant. + */ + SPEPS_AUTHORIZED("sp.authorized.parameters"), + + /** + * Represents the 'spSector' constant value. + */ + SPSECTOR("spSector"), + /** + * Represents the 'spApplication' constant value. + */ + SPAPPLICATION("spApplication"), + /** + * Represents the 'spCountry' constant value. + */ + SPCOUNTRY("spCountry"), + /** + * Represents the 'spInstitution' constant value. + */ + SPINSTITUTION("spInstitution"), + /** + * Represents the 'storkAttribute.number' parameter constant. + */ + STORK_ATTRIBUTE_NUMBER("storkAttribute.number"), + /** + * Represents the 'storkAttributeValue.number' parameter constant. + */ + STORK_ATTRIBUTE_VALUE_NUMBER("storkAttributeValue.number"), + + /** + * Represents the 'username' parameter constant. + */ + USERNAME("username"), + + /** + * Represents the 'tooManyParameters' parameter constant. + */ + TOO_MANY_PARAMETERS("tooManyParameters"), + /** + * Represents the 'validation.active' parameter constant. + */ + VALIDATION_ACTIVE("validation.active"), + + /** + * Represents the 'x-forwarded-for' parameter constant. + */ + X_FORWARDED_FOR("x-forwarded-for"), + /** + * Represents the 'x-forwarded-host' parameter constant. + */ + X_FORWARDED_HOST("x-forwarded-host"), + /** + * Represents the 'XMLResponse' parameter constant. + */ + XML_RESPONSE("XMLResponse"), + + /** + * Represents the 'ap-cpeps.number' parameter constant. + */ + AP_PEPS_NUMBER("ap-cpeps.number"), + + /** + * Represents the 'atp.number' parameter constant. + */ + ATTRIBUTE_PROVIDER_NUMBER("atp.number"), + + /** + * Represents the 'apLinker' parameter constant. + */ + AP_LINKER("apLinker"), + + /** + * Represents the 'NOSEL' parameter constant (no attribute provider selected). + */ + AP_NO_SELECTION("NOSEL"), + + /** + * Represents the 'OCSEL' parameter constant (attribute provider in another country). + */ + AP_OTHER_COUNTRY("OCSEL"), + + /** + * Represents the '_provider' suffix parameter constant. + */ + AP_PROVIDER_SELECT_SUFFIX("_provider"), + + /** + * Represents the '_country' suffix parameter constant. + */ + AP_COUNTRY_SELECT_SUFFIX("_country"), + + /** + * Represents the 'next-ap' parameter constant. + */ + NEXT_AP("next-ap"), + + /** + * Represents the 'next-apeps' parameter constant. + */ + NEXT_APEPS("next-apeps"), + + /** + * Represents the 'attr-filter.number' parameter constant. + */ + ATTRIBUTES_FILTER_NUMBER("attr-filter.number"), + + /** + * Represents the 'atp.url' parameter constant. + */ + ATP_URL("atp.url"); + + /** + * Represents the constant's value. + */ + private String value; + + /** + * Solo Constructor. + * + * @param nValue The Constant value. + */ + PEPSParameters(final String nValue) { + this.value = nValue; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + return value; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSUtil.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSUtil.java.svn-base new file mode 100644 index 000000000..ae1f203f5 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSUtil.java.svn-base @@ -0,0 +1,353 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.io.UnsupportedEncodingException; +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.bouncycastle.crypto.Digest; +import org.bouncycastle.util.encoders.Base64; + +import eu.stork.peps.auth.commons.exceptions.InternalErrorPEPSException; +import eu.stork.peps.auth.commons.exceptions.InvalidParameterPEPSException; + +/** + * This class holds static helper methods. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.75 $, $Date: 2010-11-23 00:05:35 $ + */ +public final class PEPSUtil { + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(PEPSUtil.class.getName()); + + /** + * Configurations object. + */ + private static Properties configs; + + /** + * Max prefix. + */ + private static final String MAX_PARAM_PREFIX = "max."; + + /** + * Code prefix to get error code. + */ + private static final String CODE_PARAM_SUFFIX = ".code"; + + /** + * param's size prefix to get max param size. + */ + private static final String MAX_PARAM_SUFFIX = ".size"; + + /** + * Message prefix to get error message. + */ + private static final String MSG_PARAM_SUFFIX = ".message"; + + /** + * Private constructor. Prevents the class from being instantiated. + */ + private PEPSUtil() { + // empty constructor + } + + /** + * Creates a single instance of this class and sets the properties. + * + * @param nConfigs The set of available configurations. + * + * @return The created PEPSUtil's class. + */ + public static PEPSUtil createInstance(final Properties nConfigs) { + if (nConfigs != null) { + PEPSUtil.configs = nConfigs; + } + return new PEPSUtil(); + } + + /** + * Getter for the Properties. + * + * @return configs The properties value. + */ + public Properties getConfigs() { + return configs; + } + + /** + * Setter for the Properties. + * + * @param nConfigs The new properties value. + */ + public static void setConfigs(final Properties nConfigs) { + if (nConfigs != null) { + PEPSUtil.configs = nConfigs; + } + } + + /** + * Returns the identifier of some configuration given a set of configurations + * and the corresponding configuration key. + * + * @param configKey The key that IDs some configuration. + * + * @return The configuration String value. + */ + public static String getConfig(final String configKey) { + return configs.getProperty(configKey); + } + + /** + * Validates the input paramValue identified by the paramName. + * + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + * + * @return true if the parameter is valid. + */ + public static boolean isValidParameter(final String paramName, + final String paramValue) { + + final String validationParam = + PEPSUtil.getConfig(PEPSParameters.VALIDATION_ACTIVE.toString()); + boolean retVal = true; + + final String paramConf = MAX_PARAM_PREFIX + paramName + MAX_PARAM_SUFFIX; + + if (PEPSValues.TRUE.toString().equals(validationParam)) { + final String paramSizeStr = PEPSUtil.getConfig(paramConf); + // Checking if the parameter size exists and if it's numeric + if (StringUtils.isNumeric(paramSizeStr)) { + final int maxParamSize = Integer.valueOf(paramSizeStr); + if (StringUtils.isEmpty(paramValue) + || (paramValue.length() > maxParamSize)) { + retVal = false; + LOG.warn("Invalid parameter [" + paramName + "] value " + paramValue); + } + } else { + retVal = false; + LOG.error("Missing " + paramConf + + " configuration in the pepsUtils.properties configuration file"); + } + } + return retVal; + } + + /** + * Validates the Parameter and throws an exception if an error occurs. Throws + * an InvalidParameterPEPSException runtime exception if the parameter is + * invalid. + * + * @param className The Class Name that invoked the method. + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + */ + public static void validateParameter(final String className, + final String paramName, final Object paramValue) { + + if (paramValue == null) { + PEPSUtil.validateParameter(className, paramName, ""); + } else { + PEPSUtil.validateParameter(className, paramName, paramValue.toString()); + } + } + + /** + * Validates the Parameters and throws an exception if an error occurs. + * + * @param className The Class Name that invoked the method. + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + */ + public static void validateParameter(final String className, + final String paramName, final String paramValue) { + + PEPSUtil.validateParameter(className, paramName, paramValue, + PEPSUtil.getErrorCode(paramName), PEPSUtil.getErrorMessage(paramName)); + } + + /** + * Validates the Parameters and throws an exception if an error occurs. + * + * @param className The Class Name that invoked the method. + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + * @param error The PEPSError to get error code and messages from configs. + */ + public static void validateParameter(final String className, + final String paramName, final String paramValue, final PEPSErrors error) { + + PEPSUtil.validateParameter(className, paramName, paramValue, + PEPSUtil.getConfig(error.errorCode()), + PEPSUtil.getConfig(error.errorMessage())); + } + + /** + * Validates the HTTP Parameter and throws an exception if an error occurs. + * Throws an InvalidParameterPEPSException runtime exception if the parameter + * is invalid. + * + * @param className The Class Name that invoked the method. + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + * @param errorCode The error code to include on the exception. + * @param errorMessage The error message to include on the exception. + */ + public static void validateParameter(final String className, + final String paramName, final String paramValue, final String errorCode, + final String errorMessage) { + + if (!isValidParameter(paramName, paramValue)) { + LOG.warn("Invalid parameter [" + paramName + "] value found at " + + className); + throw new InvalidParameterPEPSException(errorCode, errorMessage); + } + } + + /** + * Getter for the error code of some given error related to the input param. + * + * @param paramName The name of the parameter associated with the error. + * + * @return The code of the error. + */ + private static String getErrorCode(final String paramName) { + return getConfig(paramName + CODE_PARAM_SUFFIX); + } + + /** + * Getter for the error message of some given error related to the input + * parameter. + * + * @param paramName The name of the parameter associated with the message. + * + * @return The message for the error. + */ + private static String getErrorMessage(final String paramName) { + return getConfig(paramName + MSG_PARAM_SUFFIX); + } + + /** + * {@link Base64} encodes the input samlToken parameter. + * + * @param samlToken the SAML Token to be encoded. + * + * @return The Base64 String representing the samlToken. + * + * @see Base64#encode + */ + public static String encodeSAMLToken(final byte[] samlToken) { + try { + return new String(Base64.encode(samlToken), "UTF8"); + } catch (UnsupportedEncodingException e) { + LOG.error(PEPSErrors.INTERNAL_ERROR.errorMessage(), e); + return null; + } + } + + /** + * Decodes the {@link Base64} String input parameter representing a samlToken. + * + * @param samlToken the SAML Token to be decoded. + * + * @return The samlToken decoded bytes. + * + * @see Base64#decode + */ + public static byte[] decodeSAMLToken(final String samlToken) { + return Base64.decode(samlToken); + } + + /** + * Hashes a SAML token. Throws an InternalErrorPEPSException runtime exception + * if the Cryptographic Engine fails. + * + * @param samlToken the SAML Token to be hashed. + * + * @return byte[] with the hashed SAML Token. + */ + public static byte[] hashPersonalToken(final byte[] samlToken) { + try { + final String className = + PEPSUtil.getConfig(PEPSValues.HASH_DIGEST_CLASS.toString()); + + final Digest digest = + (Digest) Class.forName(className).getConstructor() + .newInstance((Object[]) null); + digest.update(samlToken, 0, samlToken.length); + + final int retLength = digest.getDigestSize(); + final byte[] ret = new byte[retLength]; + + digest.doFinal(ret, 0); + return ret; + + } catch (final Exception e) { + // For all those exceptions that could be thrown, we always log it and + // thrown an InternalErrorPEPSException. + LOG.error(PEPSErrors.HASH_ERROR.errorMessage(), e); + throw new InternalErrorPEPSException( + PEPSUtil.getConfig(PEPSErrors.HASH_ERROR.errorCode()), + PEPSUtil.getConfig(PEPSErrors.HASH_ERROR.errorMessage()), e); + } + } + + /** + * Gets the Stork error code in the error message if exists! + * + * @param errorMessage The message to get the error code if exists; + * + * @return the error code if exists. Returns null otherwise. + */ + public static String getStorkErrorCode(final String errorMessage) { + if (StringUtils.isNotBlank(errorMessage) + && errorMessage.indexOf(PEPSValues.ERROR_MESSAGE_SEP.toString()) >= 0) { + final String[] msgSplitted = + errorMessage.split(PEPSValues.ERROR_MESSAGE_SEP.toString()); + if (msgSplitted.length == 2 && StringUtils.isNumeric(msgSplitted[0])) { + return msgSplitted[0]; + } + } + return null; + } + + /** + * Gets the Stork error message in the saml message if exists! + * + * @param errorMessage The message to get in the saml message if exists; + * + * @return the error message if exists. Returns the original message + * otherwise. + */ + public static String getStorkErrorMessage(final String errorMessage) { + if (StringUtils.isNotBlank(errorMessage) + && errorMessage.indexOf(PEPSValues.ERROR_MESSAGE_SEP.toString()) >= 0) { + final String[] msgSplitted = + errorMessage.split(PEPSValues.ERROR_MESSAGE_SEP.toString()); + if (msgSplitted.length == 2 && StringUtils.isNumeric(msgSplitted[0])) { + return msgSplitted[1]; + } + } + return errorMessage; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSValues.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSValues.java.svn-base new file mode 100644 index 000000000..568c25053 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSValues.java.svn-base @@ -0,0 +1,325 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains all the value constants. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.17 $, $Date: 2011-07-07 20:48:45 $ + */ +public enum PEPSValues { + + /** + * Represents the 'all' constant value. + */ + ALL("all"), + /** + * Represents the 'none' constant value. + */ + NONE("none"), + /** + * Represents the 'true' constant value. + */ + TRUE("true"), + /** + * Represents the 'false' constant value. + */ + FALSE("false"), + /** + * Represents the empty string constant value. + */ + EMPTY_STRING(""), + + /** + * Represents the ',' separator constant value. + */ + ATTRIBUTE_VALUE_SEP(","), + /** + * Represents the ';' separator constant value. + */ + ATTRIBUTE_SEP(";"), + /** + * Represents the ':' separator constant value. + */ + ATTRIBUTE_TUPLE_SEP(":"), + /** + * Represents the '/' separator constant value. + */ + EID_SEPARATOR("/"), + /** + * Represents the ' - ' separator constant value. + */ + ERROR_MESSAGE_SEP(" - "), + /** + * Represents the '#' parameter constant value. + */ + LOGGER_SEP("#"), + /** + * Represents the 'NOT_AVAILABLE' parameter constant value. + */ + NOT_AVAILABLE("NotAvailable"), + /** + * Represents the ';' parameter constant value. + */ + SPEPS_AUTHORIZED_SEP(";"), + + /** + * Represents the 'ap' constant value. + */ + AP("ap"), + /** + * Represents the 'C-PEPS' constant value. + */ + CPEPS("C-PEPS"), + /** + * Represents the 'cpeps' constant value. + */ + CPEPS_PREFIX("cpeps"), + /** + * Represents the 'peps' constant value. + */ + PEPS("peps"), + /** + * Represents the '-PEPS' constant value. + */ + PEPS_SUFFIX("-PEPS"), + /** + * Represents the 'SP' constant value. + */ + SP("SP"), + /** + * Represents the 'S-PEPS' constant value. + */ + SPEPS("S-PEPS"), + /** + * Represents the 'speps' constant value. + */ + SPEPS_PREFIX("speps"), + /** + * Represents the 'sp.default.parameters' constant value. + */ + DEFAULT("sp.default.parameters"), + /** + * Represents the default saml id constant value. + */ + DEFAULT_SAML_ID("1"), + /** + * Represents the 'hashDigest.className' constant value. + */ + HASH_DIGEST_CLASS("hashDigest.className"), + + /** + * Represents the 'eu.stork.communication.requests' constant value. + */ + STORK_PACKAGE_REQUEST_LOGGER_VALUE("eu.stork.communication.requests"), + /** + * Represents the 'eu.stork.communication.responses' constant value. + */ + STORK_PACKAGE_RESPONSE_LOGGER_VALUE("eu.stork.communication.responses"), + + /** + * Represents the 'S-PEPS receives request from SP' constant value. + */ + SP_REQUEST("S-PEPS receives request from SP"), + /** + * Represents the 'Get Citizen Consent' constant value. + */ + CITIZEN_CONSENT_LOG("Get Citizen Consent"), + /** + * Represents the 'C-PEPS receives request from S-PEPS' constant value. + */ + CPEPS_REQUEST("C-PEPS receives request from S-PEPS"), + /** + * Represents the 'C-PEPS generates response to S-PEPS' constant value. + */ + CPEPS_RESPONSE("C-PEPS generates response to S-PEPS"), + /** + * Represents the 'S-PEPS generates request to C-PEPS' constant value. + */ + SPEPS_REQUEST("S-PEPS generates request to C-PEPS"), + /** + * Represents the 'S-PEPS receives response from C-PEPS' constant value. + */ + SPEPS_RESPONSE("S-PEPS receives response from C-PEPS"), + /** + * Represents the 'S-PEPS generates response to SP' constant value. + */ + SP_RESPONSE("S-PEPS generates response to SP"), + /** + * Represents the 'Success' constant value. + */ + SUCCESS("Success"), + /** + * Represents the December's month number constant value. + */ + LAST_MONTH("12"), + /** + * Represents the yyyyMM constant value. + */ + NO_DAY_DATE_FORMAT("yyyyMM"), + + /** + * Represents the 'attrValue' constant value. + */ + ATTRIBUTE("attrValue"), + /** + * Represents the 'derivedAttr' constant value. + */ + DERIVE_ATTRIBUTE("deriveAttr"), + /** + * Represents the 'storkAttribute' constant value. + */ + STORK_ATTRIBUTE("storkAttribute"), + + /** + * Represents the 'properties' constant value. + */ + PROPERTIES("properties"), + /** + * Represents the 'referer' constant value. + */ + REFERER("referer"), + /** + * Represents the 'host' constant value. + */ + HOST("host"), + /** + * Represents the 'spid' constant value. + */ + SPID("spid"), + /** + * Represents the 'domain' constant value. + */ + DOMAIN("domain"), + /** + * Represents the '.validation' constant value. + */ + VALIDATION_SUFFIX(".validation"), + /** + * Represents the 'jsessionid' constant value. + */ + EQUAL("="), + /** + * Represents the 'HttpOnly' constant value. + */ + HTTP_ONLY("HttpOnly"), + /** + * Represents the 'SET-COOKIE' constant value. + */ + JSSESSION("JSESSIONID"), + /** + * Represents the '=' constant value. + */ + SETCOOKIE("SET-COOKIE"), + /** + * Represents the ';' constant value. + */ + SEMICOLON(";"), + /** + * Represents the ' ' constant value. + */ + SPACE(" "), + /** + * Represents the 'atp' constant value. + */ + APROVIDER_PREFIX("atp"), + /** + * Represents the 'ap-cpeps' constant value. + */ + AP_CPEPS_PREFIX("ap-cpeps"), + /** + * Represents the 'attr-filter' constant value. + */ + AP_ATTRFILTER_PREFIX("attr-filter"); + + /** + * Represents the constant's value. + */ + private String value; + + /** + * Solo Constructor. + * + * @param val The Constant value. + */ + PEPSValues(final String val) { + + this.value = val; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + + return value; + } + + /** + * Construct the return value with the following structure + * CONSTANT_VALUE+index+".id". + * + * @param index the number. + * + * @return The concatenated String value. + */ + public String index(final int index) { + + return value + index + ".id"; + } + + /** + * Construct the return value with the following structure + * CONSTANT_VALUE+index+".value". + * + * @param index the number. + * + * @return The concatenated string value. + */ + public String value(final int index) { + + return value + index + ".value"; + } + + /** + * Construct the return value with the following structure + * CONSTANT_VALUE+index+".name". + * + * @param index the number. + * + * @return The concatenated String value. + */ + public String name(final int index) { + + return value + index + ".name"; + } + + /** + * Construct the return value with the following structure + * CONSTANT_VALUE+index+".url". + * + * @param index the number. + * + * @return The concatenated String value. + */ + public String url(final int index) { + + return value + index + ".url"; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttribute.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttribute.java.svn-base new file mode 100644 index 000000000..bb9b3b694 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttribute.java.svn-base @@ -0,0 +1,323 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import eu.stork.peps.auth.commons.exceptions.InternalErrorPEPSException; + +/** + * This class is a bean used to store the information relative to the + * PersonalAttribute. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.22 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class PersonalAttribute implements Serializable, Cloneable { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 2612951678412632174L; + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(PersonalAttribute.class + .getName()); + + /** + * Name of the personal attribute. + */ + private String name; + + /** + * Values of the personal attribute. + */ + private List value = new ArrayList(); + + /** + * Complex values of the personal attribute. + */ + private Map complexValue = new HashMap(); + + /** + * Is the personal attribute mandatory? + */ + private transient boolean required; + + /** + * Returned status of the attribute from the IdP. + */ + private String status; + + /** + * Name of the personal attribute. + */ + private String friendlyName; + + /** + * Empty Constructor. + */ + public PersonalAttribute() { + super(); + } + + /** + * PersonalAttribute Constructor for complex values. + * + * @param attrName The attribute name. + * @param attrIsRequired The attribute type value. + * @param attrComplexValue The attribute's value. + * @param attrStatus The attribute's status value. + */ + public PersonalAttribute(final String attrName, final boolean attrIsRequired, + final List attrComplexValue, final String attrStatus) { + this.setName(attrName); + this.setIsRequired(attrIsRequired); + this.setValue(attrComplexValue); + this.setStatus(attrStatus); + } + + /** + * PersonalAttribute Constructor for complex values. + * + * @param attrName The attribute name. + * @param attrIsRequired The attribute type value. + * @param attrComplexValue The attribute's complex value. + * @param attrStatus The attribute's status value. + */ + public PersonalAttribute(final String attrName, final boolean attrIsRequired, + final Map attrComplexValue, final String attrStatus) { + this.setName(attrName); + this.setIsRequired(attrIsRequired); + this.setComplexValue(attrComplexValue); + this.setStatus(attrStatus); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public Object clone() { + + try { + final PersonalAttribute personalAttr = (PersonalAttribute) super.clone(); + personalAttr.setIsRequired(this.isRequired()); + personalAttr.setName(this.getName()); + personalAttr.setStatus(this.getStatus()); + if (!isEmptyValue()) { + final List val = + (List) ((ArrayList) this.getValue()).clone(); + personalAttr.setValue(val); + } + if (!isEmptyComplexValue()) { + final Map complexVal = + (Map) ((HashMap) this + .getComplexValue()).clone(); + personalAttr.setComplexValue(complexVal); + } + return personalAttr; + } catch (final CloneNotSupportedException e) { + // assert false; + LOG.trace("Nothing to do."); + throw new InternalErrorPEPSException( + PEPSUtil.getConfig(PEPSErrors.INTERNAL_ERROR.errorCode()), + PEPSUtil.getConfig(PEPSErrors.INTERNAL_ERROR.errorMessage()), e); + } + } + + /** + * Getter for the required value. + * + * @return The required value. + */ + public boolean isRequired() { + return required; + } + + /** + * Setter for the required value. + * + * @param attrIsRequired this attribute? + */ + public void setIsRequired(final boolean attrIsRequired) { + this.required = attrIsRequired; + } + + /** + * Getter for the name value. + * + * @return The name value. + */ + public String getName() { + return name; + } + + /** + * Setter for the name value. + * + * @param attrName The personal attribute name. + */ + public void setName(final String attrName) { + this.name = attrName; + } + + /** + * Getter for the value. + * + * @return The list of values. + */ + public List getValue() { + return value; + } + + /** + * Setter for the list of values. + * + * @param attrValue The personal attribute value. + */ + public void setValue(final List attrValue) { + if (attrValue != null) { + this.value = attrValue; + } + } + + /** + * Getter for the status. + * + * @return The status value. + */ + public String getStatus() { + return status; + } + + /** + * Setter for the status value. + * + * @param attrStatus The personal attribute status. + */ + public void setStatus(final String attrStatus) { + this.status = attrStatus; + } + + /** + * Getter for the complex value. + * + * @return The complex value. + */ + public Map getComplexValue() { + return complexValue; + } + + /** + * Setter for the complex value. + * + * @param complexVal The personal attribute Complex value. + */ + public void setComplexValue(final Map complexVal) { + if (complexVal != null) { + this.complexValue = complexVal; + } + } + + /** + * Getter for the personal's friendly name. + * + * @return The personal's friendly name value. + */ + public String getFriendlyName() { + return friendlyName; + } + + /** + * Setter for the personal's friendly name. + * + * @param fName The personal's friendly name. + */ + public void setFriendlyName(final String fName) { + this.friendlyName = fName; + } + + /** + * Return true the value is empty. + * + * @return True if the value is empty "[]"; + */ + public boolean isEmptyValue() { + return value.isEmpty() || (value.size() == 1 && value.get(0).length() == 0); + } + + /** + * Returns true if the Complex Value is empty. + * + * @return True if the Complex Value is empty; + */ + public boolean isEmptyComplexValue() { + return complexValue.isEmpty(); + } + + /** + * Returns true if the Status is empty. + * + * @return True if the Status is empty; + */ + public boolean isEmptyStatus() { + return (status == null || status.length() == 0); + } + + /** + * Prints the PersonalAttribute in the following format. + * name:required:[v,a,l,u,e,s]|[v=a,l=u,e=s]:status; + * + * @return The PersonalAttribute as a string. + */ + public String toString() { + final StringBuilder strBuild = new StringBuilder(); + + AttributeUtil.appendIfNotNull(strBuild, getName()); + strBuild.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); + AttributeUtil.appendIfNotNull(strBuild, String.valueOf(isRequired())); + strBuild.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); + strBuild.append('['); + + if (isEmptyValue()) { + if (!isEmptyComplexValue()) { + AttributeUtil.appendIfNotNull(strBuild, AttributeUtil.mapToString( + getComplexValue(), PEPSValues.ATTRIBUTE_VALUE_SEP.toString())); + } + } else { + AttributeUtil.appendIfNotNull( + strBuild, + AttributeUtil.listToString(getValue(), + PEPSValues.ATTRIBUTE_VALUE_SEP.toString())); + } + + strBuild.append(']'); + strBuild.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); + AttributeUtil.appendIfNotNull(strBuild, getStatus()); + strBuild.append(PEPSValues.ATTRIBUTE_SEP.toString()); + + return strBuild.toString(); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttributeList.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttributeList.java.svn-base new file mode 100644 index 000000000..d33ccfe18 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttributeList.java.svn-base @@ -0,0 +1,305 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.StringTokenizer; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; + +/** + * This class is a bean used to store the information relative to the + * PersonalAttributeList. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.27 $, $Date: 2010-11-18 22:54:56 $ + * + * @see PersonalAttribute + */ +@SuppressWarnings("PMD") +public final class PersonalAttributeList extends + HashMap implements IPersonalAttributeList{ + + /** + * Logger object. + */ + private static final Logger LOG = Logger + .getLogger(PersonalAttributeList.class.getName()); + + /** + * Serial id. + */ + private static final long serialVersionUID = 7375127363889975062L; + + /** + * Hash with the latest fetched attribute name alias. + */ + private final transient Map latestAttrAlias = + new HashMap(); + + /** + * Hash with mapping number of alias or the attribute name. + */ + private final transient Map attrAliasNumber = + new HashMap(); + + /** + * Default constructor. + */ + public PersonalAttributeList() { + // The best practices recommend to call the super constructor. + super(); + } + + /** + * Constructor with initial capacity for the PersonalAttributeList size. + * + * @param capacity The initial capacity for the PersonalAttributeList. + */ + public PersonalAttributeList(final int capacity) { + super(capacity); + } + + /** + * {@inheritDoc} + */ + public Iterator iterator() { + return this.values().iterator(); + } + + /** + * {@inheritDoc} + */ + public PersonalAttribute get(final Object key) { + String attrName = (String) key; + + if (this.latestAttrAlias.containsKey(key)) { + attrName = attrName + this.latestAttrAlias.get(key); + } else { + if (this.attrAliasNumber.containsKey(key)) { + this.latestAttrAlias.put(attrName, this.attrAliasNumber.get(key)); + } + } + return super.get(attrName); + } + + /** + * {@inheritDoc} + */ + public void add(final PersonalAttribute value) { + if (value != null) { + this.put(value.getName(), value); + } + } + + /** + * {@inheritDoc} + */ + public PersonalAttribute put(final String key, final PersonalAttribute val) { + if (StringUtils.isNotEmpty(key) && val != null) { + // Validate if attribute name already exists! + String attrAlias = key; + if (this.containsKey(key)) { + if (!val.isEmptyValue() && StringUtils.isNumeric(val.getValue().get(0))) { + final String attrValue = val.getValue().get(0); + attrAlias = key + attrValue; + this.attrAliasNumber.put(key, Integer.valueOf(attrValue)); + } else { + final PersonalAttribute attr = super.get(key); + if (!attr.isEmptyValue() + && StringUtils.isNumeric(attr.getValue().get(0))) { + attrAlias = key + attr.getValue().get(0); + super.put(key, (PersonalAttribute) attr); + this.attrAliasNumber.put(key, null); + } + } + } + return super.put(attrAlias, val); + } else { + return null; + } + } + + /** + * {@inheritDoc} + */ + public void populate(final String attrList) { + final StringTokenizer strToken = + new StringTokenizer(attrList, PEPSValues.ATTRIBUTE_SEP.toString()); + + while (strToken.hasMoreTokens()) { + final PersonalAttribute persAttr = new PersonalAttribute(); + String[] tuples = + strToken.nextToken().split(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString(), + AttributeConstants.NUMBER_TUPLES.intValue()); + + // Convert to the new format if needed! + tuples = convertFormat(tuples); + + if (AttributeUtil.hasValidTuples(tuples)) { + final int attrValueIndex = + AttributeConstants.ATTR_VALUE_INDEX.intValue(); + final String tmpAttrValue = + tuples[attrValueIndex].substring(1, + tuples[attrValueIndex].length() - 1); + final String[] vals = + tmpAttrValue.split(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + persAttr.setName(tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()]); + persAttr.setIsRequired(Boolean + .valueOf(tuples[AttributeConstants.ATTR_TYPE_INDEX.intValue()])); + + // check if it is a complex value + if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] + .equals(PEPSParameters.COMPLEX_ADDRESS_VALUE.toString())) + { + persAttr.setComplexValue(createComplexValue(vals)); + } + else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] + .equals(PEPSParameters.COMPLEX_NEWATTRIBUTE_VALUE.toString())) + { + persAttr.setComplexValue(createComplexValue(vals)); + } + + else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] + .equals(PEPSParameters.COMPLEX_HASDEGREE_VALUE.toString())) + { + persAttr.setComplexValue(createComplexValue(vals)); + } + else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] + .equals(PEPSParameters.COMPLEX_MANDATECONTENT_VALUE.toString())) + { + persAttr.setComplexValue(createComplexValue(vals)); + } + else + { + persAttr.setValue(createValues(vals)); + } + + if (tuples.length == AttributeConstants.NUMBER_TUPLES.intValue()) { + persAttr.setStatus(tuples[AttributeConstants.ATTR_STATUS_INDEX + .intValue()]); + } + this.put(tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()], + persAttr); + + } else { + LOG.warn("Invalid personal attribute list tuples"); + } + + } + } + + /** + * Returns a copy of this IPersonalAttributeList instance. + * + * @return The copy of this IPersonalAttributeList. + */ + public Object clone() { + return (PersonalAttributeList) super.clone(); + } + + /** + * Creates a string in the following format. + * + * attrName:attrType:[attrValue1,attrValue2=attrComplexValue]:attrStatus; + * + * @return {@inheritDoc} + */ + @Override + public String toString() { + final Iterator> itAttrs = + this.entrySet().iterator(); + final StringBuilder strBuilder = new StringBuilder(); + + while (itAttrs.hasNext()) { + final Entry attrEntry = itAttrs.next(); + final PersonalAttribute attr = attrEntry.getValue(); + strBuilder.append(attr.toString()); + } + + return strBuilder.toString(); + } + + /** + * Validates and creates the attribute's complex values. + * + * @param values The complex values. + * + * @return The {@link Map} with the complex values. + * + * @see Map + */ + private Map createComplexValue(final String[] values) { + final Map complexValue = new HashMap(); + for (final String val : values) { + final String[] tVal = val.split("="); + if (StringUtils.isNotEmpty(val) && tVal.length == 2) { + complexValue.put(tVal[0], AttributeUtil.unescape(tVal[1])); + } + } + return complexValue; + } + + /** + * Validates and creates the attribute values. + * + * @param vals The attribute values. + * + * @return The {@link List} with the attribute values. + * + * @see List + */ + private List createValues(final String[] vals) { + final List values = new ArrayList(); + for (final String val : vals) { + if (StringUtils.isNotEmpty(val)) { + values.add(AttributeUtil.unescape(val)); + } + } + return values; + } + + /** + * Converts the attribute tuple (attrName:attrType...) to the new format. + * + * @param tuples The attribute tuples to convert. + * + * @return The attribute tuples in the new format. + */ + private String[] convertFormat(final String[] tuples) { + final String[] newFormatTuples = + new String[AttributeConstants.NUMBER_TUPLES.intValue()]; + if (tuples != null) { + System.arraycopy(tuples, 0, newFormatTuples, 0, tuples.length); + + for (int i = tuples.length; i < newFormatTuples.length; i++) { + if (i == AttributeConstants.ATTR_VALUE_INDEX.intValue()) { + newFormatTuples[i] = "[]"; + } else { + newFormatTuples[i] = ""; + } + } + } + return newFormatTuples; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryRequest.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryRequest.java.svn-base new file mode 100644 index 000000000..33160f2ac --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryRequest.java.svn-base @@ -0,0 +1,426 @@ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; + +import org.apache.log4j.Logger; + +public class STORKAttrQueryRequest implements Serializable, Cloneable { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 4778480781609392750L; + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(STORKAttrQueryRequest.class + .getName()); + + /** The samlId. */ + private String samlId; + + /** The destination. */ + private String destination; + + /** The distinguished name. */ + private String distinguishedName; + + /** The e id sector share. */ + private boolean eIDSectorShare; + + /** The e id cross sector share. */ + private boolean eIDCrossSectorShare; + + /** The e id cross border share. */ + private boolean eIDCrossBorderShare; + + /** The personal attribute list. */ + private IPersonalAttributeList attributeList = new PersonalAttributeList(); + + /** The qaa. */ + private int qaa; + + /** The token saml. */ + private byte[] tokenSaml = new byte[0]; + + /** The issuer. */ + private String issuer; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The country. */ + private String country; + + /** The citizen country code. */ + private String citizenCountry; + + /** The Service Provider ID. */ + private String sPID; + + /** The Alias used at the keystore for saving this certificate. */ + private String alias; + + /** + * Gets the SP's Certificate Alias. + * + * @return alias The SP's Certificate Alias. + */ + public String getAlias() { + return alias; + } + + /** + * Sets the SP's Certificate Alias. + * + * @param nAlias The SP's Certificate Alias. + */ + public void setAlias(final String nAlias) { + this.alias = nAlias; + } + + /** + * Gets the SP ID. + * + * @return sPID The SP ID. + */ + public String getSPID() { + return sPID; + } + + /** + * Sets the SP ID. + * + * @param sPId The new sp samlId. + */ + public void setSPID(final String sPId) { + this.sPID = sPId; + } + + /** + * Gets the citizen country code. + * + * @return The citizen country code value. + */ + public String getCitizenCountryCode() { + return citizenCountry; + } + + /** + * Sets the citizen country code. + * + * @param countryCode the new citizen country code value. + */ + public void setCitizenCountryCode(final String countryCode) { + this.citizenCountry = countryCode; + } + + /** + * Gets the sp country. + * + * @return The sp country value. + */ + public String getSpCountry() { + return spCountry; + } + + /** + * Sets the sp country. + * + * @param sPCountry the new sp country value. + */ + public void setSpCountry(final String sPCountry) { + this.spCountry = sPCountry; + } + + /** + * Gets the issuer. + * + * @return The issuer value. + */ + public String getIssuer() { + return issuer; + } + + /** + * Sets the issuer. + * + * @param samlIssuer the new issuer value. + */ + public void setIssuer(final String samlIssuer) { + this.issuer = samlIssuer; + } + + /** + * Gets the SAML Token. + * + * @return The SAML Token value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Sets the SAML Token. + * + * @param samlToken The new SAML Token value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Gets the country. + * + * @return The country value. + */ + public String getCountry() { + return country; + } + + /** + * Sets the country. + * + * @param nCountry the new country value. + */ + public void setCountry(final String nCountry) { + this.country = nCountry; + } + + /** + * Getter for the qaa value. + * + * @return The qaa value value. + */ + public int getQaa() { + return qaa; + } + + /** + * Setter for the qaa value. + * + * @param qaaLevel The new qaa value. + */ + public void setQaa(final int qaaLevel) { + this.qaa = qaaLevel; + } + + /** + * Getter for the destination value. + * + * @return The destination value. + */ + public String getDestination() { + return destination; + } + + /** + * Setter for the destination value. + * + * @param detination the new destination value. + */ + public void setDestination(final String detination) { + this.destination = detination; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param newSamlId the new samlId value. + */ + public void setSamlId(final String newSamlId) { + this.samlId = newSamlId; + } + + + /** + * Getter for the attributeList value. + * + * @return The attributeList value. + * + * @see IPersonalAttributeList + */ + public IPersonalAttributeList getPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the attributeList value. + * + * @param attrList the personal attribute list value. + * + * @see IPersonalAttributeList + */ + public void setPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.attributeList = attrList; + } + } + + /** + * Getter for the distinguishedName value. + * + * @return The distinguishedName value. + */ + public String getDistinguishedName() { + return distinguishedName; + } + + /** + * Setter for the distinguishedName value. + * + * @param certDN the distinguished name value. + */ + public void setDistinguishedName(final String certDN) { + this.distinguishedName = certDN; + } + + /** + * Gets the service provider sector. + * + * @return The service provider sector value. + */ + public String getSpSector() { + return spSector; + } + + /** + * Sets the service provider sector. + * + * @param samlSPSector the new service provider sector value. + */ + public void setSpSector(final String samlSPSector) { + this.spSector = samlSPSector; + } + + /** + * Gets the service provider institution. + * + * @return The service provider institution value. + */ + public String getSpInstitution() { + return spInstitution; + } + + /** + * Sets the service provider institution. + * + * @param samlSPInst the new service provider institution value. + */ + public void setSpInstitution(final String samlSPInst) { + this.spInstitution = samlSPInst; + } + + /** + * Gets the service provider application. + * + * @return The service provider application value. + */ + public String getSpApplication() { + return spApplication; + } + + /** + * Sets the service provider application. + * + * @param samlSPApp the new service provider application value. + */ + public void setSpApplication(final String samlSPApp) { + this.spApplication = samlSPApp; + } + + /** + * Checks if is eId sector share. + * + * @return true, if is eId sector share. + */ + public boolean isEIDSectorShare() { + return eIDSectorShare; + } + + /** + * Sets the eId sector share. + * + * @param eIdSectorShare the new eId sector share value. + */ + public void setEIDSectorShare(final boolean eIdSectorShare) { + this.eIDSectorShare = eIdSectorShare; + } + + /** + * Checks if is eId cross sector share. + * + * @return true, if is eId cross sector share. + */ + public boolean isEIDCrossSectorShare() { + return eIDCrossSectorShare; + } + + /** + * Sets the eId cross sector share. + * + * @param eIdCrossSectorShare the new eId cross sector share value. + */ + public void setEIDCrossSectorShare(final boolean eIdCrossSectorShare) { + this.eIDCrossSectorShare = eIdCrossSectorShare; + } + + /** + * Checks if is eId cross border share. + * + * @return true, if is eId cross border share. + */ + public boolean isEIDCrossBorderShare() { + return eIDCrossBorderShare; + } + + /** + * Sets the eId cross border share. + * + * @param eIdCrossBorderShare the new eId cross border share value. + */ + public void setEIDCrossBorderShare(final boolean eIdCrossBorderShare) { + this.eIDCrossBorderShare = eIdCrossBorderShare; + } + + /** + * Returns a copy of this STORKAttrQueryRequest instance. + * + * @return The copy of this STORKAttrQueryRequest. + * @throws CloneNotSupportedException on clone exception + */ + @Override + public Object clone() throws CloneNotSupportedException{ + STORKAttrQueryRequest storkAttrQueryReq = null; + storkAttrQueryReq = (STORKAttrQueryRequest) super.clone(); + storkAttrQueryReq.setPersonalAttributeList(getPersonalAttributeList()); + storkAttrQueryReq.setTokenSaml(getTokenSaml()); + return storkAttrQueryReq; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryResponse.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryResponse.java.svn-base new file mode 100644 index 000000000..215b978dc --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryResponse.java.svn-base @@ -0,0 +1,301 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import org.apache.log4j.Logger; +import org.joda.time.DateTime; + +public class STORKAttrQueryResponse { + + /** Response Id. */ + private String samlId; + + /** Request failed? */ + private boolean fail; + + /** Status code. */ + private String statusCode; + + /** Secondary status code. */ + private String subStatusCode; + + /** Audience restriction. */ + private transient String audienceRest; + + /** Error message. */ + private String message; + + /** Id of the request that originated this response. */ + private String inResponseTo; + + /** Expiration date. */ + private DateTime notOnOrAfter; + + /** Creation date. */ + private DateTime notBefore; + + /** The SAML token. */ + private byte[] tokenSaml = new byte[0]; + + /** Country. */ + private String country; + + /** Citizen's personal attribute list. */ + private transient IPersonalAttributeList attributeList = new PersonalAttributeList(); + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(STORKAttrQueryResponse.class.getName()); + + /** + * Getter for the subStatusCode. + * + * @return The subStatusCode value. + */ + public String getSubStatusCode() { + return subStatusCode; + } + + /** + * Setter for the subStatusCode. + * + * @param samlSubStatusCode the new subStatusCode value. + */ + public void setSubStatusCode(final String samlSubStatusCode) { + this.subStatusCode = samlSubStatusCode; + } + + /** + * Getter for audienceRest. + * + * @return The audienceRest value. + */ + public String getAudienceRestriction() { + return audienceRest; + } + + /** + * Setter for audienceRest. + * + * @param audRest the new audienceRest value. + */ + public void setAudienceRestriction(final String audRest) { + this.audienceRest = audRest; + } + + /** + * Getter for the samlToken. + * + * @return The samlToken value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Setter for samlToken. + * + * @param samlToken the new tokenSaml value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Getter for the country name. + * + * @return The country name value. + */ + public String getCountry() { + return country; + } + + /** + * Setter for the country name. + * + * @param cCountry the new country name value. + */ + public void setCountry(final String cCountry) { + this.country = cCountry; + } + + /** + * Getter for pal value. + * + * @return The pal value. + * + * @see PersonalAttributeList + */ + public IPersonalAttributeList getPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the Personal Attribute List value. + * + * @param attrList the new value. + * + * @see PersonalAttributeList + */ + public void setPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.attributeList = attrList; + } + } + + /** + * Getter for the inResponseTo value. + * + * @return The inResponseTo value. + */ + public String getInResponseTo() { + return inResponseTo; + } + + /** + * Setter for the inResponseTo value. + * + * @param samlInResponseTo the new inResponseTo value. + */ + public void setInResponseTo(final String samlInResponseTo) { + this.inResponseTo = samlInResponseTo; + } + + /** + * Getter for the fail value. + * + * @return The fail value. + */ + public boolean isFail() { + return fail; + } + + /** + * Setter for the fail value. + * + * @param failVal the new fail value. + */ + public void setFail(final boolean failVal) { + this.fail = failVal; + } + + /** + * Getter for the message value. + * + * @return The message value. + */ + public String getMessage() { + return message; + } + + /** + * Setter for the message value. + * + * @param msg the new message value. + */ + public void setMessage(final String msg) { + this.message = msg; + } + + /** + * Getter for the statusCode value. + * + * @return The statusCode value. + */ + public String getStatusCode() { + return statusCode; + } + + /** + * Setter for the statusCode value. + * + * @param status the new statusCode value. + */ + public void setStatusCode(final String status) { + this.statusCode = status; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param nSamlId the new samlId value. + */ + public void setSamlId(final String nSamlId) { + this.samlId = nSamlId; + } + + /** + * Getter for the notOnOrAfter value. + * + * @return The notOnOrAfter value. + * + * @see DateTime + */ + public DateTime getNotOnOrAfter() { + return this.notOnOrAfter; + } + + /** + * Setter for the notOnOrAfter value. + * + * @param nOnOrAfter the new notOnOrAfter value. + * + * @see DateTime + */ + public void setNotOnOrAfter(final DateTime nOnOrAfter) { + this.notOnOrAfter = nOnOrAfter; + } + + /** + * Getter for the notBefore value. + * + * @return The notBefore value. + * + * @see DateTime + */ + public DateTime getNotBefore() { + return notBefore; + } + + /** + * Setter for the notBefore value. + * + * @param nBefore the new notBefore value. + * + * @see DateTime + */ + public void setNotBefore(final DateTime nBefore) { + this.notBefore = nBefore; + } + +} + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnRequest.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnRequest.java.svn-base new file mode 100644 index 000000000..2354d0eb1 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnRequest.java.svn-base @@ -0,0 +1,495 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; + +import org.apache.log4j.Logger; + +/** + * This class is a bean used to store the information relative to the + * STORKAuthnRequest (SAML Token Request). + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.21 $, $Date: 2011-02-17 22:44:34 $ + */ +public final class STORKAuthnRequest implements Serializable, Cloneable { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 4778480781609392750L; + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(STORKAuthnRequest.class + .getName()); + + /** The samlId. */ + private String samlId; + + /** The assertion consumer service url. */ + private String serviceURL; + + /** The destination. */ + private String destination; + + /** The provider name. */ + private String providerName; + + /** The distinguished name. */ + private String distinguishedName; + + /** The e id sector share. */ + private boolean eIDSectorShare; + + /** The e id cross sector share. */ + private boolean eIDCrossSectorShare; + + /** The e id cross border share. */ + private boolean eIDCrossBorderShare; + + /** The personal attribute list. */ + private IPersonalAttributeList attributeList = new PersonalAttributeList(); + + /** The qaa. */ + private int qaa; + + /** The token saml. */ + private byte[] tokenSaml = new byte[0]; + + /** The issuer. */ + private String issuer; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The country. */ + private String country; + + /** The citizen country code. */ + private String citizenCountry; + + /** The Service Provider ID. */ + private String sPID; + + /** The Alias used at the keystore for saving this certificate. */ + private String alias; + + /** + * Gets the SP's Certificate Alias. + * + * @return alias The SP's Certificate Alias. + */ + public String getAlias() { + return alias; + } + + /** + * Sets the SP's Certificate Alias. + * + * @param nAlias The SP's Certificate Alias. + */ + public void setAlias(final String nAlias) { + this.alias = nAlias; + } + + /** + * Gets the SP ID. + * + * @return sPID The SP ID. + */ + public String getSPID() { + return sPID; + } + + /** + * Sets the SP ID. + * + * @param sPId The new sp samlId. + */ + public void setSPID(final String sPId) { + this.sPID = sPId; + } + + /** + * Gets the citizen country code. + * + * @return The citizen country code value. + */ + public String getCitizenCountryCode() { + return citizenCountry; + } + + /** + * Sets the citizen country code. + * + * @param countryCode the new citizen country code value. + */ + public void setCitizenCountryCode(final String countryCode) { + this.citizenCountry = countryCode; + } + + /** + * Gets the sp country. + * + * @return The sp country value. + */ + public String getSpCountry() { + return spCountry; + } + + /** + * Sets the sp country. + * + * @param sPCountry the new sp country value. + */ + public void setSpCountry(final String sPCountry) { + this.spCountry = sPCountry; + } + + /** + * Gets the issuer. + * + * @return The issuer value. + */ + public String getIssuer() { + return issuer; + } + + /** + * Sets the issuer. + * + * @param samlIssuer the new issuer value. + */ + public void setIssuer(final String samlIssuer) { + this.issuer = samlIssuer; + } + + /** + * Gets the SAML Token. + * + * @return The SAML Token value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Sets the SAML Token. + * + * @param samlToken The new SAML Token value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Gets the country. + * + * @return The country value. + */ + public String getCountry() { + return country; + } + + /** + * Sets the country. + * + * @param nCountry the new country value. + */ + public void setCountry(final String nCountry) { + this.country = nCountry; + } + + /** + * Getter for the qaa value. + * + * @return The qaa value value. + */ + public int getQaa() { + return qaa; + } + + /** + * Setter for the qaa value. + * + * @param qaaLevel The new qaa value. + */ + public void setQaa(final int qaaLevel) { + this.qaa = qaaLevel; + } + + /** + * Getter for the serviceURL value. + * + * @return The serviceURL value. + */ + public String getAssertionConsumerServiceURL() { + return serviceURL; + } + + /** + * Setter for the serviceURL value. + * + * @param newServiceURL the assertion consumer service URL. + */ + public void setAssertionConsumerServiceURL(final String newServiceURL) { + this.serviceURL = newServiceURL; + } + + /** + * Getter for the destination value. + * + * @return The destination value. + */ + public String getDestination() { + return destination; + } + + /** + * Setter for the destination value. + * + * @param detination the new destination value. + */ + public void setDestination(final String detination) { + this.destination = detination; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param newSamlId the new samlId value. + */ + public void setSamlId(final String newSamlId) { + this.samlId = newSamlId; + } + + /** + * Getter for the providerName value. + * + * @return The provider name value. + */ + public String getProviderName() { + return providerName; + } + + /** + * Setter for the providerName value. + * + * @param samlProvider the provider name value. + */ + public void setProviderName(final String samlProvider) { + this.providerName = samlProvider; + } + + /** + * Getter for the attributeList value. + * + * @return The attributeList value. + * + * @see IPersonalAttributeList + */ + public IPersonalAttributeList getPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the attributeList value. + * + * @param attrList the personal attribute list value. + * + * @see IPersonalAttributeList + */ + public void setPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.attributeList = attrList; + } + } + + /** + * Getter for the distinguishedName value. + * + * @return The distinguishedName value. + */ + public String getDistinguishedName() { + return distinguishedName; + } + + /** + * Setter for the distinguishedName value. + * + * @param certDN the distinguished name value. + */ + public void setDistinguishedName(final String certDN) { + this.distinguishedName = certDN; + } + + /** + * Gets the service provider sector. + * + * @return The service provider sector value. + */ + public String getSpSector() { + return spSector; + } + + /** + * Sets the service provider sector. + * + * @param samlSPSector the new service provider sector value. + */ + public void setSpSector(final String samlSPSector) { + this.spSector = samlSPSector; + } + + /** + * Gets the service provider institution. + * + * @return The service provider institution value. + */ + public String getSpInstitution() { + return spInstitution; + } + + /** + * Sets the service provider institution. + * + * @param samlSPInst the new service provider institution value. + */ + public void setSpInstitution(final String samlSPInst) { + this.spInstitution = samlSPInst; + } + + /** + * Gets the service provider application. + * + * @return The service provider application value. + */ + public String getSpApplication() { + return spApplication; + } + + /** + * Sets the service provider application. + * + * @param samlSPApp the new service provider application value. + */ + public void setSpApplication(final String samlSPApp) { + this.spApplication = samlSPApp; + } + + /** + * Checks if is eId sector share. + * + * @return true, if is eId sector share. + */ + public boolean isEIDSectorShare() { + return eIDSectorShare; + } + + /** + * Sets the eId sector share. + * + * @param eIdSectorShare the new eId sector share value. + */ + public void setEIDSectorShare(final boolean eIdSectorShare) { + this.eIDSectorShare = eIdSectorShare; + } + + /** + * Checks if is eId cross sector share. + * + * @return true, if is eId cross sector share. + */ + public boolean isEIDCrossSectorShare() { + return eIDCrossSectorShare; + } + + /** + * Sets the eId cross sector share. + * + * @param eIdCrossSectorShare the new eId cross sector share value. + */ + public void setEIDCrossSectorShare(final boolean eIdCrossSectorShare) { + this.eIDCrossSectorShare = eIdCrossSectorShare; + } + + /** + * Checks if is eId cross border share. + * + * @return true, if is eId cross border share. + */ + public boolean isEIDCrossBorderShare() { + return eIDCrossBorderShare; + } + + /** + * Sets the eId cross border share. + * + * @param eIdCrossBorderShare the new eId cross border share value. + */ + public void setEIDCrossBorderShare(final boolean eIdCrossBorderShare) { + this.eIDCrossBorderShare = eIdCrossBorderShare; + } + + /** + * Returns a copy of this STORKAuthnRequest instance. + * + * @return The copy of this STORKAuthnRequest. + * @throws CloneNotSupportedException on clone exception + */ + @Override + public Object clone() throws CloneNotSupportedException{ + STORKAuthnRequest storkAuthnReq = null; + try { + storkAuthnReq = (STORKAuthnRequest) super.clone(); + storkAuthnReq.setPersonalAttributeList(getPersonalAttributeList()); + storkAuthnReq.setTokenSaml(getTokenSaml()); + } catch (final CloneNotSupportedException e) { + // assert false; + LOG.trace("[PersonalAttribute] Nothing to do."); + } + + return storkAuthnReq; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnResponse.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnResponse.java.svn-base new file mode 100644 index 000000000..aa98974f6 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnResponse.java.svn-base @@ -0,0 +1,309 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import org.apache.log4j.Logger; +import org.joda.time.DateTime; + +/** + * This class is a bean used to store the information relative to the + * STORKAuthnResponse. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class STORKAuthnResponse { + + /** Response Id. */ + private String samlId; + + /** Authentication failed? */ + private boolean fail; + + /** Status code. */ + private String statusCode; + + /** Secondary status code. */ + private String subStatusCode; + + /** Audience restriction. */ + private transient String audienceRest; + + /** Error message. */ + private String message; + + /** Id of the request that originated this response. */ + private String inResponseTo; + + /** Expiration date. */ + private DateTime notOnOrAfter; + + /** Creation date. */ + private DateTime notBefore; + + /** The SAML token. */ + private byte[] tokenSaml = new byte[0]; + + /** Country. */ + private String country; + + /** Citizen's personal attribute list. */ + private transient IPersonalAttributeList attributeList = new PersonalAttributeList(); + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(STORKAuthnResponse.class.getName()); + + /** + * Getter for the subStatusCode. + * + * @return The subStatusCode value. + */ + public String getSubStatusCode() { + return subStatusCode; + } + + /** + * Setter for the subStatusCode. + * + * @param samlSubStatusCode the new subStatusCode value. + */ + public void setSubStatusCode(final String samlSubStatusCode) { + this.subStatusCode = samlSubStatusCode; + } + + /** + * Getter for audienceRest. + * + * @return The audienceRest value. + */ + public String getAudienceRestriction() { + return audienceRest; + } + + /** + * Setter for audienceRest. + * + * @param audRest the new audienceRest value. + */ + public void setAudienceRestriction(final String audRest) { + this.audienceRest = audRest; + } + + /** + * Getter for the samlToken. + * + * @return The samlToken value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Setter for samlToken. + * + * @param samlToken the new tokenSaml value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Getter for the country name. + * + * @return The country name value. + */ + public String getCountry() { + return country; + } + + /** + * Setter for the country name. + * + * @param cCountry the new country name value. + */ + public void setCountry(final String cCountry) { + this.country = cCountry; + } + + /** + * Getter for pal value. + * + * @return The pal value. + * + * @see PersonalAttributeList + */ + public IPersonalAttributeList getPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the Personal Attribute List value. + * + * @param attrList the new value. + * + * @see PersonalAttributeList + */ + public void setPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.attributeList = attrList; + } + } + + /** + * Getter for the inResponseTo value. + * + * @return The inResponseTo value. + */ + public String getInResponseTo() { + return inResponseTo; + } + + /** + * Setter for the inResponseTo value. + * + * @param samlInResponseTo the new inResponseTo value. + */ + public void setInResponseTo(final String samlInResponseTo) { + this.inResponseTo = samlInResponseTo; + } + + /** + * Getter for the fail value. + * + * @return The fail value. + */ + public boolean isFail() { + return fail; + } + + /** + * Setter for the fail value. + * + * @param failVal the new fail value. + */ + public void setFail(final boolean failVal) { + this.fail = failVal; + } + + /** + * Getter for the message value. + * + * @return The message value. + */ + public String getMessage() { + return message; + } + + /** + * Setter for the message value. + * + * @param msg the new message value. + */ + public void setMessage(final String msg) { + this.message = msg; + } + + /** + * Getter for the statusCode value. + * + * @return The statusCode value. + */ + public String getStatusCode() { + return statusCode; + } + + /** + * Setter for the statusCode value. + * + * @param status the new statusCode value. + */ + public void setStatusCode(final String status) { + this.statusCode = status; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param nSamlId the new samlId value. + */ + public void setSamlId(final String nSamlId) { + this.samlId = nSamlId; + } + + /** + * Getter for the notOnOrAfter value. + * + * @return The notOnOrAfter value. + * + * @see DateTime + */ + public DateTime getNotOnOrAfter() { + return this.notOnOrAfter; + } + + /** + * Setter for the notOnOrAfter value. + * + * @param nOnOrAfter the new notOnOrAfter value. + * + * @see DateTime + */ + public void setNotOnOrAfter(final DateTime nOnOrAfter) { + this.notOnOrAfter = nOnOrAfter; + } + + /** + * Getter for the notBefore value. + * + * @return The notBefore value. + * + * @see DateTime + */ + public DateTime getNotBefore() { + return notBefore; + } + + /** + * Setter for the notBefore value. + * + * @param nBefore the new notBefore value. + * + * @see DateTime + */ + public void setNotBefore(final DateTime nBefore) { + this.notBefore = nBefore; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKStatusCode.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKStatusCode.java.svn-base new file mode 100644 index 000000000..a9c4a156b --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKStatusCode.java.svn-base @@ -0,0 +1,68 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains the SAML Token Status Code. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.13 $, $Date: 2010-11-17 05:15:28 $ + */ +public enum STORKStatusCode { + + /** URI for Requester status code. */ + REQUESTER_URI("urn:oasis:names:tc:SAML:2.0:status:Requester"), + + /** URI for Responder status code. */ + RESPONDER_URI("urn:oasis:names:tc:SAML:2.0:status:Responder"), + + /** URI for Success status code. */ + SUCCESS_URI("urn:oasis:names:tc:SAML:2.0:status:Success"), + + /** Attribute is Available. */ + STATUS_AVAILABLE("Available"), + + /** Attribute is NotAvailable. */ + STATUS_NOT_AVAILABLE("NotAvailable"), + + /** Attribute is Withheld. */ + STATUS_WITHHELD("Withheld"); + + /** + * Represents the constant's value. + */ + private String value; + + /** + * Solo Constructor. + * + * @param val The Constant value. + */ + private STORKStatusCode(final String val) { + + this.value = val; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + + return value; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKSubStatusCode.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKSubStatusCode.java.svn-base new file mode 100644 index 000000000..0a711c9b7 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKSubStatusCode.java.svn-base @@ -0,0 +1,71 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains the SAML Token Sub Status Code. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.7 $, $Date: 2010-11-17 05:15:28 $ + */ +public enum STORKSubStatusCode { + + /** URI for AuthnFailed status code. */ + AUTHN_FAILED_URI("urn:oasis:names:tc:SAML:2.0:status:AuthnFailed"), + + /** URI for InvalidAttrNameOrValue status code. */ + INVALID_ATTR_NAME_VALUE_URI( + "urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue"), + + /** URI for InvalidNameIDPolicy status code. */ + INVALID_NAMEID_POLICY_URI( + "urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy"), + + /** URI for VersionMismatch status code. */ + VERSION_MISMATCH_URI("urn:oasis:names:tc:SAML:2.0:status:VersionMismatch"), + + /** URI for RequestDenied status code. */ + REQUEST_DENIED_URI("urn:oasis:names:tc:SAML:2.0:status:RequestDenied"), + + /** URI for QaaNotSupported status code. */ + QAA_NOT_SUPPORTED( + "http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported"); + + /** + * Represents the constant's value. + */ + private String value; + + /** + * Solo Constructor. + * + * @param val The Constant value. + */ + private STORKSubStatusCode(final String val) { + + this.value = val; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + + return value; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/package-info.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..19d45aaa2 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,9 @@ +/** + * Common Authentication Service functionalities to be deployed in every PEPS + * is contained in this package. + * In particular, it contains the SAML Engine that implements the SAML messages + * management + * + * @since 1.0 + */ +package eu.stork.peps.auth.commons; diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeConstants.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeConstants.java new file mode 100644 index 000000000..09769641c --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeConstants.java @@ -0,0 +1,72 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains all the STORK PEPS, Commons and Specific errors + * constant identifiers. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.2 $, $Date: 2010-11-17 05:15:28 $ + */ +public enum AttributeConstants { + + /** + * Represents the attribute's name index. + */ + ATTR_NAME_INDEX(0), + /** + * Represents the attribute's type index. + */ + ATTR_TYPE_INDEX(1), + /** + * Represents the attribute's value index. + */ + ATTR_VALUE_INDEX(2), + /** + * Represents the attribute's status index. + */ + ATTR_STATUS_INDEX(3), + /** + * Represents the number of allowed tuples. + */ + NUMBER_TUPLES(4); + + /** + * Represents the constant's value. + */ + private int attribute; + + /** + * Solo Constructor. + * + * @param attr The Attribute Constant value. + */ + AttributeConstants(final int attr) { + + this.attribute = attr; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public int intValue() { + + return attribute; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java new file mode 100644 index 000000000..013f4caf3 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java @@ -0,0 +1,74 @@ +package eu.stork.peps.auth.commons; + +/** + * This class is a bean used to store the information relative to the Attribute Provider. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.00 $, $Date: 2013-09-17 $ + */ +public final class AttributeProvider { + + /** + * Provider Id. + */ + private String providerId; + + /** + * Provider Name. + */ + private String providerName; + + /** + * Attribute Provider Constructor. + * + * @param pId Id of the Attribute Provider. + * @param pName Name of the Attribute Provider. + */ + public AttributeProvider(final String pId, final String pName) { + + this.providerId = pId; + this.providerName = pName; + } + + /** + * Getter for the providerId value. + * + * @return The providerId value. + */ + public String getProviderId() { + + return providerId; + } + + /** + * Setter for the providerId value. + * + * @param pId Id of the Attribute Provider. + */ + public void setProviderId(final String pId) { + + this.providerId = pId; + } + + /** + * Getter for the providerName value. + * + * @return The providerName value. + */ + public String getProviderName() { + + return providerName; + } + + /** + * Setter for the providerName value. + * + * @param name Name of the Attribute Provider. + */ + public void setProviderName(final String name) { + + this.providerName = name; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java new file mode 100644 index 000000000..8806ba866 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java @@ -0,0 +1,94 @@ +package eu.stork.peps.auth.commons; + +import java.util.Iterator; +import java.util.LinkedHashMap; + +import org.apache.log4j.Logger; + +/** + * Implementation of the AttributeProviderMap using a LinkedHashMap. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.01 $, $Date: 2013-09-20 $ + * + * @see LinkedHashMap + */ +public class AttributeProvidersMap extends LinkedHashMap + implements IAttributeProvidersMap { + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(AttributeProvidersMap.class.getName()); + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 8949081185106296122L; + + /** + * {@inheritDoc} + */ + @Override + public IPersonalAttributeList get(AttributeSource key) { + return this.get((Object) key); + } + + /** + * {@inheritDoc} + */ + @Override + public IPersonalAttributeList remove(AttributeSource key) { + return this.remove((Object) key); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean containsKey(AttributeSource key) { + return this.containsKey((Object) key); + } + + /** + * {@inheritDoc} + */ + @Override + public Iterator keyIterator() { + return this.keySet().iterator(); + } + + public void trace() { + Iterator iterator; + Iterator iterator2; + AttributeSource source; + IPersonalAttributeList pal; + PersonalAttribute pa; + + iterator = this.keyIterator(); + LOG.trace("Start dumping of AttributeProvidersMap\n======================="); + while (iterator.hasNext()) { + source = iterator.next(); + + LOG.trace("Source details: type [" + source.getSourceType() + "], URL [" + source.getProviderURL() + "]"); + + if(source.getSourceType() == AttributeSource.SOURCE_LOCAL_APROVIDER) + LOG.trace("-> Attribute Provider: ID [" + source.getProvider().getProviderId() + "], name [" + source.getProvider().getProviderName() + "]"); + else + LOG.trace("-> Country: ID [" + source.getCountry().getCountryId() + "], name [" + source.getCountry().getCountryName() + "]"); + + pal = this.get(source); + LOG.trace("++++++++=>"); + iterator2 = pal.iterator(); + while (iterator2.hasNext()) { + pa = iterator2.next(); + + LOG.trace("-> Citizen Attribute: name [" + pa.getName() + "], name [" + pa.isRequired() + "]"); + } + LOG.trace("<=++++++++"); + + LOG.trace("-----------------------"); + } + LOG.trace("END\n======================="); + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java new file mode 100644 index 000000000..4b9dc33e9 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java @@ -0,0 +1,119 @@ +package eu.stork.peps.auth.commons; + +/** + * This class is a bean used to store the information relative to the Attribute Source (either AttributeProvider or Country). + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.00 $, $Date: 2013-09-19 $ + */ +public final class AttributeSource { + public static final int SOURCE_LOCAL_APROVIDER = 1; + public static final int SOURCE_REMOTE_COUNTRY = 2; + + /** + * Provider source. + */ + private int sourceType; + + /** + * Provider URL. + */ + private String providerURL; + + /** + * The local Attribute Provider. + */ + private AttributeProvider provider; + + /** + * The remote Country. + */ + private Country country; + + /** + * Attribute Source Constructor. + * + * @param provider The local Attribute Provider. + * @param pURL URL of the Attribute Provider. + */ + public AttributeSource(final AttributeProvider provider, final String pURL) { + this.setSourceType(SOURCE_LOCAL_APROVIDER); + + this.setProvider(provider); + this.setProviderURL(pURL); + } + + /** + * Attribute Source Constructor. + * + * @param country The remote Country. + * @param pURL URL of the Country. + */ + public AttributeSource(final Country country, final String pURL) { + this.setSourceType(SOURCE_REMOTE_COUNTRY); + + this.setCountry(country); + this.setProviderURL(pURL); + } + + /** + * @param sourceType the sourceType to set + */ + public void setSourceType(int sourceType) { + this.sourceType = sourceType; + } + + /** + * @return the sourceType + */ + public int getSourceType() { + return sourceType; + } + + /** + * @param providerURL the providerURL to set + */ + public void setProviderURL(String providerURL) { + this.providerURL = providerURL; + } + + /** + * @return the providerURL + */ + public String getProviderURL() { + return providerURL; + } + + /** + * @param provider the provider to set + */ + public void setProvider(AttributeProvider provider) { + this.setSourceType(SOURCE_LOCAL_APROVIDER); + + this.provider = provider; + } + + /** + * @return the provider + */ + public AttributeProvider getProvider() { + return provider; + } + + /** + * @param country the country to set + */ + public void setCountry(Country country) { + this.setSourceType(SOURCE_REMOTE_COUNTRY); + + this.country = country; + } + + /** + * @return the country + */ + public Country getCountry() { + return country; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java new file mode 100644 index 000000000..84e3576e5 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java @@ -0,0 +1,231 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.commons.lang.StringUtils; + +/** + * This class holds static helper methods. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.5 $, $Date: 2010-12-15 23:19:59 $ + */ +public final class AttributeUtil { + + /** + * Private constructor. Prevents the class from being instantiated. + */ + private AttributeUtil() { + // empty constructor + } + + /** + * Safe escape any given string. + * + * @param value The HTTP Value to escaped. + * + * @return The value escaped value. + */ + public static String escape(final String value) { + + final String attrSep = PEPSValues.ATTRIBUTE_SEP.toString(); + final String attrTupleSep = PEPSValues.ATTRIBUTE_TUPLE_SEP.toString(); + final String attrValueSep = PEPSValues.ATTRIBUTE_VALUE_SEP.toString(); + + final String escAttrSep = "%" + (int) attrSep.charAt(0); + final String escAttrTupleSep = "%" + (int) attrTupleSep.charAt(0); + final String escAttrValueSep = "%" + (int) attrValueSep.charAt(0); + + return value.replace(attrSep, escAttrSep) + .replace(attrTupleSep, escAttrTupleSep) + .replace(attrValueSep, escAttrValueSep); + } + + /** + * Unescape any given string. + * + * @param value The HTTP Value to be unescaped. + * + * @return The value unescaped value. + */ + public static String unescape(final String value) { + final String attrSep = PEPSValues.ATTRIBUTE_SEP.toString(); + final String attrTupleSep = PEPSValues.ATTRIBUTE_TUPLE_SEP.toString(); + final String attrValueSep = PEPSValues.ATTRIBUTE_VALUE_SEP.toString(); + + final String escAttrSep = "%" + (int) attrSep.charAt(0); + final String escAttrTupleSep = "%" + (int) attrTupleSep.charAt(0); + final String escAttrValueSep = "%" + (int) attrValueSep.charAt(0); + + return value.replace(escAttrSep, attrSep) + .replace(escAttrTupleSep, attrTupleSep) + .replace(escAttrValueSep, attrValueSep); + } + + /** + * Appends the string representation of an object to a StringBuilder. + * + * @param strBuilder The StringBuilder to append to. + * @param val The string representation of an object. + */ + public static void appendIfNotNull(final StringBuilder strBuilder, + final Object val) { + + if (val != null) { + strBuilder.append(val); + } + } + + /** + * Given a separator and a list of strings, joins the list, as a string, + * separated by the separator string. + * + * @param list The list of strings to join. + * @param separator The separator string. + * @return the list, as a string, separated by the separator string. + */ + public static String listToString(final List list, + final String separator) { + + final StringBuilder strBuilder = new StringBuilder(); + for (final String s : list) { + if (!StringUtils.isEmpty(s)) { + strBuilder.append(AttributeUtil.escape(s) + separator); + } + } + return strBuilder.toString(); + } + + /** + * Given a separator and a map of strings to strings, joins the map, as a + * string, separated by the separator string with the pair key/value + * concatenated with a '='. + * + * @param map The map of strings to join. + * @param separator The separator string. + * + * @return the map of strings, as a string, separated by the separator string + * with the pair key/value concatenated with a '='. + */ + public static String mapToString(final Map map, + final String separator) { + + final StringBuilder strBuilder = new StringBuilder(); + final Iterator> valuesIt = map.entrySet().iterator(); + while (valuesIt.hasNext()) { + final Entry entry = valuesIt.next(); + strBuilder.append(entry.getKey()); + strBuilder.append('='); + strBuilder.append(AttributeUtil.escape(entry.getValue())); + strBuilder.append(separator); + } + return strBuilder.toString(); + } + + /** + * Validates the attribute value format. + * + * @param value The attribute value to validate. + * + * @return true if value has a valid format. + */ + public static boolean isValidValue(final String value) { + boolean retVal = false; + if (value != null && value.charAt(0) == '[' && value.endsWith("]")) { + final String tmpAttrValue = value.substring(1, value.length() - 1); + final String[] vals = + tmpAttrValue.split(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + if (tmpAttrValue.length() >= 0 + || (vals.length > 0 && vals[0].length() > 0)) { + retVal = true; + } + } + return retVal; + } + + /** + * Validates the attribute type value. It's case insensitive. E.g. return true + * value to: a) "true", "TRUE", "True", ... b) "false", "FALSE", "False", ... + * + * @param type The attribute type value. + * + * @return true if type has a true or false (case insensitive) value. + */ + public static boolean isValidType(final String type) { + return StringUtils.isNotEmpty(type) && (PEPSValues.TRUE.toString().equalsIgnoreCase(type) || PEPSValues.FALSE.toString().equalsIgnoreCase(type)) ; + } + + /** + * Validates the Personal attribute tuple. E.g. name:type:[value]:status + * + * @param tuples The Personal attribute's tuple. + * + * @return true if the tuples' format is valid. + * + * @see PEPSUtil#validateParameter(String, String, String) + * @see String#equalsIgnoreCase(String) + */ + public static boolean hasValidTuples(final String[] tuples) { + boolean retVal = false; + + int numberTuples = AttributeConstants.NUMBER_TUPLES.intValue(); + if (tuples != null && tuples.length == numberTuples) { + // validate attrName + final int attrNameIndex = AttributeConstants.ATTR_NAME_INDEX.intValue(); + final int attrTypeIndex = AttributeConstants.ATTR_TYPE_INDEX.intValue(); + final int attrValueIndex = AttributeConstants.ATTR_VALUE_INDEX.intValue(); + + retVal = + StringUtils.isNotEmpty(tuples[attrNameIndex]) + && StringUtils.isNotEmpty(tuples[attrTypeIndex]) + && StringUtils.isNotEmpty(tuples[attrValueIndex]) + && AttributeUtil.isValidType(tuples[attrTypeIndex]) + && AttributeUtil.isValidValue(tuples[attrValueIndex]); + } + return retVal; + } + + /** + * Check if all mandatory attributes have values. + * + * @param personalAttrList The Personal Attributes List. + * + * @return true if all mandatory attributes have values, false if at least one + * attribute doesn't have value. + */ + public static boolean checkMandatoryAttributes( + final IPersonalAttributeList personalAttrList) { + + final Iterator itAttributes = + personalAttrList.values().iterator(); + boolean retVal = true; + while (itAttributes.hasNext() && retVal) { + final PersonalAttribute attr = itAttributes.next(); + if (attr.isRequired() + && !STORKStatusCode.STATUS_AVAILABLE.toString() + .equals(attr.getStatus())) { + retVal = false; + } + } + return retVal; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java new file mode 100644 index 000000000..2245178f4 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java @@ -0,0 +1,123 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.ArrayList; +import java.util.List; + +/** + * This class is a bean used to store the information relative to the Citizen + * Consent. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class CitizenConsent { + + /** + * Mandatory attributes list. + */ + private List mandatoryList; + + /** + * Optional attributes list. + */ + private List optionalList; + + /** + * Citizen Consent default Constructor. + */ + public CitizenConsent() { + this.mandatoryList = new ArrayList(); + this.optionalList = new ArrayList(); + } + + /** + * Getter for the mandatoryList value. + * + * @return The mandatoryList value. + */ + public List getMandatoryList() { + return this.mandatoryList; + } + + /** + * Setter for the mandatoryList value. + * + * @param mandatoryAttrList Mandatory parameters list. + */ + public void setMandatoryList(final List mandatoryAttrList) { + this.mandatoryList = mandatoryAttrList; + } + + /** + * Setter for some mandatoryAttribute. Adds the input parameter to the + * mandatoryList. + * + * @param mandatoryAttr Attribute to add to the mandatoryList. + */ + public void setMandatoryAttribute(final String mandatoryAttr) { + this.mandatoryList.add(mandatoryAttr); + } + + /** + * Getter for the optionalList value. + * + * @return The optionalList value. + */ + public List getOptionalList() { + return optionalList; + } + + /** + * Setter for the optionalList value. + * + * @param optAttrList Optional parameters list. + */ + public void setOptionalList(final List optAttrList) { + this.optionalList = optAttrList; + } + + /** + * Setter for some optionalAttr. Adds the input parameter to the optionalList. + * + * @param optionalAttr Attribute to add to the optionalList. + */ + public void setOptionalAttribute(final String optionalAttr) { + this.optionalList.add(optionalAttr); + } + + /** + * Returns a string in the following format. "Mandatory attributes: + * mandatoryAttr1;mandatoryAttr2;mandatoryAttrN Optional attributes: + * optionalAttr1;optionalAttr2;optionalAttrN" + * + * @return {@inheritDoc} + */ + public String toString() { + final StringBuilder strbldr = new StringBuilder(); + strbldr.append("Mandatory attributes: "); + for (String str : mandatoryList) { + strbldr.append(str + ";"); + } + strbldr.append(" Optional attributes: "); + for (String str : optionalList) { + strbldr.append(str + ";"); + } + return strbldr.toString(); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Country.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Country.java new file mode 100644 index 000000000..001f9317a --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Country.java @@ -0,0 +1,95 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; + +/** + * This class is a bean used to store the information relative to the Country. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.10 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class Country implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1135994036496370993L; + +/** + * Country Id. + */ + private String countryId; + + /** + * Country Name. + */ + private String countryName; + + /** + * Country Constructor. + * + * @param cId Id of the Country. + * @param cName Name of the Country. + */ + public Country(final String cId, final String cName) { + + this.countryId = cId; + this.countryName = cName; + } + + /** + * Getter for the countryId value. + * + * @return The countryId value. + */ + public String getCountryId() { + + return countryId; + } + + /** + * Setter for the countryId value. + * + * @param cId Id of the Country. + */ + public void setCountryId(final String cId) { + + this.countryId = cId; + } + + /** + * Getter for the countryName value. + * + * @return The countryName value. + */ + public String getCountryName() { + + return countryName; + } + + /** + * Setter for the countryName value. + * + * @param name Name of the Country. + */ + public void setCountryName(final String name) { + + this.countryName = name; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CountryCodes.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CountryCodes.java new file mode 100644 index 000000000..54345f3ea --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CountryCodes.java @@ -0,0 +1,79 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.Arrays; +import java.util.List; + +/** + * This class contains all the ISO 3166-1 Alpha 3 Country Codes. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.2 $, $Date: 2011-04-14 00:24:56 $ + */ +public final class CountryCodes { + + /** + * Private Constructor. + */ + private CountryCodes() { + + } + + /** + * ISO 3166-1 Alpha 3 Country Codes. + */ + private static List countrysAlpha3 = Arrays.asList("ABW", "AFG", + "AGO", "AIA", "ALA", "ALB", "AND", "ANT", "ARE", "ARG", "ARM", "ASM", + "ATA", "ATF", "ATG", "AUS", "AUT", "AZE", "BDI", "BEL", "BEN", "BES", + "BFA", "BGD", "BGR", "BHR", "BHS", "BIH", "BLM", "BLR", "BLZ", "BMU", + "BOL", "BRA", "BRB", "BRN", "BTN", "BUR", "BVT", "BWA", "BYS", "CAF", + "CAN", "CCK", "CHE", "CHL", "CHN", "CIV", "CMR", "COD", "COG", "COK", + "COL", "COM", "CPV", "CRI", "CSK", "CUB", "CUW", "CXR", "CYM", "CYP", + "CZE", "DEU", "DJI", "DMA", "DNK", "DOM", "DZA", "ECU", "EGY", "ERI", + "ESH", "ESP", "EST", "ETH", "FIN", "FJI", "FLK", "FRA", "FRO", "FSM", + "GAB", "GBR", "GEO", "GGY", "GHA", "GIB", "GIN", "GLP", "GMB", "GNB", + "GNQ", "GRC", "GRD", "GRL", "GTM", "GUF", "GUM", "GUY", "HKG", "HMD", + "HND", "HRV", "HTI", "HUN", "IDN", "IMN", "IND", "IOT", "IRL", "IRN", + "IRQ", "ISL", "ISR", "ITA", "JAM", "JEY", "JOR", "JPN", "KAZ", "KEN", + "KGZ", "KHM", "KIR", "KNA", "KOR", "KWT", "LAO", "LBN", "LBR", "LBY", + "LCA", "LIE", "LKA", "LSO", "LTU", "LUX", "LVA", "MAC", "MAF", "MAR", + "MCO", "MDA", "MDG", "MDV", "MEX", "MHL", "MKD", "MLI", "MLT", "MMR", + "MNE", "MNG", "MNP", "MOZ", "MRT", "MSR", "MTQ", "MUS", "MWI", "MYS", + "MYT", "NAM", "NCL", "NER", "NFK", "NGA", "NIC", "NIU", "NLD", "NOR", + "NPL", "NRU", "NZL", "OMN", "PAK", "PAN", "PCN", "PER", "PHL", "PLW", + "PNG", "POL", "PRI", "PRK", "PRT", "PRY", "PSE", "PYF", "QAT", "REU", + "ROM", "ROU", "RUS", "RWA", "SAU", "SCG", "SDN", "SEN", "SGP", "SGS", + "SHN", "SJM", "SLB", "SLE", "SLV", "SMR", "SOM", "SPM", "SRB", "STP", + "SUR", "SVK", "SVN", "SXW", "SWE", "SWZ", "SYC", "SYR", "TCA", "TCD", + "TGO", "THA", "TJK", "TKL", "TKM", "TLS", "TMP", "TON", "TTO", "TUN", + "TUR", "TUV", "TWN", "TZA", "UGA", "UKR", "UMI", "URY", "USA", "UZB", + "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF", "WSM", "YEM", + "YUG", "ZAF", "ZAR", "ZMB", "ZWE"); + + /** + * Searches the CountryCode (3166-1 alpha3 format) an return true if it + * exists. + * + * @param countryCode The Country code to search. + * + * @return true if the CountryCode exists, false otherwise. + */ + public static boolean hasCountryCodeAlpha3(final String countryCode) { + + return CountryCodes.countrysAlpha3.contains(countryCode); + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/DateUtil.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/DateUtil.java new file mode 100644 index 000000000..9c0bd6775 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/DateUtil.java @@ -0,0 +1,169 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.sql.Timestamp; +import java.util.GregorianCalendar; + +import org.apache.log4j.Logger; +import org.joda.time.DateTime; +import org.joda.time.Years; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +import eu.stork.peps.auth.commons.exceptions.SecurityPEPSException; + +/** + * This class holds static helper methods for Date Operations. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.4 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class DateUtil { + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(DateUtil.class.getName()); + + /** + * yyyy Date format size. + */ + private static final int YEAR_DATE_SIZE = 4; + + /** + * yyyyMM Date format size. + */ + private static final int MONTH_DATE_SIZE = 6; + + /** + * Private constructor. Prevents the class from being instantiated. + */ + private DateUtil() { + // empty constructor + } + + /** + * Fulfils dateValue with a valid date. The following roles are applied: a) If + * the dateValue only contains the year then fulfils with last year's day. + * e.g. this method returns 19951231 to the 1995 dateValue. b) If the + * dateValue contains the year and the month then fulfils with last month's + * day. e.g. this method returns 19950630 to the 199505 dateValue. + * + * @param dateValue The date to be fulfilled. + * + * @return The dateValue fulfilled. + */ + private static String fulfilDate(final String dateValue) { + + final StringBuffer strBuf = new StringBuffer(); + strBuf.append(dateValue); + // if the IdP just provides the year then we must fullfil the date. + if (dateValue.length() == YEAR_DATE_SIZE) { + strBuf.append(PEPSValues.LAST_MONTH.toString()); + } + // if the IdP provides the year and the month then we must fullfil the + // date. + if (dateValue.length() == MONTH_DATE_SIZE + || strBuf.length() == MONTH_DATE_SIZE) { + // IdP doesn't provide the day, so we will use DateTime to + // calculate it. + final String noDayCons = PEPSValues.NO_DAY_DATE_FORMAT.toString(); + final DateTimeFormatter fmt = DateTimeFormat.forPattern(noDayCons); + final DateTime dateTime = fmt.parseDateTime(strBuf.toString()); + // Append the last month's day. + strBuf.append(dateTime.dayOfMonth().withMaximumValue().getDayOfMonth()); + } + + return strBuf.toString(); + } + + /** + * Validates the dateValue format: a) if has a valid size; b) if has a numeric + * value; Note: dateValue must have the format yyyyMMdd. + * + * @param dateValueTmp The date to be validated. + * @param pattern The accepted date format. + * + * @return true if the date has a valid format. + */ + public static boolean isValidFormatDate(final String dateValueTmp, + final String pattern) { + + boolean retVal = true; + try { + final String dateValue = DateUtil.fulfilDate(dateValueTmp); + + final DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern); + fmt.parseDateTime(dateValue); + } catch (final Exception e) { + // We catch Exception because we only have to return false + // value! + retVal = false; + } + return retVal; + } + + /** + * Calculates the age for a given date string. + * + * @param dateVal The date to be validated. + * @param now The current date. + * @param pattern The date pattern. + * + * @return The age value. + */ + public static int calculateAge(final String dateVal, final DateTime now, + final String pattern) { + + if (DateUtil.isValidFormatDate(dateVal, pattern)) { + try { + final String dateValueTemp = DateUtil.fulfilDate(dateVal); + final DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern); + final DateTime dateTime = fmt.parseDateTime(dateValueTemp); + // Calculating age + final Years age = Years.yearsBetween(dateTime, now); + + return age.getYears(); + } catch (final IllegalArgumentException e) { + LOG.warn("Invalid date format (" + pattern + + ") or an invalid dateValue."); + throw new SecurityPEPSException( + PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorCode()), + PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorMessage()), + e); + } + } else { + LOG.warn("Couldn't calculate Age, invalid date!"); + throw new SecurityPEPSException( + PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorCode()), + PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorMessage())); + } + + } + + /** + * Generates the current timestamp. + * + * @return timestamp The current timestamp + */ + public static Timestamp currentTimeStamp() { + final GregorianCalendar cal = new GregorianCalendar(); + final long millis = cal.getTimeInMillis(); + return new Timestamp(millis); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java new file mode 100644 index 000000000..733399ca3 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java @@ -0,0 +1,82 @@ +package eu.stork.peps.auth.commons; + +import java.util.Iterator; + +/** + * Interface for Attributes Providers map. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.00 $, $Date: 2013-09-20 $ + */ +public interface IAttributeProvidersMap { + + /** + * Returns the object associated the the given key. + * + * @param key with which the specified value is to be associated. + * + * @return The object associated the the given key. + */ + IPersonalAttributeList get(AttributeSource key); + + /** + * Associates a key to a value, and inserts them in the session object. + * + * @param key with which the specified value is to be associated. + * @param value to be associated with the specified key. + * + * @return previous value associated with specified key, or null if there was + * no mapping for key. A null return can also indicate that the map + * previously associated null with the specified key. + */ + Object put(AttributeSource key, IPersonalAttributeList value); + + /** + * Removes the mapping for this key. + * + * @param key with which the specified value is to be associated. + * + * @return previous value associated with specified key, or null if there was + * no mapping for key. A null return can also indicate that the map + * previously associated null with the specified key. + */ + IPersonalAttributeList remove(AttributeSource key); + + /** + * Returns the number of key-value mappings in this map. + * + * @return the number of key-value mappings in this map. + */ + int size(); + + /** + * Returns true if this map contains a mapping for the specified key. + * + * @param key with which the specified value is to be associated. + * + * @return true if this map contains a mapping for the specified key. + */ + boolean containsKey(AttributeSource key); + + /** + * Removes all mappings from this map. + */ + void clear(); + + /** + * Returns true if this map contains no key-value mappings. + * + * @return true if this map contains no key-value mappings. + */ + boolean isEmpty(); + + /** + * Returns an Iterator of the keys contained in this map. The implementation must + * take care in order for the Iterator to have predictable order of the returned + * keys. + * + * @return an iterator of the keys contained in this map + */ + Iterator keyIterator(); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java new file mode 100644 index 000000000..83b8e57fe --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java @@ -0,0 +1,140 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.Collection; +import java.util.Iterator; + +/** + * Interface for {@link PersonalAttributeList}. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.16 $, $Date: 2010-11-17 05:15:28 $ + * + * @see PersonalAttribute + */ +@SuppressWarnings("PMD.CloneMethodMustImplementCloneable") +public interface IPersonalAttributeList extends Iterable, + Cloneable { + + /** + * Associates the specified value with the specified key in this Personal + * Attribute List. + * + * @param key with which the specified value is to be associated. + * @param value to be associated with the specified key. + * + * @return the previous value associated with key, or null if there was no + * mapping for key. + * + * @see PersonalAttribute + */ + PersonalAttribute put(String key, PersonalAttribute value); + + /** + * Returns the value to which the specified key is mapped, or null if this map + * contains no mapping for the key. + * + * @param key whose associated value is to be returned. + * + * @return The value to which the specified key is mapped, or null if this map + * contains no mapping for the key. + * + * @see PersonalAttribute + */ + PersonalAttribute get(Object key); + + /** + * Adds to the PersonalAttributeList the given PersonalAttribute. It sets the + * attribute name as the key to the attribute value. + * + * @param value PersonalAttribute to add to the PersonalAttributeList + */ + void add(PersonalAttribute value); + + /** + * Get the size of the Personal Attribute List. + * + * @return size of the Personal Attribute List. + */ + int size(); + + /** + * Checks if the Personal Attribute List contains the given key. + * + * @param key with which the specified value is to be associated. + * + * @return true if the Personal Attribute List contains the given key, false + * otherwise. + */ + boolean containsKey(Object key); + + /** + * Getter for the iterator of the Personal Attribute List values. + * + * @return The iterator for the Personal Attribute List values. + * + * @see PersonalAttribute + */ + Iterator iterator(); + + /** + * Creates a Personal Attribute List from a String representing an Attribute + * List. + * + * @param attrList String Object representing the attribute list. + */ + void populate(String attrList); + + /** + * Removes the mapping for this key from this map if present. + * + * @param key key whose mapping is to be removed from the map. + * @return previous value associated with specified key, or null if + * there was no mapping for key. A null return can also + * indicate that the map previously associated null with the + * specified key. + */ + PersonalAttribute remove(Object key); + + /** + * Returns a collection view of the values contained in this map. The + * collection is backed by the map, so changes to the map are reflected in the + * collection, and vice-versa. The collection supports element removal, which + * removes the corresponding mapping from this map, via the + * Iterator.remove, Collection.remove, removeAll, + * retainAll, and clear operations. It does not support the + * add or addAll operations. + * + * @return a collection view of the values contained in this map. + */ + Collection values(); + + /** + * Returns true if this map contains no key-value mappings. + * + * @return true if this map contains no key-value mappings. + */ + boolean isEmpty(); + + /** + * Returns a copy of this IPersonalAttributeList instance. + * + * @return The copy of this IPersonalAttributeList. + */ + Object clone() throws CloneNotSupportedException; + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IStorkLogger.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IStorkLogger.java new file mode 100644 index 000000000..33eb618f0 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IStorkLogger.java @@ -0,0 +1,239 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * Interface for stork logging. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.10 $, $Date: 2011-02-17 22:44:34 $ + */ +public interface IStorkLogger { + + /** + * Getter for SpApplication. + * + * @return The SpApplication value. + */ + String getSpApplication(); + + /** + * Setter for SpApplication. + * + * @param spApplication The SP Application. + */ + void setSpApplication(String spApplication); + + /** + * Getter for ProviderName. + * + * @return The ProviderName value. + */ + String getProviderName(); + + /** + * Setter for ProviderName. + * + * @param providerName The provider name. + */ + void setProviderName(String providerName); + + /** + * + * Getter for Origin. + * + * @return The Origin value. + * + */ + String getOrigin(); + + /** + * Setter for Origin. + * + * @param origin The origin. + */ + void setOrigin(String origin); + + /** + * + * Getter for QAA Level. + * + * @return The QAA Level value. + * + */ + int getQaaLevel(); + + /** + * Setter for QAA Level. + * + * @param qaaLevel The qaa level. + */ + void setQaaLevel(int qaaLevel); + + /** + * + * Getter for timestamp. + * + * @return The timestamp value. + * + */ + String getTimestamp(); + + /** + * Setter for timestamp. + * + * @param timestamp The request's timestamp. + */ + void setTimestamp(String timestamp); + + /** + * Getter for InResponseTo. + * + * @return The InResponseTo value. + */ + String getInResponseTo(); + + /** + * Setter for InResponseTo. + * + * @param inResponseTo The Saml's response id. + */ + void setInResponseTo(String inResponseTo); + + /** + * Getter for InResponseToSPReq. + * + * @return The InResponseToSPReq value. + */ + String getInResponseToSPReq(); + + /** + * Setter for InResponseToSPRequ. + * + * @param inResponseToSPReq The Saml's response id. + */ + void setInResponseToSPReq(String inResponseToSPReq); + + /** + * Getter for opType. + * + * @return The opType value. + */ + String getOpType(); + + /** + * Setter for opType. + * + * @param opType The operation type. + */ + void setOpType(String opType); + + /** + * Getter for destination. + * + * @return The destination value. + */ + String getDestination(); + + /** + * Setter for destinationIp. + * + * @param destination The remote IP. + */ + void setDestination(String destination); + + /** + * Getter for message or assertion consumer. + * + * @return The message or assertion consumer. + */ + String getMessage(); + + /** + * Setter for message or assertion consumer. + * + * @param message or assertion consumer. + */ + void setMessage(String message); + + /** + * Getter for country. + * + * @return The country value. + */ + String getCountry(); + + /** + * Setter for country. + * + * @param country The country. + */ + void setCountry(String country); + + /** + * Getter for samlHash. + * + * @return The samlHash value. + */ + byte[] getSamlHash(); + + /** + * Setter for samlHash. + * + * @param samlHash the encrypted SAML token + */ + void setSamlHash(byte[] samlHash); + + /** + * Getter for msgId. + * + * @return the msgId + */ + String getMsgId(); + + /** + * Setter for msgId. + * + * @param msgId the ID of the originator of this message + */ + void setMsgId(String msgId); + + /** + * Getter for sPMsgId. + * + * @return the sPMsgId + */ + String getSPMsgId(); + + /** + * Setter for sPMsgId. + * + * @param sPMsgId the ID of the originator of this message + */ + void setSPMsgId(String sPMsgId); + + /** + * The format of the returned String must be the following: + * "requestCounter#ddMMMyyyykk:mm:ss#opType#originIp#originName + * #destinationIp#destinationName#samlHash#[originatorName#msgId#]" + * + * The values enclosed in '[]' only apply when logging responses. + * + * @return {@inheritDoc} + */ + @Override + String toString(); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IStorkSession.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IStorkSession.java new file mode 100644 index 000000000..f38b41838 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IStorkSession.java @@ -0,0 +1,85 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * Interface for stork session. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.9 $, $Date: 2010-11-17 05:15:28 $ + */ +public interface IStorkSession { + + /** + * Returns the object associated the the given key. + * + * @param key with which the specified value is to be associated. + * + * @return The object associated the the given key. + */ + Object get(Object key); + + /** + * Associates a key to a value, and inserts them in the session object. + * + * @param key with which the specified value is to be associated. + * @param value to be associated with the specified key. + * + * @return previous value associated with specified key, or null if there was + * no mapping for key. A null return can also indicate that the map + * previously associated null with the specified key. + */ + Object put(String key, Object value); + + /** + * Removes the mapping for this key. + * + * @param key with which the specified value is to be associated. + * + * @return previous value associated with specified key, or null if there was + * no mapping for key. A null return can also indicate that the map + * previously associated null with the specified key. + */ + Object remove(Object key); + + /** + * Returns the number of key-value mappings in this map. + * + * @return the number of key-value mappings in this map. + */ + int size(); + + /** + * Returns true if this map contains a mapping for the specified key. + * + * @param key with which the specified value is to be associated. + * + * @return true if this map contains a mapping for the specified key. + */ + boolean containsKey(Object key); + + /** + * Removes all mappings from this map. + */ + void clear(); + + /** + * Returns true if this map contains no key-value mappings. + * + * @return true if this map contains no key-value mappings. + */ + boolean isEmpty(); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java new file mode 100644 index 000000000..43d3adaa9 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java @@ -0,0 +1,173 @@ +package eu.stork.peps.auth.commons; + +import java.util.Iterator; + +/** + * This class is a bean used to store the information of Attribute Providers, the Attribute + * List to be requested, the Assertions returned by the Attribute Providers and the values + * that each Attribute has. This information along with the current status of the Linker (the + * attribute providers that were queried and the remaining providers) is used by the PEPS + * actions in order to complete the Attribute gathering. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.20 $, $Date: 2013-10-28 $ + */ +public final class Linker { + /** + * Attributes Providers map. + */ + private IAttributeProvidersMap attributeProvidersMap; + + /** + * The current index of local (domestic) Attribute Providers. + */ + private int localIndex; + + /** + * The current index of remote (foreign) Attribute Providers - countries. + */ + private int remoteIndex; + + /** + * Constructs an empty Linker object. + */ + public Linker() { + localIndex = 0; + remoteIndex = 0; + } + + /** + * Based on the internal state of the Linker it returns the next local Attribute Source + * + * @return The next Attribute Source or null if not found + * + * @see AttributeSource + */ + public AttributeSource getNextLocalProvider() { + Iterator iterator; + AttributeSource source, found; + int curIndex = 0; + + found = null; + + if ( attributeProvidersMap!=null && !attributeProvidersMap.isEmpty() ) { + iterator = attributeProvidersMap.keyIterator(); + while (iterator.hasNext()) { + source = iterator.next(); + + if ( source.getSourceType()==AttributeSource.SOURCE_LOCAL_APROVIDER ) { + if ( curIndex>=localIndex ) { + found = source; + + break; + } + + curIndex++; + } + } + } + + return found; + } + + /** + * Based on the internal state of the Linker it returns the next remote Attribute Source + * + * @return The next Attribute Source or null if not found + * + * @see AttributeSource + */ + public AttributeSource getNextRemoteProvider() { + Iterator iterator; + AttributeSource source, found; + int curIndex = 0; + + found = null; + + if ( attributeProvidersMap !=null && !attributeProvidersMap.isEmpty() ) { + iterator = attributeProvidersMap.keyIterator(); + while (iterator.hasNext()) { + source = iterator.next(); + + if ( source.getSourceType()==AttributeSource.SOURCE_REMOTE_COUNTRY ) { + if ( curIndex>=remoteIndex ) { + found = source; + + break; + } + + curIndex++; + } + } + } + + return found; + } + + /** + * It updates the Linker with the values returned by the Attribute Source. It also advances + * to the next index in order to mark this attribute source as completed. + * + * @param source The Attribute Source that was queried for attribute values. + * @param attrResponse The attrResponse returned by the Attribute Source that contains the attribute values. + * + * @see AttributeSource, STORKAttrQueryResponse + */ + public void setProviderReponse(AttributeSource source, STORKAttrQueryResponse attrResponse) { + if ( source.getSourceType()==AttributeSource.SOURCE_REMOTE_COUNTRY ) + remoteIndex++; + else + localIndex++; + + //TODO How to store Assertions (format: byte, base64 string, entire object?) + + this.attributeProvidersMap.put(source, attrResponse.getPersonalAttributeList()); + } + + /** + * Reset the internal state of the local Attribute Source in order to start over. + */ + public void resetLocalIndex() { + localIndex = 0; + } + + /** + * Reset the internal state of the remote Attribute Source in order to start over. + */ + public void resetRemoteIndex() { + remoteIndex = 0; + } + + /** + * Setter for attributeProvidersMap. + * + * @param attributeProvidersMap The attributeProvidersMap to set. + */ + public void setAttributeProvidersMap(IAttributeProvidersMap attributeProvidersMap) { + this.attributeProvidersMap = attributeProvidersMap; + } + + /** + * Getter for attributeProvidersMap. + * + * @return attributeProvidersMap + */ + public IAttributeProvidersMap getAttributeProvidersMap() { + return attributeProvidersMap; + } + + /** + * Returns the Personal Attribute list of the provided Attribute Source. + * + * @return The IPersonalAttributeList assosiated with this source or null if empty + * + * @see IPersonalAttributeList + */ + public IPersonalAttributeList getProviderAttributes(AttributeSource source) { + if ( attributeProvidersMap.containsKey(source) ) + return attributeProvidersMap.get(source); + else + return null; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java new file mode 100644 index 000000000..3aa549a06 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java @@ -0,0 +1,348 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains all the STORK PEPS, Commons and Specific errors + * constant identifiers. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.10 $, $Date: 2011-02-17 22:44:34 $ + */ +public enum PEPSErrors { + + /** + * Represents the 'authenticationFailed' constant error identifier. + */ + AUTHENTICATION_FAILED_ERROR("authenticationFailed"), + /** + * Represents the 'spCountrySelector.errorCreatingSAML' constant error + * identifier. + */ + SP_COUNTRY_SELECTOR_ERROR_CREATE_SAML("spCountrySelector.errorCreatingSAML"), + /** + * Represents the 'spCountrySelector.destNull' constant error identifier. + */ + SP_COUNTRY_SELECTOR_DESTNULL("spCountrySelector.destNull"), + /** + * Represents the 'spCountrySelector.invalidAttr' constant error identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_ATTR("spCountrySelector.invalidAttr"), + /** + * Represents the 'spCountrySelector.invalidProviderName' constant error + * identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_PROVIDER_NAME( + "spCountrySelector.invalidProviderName"), + /** + * Represents the 'spCountrySelector.invalidQaaSPid' constant error + * identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_QAASPID("spCountrySelector.invalidQaaSPid"), + /** + * Represents the 'spCountrySelector.invalidSpId' constant error identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_SPID("spCountrySelector.invalidSpId"), + /** + * Represents the 'spCountrySelector.invalidSPQAA' constant error identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_SPQAA("spCountrySelector.invalidSPQAA"), + /** + * Represents the 'spCountrySelector.invalidSpURL' constant error identifier. + */ + SP_COUNTRY_SELECTOR_INVALID_SPURL("spCountrySelector.invalidSpURL"), + /** + * Represents the 'spCountrySelector.spNotAllowed' constant error identifier. + */ + SP_COUNTRY_SELECTOR_SPNOTALLOWED("spCountrySelector.spNotAllowed"), + + /** + * Represents the 'sProviderAction.errorCreatingSAML' constant error + * identifier. + */ + SPROVIDER_SELECTOR_ERROR_CREATE_SAML("sProviderAction.errorCreatingSAML"), + /** + * Represents the 'sProviderAction.attr' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_ATTR("sProviderAction.invalidAttr"), + /** + * Represents the 'sProviderAction.country' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_COUNTRY("sProviderAction.invalidCountry"), + /** + * Represents the 'sProviderAction.relayState' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_RELAY_STATE("sProviderAction.invalidRelayState"), + /** + * Represents the 'sProviderAction.saml' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SAML("sProviderAction.invalidSaml"), + /** + * Represents the 'sProviderAction.spAlias' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPALIAS("sProviderAction.invalidSPAlias"), + /** + * Represents the 'sProviderAction.spDomain' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPDOMAIN("sProviderAction.invalidSPDomain"), + /** + * Represents the 'sProviderAction.spId' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPID("sProviderAction.invalidSPId"), + /** + * Represents the 'sProviderAction.spQAA' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPQAA("sProviderAction.invalidSPQAA"), + /** + * Represents the 'sProviderAction.spQAAId' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPQAAID("sProviderAction.invalidSPQAAId"), + /** + * Represents the 'sProviderAction.spRedirect' constant error identifier. + */ + SPROVIDER_SELECTOR_INVALID_SPREDIRECT("sProviderAction.invalidSPRedirect"), + /** + * Represents the 'sProviderAction.invalidSPProviderName' constant error + * identifier. + */ + SPROVIDER_SELECTOR_INVALID_SP_PROVIDERNAME( + "sProviderAction.invalidSPProviderName"), + /** + * Represents the 'sProviderAction.spNotAllowed' constant error identifier. + */ + SPROVIDER_SELECTOR_SPNOTALLOWED("sProviderAction.spNotAllowed"), + + + /** + * Represents the 'internalError' constant error identifier. + */ + INTERNAL_ERROR("internalError"), + + /** + * Represents the 'colleagueRequest.attrNull' constant error identifier. + */ + COLLEAGUE_REQ_ATTR_NULL("colleagueRequest.attrNull"), + /** + * Represents the 'colleagueRequest.errorCreatingSAML' constant error + * identifier. + */ + COLLEAGUE_REQ_ERROR_CREATE_SAML("colleagueRequest.errorCreatingSAML"), + /** + * Represents the 'colleagueRequest.invalidCountryCode' constant error + * identifier. + */ + COLLEAGUE_REQ_INVALID_COUNTRYCODE("colleagueRequest.invalidCountryCode"), + /** + * Represents the 'colleagueRequest.invalidDestUrl' constant error identifier. + */ + COLLEAGUE_REQ_INVALID_DEST_URL("colleagueRequest.invalidDestUrl"), + /** + * Represents the 'colleagueRequest.invalidQaa' constant error identifier. + */ + COLLEAGUE_REQ_INVALID_QAA("colleagueRequest.invalidQaa"), + /** + * Represents the 'colleagueRequest.invalidRedirect' constant error + * identifier. + */ + COLLEAGUE_REQ_INVALID_REDIRECT("colleagueRequest.invalidRedirect"), + /** + * Represents the 'colleagueRequest.invalidSAML' constant error identifier. + */ + COLLEAGUE_REQ_INVALID_SAML("colleagueRequest.invalidSAML"), + + + /** + * Represents the 'cpepsRedirectUrl' constant error identifier. + */ + CPEPS_REDIRECT_URL("cpepsRedirectUrl"), + /** + * Represents the 'spepsRedirectUrl' constant error identifier. + */ + SPEPS_REDIRECT_URL("spepsRedirectUrl"), + /** + * Represents the 'sProviderAction.invCountry' constant error identifier. + */ + SP_ACTION_INV_COUNTRY("sProviderAction.invCountry"), + + /** + * Represents the 'providernameAlias.invalid' constant error identifier. + */ + PROVIDER_ALIAS_INVALID("providernameAlias.invalid"), + + + /** + * Represents the 'cPeps.attrNull' constant error identifier. + */ + CPEPS_ATTR_NULL("cPeps.attrNull"), + + /** + * Represents the 'colleagueResponse.invalidSAML' constant error identifier. + */ + COLLEAGUE_RESP_INVALID_SAML("colleagueResponse.invalidSAML"), + + /** + * Represents the 'citizenNoConsent.mandatory' constant error identifier. + */ + CITIZEN_NO_CONSENT_MANDATORY("citizenNoConsent.mandatory"), + /** + * Represents the 'citizenResponse.mandatory' constant error identifier. + */ + CITIZEN_RESPONSE_MANDATORY("citizenResponse.mandatory"), + /** + * Represents the 'attVerification.mandatory' constant error identifier. + */ + ATT_VERIFICATION_MANDATORY("attVerification.mandatory"), + /** + * Represents the 'attrValue.verification' constant error identifier. + */ + ATTR_VALUE_VERIFICATION("attrValue.verification"), + + /** + * Represents the 'audienceRestrictionError' constant error identifier. + */ + AUDIENCE_RESTRICTION("audienceRestrictionError"), + /** + * Represents the 'auRequestIdError' constant error identifier. + */ + AU_REQUEST_ID("auRequestIdError"), + /** + * Represents the 'domain' constant error identifier. + */ + DOMAIN("domain"), + /** + * Represents the 'hash.error' constant error identifier. + */ + HASH_ERROR("hash.error"), + /** + * Represents the 'invalidAttributeList' constant error identifier. + */ + INVALID_ATTRIBUTE_LIST("invalidAttributeList"), + /** + * Represents the 'invalidAttributeValue' constant error identifier. + */ + INVALID_ATTRIBUTE_VALUE("invalidAttributeValue"), + /** + * Represents the 'qaaLevel' constant error identifier. + */ + QAALEVEL("qaaLevel"), + /** + * Represents the 'requests' constant error identifier. + */ + REQUESTS("requests"), + /** + * Represents the 'SPSAMLRequest' constant error identifier. + */ + SP_SAML_REQUEST("SPSAMLRequest"), + /** + * Represents the 'spepsSAMLRequest' constant error identifier. + */ + SPEPS_SAML_REQUEST("spepsSAMLRequest"), + /** + * Represents the 'IdPSAMLResponse' constant error identifier. + */ + IDP_SAML_RESPONSE("IdPSAMLResponse"), + /** + * Represents the 'cpepsSAMLResponse' constant error identifier. + */ + CPEPS_SAML_RESPONSE("cpepsSAMLResponse"), + /** + * Represents the 'cpepsSAMLResponse' constant error identifier. + */ + SPEPS_SAML_RESPONSE("spepsSAMLResponse"), + /** + * Represents the 'session' constant error identifier. + */ + SESSION("session"), + /** + * Represents the 'invalid.session' constant error identifier. + */ + INVALID_SESSION("invalid.session"), + /** + * Represents the 'invalid.sessionId' constant error identifier. + */ + INVALID_SESSION_ID("invalid.sessionId"), + /** + * Represents the 'missing.sessionId' constant error identifier. + */ + MISSING_SESSION_ID("sessionError"), + /** + * Represents the 'AtPSAMLResponse' constant error identifier. + */ + ATP_SAML_RESPONSE("AtPSAMLResponse"); + + /** + * Represents the constant's value. + */ + private String error; + + /** + * Solo Constructor. + * + * @param nError The Constant error value. + */ + PEPSErrors(final String nError) { + this.error = nError; + } + + /** + * Construct the errorCode Constant value. + * + * @return The errorCode Constant. + */ + public String errorCode() { + return error + ".code"; + } + + /** + * Construct the errorCode Constant value with the given code text. + * + * @param text the code text to append to the constant. + * + * @return The errorCode Constant for the given code text. + */ + public String errorCode(final String text) { + return error + "." + text + ".code"; + } + + /** + * Construct the errorMessage constant value. + * + * @return The errorMessage constant. + */ + public String errorMessage() { + return error + ".message"; + } + + /** + * Construct the errorMessage Constant value with the given message text. + * + * @param text the message text to append to the constant. + * + * @return The errorMessage Constant for the given text. + */ + public String errorMessage(final String text) { + return error + "." + text + ".message"; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + return error; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java new file mode 100644 index 000000000..37b204351 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java @@ -0,0 +1,511 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains all the STORK PEPS, Commons and Specific Parameters. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.13 $, $Date: 2011-07-07 20:48:45 $ + */ +public enum PEPSParameters { + + /** + * Represents the 'apId' parameter constant. + */ + AP_ID("apId"), + /** + * Represents the 'apUrl' parameter constant. + */ + AP_URL("apUrl"), + /** + * Represents the 'ap.number' parameter constant. + */ + AP_NUMBER("ap.number"), + + /** + * Represents the 'assertionConsumerServiceURL' parameter constant. + */ + ASSERTION_CONSUMER_S_URL("assertionConsumerServiceURL"), + + /** + * Represents the 'auth' parameter constant. + */ + AUTHENTICATION("auth"), + + /** + * Represents the 'auth-on-behalf-of' parameter constant. + */ + AUTHENTICATION_ON_BEHALF_OF("auth-on-behalf-of"), + + /** + * Represents the 'attr' parameter constant. + */ + ATTRIBUTE("attr"), + /** + * Represents the 'attrName' parameter constant. + */ + ATTRIBUTE_NAME("attrName"), + /** + * Represents the 'attrStatus' parameter constant. + */ + ATTRIBUTE_STATUS("attrStatus"), + /** + * Represents the 'attrType' parameter constant. + */ + ATTRIBUTE_TYPE("attrType"), + /** + * Represents the 'attrValue' parameter constant. + */ + ATTRIBUTE_VALUE("attrValue"), + /** + * Represents the 'attrList' parameter constant. + */ + ATTRIBUTE_LIST("attrList"), + /** + * Represents the 'attrTuple' parameter constant. + */ + ATTRIBUTE_TUPLE("attrTuple"), + /** + * Represents the 'attribute-missing' parameter constant. + */ + ATTRIBUTE_MISSING("attribute-missing"), + /** + * Represents the 'attributesNotAllowed' parameter constant. + */ + ATTRIBUTES_NOT_ALLOWED("attributesNotAllowed"), + /** + * Represents the 'authnRequest' parameter constant. + */ + AUTH_REQUEST("authnRequest"), + + /** + * Represents the 'attrValue.number' parameter constant. + */ + ATTR_VALUE_NUMBER("attrValue.number"), + + /** + * Represents the 'derivation.date.format' parameter constant. + */ + DERIVATION_DATE_FORMAT("derivation.date.format"), + /** + * Represents the 'deriveAttr.number' parameter constant. + */ + DERIVE_ATTRIBUTE_NUMBER("deriveAttr.number"), + + /** + * Represents the complex attributes parameter constant. + */ + COMPLEX_ADDRESS_VALUE("canonicalResidenceAddress"), + COMPLEX_NEWATTRIBUTE_VALUE("newAttribute2"), + COMPLEX_HASDEGREE_VALUE("hasDegree"), + COMPLEX_MANDATECONTENT_VALUE("mandateContent"), + /** + * Represents the 'consent-type' parameter constant. + */ + CONSENT_TYPE("consent-type"), + /** + * Represents the 'consent-value' parameter constant. + */ + CONSENT_VALUE("consent-value"), + /** + * Represents the 'country' parameter constant. + */ + COUNTRY("country"), + /** + * Represents the 'countryOrigin' parameter constant. + */ + COUNTRY_ORIGIN("countryOrigin"), + + /** + * Represents the 'cpepsURL' parameter constant. + */ + CPEPS_URL("cpepsURL"), + /** + * Represents the 'callback' parameter constant. + */ + CPEPS_CALLBACK("callback"), + /** + * Represents the 'peps.specificidpredirect.url' parameter constant. + */ + CPEPS_IDP_CALLBACK_VALUE("peps.specificidpredirect.url"), + /** + * Represents the 'peps.specificapredirect.url' parameter constant. + */ + CPEPS_AP_CALLBACK_VALUE("peps.specificapredirect.url"), + + /** + * Represents the 'errorCode' parameter constant. + */ + ERROR_CODE("errorCode"), + /** + * Represents the 'subCode' parameter constant. + */ + ERROR_SUBCODE("subCode"), + /** + * Represents the 'errorMessage' parameter constant. + */ + ERROR_MESSAGE("errorMessage"), + /** + * Represents the 'errorRedirectUrl' parameter constant. + */ + ERROR_REDIRECT_URL("errorRedirectUrl"), + + /** + * errorRedirectUrl Represents the 'external-authentication' parameter + * constant. + */ + EXTERNAL_AUTH("external-authentication"), + /** + * Represents the 'external-ap' parameter constant. + */ + EXTERNAL_AP("external-ap"), + /** + * Represents the 'external-sig-module' parameter constant. + */ + EXT_SIG_CREATOR_MOD("external-sig-module"), + + /** + * Represents the 'http-x-forwarded-for' parameter constant. + */ + HTTP_X_FORWARDED_FOR("http-x-forwarded-for"), + + /** + * Represents the 'idp.url' parameter constant. + */ + IDP_URL("idp.url"), + /** + * Represents the 'idpAUB.url' parameter constant. + */ + IDPAUB_URL("idpAUB.url"), + /** + * Represents the 'internal-authentication' parameter constant. + */ + INTERNAL_AUTH("internal-authentication"), + /** + * Represents the 'internal-ap' parameter constant. + */ + INTERNAL_AP("internal-ap"), + + /** + * Represents the 'samlIssuer' parameter constant. + */ + ISSUER("samlIssuer"), + /** + * Represents the 'samlIssuer.idp' parameter constant. + */ + ISSUER_IDP("samlIssuer.idp"), + /** + * Represents the 'samlIssuer.atp' parameter constant. + */ + ISSUER_ATP("samlIssuer.atp"), + + /** + * Represents the 'mandatory' parameter constant. + */ + MANDATORY("mandatory"), + /** + * Represents the 'mandatoryAttributeMissing' parameter constant. + */ + MANDATORY_ATTR_MISSING("mandatoryAttributeMissing"), + /** + * Represents the 'mandatoryConsentAttrMissing' parameter constant. + */ + MANDATORY_CONSENT_MISSING("mandatoryConsentAttrMissing"), + /** + * Represents the 'optional' parameter constant. + */ + OPTIONAL("optional"), + + /** + * Represents the 'no-consent-type' parameter constant. + */ + NO_CONSENT_TYPE("no-consent-type"), + /** + * Represents the 'no-consent-value' parameter constant. + */ + NO_CONSENT_VALUE("no-consent-value"), + + /** + * Represents the 'provider.name' parameter constant. + */ + PROVIDER_NAME_VALUE("providerName"), + /** + * Represents the 'cpeps.askconsent' parameter constant. + */ + PEPS_ASK_CONSENT("cpeps.askconsent"), + /** + * Represents the 'cpeps.askconsentvalue' parameter constant. + */ + PEPS_ASK_CONSENT_VALUE("cpeps.askconsentvalue"), + /** + * Represents the 'pepsAuth' parameter constant. + */ + PEPS_AUTH_CONSENT("pepsAuth"), + /** + * Represents the 'validation.bypass' parameter constant. + */ + PEPS_BYPASS("validation.bypass"), + /** + * Represents the 'cpeps.number' parameter constant. + */ + PEPS_NUMBER("cpeps.number"), + /** + * Represents the 'cpeps.specificapredirect.url' parameter constant. + */ + PEPS_SPECIFIC_URL("cpeps.specificapredirect.url"), + + /** + * Represents the 'qaaLevel' parameter constant. + */ + QAALEVEL("qaaLevel"), + + /** + * Represents the 'speps.redirectUrl' parameter constant. + */ + SPEPS_REDIRECT_URL("speps.redirectUrl"), + + /** + * Represents the 'sp.redirectUrl' parameter constant. + */ + SP_REDIRECT_URL("sp.redirectUrl"), + /** + * Represents the 'cpeps.redirectUrl' parameter constant. + */ + CPEPS_REDIRECT_URL("cpeps.redirectUrl"), + /** + * Represents the 'RelayState' parameter constant. + */ + RELAY_STATE("RelayState"), + /** + * Represents the 'remoteAddr' parameter constant. + */ + REMOTE_ADDR("remoteAddr"), + /** + * Represents the 'remoteUser' parameter constant. + */ + REMOTE_USER("remoteUser"), + + /** + * Represents the 'SAMLRequest' parameter constant. + */ + SAML_REQUEST("SAMLRequest"), + /** + * Represents the 'SAMLResponse' parameter constant. + */ + SAML_RESPONSE("SAMLResponse"), + /** + * Represents the 'SAMLFail' parameter constant. + */ + SAML_TOKEN_FAIL("SAMLFail"), + /** + * Represents the 'TokenId' parameter constant. + */ + SAML_TOKEN_ID("TokenId"), + /** + * Represents the 'inResponseTo' parameter constant. + */ + SAML_IN_RESPONSE_TO("inResponseTo"), + /** + * Represents the 'inResponseTo.idp' parameter constant. + */ + SAML_IN_RESPONSE_TO_IDP("inResponseTo.idp"), + /** + * Represents the 'inResponseTo.atp' parameter constant. + */ + SAML_IN_RESPONSE_TO_ATP("inResponseTo.atp"), + /** + * Represents the 'SignatureResponse' parameter constant. + */ + SIGNATURE_RESPONSE("SignatureResponse"), + + /** + * Represents the 'cPepsSession' parameter constant. + */ + SESSION_ID_URL("cPepsSession"), + /** + * Represents the 'spId' parameter constant. + */ + SP_ID("spId"), + /** + * Represents the 'spQaaLevel' parameter constant. + */ + SP_QAALEVEL("spQaaLevel"), + /** + * Represents the 'spUrl' parameter constant. + */ + SP_URL("spUrl"), + + /** + * Represents the 'allow.derivation.all' parameter constant. + */ + SPECIFIC_ALLOW_DERIVATION_ALL("allow.derivation.all"), + /** + * Represents the ''allow.unknowns parameter constant. + */ + SPECIFIC_ALLOW_UNKNOWNS("allow.unknowns"), + /** + * Represents the 'derivation.date.separator' parameter constant. + */ + SPECIFIC_DERIVATION_DATE_SEP("derivation.date.separator"), + /** + * Represents the 'derivation.month.position' parameter constant. + */ + SPECIFIC_DERIVATION_MONTH_POS("derivation.month.position"), + /** + * Represents the 'derivation.day.position' parameter constant. + */ + SPECIFIC_DERIVATION_DAY_POS("derivation.day.position"), + /** + * Represents the 'derivation.year.position' parameter constant. + */ + SPECIFIC_DERIVATION_YEAR_POS("derivation.year.position"), + + /** + * sp.authorized.parameters Represents the '' parameter constant. + */ + SPEPS_AUTHORIZED("sp.authorized.parameters"), + + /** + * Represents the 'spSector' constant value. + */ + SPSECTOR("spSector"), + /** + * Represents the 'spApplication' constant value. + */ + SPAPPLICATION("spApplication"), + /** + * Represents the 'spCountry' constant value. + */ + SPCOUNTRY("spCountry"), + /** + * Represents the 'spInstitution' constant value. + */ + SPINSTITUTION("spInstitution"), + /** + * Represents the 'storkAttribute.number' parameter constant. + */ + STORK_ATTRIBUTE_NUMBER("storkAttribute.number"), + /** + * Represents the 'storkAttributeValue.number' parameter constant. + */ + STORK_ATTRIBUTE_VALUE_NUMBER("storkAttributeValue.number"), + + /** + * Represents the 'username' parameter constant. + */ + USERNAME("username"), + + /** + * Represents the 'tooManyParameters' parameter constant. + */ + TOO_MANY_PARAMETERS("tooManyParameters"), + /** + * Represents the 'validation.active' parameter constant. + */ + VALIDATION_ACTIVE("validation.active"), + + /** + * Represents the 'x-forwarded-for' parameter constant. + */ + X_FORWARDED_FOR("x-forwarded-for"), + /** + * Represents the 'x-forwarded-host' parameter constant. + */ + X_FORWARDED_HOST("x-forwarded-host"), + /** + * Represents the 'XMLResponse' parameter constant. + */ + XML_RESPONSE("XMLResponse"), + + /** + * Represents the 'ap-cpeps.number' parameter constant. + */ + AP_PEPS_NUMBER("ap-cpeps.number"), + + /** + * Represents the 'atp.number' parameter constant. + */ + ATTRIBUTE_PROVIDER_NUMBER("atp.number"), + + /** + * Represents the 'apLinker' parameter constant. + */ + AP_LINKER("apLinker"), + + /** + * Represents the 'NOSEL' parameter constant (no attribute provider selected). + */ + AP_NO_SELECTION("NOSEL"), + + /** + * Represents the 'OCSEL' parameter constant (attribute provider in another country). + */ + AP_OTHER_COUNTRY("OCSEL"), + + /** + * Represents the '_provider' suffix parameter constant. + */ + AP_PROVIDER_SELECT_SUFFIX("_provider"), + + /** + * Represents the '_country' suffix parameter constant. + */ + AP_COUNTRY_SELECT_SUFFIX("_country"), + + /** + * Represents the 'next-ap' parameter constant. + */ + NEXT_AP("next-ap"), + + /** + * Represents the 'next-apeps' parameter constant. + */ + NEXT_APEPS("next-apeps"), + + /** + * Represents the 'attr-filter.number' parameter constant. + */ + ATTRIBUTES_FILTER_NUMBER("attr-filter.number"), + + /** + * Represents the 'atp.url' parameter constant. + */ + ATP_URL("atp.url"); + + /** + * Represents the constant's value. + */ + private String value; + + /** + * Solo Constructor. + * + * @param nValue The Constant value. + */ + PEPSParameters(final String nValue) { + this.value = nValue; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + return value; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java new file mode 100644 index 000000000..ae1f203f5 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java @@ -0,0 +1,353 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.io.UnsupportedEncodingException; +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.bouncycastle.crypto.Digest; +import org.bouncycastle.util.encoders.Base64; + +import eu.stork.peps.auth.commons.exceptions.InternalErrorPEPSException; +import eu.stork.peps.auth.commons.exceptions.InvalidParameterPEPSException; + +/** + * This class holds static helper methods. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.75 $, $Date: 2010-11-23 00:05:35 $ + */ +public final class PEPSUtil { + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(PEPSUtil.class.getName()); + + /** + * Configurations object. + */ + private static Properties configs; + + /** + * Max prefix. + */ + private static final String MAX_PARAM_PREFIX = "max."; + + /** + * Code prefix to get error code. + */ + private static final String CODE_PARAM_SUFFIX = ".code"; + + /** + * param's size prefix to get max param size. + */ + private static final String MAX_PARAM_SUFFIX = ".size"; + + /** + * Message prefix to get error message. + */ + private static final String MSG_PARAM_SUFFIX = ".message"; + + /** + * Private constructor. Prevents the class from being instantiated. + */ + private PEPSUtil() { + // empty constructor + } + + /** + * Creates a single instance of this class and sets the properties. + * + * @param nConfigs The set of available configurations. + * + * @return The created PEPSUtil's class. + */ + public static PEPSUtil createInstance(final Properties nConfigs) { + if (nConfigs != null) { + PEPSUtil.configs = nConfigs; + } + return new PEPSUtil(); + } + + /** + * Getter for the Properties. + * + * @return configs The properties value. + */ + public Properties getConfigs() { + return configs; + } + + /** + * Setter for the Properties. + * + * @param nConfigs The new properties value. + */ + public static void setConfigs(final Properties nConfigs) { + if (nConfigs != null) { + PEPSUtil.configs = nConfigs; + } + } + + /** + * Returns the identifier of some configuration given a set of configurations + * and the corresponding configuration key. + * + * @param configKey The key that IDs some configuration. + * + * @return The configuration String value. + */ + public static String getConfig(final String configKey) { + return configs.getProperty(configKey); + } + + /** + * Validates the input paramValue identified by the paramName. + * + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + * + * @return true if the parameter is valid. + */ + public static boolean isValidParameter(final String paramName, + final String paramValue) { + + final String validationParam = + PEPSUtil.getConfig(PEPSParameters.VALIDATION_ACTIVE.toString()); + boolean retVal = true; + + final String paramConf = MAX_PARAM_PREFIX + paramName + MAX_PARAM_SUFFIX; + + if (PEPSValues.TRUE.toString().equals(validationParam)) { + final String paramSizeStr = PEPSUtil.getConfig(paramConf); + // Checking if the parameter size exists and if it's numeric + if (StringUtils.isNumeric(paramSizeStr)) { + final int maxParamSize = Integer.valueOf(paramSizeStr); + if (StringUtils.isEmpty(paramValue) + || (paramValue.length() > maxParamSize)) { + retVal = false; + LOG.warn("Invalid parameter [" + paramName + "] value " + paramValue); + } + } else { + retVal = false; + LOG.error("Missing " + paramConf + + " configuration in the pepsUtils.properties configuration file"); + } + } + return retVal; + } + + /** + * Validates the Parameter and throws an exception if an error occurs. Throws + * an InvalidParameterPEPSException runtime exception if the parameter is + * invalid. + * + * @param className The Class Name that invoked the method. + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + */ + public static void validateParameter(final String className, + final String paramName, final Object paramValue) { + + if (paramValue == null) { + PEPSUtil.validateParameter(className, paramName, ""); + } else { + PEPSUtil.validateParameter(className, paramName, paramValue.toString()); + } + } + + /** + * Validates the Parameters and throws an exception if an error occurs. + * + * @param className The Class Name that invoked the method. + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + */ + public static void validateParameter(final String className, + final String paramName, final String paramValue) { + + PEPSUtil.validateParameter(className, paramName, paramValue, + PEPSUtil.getErrorCode(paramName), PEPSUtil.getErrorMessage(paramName)); + } + + /** + * Validates the Parameters and throws an exception if an error occurs. + * + * @param className The Class Name that invoked the method. + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + * @param error The PEPSError to get error code and messages from configs. + */ + public static void validateParameter(final String className, + final String paramName, final String paramValue, final PEPSErrors error) { + + PEPSUtil.validateParameter(className, paramName, paramValue, + PEPSUtil.getConfig(error.errorCode()), + PEPSUtil.getConfig(error.errorMessage())); + } + + /** + * Validates the HTTP Parameter and throws an exception if an error occurs. + * Throws an InvalidParameterPEPSException runtime exception if the parameter + * is invalid. + * + * @param className The Class Name that invoked the method. + * @param paramName The name of the parameter to validate. + * @param paramValue The value of the parameter to validate. + * @param errorCode The error code to include on the exception. + * @param errorMessage The error message to include on the exception. + */ + public static void validateParameter(final String className, + final String paramName, final String paramValue, final String errorCode, + final String errorMessage) { + + if (!isValidParameter(paramName, paramValue)) { + LOG.warn("Invalid parameter [" + paramName + "] value found at " + + className); + throw new InvalidParameterPEPSException(errorCode, errorMessage); + } + } + + /** + * Getter for the error code of some given error related to the input param. + * + * @param paramName The name of the parameter associated with the error. + * + * @return The code of the error. + */ + private static String getErrorCode(final String paramName) { + return getConfig(paramName + CODE_PARAM_SUFFIX); + } + + /** + * Getter for the error message of some given error related to the input + * parameter. + * + * @param paramName The name of the parameter associated with the message. + * + * @return The message for the error. + */ + private static String getErrorMessage(final String paramName) { + return getConfig(paramName + MSG_PARAM_SUFFIX); + } + + /** + * {@link Base64} encodes the input samlToken parameter. + * + * @param samlToken the SAML Token to be encoded. + * + * @return The Base64 String representing the samlToken. + * + * @see Base64#encode + */ + public static String encodeSAMLToken(final byte[] samlToken) { + try { + return new String(Base64.encode(samlToken), "UTF8"); + } catch (UnsupportedEncodingException e) { + LOG.error(PEPSErrors.INTERNAL_ERROR.errorMessage(), e); + return null; + } + } + + /** + * Decodes the {@link Base64} String input parameter representing a samlToken. + * + * @param samlToken the SAML Token to be decoded. + * + * @return The samlToken decoded bytes. + * + * @see Base64#decode + */ + public static byte[] decodeSAMLToken(final String samlToken) { + return Base64.decode(samlToken); + } + + /** + * Hashes a SAML token. Throws an InternalErrorPEPSException runtime exception + * if the Cryptographic Engine fails. + * + * @param samlToken the SAML Token to be hashed. + * + * @return byte[] with the hashed SAML Token. + */ + public static byte[] hashPersonalToken(final byte[] samlToken) { + try { + final String className = + PEPSUtil.getConfig(PEPSValues.HASH_DIGEST_CLASS.toString()); + + final Digest digest = + (Digest) Class.forName(className).getConstructor() + .newInstance((Object[]) null); + digest.update(samlToken, 0, samlToken.length); + + final int retLength = digest.getDigestSize(); + final byte[] ret = new byte[retLength]; + + digest.doFinal(ret, 0); + return ret; + + } catch (final Exception e) { + // For all those exceptions that could be thrown, we always log it and + // thrown an InternalErrorPEPSException. + LOG.error(PEPSErrors.HASH_ERROR.errorMessage(), e); + throw new InternalErrorPEPSException( + PEPSUtil.getConfig(PEPSErrors.HASH_ERROR.errorCode()), + PEPSUtil.getConfig(PEPSErrors.HASH_ERROR.errorMessage()), e); + } + } + + /** + * Gets the Stork error code in the error message if exists! + * + * @param errorMessage The message to get the error code if exists; + * + * @return the error code if exists. Returns null otherwise. + */ + public static String getStorkErrorCode(final String errorMessage) { + if (StringUtils.isNotBlank(errorMessage) + && errorMessage.indexOf(PEPSValues.ERROR_MESSAGE_SEP.toString()) >= 0) { + final String[] msgSplitted = + errorMessage.split(PEPSValues.ERROR_MESSAGE_SEP.toString()); + if (msgSplitted.length == 2 && StringUtils.isNumeric(msgSplitted[0])) { + return msgSplitted[0]; + } + } + return null; + } + + /** + * Gets the Stork error message in the saml message if exists! + * + * @param errorMessage The message to get in the saml message if exists; + * + * @return the error message if exists. Returns the original message + * otherwise. + */ + public static String getStorkErrorMessage(final String errorMessage) { + if (StringUtils.isNotBlank(errorMessage) + && errorMessage.indexOf(PEPSValues.ERROR_MESSAGE_SEP.toString()) >= 0) { + final String[] msgSplitted = + errorMessage.split(PEPSValues.ERROR_MESSAGE_SEP.toString()); + if (msgSplitted.length == 2 && StringUtils.isNumeric(msgSplitted[0])) { + return msgSplitted[1]; + } + } + return errorMessage; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java new file mode 100644 index 000000000..568c25053 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java @@ -0,0 +1,325 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains all the value constants. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.17 $, $Date: 2011-07-07 20:48:45 $ + */ +public enum PEPSValues { + + /** + * Represents the 'all' constant value. + */ + ALL("all"), + /** + * Represents the 'none' constant value. + */ + NONE("none"), + /** + * Represents the 'true' constant value. + */ + TRUE("true"), + /** + * Represents the 'false' constant value. + */ + FALSE("false"), + /** + * Represents the empty string constant value. + */ + EMPTY_STRING(""), + + /** + * Represents the ',' separator constant value. + */ + ATTRIBUTE_VALUE_SEP(","), + /** + * Represents the ';' separator constant value. + */ + ATTRIBUTE_SEP(";"), + /** + * Represents the ':' separator constant value. + */ + ATTRIBUTE_TUPLE_SEP(":"), + /** + * Represents the '/' separator constant value. + */ + EID_SEPARATOR("/"), + /** + * Represents the ' - ' separator constant value. + */ + ERROR_MESSAGE_SEP(" - "), + /** + * Represents the '#' parameter constant value. + */ + LOGGER_SEP("#"), + /** + * Represents the 'NOT_AVAILABLE' parameter constant value. + */ + NOT_AVAILABLE("NotAvailable"), + /** + * Represents the ';' parameter constant value. + */ + SPEPS_AUTHORIZED_SEP(";"), + + /** + * Represents the 'ap' constant value. + */ + AP("ap"), + /** + * Represents the 'C-PEPS' constant value. + */ + CPEPS("C-PEPS"), + /** + * Represents the 'cpeps' constant value. + */ + CPEPS_PREFIX("cpeps"), + /** + * Represents the 'peps' constant value. + */ + PEPS("peps"), + /** + * Represents the '-PEPS' constant value. + */ + PEPS_SUFFIX("-PEPS"), + /** + * Represents the 'SP' constant value. + */ + SP("SP"), + /** + * Represents the 'S-PEPS' constant value. + */ + SPEPS("S-PEPS"), + /** + * Represents the 'speps' constant value. + */ + SPEPS_PREFIX("speps"), + /** + * Represents the 'sp.default.parameters' constant value. + */ + DEFAULT("sp.default.parameters"), + /** + * Represents the default saml id constant value. + */ + DEFAULT_SAML_ID("1"), + /** + * Represents the 'hashDigest.className' constant value. + */ + HASH_DIGEST_CLASS("hashDigest.className"), + + /** + * Represents the 'eu.stork.communication.requests' constant value. + */ + STORK_PACKAGE_REQUEST_LOGGER_VALUE("eu.stork.communication.requests"), + /** + * Represents the 'eu.stork.communication.responses' constant value. + */ + STORK_PACKAGE_RESPONSE_LOGGER_VALUE("eu.stork.communication.responses"), + + /** + * Represents the 'S-PEPS receives request from SP' constant value. + */ + SP_REQUEST("S-PEPS receives request from SP"), + /** + * Represents the 'Get Citizen Consent' constant value. + */ + CITIZEN_CONSENT_LOG("Get Citizen Consent"), + /** + * Represents the 'C-PEPS receives request from S-PEPS' constant value. + */ + CPEPS_REQUEST("C-PEPS receives request from S-PEPS"), + /** + * Represents the 'C-PEPS generates response to S-PEPS' constant value. + */ + CPEPS_RESPONSE("C-PEPS generates response to S-PEPS"), + /** + * Represents the 'S-PEPS generates request to C-PEPS' constant value. + */ + SPEPS_REQUEST("S-PEPS generates request to C-PEPS"), + /** + * Represents the 'S-PEPS receives response from C-PEPS' constant value. + */ + SPEPS_RESPONSE("S-PEPS receives response from C-PEPS"), + /** + * Represents the 'S-PEPS generates response to SP' constant value. + */ + SP_RESPONSE("S-PEPS generates response to SP"), + /** + * Represents the 'Success' constant value. + */ + SUCCESS("Success"), + /** + * Represents the December's month number constant value. + */ + LAST_MONTH("12"), + /** + * Represents the yyyyMM constant value. + */ + NO_DAY_DATE_FORMAT("yyyyMM"), + + /** + * Represents the 'attrValue' constant value. + */ + ATTRIBUTE("attrValue"), + /** + * Represents the 'derivedAttr' constant value. + */ + DERIVE_ATTRIBUTE("deriveAttr"), + /** + * Represents the 'storkAttribute' constant value. + */ + STORK_ATTRIBUTE("storkAttribute"), + + /** + * Represents the 'properties' constant value. + */ + PROPERTIES("properties"), + /** + * Represents the 'referer' constant value. + */ + REFERER("referer"), + /** + * Represents the 'host' constant value. + */ + HOST("host"), + /** + * Represents the 'spid' constant value. + */ + SPID("spid"), + /** + * Represents the 'domain' constant value. + */ + DOMAIN("domain"), + /** + * Represents the '.validation' constant value. + */ + VALIDATION_SUFFIX(".validation"), + /** + * Represents the 'jsessionid' constant value. + */ + EQUAL("="), + /** + * Represents the 'HttpOnly' constant value. + */ + HTTP_ONLY("HttpOnly"), + /** + * Represents the 'SET-COOKIE' constant value. + */ + JSSESSION("JSESSIONID"), + /** + * Represents the '=' constant value. + */ + SETCOOKIE("SET-COOKIE"), + /** + * Represents the ';' constant value. + */ + SEMICOLON(";"), + /** + * Represents the ' ' constant value. + */ + SPACE(" "), + /** + * Represents the 'atp' constant value. + */ + APROVIDER_PREFIX("atp"), + /** + * Represents the 'ap-cpeps' constant value. + */ + AP_CPEPS_PREFIX("ap-cpeps"), + /** + * Represents the 'attr-filter' constant value. + */ + AP_ATTRFILTER_PREFIX("attr-filter"); + + /** + * Represents the constant's value. + */ + private String value; + + /** + * Solo Constructor. + * + * @param val The Constant value. + */ + PEPSValues(final String val) { + + this.value = val; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + + return value; + } + + /** + * Construct the return value with the following structure + * CONSTANT_VALUE+index+".id". + * + * @param index the number. + * + * @return The concatenated String value. + */ + public String index(final int index) { + + return value + index + ".id"; + } + + /** + * Construct the return value with the following structure + * CONSTANT_VALUE+index+".value". + * + * @param index the number. + * + * @return The concatenated string value. + */ + public String value(final int index) { + + return value + index + ".value"; + } + + /** + * Construct the return value with the following structure + * CONSTANT_VALUE+index+".name". + * + * @param index the number. + * + * @return The concatenated String value. + */ + public String name(final int index) { + + return value + index + ".name"; + } + + /** + * Construct the return value with the following structure + * CONSTANT_VALUE+index+".url". + * + * @param index the number. + * + * @return The concatenated String value. + */ + public String url(final int index) { + + return value + index + ".url"; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java new file mode 100644 index 000000000..bb9b3b694 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java @@ -0,0 +1,323 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import eu.stork.peps.auth.commons.exceptions.InternalErrorPEPSException; + +/** + * This class is a bean used to store the information relative to the + * PersonalAttribute. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.22 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class PersonalAttribute implements Serializable, Cloneable { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 2612951678412632174L; + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(PersonalAttribute.class + .getName()); + + /** + * Name of the personal attribute. + */ + private String name; + + /** + * Values of the personal attribute. + */ + private List value = new ArrayList(); + + /** + * Complex values of the personal attribute. + */ + private Map complexValue = new HashMap(); + + /** + * Is the personal attribute mandatory? + */ + private transient boolean required; + + /** + * Returned status of the attribute from the IdP. + */ + private String status; + + /** + * Name of the personal attribute. + */ + private String friendlyName; + + /** + * Empty Constructor. + */ + public PersonalAttribute() { + super(); + } + + /** + * PersonalAttribute Constructor for complex values. + * + * @param attrName The attribute name. + * @param attrIsRequired The attribute type value. + * @param attrComplexValue The attribute's value. + * @param attrStatus The attribute's status value. + */ + public PersonalAttribute(final String attrName, final boolean attrIsRequired, + final List attrComplexValue, final String attrStatus) { + this.setName(attrName); + this.setIsRequired(attrIsRequired); + this.setValue(attrComplexValue); + this.setStatus(attrStatus); + } + + /** + * PersonalAttribute Constructor for complex values. + * + * @param attrName The attribute name. + * @param attrIsRequired The attribute type value. + * @param attrComplexValue The attribute's complex value. + * @param attrStatus The attribute's status value. + */ + public PersonalAttribute(final String attrName, final boolean attrIsRequired, + final Map attrComplexValue, final String attrStatus) { + this.setName(attrName); + this.setIsRequired(attrIsRequired); + this.setComplexValue(attrComplexValue); + this.setStatus(attrStatus); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public Object clone() { + + try { + final PersonalAttribute personalAttr = (PersonalAttribute) super.clone(); + personalAttr.setIsRequired(this.isRequired()); + personalAttr.setName(this.getName()); + personalAttr.setStatus(this.getStatus()); + if (!isEmptyValue()) { + final List val = + (List) ((ArrayList) this.getValue()).clone(); + personalAttr.setValue(val); + } + if (!isEmptyComplexValue()) { + final Map complexVal = + (Map) ((HashMap) this + .getComplexValue()).clone(); + personalAttr.setComplexValue(complexVal); + } + return personalAttr; + } catch (final CloneNotSupportedException e) { + // assert false; + LOG.trace("Nothing to do."); + throw new InternalErrorPEPSException( + PEPSUtil.getConfig(PEPSErrors.INTERNAL_ERROR.errorCode()), + PEPSUtil.getConfig(PEPSErrors.INTERNAL_ERROR.errorMessage()), e); + } + } + + /** + * Getter for the required value. + * + * @return The required value. + */ + public boolean isRequired() { + return required; + } + + /** + * Setter for the required value. + * + * @param attrIsRequired this attribute? + */ + public void setIsRequired(final boolean attrIsRequired) { + this.required = attrIsRequired; + } + + /** + * Getter for the name value. + * + * @return The name value. + */ + public String getName() { + return name; + } + + /** + * Setter for the name value. + * + * @param attrName The personal attribute name. + */ + public void setName(final String attrName) { + this.name = attrName; + } + + /** + * Getter for the value. + * + * @return The list of values. + */ + public List getValue() { + return value; + } + + /** + * Setter for the list of values. + * + * @param attrValue The personal attribute value. + */ + public void setValue(final List attrValue) { + if (attrValue != null) { + this.value = attrValue; + } + } + + /** + * Getter for the status. + * + * @return The status value. + */ + public String getStatus() { + return status; + } + + /** + * Setter for the status value. + * + * @param attrStatus The personal attribute status. + */ + public void setStatus(final String attrStatus) { + this.status = attrStatus; + } + + /** + * Getter for the complex value. + * + * @return The complex value. + */ + public Map getComplexValue() { + return complexValue; + } + + /** + * Setter for the complex value. + * + * @param complexVal The personal attribute Complex value. + */ + public void setComplexValue(final Map complexVal) { + if (complexVal != null) { + this.complexValue = complexVal; + } + } + + /** + * Getter for the personal's friendly name. + * + * @return The personal's friendly name value. + */ + public String getFriendlyName() { + return friendlyName; + } + + /** + * Setter for the personal's friendly name. + * + * @param fName The personal's friendly name. + */ + public void setFriendlyName(final String fName) { + this.friendlyName = fName; + } + + /** + * Return true the value is empty. + * + * @return True if the value is empty "[]"; + */ + public boolean isEmptyValue() { + return value.isEmpty() || (value.size() == 1 && value.get(0).length() == 0); + } + + /** + * Returns true if the Complex Value is empty. + * + * @return True if the Complex Value is empty; + */ + public boolean isEmptyComplexValue() { + return complexValue.isEmpty(); + } + + /** + * Returns true if the Status is empty. + * + * @return True if the Status is empty; + */ + public boolean isEmptyStatus() { + return (status == null || status.length() == 0); + } + + /** + * Prints the PersonalAttribute in the following format. + * name:required:[v,a,l,u,e,s]|[v=a,l=u,e=s]:status; + * + * @return The PersonalAttribute as a string. + */ + public String toString() { + final StringBuilder strBuild = new StringBuilder(); + + AttributeUtil.appendIfNotNull(strBuild, getName()); + strBuild.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); + AttributeUtil.appendIfNotNull(strBuild, String.valueOf(isRequired())); + strBuild.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); + strBuild.append('['); + + if (isEmptyValue()) { + if (!isEmptyComplexValue()) { + AttributeUtil.appendIfNotNull(strBuild, AttributeUtil.mapToString( + getComplexValue(), PEPSValues.ATTRIBUTE_VALUE_SEP.toString())); + } + } else { + AttributeUtil.appendIfNotNull( + strBuild, + AttributeUtil.listToString(getValue(), + PEPSValues.ATTRIBUTE_VALUE_SEP.toString())); + } + + strBuild.append(']'); + strBuild.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); + AttributeUtil.appendIfNotNull(strBuild, getStatus()); + strBuild.append(PEPSValues.ATTRIBUTE_SEP.toString()); + + return strBuild.toString(); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java new file mode 100644 index 000000000..d33ccfe18 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java @@ -0,0 +1,305 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.StringTokenizer; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; + +/** + * This class is a bean used to store the information relative to the + * PersonalAttributeList. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.27 $, $Date: 2010-11-18 22:54:56 $ + * + * @see PersonalAttribute + */ +@SuppressWarnings("PMD") +public final class PersonalAttributeList extends + HashMap implements IPersonalAttributeList{ + + /** + * Logger object. + */ + private static final Logger LOG = Logger + .getLogger(PersonalAttributeList.class.getName()); + + /** + * Serial id. + */ + private static final long serialVersionUID = 7375127363889975062L; + + /** + * Hash with the latest fetched attribute name alias. + */ + private final transient Map latestAttrAlias = + new HashMap(); + + /** + * Hash with mapping number of alias or the attribute name. + */ + private final transient Map attrAliasNumber = + new HashMap(); + + /** + * Default constructor. + */ + public PersonalAttributeList() { + // The best practices recommend to call the super constructor. + super(); + } + + /** + * Constructor with initial capacity for the PersonalAttributeList size. + * + * @param capacity The initial capacity for the PersonalAttributeList. + */ + public PersonalAttributeList(final int capacity) { + super(capacity); + } + + /** + * {@inheritDoc} + */ + public Iterator iterator() { + return this.values().iterator(); + } + + /** + * {@inheritDoc} + */ + public PersonalAttribute get(final Object key) { + String attrName = (String) key; + + if (this.latestAttrAlias.containsKey(key)) { + attrName = attrName + this.latestAttrAlias.get(key); + } else { + if (this.attrAliasNumber.containsKey(key)) { + this.latestAttrAlias.put(attrName, this.attrAliasNumber.get(key)); + } + } + return super.get(attrName); + } + + /** + * {@inheritDoc} + */ + public void add(final PersonalAttribute value) { + if (value != null) { + this.put(value.getName(), value); + } + } + + /** + * {@inheritDoc} + */ + public PersonalAttribute put(final String key, final PersonalAttribute val) { + if (StringUtils.isNotEmpty(key) && val != null) { + // Validate if attribute name already exists! + String attrAlias = key; + if (this.containsKey(key)) { + if (!val.isEmptyValue() && StringUtils.isNumeric(val.getValue().get(0))) { + final String attrValue = val.getValue().get(0); + attrAlias = key + attrValue; + this.attrAliasNumber.put(key, Integer.valueOf(attrValue)); + } else { + final PersonalAttribute attr = super.get(key); + if (!attr.isEmptyValue() + && StringUtils.isNumeric(attr.getValue().get(0))) { + attrAlias = key + attr.getValue().get(0); + super.put(key, (PersonalAttribute) attr); + this.attrAliasNumber.put(key, null); + } + } + } + return super.put(attrAlias, val); + } else { + return null; + } + } + + /** + * {@inheritDoc} + */ + public void populate(final String attrList) { + final StringTokenizer strToken = + new StringTokenizer(attrList, PEPSValues.ATTRIBUTE_SEP.toString()); + + while (strToken.hasMoreTokens()) { + final PersonalAttribute persAttr = new PersonalAttribute(); + String[] tuples = + strToken.nextToken().split(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString(), + AttributeConstants.NUMBER_TUPLES.intValue()); + + // Convert to the new format if needed! + tuples = convertFormat(tuples); + + if (AttributeUtil.hasValidTuples(tuples)) { + final int attrValueIndex = + AttributeConstants.ATTR_VALUE_INDEX.intValue(); + final String tmpAttrValue = + tuples[attrValueIndex].substring(1, + tuples[attrValueIndex].length() - 1); + final String[] vals = + tmpAttrValue.split(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + persAttr.setName(tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()]); + persAttr.setIsRequired(Boolean + .valueOf(tuples[AttributeConstants.ATTR_TYPE_INDEX.intValue()])); + + // check if it is a complex value + if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] + .equals(PEPSParameters.COMPLEX_ADDRESS_VALUE.toString())) + { + persAttr.setComplexValue(createComplexValue(vals)); + } + else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] + .equals(PEPSParameters.COMPLEX_NEWATTRIBUTE_VALUE.toString())) + { + persAttr.setComplexValue(createComplexValue(vals)); + } + + else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] + .equals(PEPSParameters.COMPLEX_HASDEGREE_VALUE.toString())) + { + persAttr.setComplexValue(createComplexValue(vals)); + } + else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] + .equals(PEPSParameters.COMPLEX_MANDATECONTENT_VALUE.toString())) + { + persAttr.setComplexValue(createComplexValue(vals)); + } + else + { + persAttr.setValue(createValues(vals)); + } + + if (tuples.length == AttributeConstants.NUMBER_TUPLES.intValue()) { + persAttr.setStatus(tuples[AttributeConstants.ATTR_STATUS_INDEX + .intValue()]); + } + this.put(tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()], + persAttr); + + } else { + LOG.warn("Invalid personal attribute list tuples"); + } + + } + } + + /** + * Returns a copy of this IPersonalAttributeList instance. + * + * @return The copy of this IPersonalAttributeList. + */ + public Object clone() { + return (PersonalAttributeList) super.clone(); + } + + /** + * Creates a string in the following format. + * + * attrName:attrType:[attrValue1,attrValue2=attrComplexValue]:attrStatus; + * + * @return {@inheritDoc} + */ + @Override + public String toString() { + final Iterator> itAttrs = + this.entrySet().iterator(); + final StringBuilder strBuilder = new StringBuilder(); + + while (itAttrs.hasNext()) { + final Entry attrEntry = itAttrs.next(); + final PersonalAttribute attr = attrEntry.getValue(); + strBuilder.append(attr.toString()); + } + + return strBuilder.toString(); + } + + /** + * Validates and creates the attribute's complex values. + * + * @param values The complex values. + * + * @return The {@link Map} with the complex values. + * + * @see Map + */ + private Map createComplexValue(final String[] values) { + final Map complexValue = new HashMap(); + for (final String val : values) { + final String[] tVal = val.split("="); + if (StringUtils.isNotEmpty(val) && tVal.length == 2) { + complexValue.put(tVal[0], AttributeUtil.unescape(tVal[1])); + } + } + return complexValue; + } + + /** + * Validates and creates the attribute values. + * + * @param vals The attribute values. + * + * @return The {@link List} with the attribute values. + * + * @see List + */ + private List createValues(final String[] vals) { + final List values = new ArrayList(); + for (final String val : vals) { + if (StringUtils.isNotEmpty(val)) { + values.add(AttributeUtil.unescape(val)); + } + } + return values; + } + + /** + * Converts the attribute tuple (attrName:attrType...) to the new format. + * + * @param tuples The attribute tuples to convert. + * + * @return The attribute tuples in the new format. + */ + private String[] convertFormat(final String[] tuples) { + final String[] newFormatTuples = + new String[AttributeConstants.NUMBER_TUPLES.intValue()]; + if (tuples != null) { + System.arraycopy(tuples, 0, newFormatTuples, 0, tuples.length); + + for (int i = tuples.length; i < newFormatTuples.length; i++) { + if (i == AttributeConstants.ATTR_VALUE_INDEX.intValue()) { + newFormatTuples[i] = "[]"; + } else { + newFormatTuples[i] = ""; + } + } + } + return newFormatTuples; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java new file mode 100644 index 000000000..33160f2ac --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java @@ -0,0 +1,426 @@ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; + +import org.apache.log4j.Logger; + +public class STORKAttrQueryRequest implements Serializable, Cloneable { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 4778480781609392750L; + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(STORKAttrQueryRequest.class + .getName()); + + /** The samlId. */ + private String samlId; + + /** The destination. */ + private String destination; + + /** The distinguished name. */ + private String distinguishedName; + + /** The e id sector share. */ + private boolean eIDSectorShare; + + /** The e id cross sector share. */ + private boolean eIDCrossSectorShare; + + /** The e id cross border share. */ + private boolean eIDCrossBorderShare; + + /** The personal attribute list. */ + private IPersonalAttributeList attributeList = new PersonalAttributeList(); + + /** The qaa. */ + private int qaa; + + /** The token saml. */ + private byte[] tokenSaml = new byte[0]; + + /** The issuer. */ + private String issuer; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The country. */ + private String country; + + /** The citizen country code. */ + private String citizenCountry; + + /** The Service Provider ID. */ + private String sPID; + + /** The Alias used at the keystore for saving this certificate. */ + private String alias; + + /** + * Gets the SP's Certificate Alias. + * + * @return alias The SP's Certificate Alias. + */ + public String getAlias() { + return alias; + } + + /** + * Sets the SP's Certificate Alias. + * + * @param nAlias The SP's Certificate Alias. + */ + public void setAlias(final String nAlias) { + this.alias = nAlias; + } + + /** + * Gets the SP ID. + * + * @return sPID The SP ID. + */ + public String getSPID() { + return sPID; + } + + /** + * Sets the SP ID. + * + * @param sPId The new sp samlId. + */ + public void setSPID(final String sPId) { + this.sPID = sPId; + } + + /** + * Gets the citizen country code. + * + * @return The citizen country code value. + */ + public String getCitizenCountryCode() { + return citizenCountry; + } + + /** + * Sets the citizen country code. + * + * @param countryCode the new citizen country code value. + */ + public void setCitizenCountryCode(final String countryCode) { + this.citizenCountry = countryCode; + } + + /** + * Gets the sp country. + * + * @return The sp country value. + */ + public String getSpCountry() { + return spCountry; + } + + /** + * Sets the sp country. + * + * @param sPCountry the new sp country value. + */ + public void setSpCountry(final String sPCountry) { + this.spCountry = sPCountry; + } + + /** + * Gets the issuer. + * + * @return The issuer value. + */ + public String getIssuer() { + return issuer; + } + + /** + * Sets the issuer. + * + * @param samlIssuer the new issuer value. + */ + public void setIssuer(final String samlIssuer) { + this.issuer = samlIssuer; + } + + /** + * Gets the SAML Token. + * + * @return The SAML Token value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Sets the SAML Token. + * + * @param samlToken The new SAML Token value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Gets the country. + * + * @return The country value. + */ + public String getCountry() { + return country; + } + + /** + * Sets the country. + * + * @param nCountry the new country value. + */ + public void setCountry(final String nCountry) { + this.country = nCountry; + } + + /** + * Getter for the qaa value. + * + * @return The qaa value value. + */ + public int getQaa() { + return qaa; + } + + /** + * Setter for the qaa value. + * + * @param qaaLevel The new qaa value. + */ + public void setQaa(final int qaaLevel) { + this.qaa = qaaLevel; + } + + /** + * Getter for the destination value. + * + * @return The destination value. + */ + public String getDestination() { + return destination; + } + + /** + * Setter for the destination value. + * + * @param detination the new destination value. + */ + public void setDestination(final String detination) { + this.destination = detination; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param newSamlId the new samlId value. + */ + public void setSamlId(final String newSamlId) { + this.samlId = newSamlId; + } + + + /** + * Getter for the attributeList value. + * + * @return The attributeList value. + * + * @see IPersonalAttributeList + */ + public IPersonalAttributeList getPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the attributeList value. + * + * @param attrList the personal attribute list value. + * + * @see IPersonalAttributeList + */ + public void setPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.attributeList = attrList; + } + } + + /** + * Getter for the distinguishedName value. + * + * @return The distinguishedName value. + */ + public String getDistinguishedName() { + return distinguishedName; + } + + /** + * Setter for the distinguishedName value. + * + * @param certDN the distinguished name value. + */ + public void setDistinguishedName(final String certDN) { + this.distinguishedName = certDN; + } + + /** + * Gets the service provider sector. + * + * @return The service provider sector value. + */ + public String getSpSector() { + return spSector; + } + + /** + * Sets the service provider sector. + * + * @param samlSPSector the new service provider sector value. + */ + public void setSpSector(final String samlSPSector) { + this.spSector = samlSPSector; + } + + /** + * Gets the service provider institution. + * + * @return The service provider institution value. + */ + public String getSpInstitution() { + return spInstitution; + } + + /** + * Sets the service provider institution. + * + * @param samlSPInst the new service provider institution value. + */ + public void setSpInstitution(final String samlSPInst) { + this.spInstitution = samlSPInst; + } + + /** + * Gets the service provider application. + * + * @return The service provider application value. + */ + public String getSpApplication() { + return spApplication; + } + + /** + * Sets the service provider application. + * + * @param samlSPApp the new service provider application value. + */ + public void setSpApplication(final String samlSPApp) { + this.spApplication = samlSPApp; + } + + /** + * Checks if is eId sector share. + * + * @return true, if is eId sector share. + */ + public boolean isEIDSectorShare() { + return eIDSectorShare; + } + + /** + * Sets the eId sector share. + * + * @param eIdSectorShare the new eId sector share value. + */ + public void setEIDSectorShare(final boolean eIdSectorShare) { + this.eIDSectorShare = eIdSectorShare; + } + + /** + * Checks if is eId cross sector share. + * + * @return true, if is eId cross sector share. + */ + public boolean isEIDCrossSectorShare() { + return eIDCrossSectorShare; + } + + /** + * Sets the eId cross sector share. + * + * @param eIdCrossSectorShare the new eId cross sector share value. + */ + public void setEIDCrossSectorShare(final boolean eIdCrossSectorShare) { + this.eIDCrossSectorShare = eIdCrossSectorShare; + } + + /** + * Checks if is eId cross border share. + * + * @return true, if is eId cross border share. + */ + public boolean isEIDCrossBorderShare() { + return eIDCrossBorderShare; + } + + /** + * Sets the eId cross border share. + * + * @param eIdCrossBorderShare the new eId cross border share value. + */ + public void setEIDCrossBorderShare(final boolean eIdCrossBorderShare) { + this.eIDCrossBorderShare = eIdCrossBorderShare; + } + + /** + * Returns a copy of this STORKAttrQueryRequest instance. + * + * @return The copy of this STORKAttrQueryRequest. + * @throws CloneNotSupportedException on clone exception + */ + @Override + public Object clone() throws CloneNotSupportedException{ + STORKAttrQueryRequest storkAttrQueryReq = null; + storkAttrQueryReq = (STORKAttrQueryRequest) super.clone(); + storkAttrQueryReq.setPersonalAttributeList(getPersonalAttributeList()); + storkAttrQueryReq.setTokenSaml(getTokenSaml()); + return storkAttrQueryReq; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java new file mode 100644 index 000000000..215b978dc --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java @@ -0,0 +1,301 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import org.apache.log4j.Logger; +import org.joda.time.DateTime; + +public class STORKAttrQueryResponse { + + /** Response Id. */ + private String samlId; + + /** Request failed? */ + private boolean fail; + + /** Status code. */ + private String statusCode; + + /** Secondary status code. */ + private String subStatusCode; + + /** Audience restriction. */ + private transient String audienceRest; + + /** Error message. */ + private String message; + + /** Id of the request that originated this response. */ + private String inResponseTo; + + /** Expiration date. */ + private DateTime notOnOrAfter; + + /** Creation date. */ + private DateTime notBefore; + + /** The SAML token. */ + private byte[] tokenSaml = new byte[0]; + + /** Country. */ + private String country; + + /** Citizen's personal attribute list. */ + private transient IPersonalAttributeList attributeList = new PersonalAttributeList(); + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(STORKAttrQueryResponse.class.getName()); + + /** + * Getter for the subStatusCode. + * + * @return The subStatusCode value. + */ + public String getSubStatusCode() { + return subStatusCode; + } + + /** + * Setter for the subStatusCode. + * + * @param samlSubStatusCode the new subStatusCode value. + */ + public void setSubStatusCode(final String samlSubStatusCode) { + this.subStatusCode = samlSubStatusCode; + } + + /** + * Getter for audienceRest. + * + * @return The audienceRest value. + */ + public String getAudienceRestriction() { + return audienceRest; + } + + /** + * Setter for audienceRest. + * + * @param audRest the new audienceRest value. + */ + public void setAudienceRestriction(final String audRest) { + this.audienceRest = audRest; + } + + /** + * Getter for the samlToken. + * + * @return The samlToken value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Setter for samlToken. + * + * @param samlToken the new tokenSaml value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Getter for the country name. + * + * @return The country name value. + */ + public String getCountry() { + return country; + } + + /** + * Setter for the country name. + * + * @param cCountry the new country name value. + */ + public void setCountry(final String cCountry) { + this.country = cCountry; + } + + /** + * Getter for pal value. + * + * @return The pal value. + * + * @see PersonalAttributeList + */ + public IPersonalAttributeList getPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the Personal Attribute List value. + * + * @param attrList the new value. + * + * @see PersonalAttributeList + */ + public void setPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.attributeList = attrList; + } + } + + /** + * Getter for the inResponseTo value. + * + * @return The inResponseTo value. + */ + public String getInResponseTo() { + return inResponseTo; + } + + /** + * Setter for the inResponseTo value. + * + * @param samlInResponseTo the new inResponseTo value. + */ + public void setInResponseTo(final String samlInResponseTo) { + this.inResponseTo = samlInResponseTo; + } + + /** + * Getter for the fail value. + * + * @return The fail value. + */ + public boolean isFail() { + return fail; + } + + /** + * Setter for the fail value. + * + * @param failVal the new fail value. + */ + public void setFail(final boolean failVal) { + this.fail = failVal; + } + + /** + * Getter for the message value. + * + * @return The message value. + */ + public String getMessage() { + return message; + } + + /** + * Setter for the message value. + * + * @param msg the new message value. + */ + public void setMessage(final String msg) { + this.message = msg; + } + + /** + * Getter for the statusCode value. + * + * @return The statusCode value. + */ + public String getStatusCode() { + return statusCode; + } + + /** + * Setter for the statusCode value. + * + * @param status the new statusCode value. + */ + public void setStatusCode(final String status) { + this.statusCode = status; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param nSamlId the new samlId value. + */ + public void setSamlId(final String nSamlId) { + this.samlId = nSamlId; + } + + /** + * Getter for the notOnOrAfter value. + * + * @return The notOnOrAfter value. + * + * @see DateTime + */ + public DateTime getNotOnOrAfter() { + return this.notOnOrAfter; + } + + /** + * Setter for the notOnOrAfter value. + * + * @param nOnOrAfter the new notOnOrAfter value. + * + * @see DateTime + */ + public void setNotOnOrAfter(final DateTime nOnOrAfter) { + this.notOnOrAfter = nOnOrAfter; + } + + /** + * Getter for the notBefore value. + * + * @return The notBefore value. + * + * @see DateTime + */ + public DateTime getNotBefore() { + return notBefore; + } + + /** + * Setter for the notBefore value. + * + * @param nBefore the new notBefore value. + * + * @see DateTime + */ + public void setNotBefore(final DateTime nBefore) { + this.notBefore = nBefore; + } + +} + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java new file mode 100644 index 000000000..2354d0eb1 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java @@ -0,0 +1,495 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; + +import org.apache.log4j.Logger; + +/** + * This class is a bean used to store the information relative to the + * STORKAuthnRequest (SAML Token Request). + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.21 $, $Date: 2011-02-17 22:44:34 $ + */ +public final class STORKAuthnRequest implements Serializable, Cloneable { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 4778480781609392750L; + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(STORKAuthnRequest.class + .getName()); + + /** The samlId. */ + private String samlId; + + /** The assertion consumer service url. */ + private String serviceURL; + + /** The destination. */ + private String destination; + + /** The provider name. */ + private String providerName; + + /** The distinguished name. */ + private String distinguishedName; + + /** The e id sector share. */ + private boolean eIDSectorShare; + + /** The e id cross sector share. */ + private boolean eIDCrossSectorShare; + + /** The e id cross border share. */ + private boolean eIDCrossBorderShare; + + /** The personal attribute list. */ + private IPersonalAttributeList attributeList = new PersonalAttributeList(); + + /** The qaa. */ + private int qaa; + + /** The token saml. */ + private byte[] tokenSaml = new byte[0]; + + /** The issuer. */ + private String issuer; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The country. */ + private String country; + + /** The citizen country code. */ + private String citizenCountry; + + /** The Service Provider ID. */ + private String sPID; + + /** The Alias used at the keystore for saving this certificate. */ + private String alias; + + /** + * Gets the SP's Certificate Alias. + * + * @return alias The SP's Certificate Alias. + */ + public String getAlias() { + return alias; + } + + /** + * Sets the SP's Certificate Alias. + * + * @param nAlias The SP's Certificate Alias. + */ + public void setAlias(final String nAlias) { + this.alias = nAlias; + } + + /** + * Gets the SP ID. + * + * @return sPID The SP ID. + */ + public String getSPID() { + return sPID; + } + + /** + * Sets the SP ID. + * + * @param sPId The new sp samlId. + */ + public void setSPID(final String sPId) { + this.sPID = sPId; + } + + /** + * Gets the citizen country code. + * + * @return The citizen country code value. + */ + public String getCitizenCountryCode() { + return citizenCountry; + } + + /** + * Sets the citizen country code. + * + * @param countryCode the new citizen country code value. + */ + public void setCitizenCountryCode(final String countryCode) { + this.citizenCountry = countryCode; + } + + /** + * Gets the sp country. + * + * @return The sp country value. + */ + public String getSpCountry() { + return spCountry; + } + + /** + * Sets the sp country. + * + * @param sPCountry the new sp country value. + */ + public void setSpCountry(final String sPCountry) { + this.spCountry = sPCountry; + } + + /** + * Gets the issuer. + * + * @return The issuer value. + */ + public String getIssuer() { + return issuer; + } + + /** + * Sets the issuer. + * + * @param samlIssuer the new issuer value. + */ + public void setIssuer(final String samlIssuer) { + this.issuer = samlIssuer; + } + + /** + * Gets the SAML Token. + * + * @return The SAML Token value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Sets the SAML Token. + * + * @param samlToken The new SAML Token value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Gets the country. + * + * @return The country value. + */ + public String getCountry() { + return country; + } + + /** + * Sets the country. + * + * @param nCountry the new country value. + */ + public void setCountry(final String nCountry) { + this.country = nCountry; + } + + /** + * Getter for the qaa value. + * + * @return The qaa value value. + */ + public int getQaa() { + return qaa; + } + + /** + * Setter for the qaa value. + * + * @param qaaLevel The new qaa value. + */ + public void setQaa(final int qaaLevel) { + this.qaa = qaaLevel; + } + + /** + * Getter for the serviceURL value. + * + * @return The serviceURL value. + */ + public String getAssertionConsumerServiceURL() { + return serviceURL; + } + + /** + * Setter for the serviceURL value. + * + * @param newServiceURL the assertion consumer service URL. + */ + public void setAssertionConsumerServiceURL(final String newServiceURL) { + this.serviceURL = newServiceURL; + } + + /** + * Getter for the destination value. + * + * @return The destination value. + */ + public String getDestination() { + return destination; + } + + /** + * Setter for the destination value. + * + * @param detination the new destination value. + */ + public void setDestination(final String detination) { + this.destination = detination; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param newSamlId the new samlId value. + */ + public void setSamlId(final String newSamlId) { + this.samlId = newSamlId; + } + + /** + * Getter for the providerName value. + * + * @return The provider name value. + */ + public String getProviderName() { + return providerName; + } + + /** + * Setter for the providerName value. + * + * @param samlProvider the provider name value. + */ + public void setProviderName(final String samlProvider) { + this.providerName = samlProvider; + } + + /** + * Getter for the attributeList value. + * + * @return The attributeList value. + * + * @see IPersonalAttributeList + */ + public IPersonalAttributeList getPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the attributeList value. + * + * @param attrList the personal attribute list value. + * + * @see IPersonalAttributeList + */ + public void setPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.attributeList = attrList; + } + } + + /** + * Getter for the distinguishedName value. + * + * @return The distinguishedName value. + */ + public String getDistinguishedName() { + return distinguishedName; + } + + /** + * Setter for the distinguishedName value. + * + * @param certDN the distinguished name value. + */ + public void setDistinguishedName(final String certDN) { + this.distinguishedName = certDN; + } + + /** + * Gets the service provider sector. + * + * @return The service provider sector value. + */ + public String getSpSector() { + return spSector; + } + + /** + * Sets the service provider sector. + * + * @param samlSPSector the new service provider sector value. + */ + public void setSpSector(final String samlSPSector) { + this.spSector = samlSPSector; + } + + /** + * Gets the service provider institution. + * + * @return The service provider institution value. + */ + public String getSpInstitution() { + return spInstitution; + } + + /** + * Sets the service provider institution. + * + * @param samlSPInst the new service provider institution value. + */ + public void setSpInstitution(final String samlSPInst) { + this.spInstitution = samlSPInst; + } + + /** + * Gets the service provider application. + * + * @return The service provider application value. + */ + public String getSpApplication() { + return spApplication; + } + + /** + * Sets the service provider application. + * + * @param samlSPApp the new service provider application value. + */ + public void setSpApplication(final String samlSPApp) { + this.spApplication = samlSPApp; + } + + /** + * Checks if is eId sector share. + * + * @return true, if is eId sector share. + */ + public boolean isEIDSectorShare() { + return eIDSectorShare; + } + + /** + * Sets the eId sector share. + * + * @param eIdSectorShare the new eId sector share value. + */ + public void setEIDSectorShare(final boolean eIdSectorShare) { + this.eIDSectorShare = eIdSectorShare; + } + + /** + * Checks if is eId cross sector share. + * + * @return true, if is eId cross sector share. + */ + public boolean isEIDCrossSectorShare() { + return eIDCrossSectorShare; + } + + /** + * Sets the eId cross sector share. + * + * @param eIdCrossSectorShare the new eId cross sector share value. + */ + public void setEIDCrossSectorShare(final boolean eIdCrossSectorShare) { + this.eIDCrossSectorShare = eIdCrossSectorShare; + } + + /** + * Checks if is eId cross border share. + * + * @return true, if is eId cross border share. + */ + public boolean isEIDCrossBorderShare() { + return eIDCrossBorderShare; + } + + /** + * Sets the eId cross border share. + * + * @param eIdCrossBorderShare the new eId cross border share value. + */ + public void setEIDCrossBorderShare(final boolean eIdCrossBorderShare) { + this.eIDCrossBorderShare = eIdCrossBorderShare; + } + + /** + * Returns a copy of this STORKAuthnRequest instance. + * + * @return The copy of this STORKAuthnRequest. + * @throws CloneNotSupportedException on clone exception + */ + @Override + public Object clone() throws CloneNotSupportedException{ + STORKAuthnRequest storkAuthnReq = null; + try { + storkAuthnReq = (STORKAuthnRequest) super.clone(); + storkAuthnReq.setPersonalAttributeList(getPersonalAttributeList()); + storkAuthnReq.setTokenSaml(getTokenSaml()); + } catch (final CloneNotSupportedException e) { + // assert false; + LOG.trace("[PersonalAttribute] Nothing to do."); + } + + return storkAuthnReq; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java new file mode 100644 index 000000000..aa98974f6 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java @@ -0,0 +1,309 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +import org.apache.log4j.Logger; +import org.joda.time.DateTime; + +/** + * This class is a bean used to store the information relative to the + * STORKAuthnResponse. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class STORKAuthnResponse { + + /** Response Id. */ + private String samlId; + + /** Authentication failed? */ + private boolean fail; + + /** Status code. */ + private String statusCode; + + /** Secondary status code. */ + private String subStatusCode; + + /** Audience restriction. */ + private transient String audienceRest; + + /** Error message. */ + private String message; + + /** Id of the request that originated this response. */ + private String inResponseTo; + + /** Expiration date. */ + private DateTime notOnOrAfter; + + /** Creation date. */ + private DateTime notBefore; + + /** The SAML token. */ + private byte[] tokenSaml = new byte[0]; + + /** Country. */ + private String country; + + /** Citizen's personal attribute list. */ + private transient IPersonalAttributeList attributeList = new PersonalAttributeList(); + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(STORKAuthnResponse.class.getName()); + + /** + * Getter for the subStatusCode. + * + * @return The subStatusCode value. + */ + public String getSubStatusCode() { + return subStatusCode; + } + + /** + * Setter for the subStatusCode. + * + * @param samlSubStatusCode the new subStatusCode value. + */ + public void setSubStatusCode(final String samlSubStatusCode) { + this.subStatusCode = samlSubStatusCode; + } + + /** + * Getter for audienceRest. + * + * @return The audienceRest value. + */ + public String getAudienceRestriction() { + return audienceRest; + } + + /** + * Setter for audienceRest. + * + * @param audRest the new audienceRest value. + */ + public void setAudienceRestriction(final String audRest) { + this.audienceRest = audRest; + } + + /** + * Getter for the samlToken. + * + * @return The samlToken value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Setter for samlToken. + * + * @param samlToken the new tokenSaml value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Getter for the country name. + * + * @return The country name value. + */ + public String getCountry() { + return country; + } + + /** + * Setter for the country name. + * + * @param cCountry the new country name value. + */ + public void setCountry(final String cCountry) { + this.country = cCountry; + } + + /** + * Getter for pal value. + * + * @return The pal value. + * + * @see PersonalAttributeList + */ + public IPersonalAttributeList getPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the Personal Attribute List value. + * + * @param attrList the new value. + * + * @see PersonalAttributeList + */ + public void setPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.attributeList = attrList; + } + } + + /** + * Getter for the inResponseTo value. + * + * @return The inResponseTo value. + */ + public String getInResponseTo() { + return inResponseTo; + } + + /** + * Setter for the inResponseTo value. + * + * @param samlInResponseTo the new inResponseTo value. + */ + public void setInResponseTo(final String samlInResponseTo) { + this.inResponseTo = samlInResponseTo; + } + + /** + * Getter for the fail value. + * + * @return The fail value. + */ + public boolean isFail() { + return fail; + } + + /** + * Setter for the fail value. + * + * @param failVal the new fail value. + */ + public void setFail(final boolean failVal) { + this.fail = failVal; + } + + /** + * Getter for the message value. + * + * @return The message value. + */ + public String getMessage() { + return message; + } + + /** + * Setter for the message value. + * + * @param msg the new message value. + */ + public void setMessage(final String msg) { + this.message = msg; + } + + /** + * Getter for the statusCode value. + * + * @return The statusCode value. + */ + public String getStatusCode() { + return statusCode; + } + + /** + * Setter for the statusCode value. + * + * @param status the new statusCode value. + */ + public void setStatusCode(final String status) { + this.statusCode = status; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param nSamlId the new samlId value. + */ + public void setSamlId(final String nSamlId) { + this.samlId = nSamlId; + } + + /** + * Getter for the notOnOrAfter value. + * + * @return The notOnOrAfter value. + * + * @see DateTime + */ + public DateTime getNotOnOrAfter() { + return this.notOnOrAfter; + } + + /** + * Setter for the notOnOrAfter value. + * + * @param nOnOrAfter the new notOnOrAfter value. + * + * @see DateTime + */ + public void setNotOnOrAfter(final DateTime nOnOrAfter) { + this.notOnOrAfter = nOnOrAfter; + } + + /** + * Getter for the notBefore value. + * + * @return The notBefore value. + * + * @see DateTime + */ + public DateTime getNotBefore() { + return notBefore; + } + + /** + * Setter for the notBefore value. + * + * @param nBefore the new notBefore value. + * + * @see DateTime + */ + public void setNotBefore(final DateTime nBefore) { + this.notBefore = nBefore; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKStatusCode.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKStatusCode.java new file mode 100644 index 000000000..a9c4a156b --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKStatusCode.java @@ -0,0 +1,68 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains the SAML Token Status Code. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.13 $, $Date: 2010-11-17 05:15:28 $ + */ +public enum STORKStatusCode { + + /** URI for Requester status code. */ + REQUESTER_URI("urn:oasis:names:tc:SAML:2.0:status:Requester"), + + /** URI for Responder status code. */ + RESPONDER_URI("urn:oasis:names:tc:SAML:2.0:status:Responder"), + + /** URI for Success status code. */ + SUCCESS_URI("urn:oasis:names:tc:SAML:2.0:status:Success"), + + /** Attribute is Available. */ + STATUS_AVAILABLE("Available"), + + /** Attribute is NotAvailable. */ + STATUS_NOT_AVAILABLE("NotAvailable"), + + /** Attribute is Withheld. */ + STATUS_WITHHELD("Withheld"); + + /** + * Represents the constant's value. + */ + private String value; + + /** + * Solo Constructor. + * + * @param val The Constant value. + */ + private STORKStatusCode(final String val) { + + this.value = val; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + + return value; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKSubStatusCode.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKSubStatusCode.java new file mode 100644 index 000000000..0a711c9b7 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKSubStatusCode.java @@ -0,0 +1,71 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons; + +/** + * This enum class contains the SAML Token Sub Status Code. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.7 $, $Date: 2010-11-17 05:15:28 $ + */ +public enum STORKSubStatusCode { + + /** URI for AuthnFailed status code. */ + AUTHN_FAILED_URI("urn:oasis:names:tc:SAML:2.0:status:AuthnFailed"), + + /** URI for InvalidAttrNameOrValue status code. */ + INVALID_ATTR_NAME_VALUE_URI( + "urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue"), + + /** URI for InvalidNameIDPolicy status code. */ + INVALID_NAMEID_POLICY_URI( + "urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy"), + + /** URI for VersionMismatch status code. */ + VERSION_MISMATCH_URI("urn:oasis:names:tc:SAML:2.0:status:VersionMismatch"), + + /** URI for RequestDenied status code. */ + REQUEST_DENIED_URI("urn:oasis:names:tc:SAML:2.0:status:RequestDenied"), + + /** URI for QaaNotSupported status code. */ + QAA_NOT_SUPPORTED( + "http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported"); + + /** + * Represents the constant's value. + */ + private String value; + + /** + * Solo Constructor. + * + * @param val The Constant value. + */ + private STORKSubStatusCode(final String val) { + + this.value = val; + } + + /** + * Return the Constant Value. + * + * @return The constant value. + */ + public String toString() { + + return value; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/all-wcprops new file mode 100644 index 000000000..14f05b17c --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/all-wcprops @@ -0,0 +1,53 @@ +K 25 +svn:wc:ra_dav:version-url +V 96 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions +END +InvalidParameterPEPSException.java +K 25 +svn:wc:ra_dav:version-url +V 131 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidParameterPEPSException.java +END +SecurityPEPSException.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/SecurityPEPSException.java +END +InvalidSessionPEPSException.java +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidSessionPEPSException.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/package-info.java +END +CPEPSException.java +K 25 +svn:wc:ra_dav:version-url +V 116 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/CPEPSException.java +END +StorkPEPSException.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/StorkPEPSException.java +END +AbstractPEPSException.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/AbstractPEPSException.java +END +InternalErrorPEPSException.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InternalErrorPEPSException.java +END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/entries new file mode 100644 index 000000000..c2ced14f4 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/entries @@ -0,0 +1,300 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +CPEPSException.java +file + + + + +2013-12-20T12:27:56.626475Z +5d3cb4a7303baeaf2104aaa7da301b21 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3570 + +StorkPEPSException.java +file + + + + +2013-12-20T12:27:56.626475Z +fea01f750728ea5f15b449acb517f4b2 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1690 + +AbstractPEPSException.java +file + + + + +2013-12-20T12:27:56.626475Z +c9aedb030e6dbc9f002c7cd3d52cf03f +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +4422 + +InternalErrorPEPSException.java +file + + + + +2013-12-20T12:27:56.626475Z +36d8f6310e84c550f65bef78d5dc4238 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2471 + +InvalidParameterPEPSException.java +file + + + + +2013-12-20T12:27:56.626475Z +c6ad53378b03a346ca0fc48a381ed771 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1800 + +SecurityPEPSException.java +file + + + + +2013-12-20T12:27:56.626475Z +78d50b78a69cb0c630e4e14420e3b7be +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2199 + +InvalidSessionPEPSException.java +file + + + + +2013-12-20T12:27:56.626475Z +5fd7f04ad6f6cc121084e682b2a4e678 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1555 + +package-info.java +file + + + + +2013-12-20T12:27:56.626475Z +7055c01b74382c525c7fcf110646d8fc +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +129 + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/AbstractPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/AbstractPEPSException.java.svn-base new file mode 100644 index 000000000..e9a96d7c2 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/AbstractPEPSException.java.svn-base @@ -0,0 +1,173 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +import java.io.Serializable; + +/** + * Abstract class to represent the various PEPS exceptions. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.13 $, $Date: 2010-11-17 05:15:28 $ + */ +public abstract class AbstractPEPSException extends RuntimeException implements + Serializable { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = -1884417567740138022L; + + /** + * Error code. + */ + private String errorCode; + + /** + * Error message. + */ + private String errorMessage; + + /** + * SAML token. + */ + private String samlTokenFail; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param code The error code value. + * @param message The error message value. + */ + public AbstractPEPSException(final String code, final String message) { + + super(message); + this.errorCode = code; + this.errorMessage = message; + } + + /** + * Exception Constructor with the errorMessage as parameters and the Throwable + * cause. + * + * @param message The error message value. + * @param cause The throwable object. + */ + public AbstractPEPSException(final String message, final Throwable cause) { + + super(message, cause); + this.errorMessage = message; + } + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters and the Throwable cause. + * + * @param code The error code value. + * @param message The error message value. + * @param cause The throwable object. + */ + public AbstractPEPSException(final String code, final String message, + final Throwable cause) { + + super(message, cause); + this.errorCode = code; + this.errorMessage = message; + } + + /** + * Exception Constructor with three Strings representing the errorCode, + * errorMessage and encoded samlToken as parameters. + * + * @param code The error code value. + * @param message The error message value. + * @param samlToken The error SAML Token. + */ + public AbstractPEPSException(final String code, final String message, + final String samlToken) { + + super(message); + this.errorCode = code; + this.errorMessage = message; + this.samlTokenFail = samlToken; + } + + /** + * Constructor with SAML Token as argument. Error message and error code are + * embedded in the SAML. + * + * @param samlToken The error SAML Token. + */ + public AbstractPEPSException(final String samlToken) { + super(); + this.samlTokenFail = samlToken; + } + + /** + * Getter for errorCode. + * + * @return The errorCode value. + */ + public final String getErrorCode() { + return errorCode; + } + + /** + * Setter for errorCode. + * + * @param code The error code value. + */ + public final void setErrorCode(final String code) { + this.errorCode = code; + } + + /** + * Getter for errorMessage. + * + * @return The error Message value. + */ + public final String getErrorMessage() { + return errorMessage; + } + + /** + * Setter for errorMessage. + * + * @param message The error message value. + */ + public final void setErrorMessage(final String message) { + this.errorMessage = message; + } + + /** + * Getter for SAMLTokenFail. + * + * @return The error SAML Token. + */ + public final String getSamlTokenFail() { + return samlTokenFail; + } + + /** + * Setter for SAMLTokenFail. + * + * @param samlToken The error SAML token. + */ + public final void setSamlTokenFail(final String samlToken) { + this.samlTokenFail = samlToken; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/CPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/CPEPSException.java.svn-base new file mode 100644 index 000000000..69cb20fdd --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/CPEPSException.java.svn-base @@ -0,0 +1,143 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * This exception is thrown by the C-PEPS service and holds the relative + * information to present to the citizen. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.9 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class CPEPSException extends RuntimeException { + + /** + * Serial id. + */ + private static final long serialVersionUID = -4012295047127999362L; + + /** + * Error code. + */ + private String errorCode; + + /** + * Error message. + */ + private String errorMessage; + + /** + * SAML token. + */ + private String samlTokenFail; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param samlToken The SAML Token. + * @param code The error code value. + * @param message The error message value. + */ + public CPEPSException(final String samlToken, final String code, + final String message) { + + super(message); + this.setErrorCode(code); + this.setErrorMessage(message); + this.setSamlTokenFail(samlToken); + } + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param samlToken The SAML Token. + * @param code The error code value. + * @param message The error message value. + * @param cause The original exception; + */ + public CPEPSException(final String samlToken, final String code, + final String message, final Throwable cause) { + + super(message, cause); + this.setErrorCode(code); + this.setErrorMessage(message); + this.setSamlTokenFail(samlToken); + } + + /** + * {@inheritDoc} + */ + public String getMessage() { + return this.getErrorMessage() + " (" + this.getErrorCode() + ")"; + } + + /** + * Getter for the error code. + * + * @return The errorCode value. + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Setter for the error code. + * + * @param code The error code. + */ + public void setErrorCode(final String code) { + this.errorCode = code; + } + + /** + * Getter for the error message. + * + * @return The errorMessage value. + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Setter for the error message. + * + * @param message The error message. + */ + public void setErrorMessage(final String message) { + this.errorMessage = message; + } + + /** + * Getter for the samlTokenFail. + * + * @return The samlTokenFail value. + */ + public String getSamlTokenFail() { + return samlTokenFail; + } + + /** + * Setter for the samlTokenFail. + * + * @param samlToken The error Saml Token. + */ + public void setSamlTokenFail(final String samlToken) { + this.samlTokenFail = samlToken; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InternalErrorPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InternalErrorPEPSException.java.svn-base new file mode 100644 index 000000000..67514d4fe --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InternalErrorPEPSException.java.svn-base @@ -0,0 +1,74 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Internal Error Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.13 $, $Date: 2010-11-17 05:15:28 $ + * + * @see AbstractPEPSException + */ +public final class InternalErrorPEPSException extends AbstractPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 1193001455410319795L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters and the Throwable cause. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + * @param cause The throwable object. + */ + public InternalErrorPEPSException(final String errorCode, + final String errorMessage, final Throwable cause) { + + super(errorCode, errorMessage, cause); + } + + /** + * Exception Constructor with three strings representing the errorCode, + * errorMessage and encoded samlToken as parameters. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + * @param samlTokenFail The error SAML Token. + */ + public InternalErrorPEPSException(final String errorCode, + final String errorMessage, final String samlTokenFail) { + + super(errorCode, errorMessage, samlTokenFail); + } + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + */ + public InternalErrorPEPSException(final String errorCode, + final String errorMessage) { + + super(errorCode, errorMessage); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidParameterPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidParameterPEPSException.java.svn-base new file mode 100644 index 000000000..12c83b589 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidParameterPEPSException.java.svn-base @@ -0,0 +1,54 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Invalid Parameter Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.11 $, $Date: 2010-11-17 05:15:28 $ + * + * @see InvalidParameterPEPSException + */ +public class InvalidParameterPEPSException extends AbstractPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 2046282148740524875L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMessage The error code message value. + */ + public InvalidParameterPEPSException(final String errorCode, + final String errorMessage) { + super(errorCode, errorMessage); + } + + /** + * Exception Constructor with one String representing the encoded samlToken. + * + * @param samlTokenFail The error SAML Token. + */ + public InvalidParameterPEPSException(final String samlTokenFail) { + super(samlTokenFail); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidSessionPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidSessionPEPSException.java.svn-base new file mode 100644 index 000000000..800525eee --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidSessionPEPSException.java.svn-base @@ -0,0 +1,46 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Invalid session Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.14 $, $Date: 2010-11-17 05:15:28 $ + * + * @see InvalidParameterPEPSException + */ +public class InvalidSessionPEPSException extends InvalidParameterPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 7147090160978319016L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + */ + public InvalidSessionPEPSException(final String errorCode, + final String errorMessage) { + + super(errorCode, errorMessage); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/SecurityPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/SecurityPEPSException.java.svn-base new file mode 100644 index 000000000..fc27371d2 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/SecurityPEPSException.java.svn-base @@ -0,0 +1,67 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Security PEPS Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.18 $, $Date: 2010-11-17 05:15:28 $ + * + * @see AbstractPEPSException + */ +public final class SecurityPEPSException extends AbstractPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 5605743302478554967L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMsg The error message value. + */ + public SecurityPEPSException(final String errorCode, final String errorMsg) { + super(errorCode, errorMsg); + } + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters and the Throwable cause. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + * @param cause The throwable object. + */ + public SecurityPEPSException(final String errorCode, + final String errorMessage, final Throwable cause) { + + super(errorCode, errorMessage, cause); + } + + /** + * Exception Constructor with one String representing the encoded samlToken. + * + * @param samlTokenFail The error SAML Token. + */ + public SecurityPEPSException(final String samlTokenFail) { + super(samlTokenFail); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/StorkPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/StorkPEPSException.java.svn-base new file mode 100644 index 000000000..a2da61a02 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/StorkPEPSException.java.svn-base @@ -0,0 +1,53 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Security PEPS Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $ + * + * @see AbstractPEPSException + */ +public final class StorkPEPSException extends AbstractPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 8048033129798427574L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMsg The error message value. + */ + public StorkPEPSException(final String errorCode, final String errorMsg) { + super(errorCode, errorMsg); + } + + /** + * {@inheritDoc} + */ + public String getMessage() { + + return "Security Error (" + this.getErrorCode() + ") processing request : " + + this.getErrorMessage(); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/package-info.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..d83068beb --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,7 @@ +/** + * Package for the PEPS’ Exceptions handling. + * + * @since 1.0 + */ +package eu.stork.peps.auth.commons.exceptions; + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/AbstractPEPSException.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/AbstractPEPSException.java new file mode 100644 index 000000000..e9a96d7c2 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/AbstractPEPSException.java @@ -0,0 +1,173 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +import java.io.Serializable; + +/** + * Abstract class to represent the various PEPS exceptions. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.13 $, $Date: 2010-11-17 05:15:28 $ + */ +public abstract class AbstractPEPSException extends RuntimeException implements + Serializable { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = -1884417567740138022L; + + /** + * Error code. + */ + private String errorCode; + + /** + * Error message. + */ + private String errorMessage; + + /** + * SAML token. + */ + private String samlTokenFail; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param code The error code value. + * @param message The error message value. + */ + public AbstractPEPSException(final String code, final String message) { + + super(message); + this.errorCode = code; + this.errorMessage = message; + } + + /** + * Exception Constructor with the errorMessage as parameters and the Throwable + * cause. + * + * @param message The error message value. + * @param cause The throwable object. + */ + public AbstractPEPSException(final String message, final Throwable cause) { + + super(message, cause); + this.errorMessage = message; + } + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters and the Throwable cause. + * + * @param code The error code value. + * @param message The error message value. + * @param cause The throwable object. + */ + public AbstractPEPSException(final String code, final String message, + final Throwable cause) { + + super(message, cause); + this.errorCode = code; + this.errorMessage = message; + } + + /** + * Exception Constructor with three Strings representing the errorCode, + * errorMessage and encoded samlToken as parameters. + * + * @param code The error code value. + * @param message The error message value. + * @param samlToken The error SAML Token. + */ + public AbstractPEPSException(final String code, final String message, + final String samlToken) { + + super(message); + this.errorCode = code; + this.errorMessage = message; + this.samlTokenFail = samlToken; + } + + /** + * Constructor with SAML Token as argument. Error message and error code are + * embedded in the SAML. + * + * @param samlToken The error SAML Token. + */ + public AbstractPEPSException(final String samlToken) { + super(); + this.samlTokenFail = samlToken; + } + + /** + * Getter for errorCode. + * + * @return The errorCode value. + */ + public final String getErrorCode() { + return errorCode; + } + + /** + * Setter for errorCode. + * + * @param code The error code value. + */ + public final void setErrorCode(final String code) { + this.errorCode = code; + } + + /** + * Getter for errorMessage. + * + * @return The error Message value. + */ + public final String getErrorMessage() { + return errorMessage; + } + + /** + * Setter for errorMessage. + * + * @param message The error message value. + */ + public final void setErrorMessage(final String message) { + this.errorMessage = message; + } + + /** + * Getter for SAMLTokenFail. + * + * @return The error SAML Token. + */ + public final String getSamlTokenFail() { + return samlTokenFail; + } + + /** + * Setter for SAMLTokenFail. + * + * @param samlToken The error SAML token. + */ + public final void setSamlTokenFail(final String samlToken) { + this.samlTokenFail = samlToken; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/CPEPSException.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/CPEPSException.java new file mode 100644 index 000000000..69cb20fdd --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/CPEPSException.java @@ -0,0 +1,143 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * This exception is thrown by the C-PEPS service and holds the relative + * information to present to the citizen. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.9 $, $Date: 2010-11-17 05:15:28 $ + */ +public final class CPEPSException extends RuntimeException { + + /** + * Serial id. + */ + private static final long serialVersionUID = -4012295047127999362L; + + /** + * Error code. + */ + private String errorCode; + + /** + * Error message. + */ + private String errorMessage; + + /** + * SAML token. + */ + private String samlTokenFail; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param samlToken The SAML Token. + * @param code The error code value. + * @param message The error message value. + */ + public CPEPSException(final String samlToken, final String code, + final String message) { + + super(message); + this.setErrorCode(code); + this.setErrorMessage(message); + this.setSamlTokenFail(samlToken); + } + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param samlToken The SAML Token. + * @param code The error code value. + * @param message The error message value. + * @param cause The original exception; + */ + public CPEPSException(final String samlToken, final String code, + final String message, final Throwable cause) { + + super(message, cause); + this.setErrorCode(code); + this.setErrorMessage(message); + this.setSamlTokenFail(samlToken); + } + + /** + * {@inheritDoc} + */ + public String getMessage() { + return this.getErrorMessage() + " (" + this.getErrorCode() + ")"; + } + + /** + * Getter for the error code. + * + * @return The errorCode value. + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Setter for the error code. + * + * @param code The error code. + */ + public void setErrorCode(final String code) { + this.errorCode = code; + } + + /** + * Getter for the error message. + * + * @return The errorMessage value. + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Setter for the error message. + * + * @param message The error message. + */ + public void setErrorMessage(final String message) { + this.errorMessage = message; + } + + /** + * Getter for the samlTokenFail. + * + * @return The samlTokenFail value. + */ + public String getSamlTokenFail() { + return samlTokenFail; + } + + /** + * Setter for the samlTokenFail. + * + * @param samlToken The error Saml Token. + */ + public void setSamlTokenFail(final String samlToken) { + this.samlTokenFail = samlToken; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InternalErrorPEPSException.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InternalErrorPEPSException.java new file mode 100644 index 000000000..67514d4fe --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InternalErrorPEPSException.java @@ -0,0 +1,74 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Internal Error Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.13 $, $Date: 2010-11-17 05:15:28 $ + * + * @see AbstractPEPSException + */ +public final class InternalErrorPEPSException extends AbstractPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 1193001455410319795L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters and the Throwable cause. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + * @param cause The throwable object. + */ + public InternalErrorPEPSException(final String errorCode, + final String errorMessage, final Throwable cause) { + + super(errorCode, errorMessage, cause); + } + + /** + * Exception Constructor with three strings representing the errorCode, + * errorMessage and encoded samlToken as parameters. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + * @param samlTokenFail The error SAML Token. + */ + public InternalErrorPEPSException(final String errorCode, + final String errorMessage, final String samlTokenFail) { + + super(errorCode, errorMessage, samlTokenFail); + } + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + */ + public InternalErrorPEPSException(final String errorCode, + final String errorMessage) { + + super(errorCode, errorMessage); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidParameterPEPSException.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidParameterPEPSException.java new file mode 100644 index 000000000..12c83b589 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidParameterPEPSException.java @@ -0,0 +1,54 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Invalid Parameter Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.11 $, $Date: 2010-11-17 05:15:28 $ + * + * @see InvalidParameterPEPSException + */ +public class InvalidParameterPEPSException extends AbstractPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 2046282148740524875L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMessage The error code message value. + */ + public InvalidParameterPEPSException(final String errorCode, + final String errorMessage) { + super(errorCode, errorMessage); + } + + /** + * Exception Constructor with one String representing the encoded samlToken. + * + * @param samlTokenFail The error SAML Token. + */ + public InvalidParameterPEPSException(final String samlTokenFail) { + super(samlTokenFail); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidSessionPEPSException.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidSessionPEPSException.java new file mode 100644 index 000000000..800525eee --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidSessionPEPSException.java @@ -0,0 +1,46 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Invalid session Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.14 $, $Date: 2010-11-17 05:15:28 $ + * + * @see InvalidParameterPEPSException + */ +public class InvalidSessionPEPSException extends InvalidParameterPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 7147090160978319016L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + */ + public InvalidSessionPEPSException(final String errorCode, + final String errorMessage) { + + super(errorCode, errorMessage); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/SecurityPEPSException.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/SecurityPEPSException.java new file mode 100644 index 000000000..fc27371d2 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/SecurityPEPSException.java @@ -0,0 +1,67 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Security PEPS Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.18 $, $Date: 2010-11-17 05:15:28 $ + * + * @see AbstractPEPSException + */ +public final class SecurityPEPSException extends AbstractPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 5605743302478554967L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMsg The error message value. + */ + public SecurityPEPSException(final String errorCode, final String errorMsg) { + super(errorCode, errorMsg); + } + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters and the Throwable cause. + * + * @param errorCode The error code value. + * @param errorMessage The error message value. + * @param cause The throwable object. + */ + public SecurityPEPSException(final String errorCode, + final String errorMessage, final Throwable cause) { + + super(errorCode, errorMessage, cause); + } + + /** + * Exception Constructor with one String representing the encoded samlToken. + * + * @param samlTokenFail The error SAML Token. + */ + public SecurityPEPSException(final String samlTokenFail) { + super(samlTokenFail); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/StorkPEPSException.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/StorkPEPSException.java new file mode 100644 index 000000000..a2da61a02 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/StorkPEPSException.java @@ -0,0 +1,53 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.commons.exceptions; + +/** + * Security PEPS Exception class. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $ + * + * @see AbstractPEPSException + */ +public final class StorkPEPSException extends AbstractPEPSException { + + /** + * Unique identifier. + */ + private static final long serialVersionUID = 8048033129798427574L; + + /** + * Exception Constructor with two Strings representing the errorCode and + * errorMessage as parameters. + * + * @param errorCode The error code value. + * @param errorMsg The error message value. + */ + public StorkPEPSException(final String errorCode, final String errorMsg) { + super(errorCode, errorMsg); + } + + /** + * {@inheritDoc} + */ + public String getMessage() { + + return "Security Error (" + this.getErrorCode() + ") processing request : " + + this.getErrorMessage(); + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/package-info.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/package-info.java new file mode 100644 index 000000000..d83068beb --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/package-info.java @@ -0,0 +1,7 @@ +/** + * Package for the PEPS’ Exceptions handling. + * + * @since 1.0 + */ +package eu.stork.peps.auth.commons.exceptions; + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/package-info.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/package-info.java new file mode 100644 index 000000000..19d45aaa2 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/package-info.java @@ -0,0 +1,9 @@ +/** + * Common Authentication Service functionalities to be deployed in every PEPS + * is contained in this package. + * In particular, it contains the SAML Engine that implements the SAML messages + * management + * + * @since 1.0 + */ +package eu.stork.peps.auth.commons; diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/all-wcprops new file mode 100644 index 000000000..d23abebd4 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/all-wcprops @@ -0,0 +1,41 @@ +K 25 +svn:wc:ra_dav:version-url +V 86 +/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/java/eu/stork/peps/auth/specific +END +ICheckAttributeValue.java +K 25 +svn:wc:ra_dav:version-url +V 112 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/ICheckAttributeValue.java +END +IDeriveAttribute.java +K 25 +svn:wc:ra_dav:version-url +V 108 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/IDeriveAttribute.java +END +IAUService.java +K 25 +svn:wc:ra_dav:version-url +V 102 +/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java +END +INormaliseValue.java +K 25 +svn:wc:ra_dav:version-url +V 107 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/INormaliseValue.java +END +ITranslatorService.java +K 25 +svn:wc:ra_dav:version-url +V 110 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 104 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/package-info.java +END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/entries new file mode 100644 index 000000000..a23f672b5 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps/auth/specific +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-28T11:11:01.095477Z +73 +emlelisst + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +ITranslatorService.java +file + + + + +2013-12-20T12:27:56.654475Z +e36bd20ddfb7e165262a4a7891440fc9 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3144 + +package-info.java +file + + + + +2013-12-20T12:27:56.654475Z +eef7721d55c2edb02a432fc08ae9e487 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +164 + +ICheckAttributeValue.java +file + + + + +2013-12-20T12:27:56.654475Z +b0472ff15d1c86f175da134b0f0eda71 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1321 + +IDeriveAttribute.java +file + + + + +2013-12-20T12:27:56.654475Z +dce3856a97583f739cdf50ca78491277 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1504 + +IAUService.java +file + + + + +2013-12-20T12:27:56.654475Z +254f57923746e205391672afffc04313 +2013-10-28T11:11:01.095477Z +73 +emlelisst + + + + + + + + + + + + + + + + + + + + + +6011 + +INormaliseValue.java +file + + + + +2013-12-20T12:27:56.654475Z +09f6e376875762fca294be4dfecb71f1 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1237 + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IAUService.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IAUService.java.svn-base new file mode 100644 index 000000000..157c8f7b6 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IAUService.java.svn-base @@ -0,0 +1,183 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import java.util.Map; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.IStorkSession; +import eu.stork.peps.auth.commons.STORKAttrQueryResponse; +import eu.stork.peps.auth.commons.STORKAuthnResponse; + +/** + * Interface for Specific Authentication methods. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface IAUService { + + /** + * Prepares the citizen to be redirected to the IdP. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param session The session object. + * @param requestAttributes The Requested attributes. + * + * @return byte[] containing a SAML Request. + * + * @see IPersonalAttributeList + * @see IStorkSession + */ + byte[] prepareCitizenAuthentication(IPersonalAttributeList personalList, + Map parameters, Map requestAttributes, + IStorkSession session); + + /** + * Authenticates a citizen. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param requestAttributes The requested attributes. + * + * @return The updated Personal Attribute List. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList authenticateCitizen( + IPersonalAttributeList personalList, Map parameters, + Map requestAttributes); + + /** + * Prepares the Citizen browser to be redirected to the AP. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param session The session object. + * @param requestAttributes The requested attributes. + * + * @return true in case of no error. + * + * @see IPersonalAttributeList + * @see IStorkSession + */ + boolean prepareAPRedirect(IPersonalAttributeList personalList, + Map parameters, Map requestAttributes, + IStorkSession session); + + /** + * Returns the attributes values from the AP. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param requestAttributes The request attributes. + * + * @return The updated Personal Attribute List. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList getAttributesFromAttributeProviders( + IPersonalAttributeList personalList, Map parameters, + Map requestAttributes); + + /** + * Get the attributes from the AP with verification. + * + * @param personalList The Personal Attribute List. + * @param parameters The HTTP Parameters. + * @param requestAttributes The requested Attributes. + * @param session The session object. + * @param auProcessId The SAML identifier. + * + * @return true if the attributes were correctly verified. + * + * @see IPersonalAttributeList + * @see IStorkSession + */ + boolean getAttributesWithVerification(IPersonalAttributeList personalList, + Map parameters, Map requestAttributes, + IStorkSession session, String auProcessId); + + /** + * Validates a SAML Response. + * + * @param samlToken The SAML Token. + * @param session The session object. + * + * @return the STORKAuthnResponse associated with the validated response. + * + * @see IStorkSession + */ + STORKAuthnResponse processAuthenticationResponse(byte[] samlToken, + IStorkSession session); + + /** + * Generates a SAML Response in case of error. + * + * @param inResponseTo The SAML's identifier to response. + * @param issuer The issuer value. + * @param assertionURL The assertion URL. + * @param code The error code. + * @param subcode The sub error code. + * @param message The error message. + * @param ipUserAddress The user IP address. + * + * @return byte[] containing the SAML Response. + */ + byte[] generateErrorAuthenticationResponse(String inResponseTo, + String issuer, String assertionURL, String code, String subcode, + String message, String ipUserAddress); + + /** + * Compares two given personal attribute lists. + * + * @param original The original Personal Attribute List. + * @param modified The modified Personal Attribute List. + * @return true if the original list contains the modified one. False + * otherwise. + * + * @see IPersonalAttributeList + */ + boolean comparePersonalAttributeLists(IPersonalAttributeList original, + IPersonalAttributeList modified); + + /** + * Prepares the citizen to be redirected to the AtP. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param session The session object. + * + * @return byte[] containing a SAML Request. + * + * @see IPersonalAttributeList + * @see IStorkSession + */ + byte[] prepareAttributeRequest(IPersonalAttributeList personalList, + Map parameters, IStorkSession session); + + /** + * Validates a SAML Response. + * + * @param samlToken The SAML Token. + * @param session The session object. + * + * @return the STORKAttrQueryResponse associated with the validated response. + * + * @see IStorkSession + */ + STORKAttrQueryResponse processAttributeResponse(byte[] samlToken, + IStorkSession session); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ICheckAttributeValue.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ICheckAttributeValue.java.svn-base new file mode 100644 index 000000000..31a8d78ff --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ICheckAttributeValue.java.svn-base @@ -0,0 +1,37 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import java.util.List; + +/** + * Interface that defines the methods to work with the validation of attributes. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface ICheckAttributeValue { + + /** + * Checks if the list of values contains the expected value. + * + * @param values The List of values. + * @param expectedValue The value to check if it exists on the list. + * + * @return boolean true, if the value is present in the list. False, + * otherwise. + */ + boolean checkValue(List values, String expectedValue); + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IDeriveAttribute.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IDeriveAttribute.java.svn-base new file mode 100644 index 000000000..78eb53004 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IDeriveAttribute.java.svn-base @@ -0,0 +1,40 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import eu.stork.peps.auth.commons.IStorkSession; +import eu.stork.peps.auth.commons.PersonalAttribute; + +/** + * Interface that defines the methods to work with derivation of attributes. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface IDeriveAttribute { + + /** + * Derives the attribute value. Set the Personal Attribute value to null if + * the value in session or the value of age are invalid (non-numeric or null). + * + * @param personalAttrList The Personal Attribute List. + * @param session The session object. + * + * @see PersonalAttribute The personal Attribute + * @see IStorkSession The session object. + */ + void deriveAttributeToData(PersonalAttribute personalAttrList, + IStorkSession session); + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/INormaliseValue.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/INormaliseValue.java.svn-base new file mode 100644 index 000000000..ca2114e32 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/INormaliseValue.java.svn-base @@ -0,0 +1,35 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import eu.stork.peps.auth.commons.PersonalAttribute; + +/** + * Interface for attribute's value normalisation. + * + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface INormaliseValue { + + /** + * Translates the attribute's value from local format to STORK format. + * + * @param personalAttribute The Personal Attribute to normalise the value. + * + * @see PersonalAttribute + */ + void normaliseAttributeValueToStork(PersonalAttribute personalAttribute); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ITranslatorService.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ITranslatorService.java.svn-base new file mode 100644 index 000000000..d4c152614 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ITranslatorService.java.svn-base @@ -0,0 +1,100 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.IStorkSession; +import eu.stork.peps.auth.commons.STORKAuthnRequest; + +/** + * Interface for attributes normalization. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface ITranslatorService { + + /** + * Translates the attributes from local format to STORK format. + * + * @param personalList The Personal Attribute List. + * + * @return The Personal Attribute List with normalised attributes. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList normaliseAttributeNamesToStork( + IPersonalAttributeList personalList); + + /** + * Translates the attributes values from local format to STORK format. + * + * @param personalList The Personal Attribute List. + * + * @return The PersonalAttributeList with normalised values. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList normaliseAttributeValuesToStork( + IPersonalAttributeList personalList); + + /** + * Translates the attributes from STORK format to local format. + * + * @param personalList The Personal Attribute List. + * + * @return The PersonalAttributeList with normalised attributes. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList normaliseAttributeNamesFromStork( + IPersonalAttributeList personalList); + + /** + * Derive Attribute Names To Stork format. + * + * @param personalList The Personal Attribute List, + * + * @return The PersonalAttributeList with derived attributes. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList deriveAttributeFromStork( + IPersonalAttributeList personalList); + + /** + * Derive Attribute Names from Stork format. + * + * @param session The session object. + * @param modifiedList The Personal Attribute List. + * + * @return The PersonalAttributeList with derived attributes. + * + * @see IStorkSession + * @see IPersonalAttributeList + */ + IPersonalAttributeList deriveAttributeToStork(IStorkSession session, + IPersonalAttributeList modifiedList); + + /** + * Validate the values of the attributes. + * + * @param authData The SAML's STORKAuthnRequest object. + * + * @return True, if all the attributes have values. False, otherwise. + * + * @see STORKAuthnRequest + */ + boolean checkAttributeValues(STORKAuthnRequest authData); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/package-info.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..a25c52311 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,8 @@ +/** + * Specific PEPS Interfaces that implements functionality of the Authentication + * Service. + * + * @since 1.0 + */ +package eu.stork.peps.auth.specific; + diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java new file mode 100644 index 000000000..157c8f7b6 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java @@ -0,0 +1,183 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import java.util.Map; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.IStorkSession; +import eu.stork.peps.auth.commons.STORKAttrQueryResponse; +import eu.stork.peps.auth.commons.STORKAuthnResponse; + +/** + * Interface for Specific Authentication methods. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface IAUService { + + /** + * Prepares the citizen to be redirected to the IdP. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param session The session object. + * @param requestAttributes The Requested attributes. + * + * @return byte[] containing a SAML Request. + * + * @see IPersonalAttributeList + * @see IStorkSession + */ + byte[] prepareCitizenAuthentication(IPersonalAttributeList personalList, + Map parameters, Map requestAttributes, + IStorkSession session); + + /** + * Authenticates a citizen. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param requestAttributes The requested attributes. + * + * @return The updated Personal Attribute List. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList authenticateCitizen( + IPersonalAttributeList personalList, Map parameters, + Map requestAttributes); + + /** + * Prepares the Citizen browser to be redirected to the AP. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param session The session object. + * @param requestAttributes The requested attributes. + * + * @return true in case of no error. + * + * @see IPersonalAttributeList + * @see IStorkSession + */ + boolean prepareAPRedirect(IPersonalAttributeList personalList, + Map parameters, Map requestAttributes, + IStorkSession session); + + /** + * Returns the attributes values from the AP. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param requestAttributes The request attributes. + * + * @return The updated Personal Attribute List. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList getAttributesFromAttributeProviders( + IPersonalAttributeList personalList, Map parameters, + Map requestAttributes); + + /** + * Get the attributes from the AP with verification. + * + * @param personalList The Personal Attribute List. + * @param parameters The HTTP Parameters. + * @param requestAttributes The requested Attributes. + * @param session The session object. + * @param auProcessId The SAML identifier. + * + * @return true if the attributes were correctly verified. + * + * @see IPersonalAttributeList + * @see IStorkSession + */ + boolean getAttributesWithVerification(IPersonalAttributeList personalList, + Map parameters, Map requestAttributes, + IStorkSession session, String auProcessId); + + /** + * Validates a SAML Response. + * + * @param samlToken The SAML Token. + * @param session The session object. + * + * @return the STORKAuthnResponse associated with the validated response. + * + * @see IStorkSession + */ + STORKAuthnResponse processAuthenticationResponse(byte[] samlToken, + IStorkSession session); + + /** + * Generates a SAML Response in case of error. + * + * @param inResponseTo The SAML's identifier to response. + * @param issuer The issuer value. + * @param assertionURL The assertion URL. + * @param code The error code. + * @param subcode The sub error code. + * @param message The error message. + * @param ipUserAddress The user IP address. + * + * @return byte[] containing the SAML Response. + */ + byte[] generateErrorAuthenticationResponse(String inResponseTo, + String issuer, String assertionURL, String code, String subcode, + String message, String ipUserAddress); + + /** + * Compares two given personal attribute lists. + * + * @param original The original Personal Attribute List. + * @param modified The modified Personal Attribute List. + * @return true if the original list contains the modified one. False + * otherwise. + * + * @see IPersonalAttributeList + */ + boolean comparePersonalAttributeLists(IPersonalAttributeList original, + IPersonalAttributeList modified); + + /** + * Prepares the citizen to be redirected to the AtP. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param session The session object. + * + * @return byte[] containing a SAML Request. + * + * @see IPersonalAttributeList + * @see IStorkSession + */ + byte[] prepareAttributeRequest(IPersonalAttributeList personalList, + Map parameters, IStorkSession session); + + /** + * Validates a SAML Response. + * + * @param samlToken The SAML Token. + * @param session The session object. + * + * @return the STORKAttrQueryResponse associated with the validated response. + * + * @see IStorkSession + */ + STORKAttrQueryResponse processAttributeResponse(byte[] samlToken, + IStorkSession session); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ICheckAttributeValue.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ICheckAttributeValue.java new file mode 100644 index 000000000..31a8d78ff --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ICheckAttributeValue.java @@ -0,0 +1,37 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import java.util.List; + +/** + * Interface that defines the methods to work with the validation of attributes. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface ICheckAttributeValue { + + /** + * Checks if the list of values contains the expected value. + * + * @param values The List of values. + * @param expectedValue The value to check if it exists on the list. + * + * @return boolean true, if the value is present in the list. False, + * otherwise. + */ + boolean checkValue(List values, String expectedValue); + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IDeriveAttribute.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IDeriveAttribute.java new file mode 100644 index 000000000..78eb53004 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IDeriveAttribute.java @@ -0,0 +1,40 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import eu.stork.peps.auth.commons.IStorkSession; +import eu.stork.peps.auth.commons.PersonalAttribute; + +/** + * Interface that defines the methods to work with derivation of attributes. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface IDeriveAttribute { + + /** + * Derives the attribute value. Set the Personal Attribute value to null if + * the value in session or the value of age are invalid (non-numeric or null). + * + * @param personalAttrList The Personal Attribute List. + * @param session The session object. + * + * @see PersonalAttribute The personal Attribute + * @see IStorkSession The session object. + */ + void deriveAttributeToData(PersonalAttribute personalAttrList, + IStorkSession session); + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/INormaliseValue.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/INormaliseValue.java new file mode 100644 index 000000000..ca2114e32 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/INormaliseValue.java @@ -0,0 +1,35 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import eu.stork.peps.auth.commons.PersonalAttribute; + +/** + * Interface for attribute's value normalisation. + * + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface INormaliseValue { + + /** + * Translates the attribute's value from local format to STORK format. + * + * @param personalAttribute The Personal Attribute to normalise the value. + * + * @see PersonalAttribute + */ + void normaliseAttributeValueToStork(PersonalAttribute personalAttribute); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java new file mode 100644 index 000000000..d4c152614 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java @@ -0,0 +1,100 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.auth.specific; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.IStorkSession; +import eu.stork.peps.auth.commons.STORKAuthnRequest; + +/** + * Interface for attributes normalization. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com + */ +public interface ITranslatorService { + + /** + * Translates the attributes from local format to STORK format. + * + * @param personalList The Personal Attribute List. + * + * @return The Personal Attribute List with normalised attributes. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList normaliseAttributeNamesToStork( + IPersonalAttributeList personalList); + + /** + * Translates the attributes values from local format to STORK format. + * + * @param personalList The Personal Attribute List. + * + * @return The PersonalAttributeList with normalised values. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList normaliseAttributeValuesToStork( + IPersonalAttributeList personalList); + + /** + * Translates the attributes from STORK format to local format. + * + * @param personalList The Personal Attribute List. + * + * @return The PersonalAttributeList with normalised attributes. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList normaliseAttributeNamesFromStork( + IPersonalAttributeList personalList); + + /** + * Derive Attribute Names To Stork format. + * + * @param personalList The Personal Attribute List, + * + * @return The PersonalAttributeList with derived attributes. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList deriveAttributeFromStork( + IPersonalAttributeList personalList); + + /** + * Derive Attribute Names from Stork format. + * + * @param session The session object. + * @param modifiedList The Personal Attribute List. + * + * @return The PersonalAttributeList with derived attributes. + * + * @see IStorkSession + * @see IPersonalAttributeList + */ + IPersonalAttributeList deriveAttributeToStork(IStorkSession session, + IPersonalAttributeList modifiedList); + + /** + * Validate the values of the attributes. + * + * @param authData The SAML's STORKAuthnRequest object. + * + * @return True, if all the attributes have values. False, otherwise. + * + * @see STORKAuthnRequest + */ + boolean checkAttributeValues(STORKAuthnRequest authData); +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/package-info.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/package-info.java new file mode 100644 index 000000000..a25c52311 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/package-info.java @@ -0,0 +1,8 @@ +/** + * Specific PEPS Interfaces that implements functionality of the Authentication + * Service. + * + * @since 1.0 + */ +package eu.stork.peps.auth.specific; + diff --git a/id/server/stork2-commons/src/main/resources/.svn/all-wcprops b/id/server/stork2-commons/src/main/resources/.svn/all-wcprops new file mode 100644 index 000000000..48074222b --- /dev/null +++ b/id/server/stork2-commons/src/main/resources/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 63 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/resources +END +log4j.xml +K 25 +svn:wc:ra_dav:version-url +V 73 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/resources/log4j.xml +END diff --git a/id/server/stork2-commons/src/main/resources/.svn/entries b/id/server/stork2-commons/src/main/resources/.svn/entries new file mode 100644 index 000000000..2f7941718 --- /dev/null +++ b/id/server/stork2-commons/src/main/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/resources +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +log4j.xml +file + + + + +2013-12-20T12:27:56.554475Z +aa8c46e41a236b8c7049713b3eeecc49 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +660 + diff --git a/id/server/stork2-commons/src/main/resources/.svn/text-base/log4j.xml.svn-base b/id/server/stork2-commons/src/main/resources/.svn/text-base/log4j.xml.svn-base new file mode 100644 index 000000000..8bce0bec0 --- /dev/null +++ b/id/server/stork2-commons/src/main/resources/.svn/text-base/log4j.xml.svn-base @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/id/server/stork2-commons/src/main/resources/log4j.xml b/id/server/stork2-commons/src/main/resources/log4j.xml new file mode 100644 index 000000000..8bce0bec0 --- /dev/null +++ b/id/server/stork2-commons/src/main/resources/log4j.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/id/server/stork2-commons/src/test/.svn/all-wcprops b/id/server/stork2-commons/src/test/.svn/all-wcprops new file mode 100644 index 000000000..bf138316a --- /dev/null +++ b/id/server/stork2-commons/src/test/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 54 +/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test +END diff --git a/id/server/stork2-commons/src/test/.svn/entries b/id/server/stork2-commons/src/test/.svn/entries new file mode 100644 index 000000000..2b2601393 --- /dev/null +++ b/id/server/stork2-commons/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-05T18:15:46.189390Z +105 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +java +dir + +resources +dir + diff --git a/id/server/stork2-commons/src/test/java/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/.svn/all-wcprops new file mode 100644 index 000000000..aadac0dbf --- /dev/null +++ b/id/server/stork2-commons/src/test/java/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 59 +/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java +END diff --git a/id/server/stork2-commons/src/test/java/.svn/entries b/id/server/stork2-commons/src/test/java/.svn/entries new file mode 100644 index 000000000..e5c0b0d44 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-05T18:15:46.189390Z +105 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +eu +dir + diff --git a/id/server/stork2-commons/src/test/java/eu/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/eu/.svn/all-wcprops new file mode 100644 index 000000000..dcd996fcd --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 62 +/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu +END diff --git a/id/server/stork2-commons/src/test/java/eu/.svn/entries b/id/server/stork2-commons/src/test/java/eu/.svn/entries new file mode 100644 index 000000000..ec6a38da6 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java/eu +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-05T18:15:46.189390Z +105 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +stork +dir + diff --git a/id/server/stork2-commons/src/test/java/eu/stork/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/eu/stork/.svn/all-wcprops new file mode 100644 index 000000000..0b2214b69 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 68 +/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu/stork +END diff --git a/id/server/stork2-commons/src/test/java/eu/stork/.svn/entries b/id/server/stork2-commons/src/test/java/eu/stork/.svn/entries new file mode 100644 index 000000000..1e73b71d3 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java/eu/stork +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-05T18:15:46.189390Z +105 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +peps +dir + diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/all-wcprops new file mode 100644 index 000000000..3646767c9 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 73 +/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu/stork/peps +END diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/entries b/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/entries new file mode 100644 index 000000000..bc7cb99e5 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java/eu/stork/peps +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-05T18:15:46.189390Z +105 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +tests +dir + diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/all-wcprops new file mode 100644 index 000000000..6f22176bb --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/all-wcprops @@ -0,0 +1,41 @@ +K 25 +svn:wc:ra_dav:version-url +V 79 +/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu/stork/peps/tests +END +PersonalAttributeTestCase.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 96 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/java/eu/stork/peps/tests/package-info.java +END +DateUtilTestCase.java +K 25 +svn:wc:ra_dav:version-url +V 100 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java +END +AttributeUtilTestCase.java +K 25 +svn:wc:ra_dav:version-url +V 105 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java +END +PersonalAttributeListTestCase.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java +END +PEPSUtilTestCase.java +K 25 +svn:wc:ra_dav:version-url +V 100 +/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java +END diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/entries b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/entries new file mode 100644 index 000000000..b5b0e66f6 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java/eu/stork/peps/tests +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-11-05T18:15:46.189390Z +105 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +DateUtilTestCase.java +file + + + + +2013-12-20T12:27:56.518475Z +244cc6104660a7835dbf72dadb305d71 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +8907 + +AttributeUtilTestCase.java +file + + + + +2013-12-20T12:27:56.518475Z +6037f125adf7f4c2f6873a0d99ab0705 +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +16318 + +PersonalAttributeListTestCase.java +file + + + + +2013-12-20T12:27:56.518475Z +2c1d87e43c773d9423bbeba31f64c8ed +2013-11-05T18:15:46.189390Z +105 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +17752 + +PEPSUtilTestCase.java +file + + + + +2013-12-20T12:27:56.518475Z +f54beadeab9af936f44af326eb1116d2 +2013-11-01T20:35:30.927048Z +96 +emferreri + + + + + + + + + + + + + + + + + + + + + +16714 + +PersonalAttributeTestCase.java +file + + + + +2013-12-20T12:27:56.518475Z +77386880d5ffadd21c9b3a3c7d51b990 +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +5449 + +package-info.java +file + + + + +2013-12-20T12:27:56.518475Z +04f136539bda0caa3d5ccdfee912cfce +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +92 + diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/AttributeUtilTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/AttributeUtilTestCase.java.svn-base new file mode 100644 index 000000000..77fc4b9c2 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/AttributeUtilTestCase.java.svn-base @@ -0,0 +1,537 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +import eu.stork.peps.auth.commons.AttributeUtil; +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSValues; +import eu.stork.peps.auth.commons.PersonalAttributeList; + +/** + * The AttributeUtil's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com + * + * @version $Revision: $, $Date: $ + */ +public final class AttributeUtilTestCase { + + /** + * Empty String to be used on the tests. + */ + private static final String EMPTY_STRING = ""; + + /** + * Tuple value sample to be used on the tests. + */ + private static final String[] TUPLE_STRING = new String[] { "age", "true", + "[18]", "Available" }; + + /** + * Complex value to be used on escape/unescape tests. + */ + private static final String COMPLEX_VAL = "postalCode=4100," + + "apartmentNumber=A,state=Porto,countryCodeAddress=PT,streetNumber=379," + + "streetName=Avenida Sidonio Pais,town=Porto,"; + + /** + * Escaped Complex value to be used on escape/unescape tests. + */ + private static final String ESC_COMPLEX_VAL = "postalCode=4100%44" + + "apartmentNumber=A%44state=Porto%44countryCodeAddress=PT%44" + + "streetNumber=379%44streetName=Avenida Sidonio Pais%44town=Porto%44"; + + /** + * Simple value to be used on escape/unescape tests. + */ + private static final String SIMPLE_VAL = "Avenida da Boavista, Porto"; + + /** + * Escaped simple value to be used on escape/unescape tests. + */ + private static final String ESC_SIMPLE_VAL = "Avenida da Boavista%44 Porto"; + + /** + * Simple text to be used on escape/unescape tests. Must match the escaped + * text. + */ + private static final String SIMPLE_TEXT = "John Doe"; + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given complex + * attribute value (canonical address' example attribute value). + */ + @Test + public void testEscapeSpecialCharsComplexVal() { + assertEquals(AttributeUtil.escape(COMPLEX_VAL), ESC_COMPLEX_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given + * attribute value. + */ + @Test + public void testEscapeSpecialCharsVal() { + assertEquals(AttributeUtil.escape(SIMPLE_VAL), ESC_SIMPLE_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given simple + * text: no special characters to escape. + */ + @Test + public void testEscapeNormalChars() { + assertEquals(AttributeUtil.escape(SIMPLE_TEXT), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#unescape(String)} method for the given + * escape complex attribute value (canonical address' example attribute + * value). + */ + @Test + public void testUnescapeSpecialCharsComplexVal() { + assertEquals(AttributeUtil.unescape(ESC_COMPLEX_VAL), COMPLEX_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given escape + * attribute value. + */ + @Test + public void testUnescapeSpecialCharsVal() { + assertEquals(AttributeUtil.unescape(ESC_SIMPLE_VAL), SIMPLE_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given simple + * text: no special characters to unescape. + */ + @Test + public void testUnescapeNormalChars() { + assertEquals(AttributeUtil.unescape(SIMPLE_TEXT), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} + * method for the given empty string. + */ + @Test + public void testAppendIfNotNullEmptyStr() { + final StringBuilder strBuilder = new StringBuilder(SIMPLE_TEXT); + AttributeUtil.appendIfNotNull(strBuilder, EMPTY_STRING); + assertEquals(strBuilder.toString(), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} + * method for the given string. + */ + @Test + public void testAppendIfNotNullStr() { + final StringBuilder strBuilder = new StringBuilder(); + AttributeUtil.appendIfNotNull(strBuilder, SIMPLE_TEXT); + assertEquals(strBuilder.toString(), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} + * method for the given null value. + */ + @Test + public void testAppendIfNotNull() { + final StringBuilder strBuilder = new StringBuilder(); + AttributeUtil.appendIfNotNull(strBuilder, null); + assertEquals(strBuilder.toString(), EMPTY_STRING); + } + + /** + * Tests the {@link AttributeUtil#listToString(List, String)} method for the + * given List with two values. + */ + @Test + public void testListToStringTwoVals() { + final List vals = new ArrayList(); + vals.add(SIMPLE_VAL); + vals.add(SIMPLE_TEXT); + + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append(SIMPLE_TEXT); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + assertEquals( + AttributeUtil.listToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#listToString(List, String)} method for the + * given List with one values. + */ + @Test + public void testListToStringOneVal() { + final List vals = new ArrayList(); + vals.add(SIMPLE_VAL); + + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + assertEquals( + AttributeUtil.listToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#listToString(List, String)} method for the + * given List with one value. + */ + @Test + public void testListToStringEmptyVal() { + final List vals = new ArrayList(); + + final StringBuilder strBuilder = new StringBuilder(); + + assertEquals( + AttributeUtil.listToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method + * for the given Map with one value. + */ + @Test + public void testMapToStringOneVal() { + final Map vals = new HashMap(); + vals.put("CanonicalAddress", COMPLEX_VAL); + + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("CanonicalAddress="); + strBuilder.append(ESC_COMPLEX_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + assertEquals(AttributeUtil.mapToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method + * for the given empty Map. + */ + @Test + public void testMapToStringEmptyVal() { + final Map vals = new HashMap(); + + final StringBuilder strBuilder = new StringBuilder(); + + assertEquals(AttributeUtil.mapToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * invalid List. + */ + @Test + public void testIsValidValueInvalidList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append("]"); + assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * null value. + */ + @Test + public void testIsValidValueNullList() { + assertFalse(AttributeUtil.isValidValue(null)); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * empty List. + */ + @Test + public void testIsValidValueEmptyList() { + assertTrue(AttributeUtil.isValidValue("[]")); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * empty List. + */ + @Test + public void testIsValidValueEmptyCommaList() { + assertTrue(AttributeUtil.isValidValue("[,]")); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one simple value List. + */ + @Test + public void testIsValidValueOneValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one simple value List. + */ + @Test + public void testIsValidValueOneValueCommaList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one complex value List. + */ + @Test + public void testIsValidValueOneComplexValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_COMPLEX_VAL); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one complex value List. + */ + @Test + public void testIsValidValueOneComplexValueCommaList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_COMPLEX_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * multi value List. + */ + @Test + public void testIsValidValueMultiValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append(SIMPLE_TEXT); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * invalid multi value List. + */ + @Test + public void testIsValidValueInvalidMultiValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append(SIMPLE_TEXT); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * true type. + */ + @Test + public void testIsValidTypetrue() { + assertTrue(AttributeUtil.isValidType("true")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * True type. + */ + @Test + public void testIsValidTypeTrue() { + assertTrue(AttributeUtil.isValidType("True")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * TRUE type. + */ + @Test + public void testIsValidTypeTRUE() { + assertTrue(AttributeUtil.isValidType("TRUE")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * invalid type. + */ + @Test + public void testIsValidTypeInvalidType() { + assertFalse(AttributeUtil.isValidType("str")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * false type. + */ + @Test + public void testIsValidTypefalse() { + assertTrue(AttributeUtil.isValidType("false")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * False type. + */ + @Test + public void testIsValidTypeFalse() { + assertTrue(AttributeUtil.isValidType("False")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * FALSE type. + */ + @Test + public void testIsValidTypeFALSEVal() { + assertTrue(AttributeUtil.isValidType("False")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * null. + */ + @Test + public void testIsValidTypeNullVal() { + assertFalse(AttributeUtil.isValidType(null)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given valid tuple. + */ + @Test + public void testHasValidTuples() { + assertTrue(AttributeUtil.hasValidTuples(TUPLE_STRING)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given invalid tuple. + */ + @Test + public void testHasValidTuplesInvalid() { + final String[] tuple = new String[]{"name", "type"}; + assertFalse(AttributeUtil.hasValidTuples(tuple)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given invalid tuple with valid size. + */ + @Test + public void testHasValidTuplesSameSizeInvalidValues() { + final String[] tuple = new String[] { "age", "type", "[18]", "Available"}; + assertFalse(AttributeUtil.hasValidTuples(tuple)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given null value. + */ + @Test + public void testHasValidTuplesNull() { + assertFalse(AttributeUtil.hasValidTuples(null)); + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given attribute list.. + */ + @Test + public void testCheckMandatoryAttributes() { + final IPersonalAttributeList attrList = new PersonalAttributeList(); + attrList.populate("isAgeOver:true:[18,]:Available;"); + assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); + + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given null value. + */ + @Test(expected = NullPointerException.class) + public void testCheckMandatoryAttributesNullAttrList() { + assertTrue(AttributeUtil.checkMandatoryAttributes(null)); + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given empty attribute list. + */ + @Test + public void testCheckMandatoryAttributesEmptyAttrList() { + final IPersonalAttributeList attrList = new PersonalAttributeList(); + assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given attribute list (missing mandatory attribute). + */ + @Test + public void testCheckMandatoryAttributesMissingAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(); + attrList.populate("isAgeOver:true:[]:NotAvailable;"); + assertFalse(AttributeUtil.checkMandatoryAttributes(attrList)); + } + +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/DateUtilTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/DateUtilTestCase.java.svn-base new file mode 100644 index 000000000..5d2296997 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/DateUtilTestCase.java.svn-base @@ -0,0 +1,294 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import java.sql.Timestamp; +import java.util.Properties; + +import org.joda.time.DateTime; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import eu.stork.peps.auth.commons.DateUtil; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.exceptions.SecurityPEPSException; + +/** + * The PersonalAttribute's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.2 $, $Date: 2010-11-17 05:17:03 $ + */ +public final class DateUtilTestCase { + + /** + * Stork Format date. + */ + private static final String FORMAT = "yyyyMMdd"; + + /** + * Expected 10 value. + */ + private static final int TEN = 10; + + /** + * Expected 11 value. + */ + private static final int ELEVEN = 11; + + /** + * The testing Date ("current" date). + */ + private static final DateTime TESTDATE = new DateTime(2011, 10, 10, 15, 20, + 0, 0); + + /** + * Init DateUtilTestCase class. + */ + @BeforeClass + public static void runsBeforeTheTestSuite() { + final Properties configs = new Properties(); + configs.setProperty("invalidAgeDateValue.code", "35"); + configs.setProperty("invalidAttributeValue.code", "34"); + configs + .setProperty( + "invalidAttributeValue.message", + "Unexpected or invalid content was encountered within a " + + " or element."); + PEPSUtil.createInstance(configs); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year against + * the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromYear() { + Assert.assertTrue(TEN == DateUtil.calculateAge("2000", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year and month + * against the testDate: 2011-10-10 15:20:00.0. Must return 11. + */ + @Test + public void calculateAgeFromEarlyMonth() { + Assert.assertTrue(ELEVEN == DateUtil.calculateAge("200001", TESTDATE, + FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year and month + * against the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromSameMonth() { + Assert.assertTrue(TEN == DateUtil.calculateAge("200010", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year and month + * against the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromLaterMonth() { + Assert.assertTrue(TEN == DateUtil.calculateAge("200011", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return 11. + */ + @Test + public void calculateAgeFromEarlyFullDate() { + Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20000101", TESTDATE, + FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return 11. + */ + @Test + public void calculateAgeFromSameDay() { + Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20001010", TESTDATE, + FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromLaterFullDate() { + Assert.assertTrue(TEN == DateUtil + .calculateAge("20001011", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromInvalidDate() { + DateUtil.calculateAge("200", TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromInvalidMonth() { + DateUtil.calculateAge("200013", TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromInvalidDay() { + DateUtil.calculateAge("20000230", TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromNullDate() { + DateUtil.calculateAge(null, TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromNullCurDate() { + DateUtil.calculateAge("2000", null, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromNullFormat() { + DateUtil.calculateAge("2000", TESTDATE, null); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return true + */ + @Test + public void isValidFormatDateFromYear() { + Assert.assertTrue(DateUtil.isValidFormatDate("2000", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year and + * month. Must return true. + */ + @Test + public void isValidFormatDateFromMonth() { + Assert.assertTrue(DateUtil.isValidFormatDate("200001", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDate() { + Assert.assertTrue(DateUtil.isValidFormatDate("20000101", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateInvalidYear() { + Assert.assertFalse(DateUtil.isValidFormatDate("200", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateInvalidMonth() { + Assert.assertFalse(DateUtil.isValidFormatDate("200013", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateInvalidDate() { + Assert.assertFalse(DateUtil.isValidFormatDate("20010229", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateNullDate() { + Assert.assertFalse(DateUtil.isValidFormatDate(null, FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateNullFormat() { + Assert.assertFalse(DateUtil.isValidFormatDate("2000", null)); + } + + /** + * Tests the {@link DateUtil#currentTimeStamp()} method for the current + * TimeStamp (TS). Must return true. + */ + @Test + public void testCurrentTimeStampBefore() { + Timestamp ts = DateUtil.currentTimeStamp(); + Assert.assertNotSame(ts, DateUtil.currentTimeStamp()); + } + + /** + * Tests the {@link DateUtil#currentTimeStamp()} method for the current + * TimeStamp (TS). Must return true. + */ + @Test + public void testCurrentTimeStampAfter() { + Timestamp ts = DateUtil.currentTimeStamp(); + Assert.assertEquals(DateUtil.currentTimeStamp(), ts); + } + +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PEPSUtilTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PEPSUtilTestCase.java.svn-base new file mode 100644 index 000000000..d4841ed43 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PEPSUtilTestCase.java.svn-base @@ -0,0 +1,553 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; + +import java.util.Properties; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSErrors; +import eu.stork.peps.auth.commons.PEPSParameters; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.exceptions.InternalErrorPEPSException; +import eu.stork.peps.auth.commons.exceptions.InvalidParameterPEPSException; + +/** + * The PEPSUtil's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com + * + * @version $Revision: $, $Date: $ + */ +public final class PEPSUtilTestCase { + + /** + * Message example. + */ + private static final String MESSAGE_SAMPLE = "003002 - Authentication Failed"; + + /** + * Error message example. + */ + private static final String ERROR_MESSAGE_SAMPLE = "Authentication Failed"; + + /** + * Error code example. + */ + private static final String ERROR_CODE_SAMPLE = "003002"; + + /** + * Properties values for testing proposes. + */ + private static final Properties CONFIGS1 = new Properties(); + + /** + * Properties values for testing proposes. + */ + private static final Properties CONFIGS2 = new Properties(); + + /** + * The empty string value: "". + */ + private static final String EMPTY_STRING = ""; + + /** + * The empty byte value: []. + */ + private static final byte[] EMPTY_BYTE = new byte[] {}; + + /** + * The empty byte hash value. + */ + private static final byte[] EMPTY_HASH_BYTE = new byte[] { -49, -125, -31, + 53, 126, -17, -72, -67, -15, 84, 40, 80, -42, 109, -128, 7, -42, 32, -28, + 5, 11, 87, 21, -36, -125, -12, -87, 33, -45, 108, -23, -50, 71, -48, -47, + 60, 93, -123, -14, -80, -1, -125, 24, -46, -121, 126, -20, 47, 99, -71, 49, + -67, 71, 65, 122, -127, -91, 56, 50, 122, -7, 39, -38, 62 }; + + /** + * The SAML example byte[] value. + */ + private static final byte[] SAML_BYTE_SAMPLE = new byte[] { 60, 115, 97, 109, + 108, 62, 46, 46, 46, 60, 47, 115, 97, 109, 108 }; + + /** + * The SAML's Base64 example value. + */ + private static final String SAML_BASE64_SAMPLE = "PHNhbWw+Li4uPC9zYW1s"; + + /** + * The SAML's Base64 byte[] example value. + */ + private static byte[] SAML_BASE64_BYTE_SAMPLE = new byte[] { 80, 72, 78, 104, + 98, 87, 119, 43, 76, 105, 52, 117, 80, 67, 57, 122, 89, 87, 49, 115 }; + + /** + * The SAML's Base64 Hash byte[] example value. + */ + private static byte[] HASH_BYTE_SAMPLE = new byte[] { 67, 38, 11, 115, 49, + -5, 54, -85, 38, 43, -99, 96, 71, -41, 50, -96, 71, -86, 90, -97, 66, -67, + 90, 101, 30, 82, -13, 60, -106, -72, -103, -75, 19, 2, -107, 107, -6, -56, + 34, -111, -44, -57, -26, -5, 33, 78, -1, 30, 21, 74, -26, 118, -46, -12, + -102, 12, -56, 30, -59, -104, -21, -42, -103, 82 }; + + /** + * Init PEPSUtilTestCase class. + */ + @BeforeClass + public static void runsBeforeTheTestSuite() { + + CONFIGS1.setProperty("max.attrList.size", "20000"); + CONFIGS1.setProperty("attrList.code", "202005"); + CONFIGS1.setProperty("attrList.message", "invalid.attrList.parameter"); + + CONFIGS1.setProperty("max.qaaLevel.size", "1"); + CONFIGS1.setProperty("max.spUrl.size", "inv"); + CONFIGS1.setProperty("validation.active", "true"); + CONFIGS1.setProperty("hashDigest.className", + "org.bouncycastle.crypto.digests.SHA512Digest"); + CONFIGS1.setProperty("invalidAgeDateValue.code", "35"); + CONFIGS1.setProperty("invalidAttributeValue.code", "34"); + CONFIGS1.setProperty("invalidAttributeValue.message", + "Unexpected or invalid content was encountered within a " + + " or element."); + } + + /** + * Tests the {@link PEPSUtil#createInstance(Properties)} method for the given + * properties object. + */ + @Test + public void testCreateInstance() { + Assert.assertNotNull(PEPSUtil.createInstance(CONFIGS2)); + } + + /** + * Tests the {@link PEPSUtil#getConfigs()}. + */ + @Test + public void testGetConfigs() { + final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); + assertEquals(pepsUtils.getConfigs(), CONFIGS1); + } + + /** + * Tests the {@link PEPSUtil#getConfigs()}. + */ + @Test + public void testGetConfigsDifferent() { + final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); + assertNotSame(pepsUtils.getConfigs(), CONFIGS2); + } + + /** + * Tests the {@link PEPSUtil#getConfig(String)} method for the given existing + * config. + */ + @Test + public void testGetConfigExists() { + assertEquals(PEPSUtil.getConfig("hashDigest.className"), + "org.bouncycastle.crypto.digests.SHA512Digest"); + } + + /** + * Tests the {@link PEPSUtil#getConfig(String)} method for the given not + * existing config. + */ + @Test + public void testGetConfigNoExists() { + assertNull(PEPSUtil.getConfig("doesnt.exists")); + } + + /** + * Tests the {@link PEPSUtil#getConfig(String)} method for the given null + * value. + */ + @Test(expected = NullPointerException.class) + public void testGetConfigNull() { + assertNull(PEPSUtil.getConfig(null)); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterExists() { + assertTrue(PEPSUtil.isValidParameter("qaaLevel", "1")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterExistsGreat() { + assertFalse(PEPSUtil.isValidParameter("qaaLevel", "12")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterExistsIvalidConf() { + assertFalse(PEPSUtil + .isValidParameter("spUrl", "http://localhost:8080/SP/")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterNotExists() { + assertFalse(PEPSUtil.isValidParameter("doesntexists", + "http://localhost:8080/SP/")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterNullParamName() { + assertFalse(PEPSUtil.isValidParameter(null, "http://localhost:8080/SP/")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterNullParamValue() { + assertFalse(PEPSUtil.isValidParameter("spUrl", null)); + } + + /** + * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} method + * for the given object values. + */ + @Test + public void testValidateParameterValid() { + final IPersonalAttributeList persAttrList = new PersonalAttributeList(); + persAttrList.populate("isAgeOver:true:[15,]:Available;"); + PEPSUtil.validateParameter("ServiceProviderAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), persAttrList); + } + + /** + * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} method + * for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterNull() { + PEPSUtil.validateParameter("ServiceProviderAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), null); + } + + /** + * Tests the {@link PEPSUtil#validateParameter(String, String, String)} method + * for the given string values. + * + * The tested class just invokes + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * so further tests will be later. + */ + @Test + public void testValidateParameter() { + PEPSUtil.validateParameter("ServiceProviderAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), + "isAgeOver:true:[15,]:Available;"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, PEPSErrors)} + * method for the given string value and {@link PEPSErrors} enum. + * + * The tested class just invokes + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * so further tests will be later. + */ + @Test + public void testValidateParameterPEPSErrors() { + PEPSUtil.validateParameter("CountrySelectorAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), + "isAgeOver:true:[15,]:Available;", + PEPSErrors.SP_COUNTRY_SELECTOR_INVALID_ATTR); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test + public void testValidateParameterValidParams() { + PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "1", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterInvalidParamValue() { + PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "10", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterInvalidParamName() { + PEPSUtil.validateParameter("ServiceProviderAction", "doesnt.exists", "1", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterNullParamName() { + PEPSUtil.validateParameter("ServiceProviderAction", null, "1", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterNullParamValue() { + PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", null, + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given + * string value. + */ + @Test + public void testEncodeSAMLToken() { + assertEquals(PEPSUtil.encodeSAMLToken(SAML_BYTE_SAMPLE), SAML_BASE64_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given + * null. + */ + @Test(expected = NullPointerException.class) + public void testEncodeSAMLTokenNull() { + assertNotSame(PEPSUtil.encodeSAMLToken(null), SAML_BASE64_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given + * empty byte[] value. + */ + @Test + public void testEncodeSAMLTokenEmpty() { + assertEquals(PEPSUtil.encodeSAMLToken(EMPTY_BYTE), EMPTY_STRING); + } + + /** + * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given + * byte[] value. + */ + @Test + public void testDecodeSAMLToken() { + assertArrayEquals(PEPSUtil.decodeSAMLToken(SAML_BASE64_SAMPLE), + SAML_BYTE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given + * null value. + */ + @Test(expected = NullPointerException.class) + public void testDecodeSAMLTokenNull() { + assertNotSame(PEPSUtil.decodeSAMLToken(null), SAML_BYTE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given + * empty string value. + */ + @Test(expected = StringIndexOutOfBoundsException.class) + public void testDecodeSAMLTokenEmpty() { + assertTrue(PEPSUtil.decodeSAMLToken(EMPTY_STRING) == EMPTY_BYTE); + } + + /** + * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given + * byte[] value. + */ + @Test + public void testHashPersonalToken() { + assertArrayEquals(PEPSUtil.hashPersonalToken(SAML_BASE64_BYTE_SAMPLE), + HASH_BYTE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given + * null value. + */ + @Test(expected = InternalErrorPEPSException.class) + public void testHashPersonalTokenNull() { + assertNull(PEPSUtil.hashPersonalToken(null)); + } + + /** + * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given + * empty value. + */ + @Test + public void testHashPersonalTokenEmpty() { + assertArrayEquals(PEPSUtil.hashPersonalToken(EMPTY_BYTE), EMPTY_HASH_BYTE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * correct message. + */ + @Test + public void testGetStorkErrorCodeExists() { + assertEquals(PEPSUtil.getStorkErrorCode(MESSAGE_SAMPLE), ERROR_CODE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * invalid message. + */ + @Test + public void testGetStorkErrorCodeNoExists() { + assertNull(PEPSUtil.getStorkErrorCode(ERROR_MESSAGE_SAMPLE)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * empty message. + */ + @Test + public void testGetStorkErrorCodeEmpty() { + assertNull(PEPSUtil.getStorkErrorCode(EMPTY_STRING)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * null message. + */ + @Test + public void testGetStorkErrorCodeNull() { + assertNull(PEPSUtil.getStorkErrorCode(null)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * invalid message. + */ + @Test + public void testGetStorkErrorCodeWithSepFake() { + assertNull(PEPSUtil.getStorkErrorCode("-")); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * invalid message. + */ + @Test + public void testGetStorkErrorCodeWithSepAndCodeFake() { + assertNull(PEPSUtil.getStorkErrorCode("000001 -")); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given correct message. + */ + @Test + public void testGetStorkErrorMessageExists() { + assertEquals(PEPSUtil.getStorkErrorMessage(MESSAGE_SAMPLE), + ERROR_MESSAGE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given invalid message. + */ + @Test + public void testGetStorkErrorMessageNoExists() { + assertEquals(PEPSUtil.getStorkErrorMessage(ERROR_MESSAGE_SAMPLE), + ERROR_MESSAGE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given empty message. + */ + @Test + public void testGetStorkErrorMessageEmpty() { + assertEquals(PEPSUtil.getStorkErrorMessage(EMPTY_STRING), + EMPTY_STRING); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given null message. + */ + @Test + public void testGetStorkErrorMessageNull() { + assertNull(PEPSUtil.getStorkErrorMessage(null)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given invalid message. + */ + @Test + public void testGetStorkErrorMessageWithSepFake() { + assertEquals(PEPSUtil.getStorkErrorMessage("-"),"-"); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given invalid message. + */ + @Test + public void testGetStorkErrorMessageWithSepAndCodeFake() { + assertEquals(PEPSUtil.getStorkErrorMessage("000001 -"),"000001 -"); + } + +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeListTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeListTestCase.java.svn-base new file mode 100644 index 000000000..4721c09b6 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeListTestCase.java.svn-base @@ -0,0 +1,557 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKStatusCode; + +/** + * The PersonalAttributeList's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.5 $, $Date: 2010-11-17 05:17:02 $ + */ +public final class PersonalAttributeListTestCase { + + /** + * isAgeOver constant value. + */ + private static final String ISAGEOVER_CONS = "isAgeOver"; + + /** + * An empty attribute. + */ + @SuppressWarnings("unused") + private static final PersonalAttributeList EMPTY_ATTR_LIST = + new PersonalAttributeList(0); + + /** + * An attribute with a complex value (canonicalResidenceAddress). + */ + private static PersonalAttribute complexAttrValue = null; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST = + "isAgeOver:true:[15,]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST2 = + "isAgeOver:true:[18,]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST3 = + "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST3_REVERSE = + "isAgeOver:true:[18,]:Available;isAgeOver:true:[15,]:Available;"; + /** + * Simple attribute value list string. + */ + private static final String COMPLEX_ATTRLIST = + "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=Ed. B," + + "state=Porto,countryCodeAddress=PT,streetNumber=379," + + "streetName=Avenida Sidonio Pais,town=Porto,]:Available;"; + /** + * Mix attribute list string. + */ + private static final String STR_MIX_ATTR_LIST = + "isAgeOver:true:[15,]:Available;canonicalResidenceAddress:true:[" + + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT," + + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto,]:" + + "Available;"; + + /** + * Attribute List example. + */ + @SuppressWarnings({ "serial" }) + private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute( + "age", true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + /** + * Init PersonalAttributeListTestCase class. + */ + @SuppressWarnings("serial") + @BeforeClass + public static void runsBeforeTheTestSuite() { + final Map values = new HashMap() { + { + put("countryCodeAddress", "PT"); + put("state", "Porto"); + put("town", "Porto"); + put("postalCode", "4100"); + put("streetName", "Avenida Sidonio Pais"); + put("streetNumber", "379"); + put("apartmentNumber", "Ed. B"); + } + }; + + complexAttrValue = + new PersonalAttribute("canonicalResidenceAddress", true, values, + STORKStatusCode.STATUS_AVAILABLE.toString()); + + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must be + * size 1 - Simple attribute. + */ + @Test + public void testAddSimpleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(ATTR_VALUE); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must be + * size 1 - Complex attribute. + */ + @Test + public void testAddCompleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(complexAttrValue); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must be + * size 0 - no attribute. + */ + @Test + public void testAddNull() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(null); + Assert.assertTrue(attrList.size() == 0); + } + + /** + * Testing Personal Attribute List add method. Same attribute name added + * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added + * twice. + */ + @SuppressWarnings("serial") + @Test + public void testAddSameAttrName() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List add method. Same attribute name added + * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added + * twice. + */ + @SuppressWarnings("serial") + @Test + public void testAddSameAttrNameEmpty() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add(""); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 1 - Simple Value. + */ + @Test + public void testPutSimpleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(ATTR_VALUE.getName(), ATTR_VALUE); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 1 - Complex Value. + */ + @Test + public void testPutComplexAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(ATTR_VALUE.getName(), complexAttrValue); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 0 - no attribute. + */ + @Test + public void testPutNull() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put("", null); + Assert.assertTrue(attrList.size() == 0); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 2 - IsAgeOver attribute added twice. + */ + @SuppressWarnings("serial") + @Test + public void testPutSameAttrName() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 2 - IsAgeOver attribute added twice. + */ + @SuppressWarnings("serial") + @Test + public void testPutSameAttrNameEmpty() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add(""); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List get method. Personal Attribute list must be + * size 1 - Simple attribute. + */ + @Test + public void testGetSimpleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(ATTR_VALUE); + Assert.assertEquals(ATTR_VALUE, attrList.get(ATTR_VALUE.getName())); + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must be + * size 1 - Complex attribute. + */ + @Test + public void testGetCompleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(complexAttrValue); + Assert.assertEquals(complexAttrValue.toString(), + attrList.get(complexAttrValue.getName()).toString()); + } + + /** + * Testing Personal Attribute List get method. Personal Attribute list must be + * size 2 - IsAgeOver attribute. + */ + @SuppressWarnings("serial") + @Test + public void testGetIsAgeOverAttr() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertEquals(SIMPLE_ATTRLIST, + attrList.get(attrValueUnder.getName()).toString()); + Assert.assertEquals(SIMPLE_ATTRLIST2, + attrList.get(attrValueOver.getName()).toString()); + } + + /** + * Testing Personal Attribute List populate method. Personal Attribute list + * must be size 1 - Simple attribute. + */ + @Test + public void testPopulateSimpleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(SIMPLE_ATTRLIST); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List populate method. Personal Attribute list + * must be size 1 - Complex attribute. + */ + @Test + public void testPopulateComplexAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(COMPLEX_ATTRLIST); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List populate method. Personal Attribute list + * must be size 1 - Simple and Complex attribute. + */ + @Test + public void testPopulateMixAttrs() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(STR_MIX_ATTR_LIST); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List toString method using add. + */ + @SuppressWarnings("serial") + @Test + public void testToStringFromAdd() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); + } + + /** + * Testing Personal Attribute List toString method using put. + * + */ + @SuppressWarnings("serial") + @Test + public void testToStringFromPut() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); + } + + /** + * Testing Personal Attribute List toString method using populate. + */ + @Test + public void testToStringFromSimplePopulate() { + final String strAttrList = "isAgeOver:true"; + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(strAttrList); + Assert.assertEquals("isAgeOver:true:[]:;", attrList.toString()); + } + + /** + * Testing Personal Attribute List toString method using populate. + */ + @Test + public void testToStringFromPopulate() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(SIMPLE_ATTRLIST3); + Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); + } + + /** + * Testing Personal Attribute List populate method, with invalid values. + */ + @Test + public void testPopulateWithInvalidValuesFormat() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate("name:type:values:status;"); + Assert.assertEquals(pal, new PersonalAttributeList()); + } + + /** + * Testing Personal Attribute List populate method, with invalid format. + */ + @Test + public void testPopulateWithInvalidFormat() { + + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate("name:type::status;"); + Assert.assertEquals(pal, new PersonalAttributeList()); + } + + /** + * Testing Personal Attribute List clone method using add. + */ + @SuppressWarnings("serial") + @Test + public void testCloneFromAdd() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertNotSame(attrList, attrList.clone()); + } + + /** + * Testing Personal Attribute List clone method using put. + */ + @SuppressWarnings("serial") + @Test + public void testCloneFromPut() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertNotSame(attrList, attrList.clone()); + } + + /** + * Testing Personal Attribute List clone method using populate. + */ + @Test + public void testCloneFromPopulate() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(SIMPLE_ATTRLIST3); + Assert.assertNotSame(pal, pal.clone()); + } + + /** + * Testing Personal Attribute List iterator. + */ + @Test + public void testIterator() { + final String strAttrList = + "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + final Iterator itAttr = pal.iterator(); + while (itAttr.hasNext()) { + final PersonalAttribute attr = itAttr.next(); + Assert.assertEquals(ISAGEOVER_CONS, attr.getName()); + } + } +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeTestCase.java.svn-base new file mode 100644 index 000000000..458d510e0 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeTestCase.java.svn-base @@ -0,0 +1,182 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import junit.framework.Assert; + +import org.junit.BeforeClass; +import org.junit.Test; + +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.STORKStatusCode; + +/** + * The PersonalAttribute's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.4 $, $Date: 2010-11-17 05:17:03 $ + */ +public final class PersonalAttributeTestCase { + + /** + * An empty attribute. + */ + private static final PersonalAttribute EMPTYATTR = new PersonalAttribute(); + + /** + * An attribute with a complex value (canonicalResidenceAddress). + */ + private static PersonalAttribute complexAttrValue = null; + + /** + * An attribute with a simple value (age). + */ + @SuppressWarnings("serial") + private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute( + "age", true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + /** + * Init PersonalAttributeTestCase class. + */ + @SuppressWarnings("serial") + @BeforeClass + public static void runsBeforeTheTestSuite() { + final Map values = new HashMap() { + { + put("countryCodeAddress", "PT"); + put("state", "Porto"); + put("town", "Porto"); + put("postalCode", "4100"); + put("streetName", "Avenida Sidonio Pais"); + put("streetNumber", "379"); + put("apartmentNumber", "B"); + } + }; + + complexAttrValue = + new PersonalAttribute("canonicalResidenceAddress", true, values, + STORKStatusCode.STATUS_AVAILABLE.toString()); + + } + + /** + * Tests the {@link PersonalAttribute#toString()} method for the given simple + * attribute value. Values must match. + */ + @Test + public void testToStringValues() { + Assert.assertEquals("age:true:[15,]:Available;", ATTR_VALUE.toString()); + } + + /** + * Tests the {@link PersonalAttribute#toString()} method for the given complex + * attribute value. Values must match. + */ + @Test + public void testToStringComplexValues() { + Assert.assertEquals( + "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=B," + + "state=Porto,countryCodeAddress=PT,streetNumber=379," + + "streetName=Avenida Sidonio Pais,town=Porto,]:Available;", + complexAttrValue.toString()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given + * empty attribute. Must return true. + */ + @Test + public void testToIsEmptyStatusWithNull() { + Assert.assertTrue(EMPTYATTR.isEmptyStatus()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given + * new attribute. Must return true. + */ + @Test + public void testToIsEmptyStatusWithEmptyString() { + final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); + attr.setStatus(""); + Assert.assertTrue(attr.isEmptyStatus()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given + * empty attribute. Must return true. + */ + @Test + public void testToIsEmptyValueWithNull() { + final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); + attr.setValue(null); + Assert.assertTrue(attr.isEmptyValue()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given + * empty attribute. Must return true. + */ + @Test + public void testToIsEmptyValue() { + Assert.assertTrue(EMPTYATTR.isEmptyValue()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the + * given empty attribute. Must return true. + */ + @Test + public void testToIsEmptyComplexValueWithNull() { + final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); + attr.setComplexValue(null); + Assert.assertTrue(attr.isEmptyComplexValue()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the + * given empty attribute. Must return true. + */ + @Test + public void testToIsEmptyComplexValueWithEmptyComplexValue() { + Assert.assertTrue(EMPTYATTR.isEmptyComplexValue()); + } + + /** + * Tests the {@link PersonalAttribute#clone()} method for the given attribute. + * Must return true. + */ + @Test + public void testCloneToComplexValue() { + Assert.assertNotSame(complexAttrValue, complexAttrValue.clone()); + } + + /** + * Tests the {@link PersonalAttribute#clone()} method for the given attribute. + * Must return true. + */ + @Test + public void testCloneToValue() { + Assert.assertNotSame(ATTR_VALUE, ATTR_VALUE.clone()); + } +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/package-info.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..452602210 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,5 @@ +/** + * This package provides all JUnit test classes. + */ +package eu.stork.peps.tests; + diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java new file mode 100644 index 000000000..77fc4b9c2 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java @@ -0,0 +1,537 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +import eu.stork.peps.auth.commons.AttributeUtil; +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSValues; +import eu.stork.peps.auth.commons.PersonalAttributeList; + +/** + * The AttributeUtil's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com + * + * @version $Revision: $, $Date: $ + */ +public final class AttributeUtilTestCase { + + /** + * Empty String to be used on the tests. + */ + private static final String EMPTY_STRING = ""; + + /** + * Tuple value sample to be used on the tests. + */ + private static final String[] TUPLE_STRING = new String[] { "age", "true", + "[18]", "Available" }; + + /** + * Complex value to be used on escape/unescape tests. + */ + private static final String COMPLEX_VAL = "postalCode=4100," + + "apartmentNumber=A,state=Porto,countryCodeAddress=PT,streetNumber=379," + + "streetName=Avenida Sidonio Pais,town=Porto,"; + + /** + * Escaped Complex value to be used on escape/unescape tests. + */ + private static final String ESC_COMPLEX_VAL = "postalCode=4100%44" + + "apartmentNumber=A%44state=Porto%44countryCodeAddress=PT%44" + + "streetNumber=379%44streetName=Avenida Sidonio Pais%44town=Porto%44"; + + /** + * Simple value to be used on escape/unescape tests. + */ + private static final String SIMPLE_VAL = "Avenida da Boavista, Porto"; + + /** + * Escaped simple value to be used on escape/unescape tests. + */ + private static final String ESC_SIMPLE_VAL = "Avenida da Boavista%44 Porto"; + + /** + * Simple text to be used on escape/unescape tests. Must match the escaped + * text. + */ + private static final String SIMPLE_TEXT = "John Doe"; + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given complex + * attribute value (canonical address' example attribute value). + */ + @Test + public void testEscapeSpecialCharsComplexVal() { + assertEquals(AttributeUtil.escape(COMPLEX_VAL), ESC_COMPLEX_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given + * attribute value. + */ + @Test + public void testEscapeSpecialCharsVal() { + assertEquals(AttributeUtil.escape(SIMPLE_VAL), ESC_SIMPLE_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given simple + * text: no special characters to escape. + */ + @Test + public void testEscapeNormalChars() { + assertEquals(AttributeUtil.escape(SIMPLE_TEXT), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#unescape(String)} method for the given + * escape complex attribute value (canonical address' example attribute + * value). + */ + @Test + public void testUnescapeSpecialCharsComplexVal() { + assertEquals(AttributeUtil.unescape(ESC_COMPLEX_VAL), COMPLEX_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given escape + * attribute value. + */ + @Test + public void testUnescapeSpecialCharsVal() { + assertEquals(AttributeUtil.unescape(ESC_SIMPLE_VAL), SIMPLE_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given simple + * text: no special characters to unescape. + */ + @Test + public void testUnescapeNormalChars() { + assertEquals(AttributeUtil.unescape(SIMPLE_TEXT), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} + * method for the given empty string. + */ + @Test + public void testAppendIfNotNullEmptyStr() { + final StringBuilder strBuilder = new StringBuilder(SIMPLE_TEXT); + AttributeUtil.appendIfNotNull(strBuilder, EMPTY_STRING); + assertEquals(strBuilder.toString(), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} + * method for the given string. + */ + @Test + public void testAppendIfNotNullStr() { + final StringBuilder strBuilder = new StringBuilder(); + AttributeUtil.appendIfNotNull(strBuilder, SIMPLE_TEXT); + assertEquals(strBuilder.toString(), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} + * method for the given null value. + */ + @Test + public void testAppendIfNotNull() { + final StringBuilder strBuilder = new StringBuilder(); + AttributeUtil.appendIfNotNull(strBuilder, null); + assertEquals(strBuilder.toString(), EMPTY_STRING); + } + + /** + * Tests the {@link AttributeUtil#listToString(List, String)} method for the + * given List with two values. + */ + @Test + public void testListToStringTwoVals() { + final List vals = new ArrayList(); + vals.add(SIMPLE_VAL); + vals.add(SIMPLE_TEXT); + + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append(SIMPLE_TEXT); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + assertEquals( + AttributeUtil.listToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#listToString(List, String)} method for the + * given List with one values. + */ + @Test + public void testListToStringOneVal() { + final List vals = new ArrayList(); + vals.add(SIMPLE_VAL); + + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + assertEquals( + AttributeUtil.listToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#listToString(List, String)} method for the + * given List with one value. + */ + @Test + public void testListToStringEmptyVal() { + final List vals = new ArrayList(); + + final StringBuilder strBuilder = new StringBuilder(); + + assertEquals( + AttributeUtil.listToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method + * for the given Map with one value. + */ + @Test + public void testMapToStringOneVal() { + final Map vals = new HashMap(); + vals.put("CanonicalAddress", COMPLEX_VAL); + + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("CanonicalAddress="); + strBuilder.append(ESC_COMPLEX_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + assertEquals(AttributeUtil.mapToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method + * for the given empty Map. + */ + @Test + public void testMapToStringEmptyVal() { + final Map vals = new HashMap(); + + final StringBuilder strBuilder = new StringBuilder(); + + assertEquals(AttributeUtil.mapToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * invalid List. + */ + @Test + public void testIsValidValueInvalidList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append("]"); + assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * null value. + */ + @Test + public void testIsValidValueNullList() { + assertFalse(AttributeUtil.isValidValue(null)); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * empty List. + */ + @Test + public void testIsValidValueEmptyList() { + assertTrue(AttributeUtil.isValidValue("[]")); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * empty List. + */ + @Test + public void testIsValidValueEmptyCommaList() { + assertTrue(AttributeUtil.isValidValue("[,]")); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one simple value List. + */ + @Test + public void testIsValidValueOneValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one simple value List. + */ + @Test + public void testIsValidValueOneValueCommaList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one complex value List. + */ + @Test + public void testIsValidValueOneComplexValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_COMPLEX_VAL); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one complex value List. + */ + @Test + public void testIsValidValueOneComplexValueCommaList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_COMPLEX_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * multi value List. + */ + @Test + public void testIsValidValueMultiValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append(SIMPLE_TEXT); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * invalid multi value List. + */ + @Test + public void testIsValidValueInvalidMultiValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append(SIMPLE_TEXT); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * true type. + */ + @Test + public void testIsValidTypetrue() { + assertTrue(AttributeUtil.isValidType("true")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * True type. + */ + @Test + public void testIsValidTypeTrue() { + assertTrue(AttributeUtil.isValidType("True")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * TRUE type. + */ + @Test + public void testIsValidTypeTRUE() { + assertTrue(AttributeUtil.isValidType("TRUE")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * invalid type. + */ + @Test + public void testIsValidTypeInvalidType() { + assertFalse(AttributeUtil.isValidType("str")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * false type. + */ + @Test + public void testIsValidTypefalse() { + assertTrue(AttributeUtil.isValidType("false")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * False type. + */ + @Test + public void testIsValidTypeFalse() { + assertTrue(AttributeUtil.isValidType("False")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * FALSE type. + */ + @Test + public void testIsValidTypeFALSEVal() { + assertTrue(AttributeUtil.isValidType("False")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * null. + */ + @Test + public void testIsValidTypeNullVal() { + assertFalse(AttributeUtil.isValidType(null)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given valid tuple. + */ + @Test + public void testHasValidTuples() { + assertTrue(AttributeUtil.hasValidTuples(TUPLE_STRING)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given invalid tuple. + */ + @Test + public void testHasValidTuplesInvalid() { + final String[] tuple = new String[]{"name", "type"}; + assertFalse(AttributeUtil.hasValidTuples(tuple)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given invalid tuple with valid size. + */ + @Test + public void testHasValidTuplesSameSizeInvalidValues() { + final String[] tuple = new String[] { "age", "type", "[18]", "Available"}; + assertFalse(AttributeUtil.hasValidTuples(tuple)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given null value. + */ + @Test + public void testHasValidTuplesNull() { + assertFalse(AttributeUtil.hasValidTuples(null)); + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given attribute list.. + */ + @Test + public void testCheckMandatoryAttributes() { + final IPersonalAttributeList attrList = new PersonalAttributeList(); + attrList.populate("isAgeOver:true:[18,]:Available;"); + assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); + + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given null value. + */ + @Test(expected = NullPointerException.class) + public void testCheckMandatoryAttributesNullAttrList() { + assertTrue(AttributeUtil.checkMandatoryAttributes(null)); + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given empty attribute list. + */ + @Test + public void testCheckMandatoryAttributesEmptyAttrList() { + final IPersonalAttributeList attrList = new PersonalAttributeList(); + assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given attribute list (missing mandatory attribute). + */ + @Test + public void testCheckMandatoryAttributesMissingAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(); + attrList.populate("isAgeOver:true:[]:NotAvailable;"); + assertFalse(AttributeUtil.checkMandatoryAttributes(attrList)); + } + +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java new file mode 100644 index 000000000..5d2296997 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java @@ -0,0 +1,294 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import java.sql.Timestamp; +import java.util.Properties; + +import org.joda.time.DateTime; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import eu.stork.peps.auth.commons.DateUtil; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.exceptions.SecurityPEPSException; + +/** + * The PersonalAttribute's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.2 $, $Date: 2010-11-17 05:17:03 $ + */ +public final class DateUtilTestCase { + + /** + * Stork Format date. + */ + private static final String FORMAT = "yyyyMMdd"; + + /** + * Expected 10 value. + */ + private static final int TEN = 10; + + /** + * Expected 11 value. + */ + private static final int ELEVEN = 11; + + /** + * The testing Date ("current" date). + */ + private static final DateTime TESTDATE = new DateTime(2011, 10, 10, 15, 20, + 0, 0); + + /** + * Init DateUtilTestCase class. + */ + @BeforeClass + public static void runsBeforeTheTestSuite() { + final Properties configs = new Properties(); + configs.setProperty("invalidAgeDateValue.code", "35"); + configs.setProperty("invalidAttributeValue.code", "34"); + configs + .setProperty( + "invalidAttributeValue.message", + "Unexpected or invalid content was encountered within a " + + " or element."); + PEPSUtil.createInstance(configs); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year against + * the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromYear() { + Assert.assertTrue(TEN == DateUtil.calculateAge("2000", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year and month + * against the testDate: 2011-10-10 15:20:00.0. Must return 11. + */ + @Test + public void calculateAgeFromEarlyMonth() { + Assert.assertTrue(ELEVEN == DateUtil.calculateAge("200001", TESTDATE, + FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year and month + * against the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromSameMonth() { + Assert.assertTrue(TEN == DateUtil.calculateAge("200010", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year and month + * against the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromLaterMonth() { + Assert.assertTrue(TEN == DateUtil.calculateAge("200011", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return 11. + */ + @Test + public void calculateAgeFromEarlyFullDate() { + Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20000101", TESTDATE, + FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return 11. + */ + @Test + public void calculateAgeFromSameDay() { + Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20001010", TESTDATE, + FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromLaterFullDate() { + Assert.assertTrue(TEN == DateUtil + .calculateAge("20001011", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromInvalidDate() { + DateUtil.calculateAge("200", TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromInvalidMonth() { + DateUtil.calculateAge("200013", TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromInvalidDay() { + DateUtil.calculateAge("20000230", TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromNullDate() { + DateUtil.calculateAge(null, TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromNullCurDate() { + DateUtil.calculateAge("2000", null, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromNullFormat() { + DateUtil.calculateAge("2000", TESTDATE, null); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return true + */ + @Test + public void isValidFormatDateFromYear() { + Assert.assertTrue(DateUtil.isValidFormatDate("2000", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year and + * month. Must return true. + */ + @Test + public void isValidFormatDateFromMonth() { + Assert.assertTrue(DateUtil.isValidFormatDate("200001", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDate() { + Assert.assertTrue(DateUtil.isValidFormatDate("20000101", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateInvalidYear() { + Assert.assertFalse(DateUtil.isValidFormatDate("200", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateInvalidMonth() { + Assert.assertFalse(DateUtil.isValidFormatDate("200013", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateInvalidDate() { + Assert.assertFalse(DateUtil.isValidFormatDate("20010229", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateNullDate() { + Assert.assertFalse(DateUtil.isValidFormatDate(null, FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateNullFormat() { + Assert.assertFalse(DateUtil.isValidFormatDate("2000", null)); + } + + /** + * Tests the {@link DateUtil#currentTimeStamp()} method for the current + * TimeStamp (TS). Must return true. + */ + @Test + public void testCurrentTimeStampBefore() { + Timestamp ts = DateUtil.currentTimeStamp(); + Assert.assertNotSame(ts, DateUtil.currentTimeStamp()); + } + + /** + * Tests the {@link DateUtil#currentTimeStamp()} method for the current + * TimeStamp (TS). Must return true. + */ + @Test + public void testCurrentTimeStampAfter() { + Timestamp ts = DateUtil.currentTimeStamp(); + Assert.assertEquals(DateUtil.currentTimeStamp(), ts); + } + +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java new file mode 100644 index 000000000..d4841ed43 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java @@ -0,0 +1,553 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; + +import java.util.Properties; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSErrors; +import eu.stork.peps.auth.commons.PEPSParameters; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.exceptions.InternalErrorPEPSException; +import eu.stork.peps.auth.commons.exceptions.InvalidParameterPEPSException; + +/** + * The PEPSUtil's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com + * + * @version $Revision: $, $Date: $ + */ +public final class PEPSUtilTestCase { + + /** + * Message example. + */ + private static final String MESSAGE_SAMPLE = "003002 - Authentication Failed"; + + /** + * Error message example. + */ + private static final String ERROR_MESSAGE_SAMPLE = "Authentication Failed"; + + /** + * Error code example. + */ + private static final String ERROR_CODE_SAMPLE = "003002"; + + /** + * Properties values for testing proposes. + */ + private static final Properties CONFIGS1 = new Properties(); + + /** + * Properties values for testing proposes. + */ + private static final Properties CONFIGS2 = new Properties(); + + /** + * The empty string value: "". + */ + private static final String EMPTY_STRING = ""; + + /** + * The empty byte value: []. + */ + private static final byte[] EMPTY_BYTE = new byte[] {}; + + /** + * The empty byte hash value. + */ + private static final byte[] EMPTY_HASH_BYTE = new byte[] { -49, -125, -31, + 53, 126, -17, -72, -67, -15, 84, 40, 80, -42, 109, -128, 7, -42, 32, -28, + 5, 11, 87, 21, -36, -125, -12, -87, 33, -45, 108, -23, -50, 71, -48, -47, + 60, 93, -123, -14, -80, -1, -125, 24, -46, -121, 126, -20, 47, 99, -71, 49, + -67, 71, 65, 122, -127, -91, 56, 50, 122, -7, 39, -38, 62 }; + + /** + * The SAML example byte[] value. + */ + private static final byte[] SAML_BYTE_SAMPLE = new byte[] { 60, 115, 97, 109, + 108, 62, 46, 46, 46, 60, 47, 115, 97, 109, 108 }; + + /** + * The SAML's Base64 example value. + */ + private static final String SAML_BASE64_SAMPLE = "PHNhbWw+Li4uPC9zYW1s"; + + /** + * The SAML's Base64 byte[] example value. + */ + private static byte[] SAML_BASE64_BYTE_SAMPLE = new byte[] { 80, 72, 78, 104, + 98, 87, 119, 43, 76, 105, 52, 117, 80, 67, 57, 122, 89, 87, 49, 115 }; + + /** + * The SAML's Base64 Hash byte[] example value. + */ + private static byte[] HASH_BYTE_SAMPLE = new byte[] { 67, 38, 11, 115, 49, + -5, 54, -85, 38, 43, -99, 96, 71, -41, 50, -96, 71, -86, 90, -97, 66, -67, + 90, 101, 30, 82, -13, 60, -106, -72, -103, -75, 19, 2, -107, 107, -6, -56, + 34, -111, -44, -57, -26, -5, 33, 78, -1, 30, 21, 74, -26, 118, -46, -12, + -102, 12, -56, 30, -59, -104, -21, -42, -103, 82 }; + + /** + * Init PEPSUtilTestCase class. + */ + @BeforeClass + public static void runsBeforeTheTestSuite() { + + CONFIGS1.setProperty("max.attrList.size", "20000"); + CONFIGS1.setProperty("attrList.code", "202005"); + CONFIGS1.setProperty("attrList.message", "invalid.attrList.parameter"); + + CONFIGS1.setProperty("max.qaaLevel.size", "1"); + CONFIGS1.setProperty("max.spUrl.size", "inv"); + CONFIGS1.setProperty("validation.active", "true"); + CONFIGS1.setProperty("hashDigest.className", + "org.bouncycastle.crypto.digests.SHA512Digest"); + CONFIGS1.setProperty("invalidAgeDateValue.code", "35"); + CONFIGS1.setProperty("invalidAttributeValue.code", "34"); + CONFIGS1.setProperty("invalidAttributeValue.message", + "Unexpected or invalid content was encountered within a " + + " or element."); + } + + /** + * Tests the {@link PEPSUtil#createInstance(Properties)} method for the given + * properties object. + */ + @Test + public void testCreateInstance() { + Assert.assertNotNull(PEPSUtil.createInstance(CONFIGS2)); + } + + /** + * Tests the {@link PEPSUtil#getConfigs()}. + */ + @Test + public void testGetConfigs() { + final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); + assertEquals(pepsUtils.getConfigs(), CONFIGS1); + } + + /** + * Tests the {@link PEPSUtil#getConfigs()}. + */ + @Test + public void testGetConfigsDifferent() { + final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); + assertNotSame(pepsUtils.getConfigs(), CONFIGS2); + } + + /** + * Tests the {@link PEPSUtil#getConfig(String)} method for the given existing + * config. + */ + @Test + public void testGetConfigExists() { + assertEquals(PEPSUtil.getConfig("hashDigest.className"), + "org.bouncycastle.crypto.digests.SHA512Digest"); + } + + /** + * Tests the {@link PEPSUtil#getConfig(String)} method for the given not + * existing config. + */ + @Test + public void testGetConfigNoExists() { + assertNull(PEPSUtil.getConfig("doesnt.exists")); + } + + /** + * Tests the {@link PEPSUtil#getConfig(String)} method for the given null + * value. + */ + @Test(expected = NullPointerException.class) + public void testGetConfigNull() { + assertNull(PEPSUtil.getConfig(null)); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterExists() { + assertTrue(PEPSUtil.isValidParameter("qaaLevel", "1")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterExistsGreat() { + assertFalse(PEPSUtil.isValidParameter("qaaLevel", "12")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterExistsIvalidConf() { + assertFalse(PEPSUtil + .isValidParameter("spUrl", "http://localhost:8080/SP/")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterNotExists() { + assertFalse(PEPSUtil.isValidParameter("doesntexists", + "http://localhost:8080/SP/")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterNullParamName() { + assertFalse(PEPSUtil.isValidParameter(null, "http://localhost:8080/SP/")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the + * given param values. + */ + @Test + public void testIsValidParameterNullParamValue() { + assertFalse(PEPSUtil.isValidParameter("spUrl", null)); + } + + /** + * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} method + * for the given object values. + */ + @Test + public void testValidateParameterValid() { + final IPersonalAttributeList persAttrList = new PersonalAttributeList(); + persAttrList.populate("isAgeOver:true:[15,]:Available;"); + PEPSUtil.validateParameter("ServiceProviderAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), persAttrList); + } + + /** + * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} method + * for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterNull() { + PEPSUtil.validateParameter("ServiceProviderAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), null); + } + + /** + * Tests the {@link PEPSUtil#validateParameter(String, String, String)} method + * for the given string values. + * + * The tested class just invokes + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * so further tests will be later. + */ + @Test + public void testValidateParameter() { + PEPSUtil.validateParameter("ServiceProviderAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), + "isAgeOver:true:[15,]:Available;"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, PEPSErrors)} + * method for the given string value and {@link PEPSErrors} enum. + * + * The tested class just invokes + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * so further tests will be later. + */ + @Test + public void testValidateParameterPEPSErrors() { + PEPSUtil.validateParameter("CountrySelectorAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), + "isAgeOver:true:[15,]:Available;", + PEPSErrors.SP_COUNTRY_SELECTOR_INVALID_ATTR); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test + public void testValidateParameterValidParams() { + PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "1", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterInvalidParamValue() { + PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "10", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterInvalidParamName() { + PEPSUtil.validateParameter("ServiceProviderAction", "doesnt.exists", "1", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterNullParamName() { + PEPSUtil.validateParameter("ServiceProviderAction", null, "1", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterNullParamValue() { + PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", null, + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given + * string value. + */ + @Test + public void testEncodeSAMLToken() { + assertEquals(PEPSUtil.encodeSAMLToken(SAML_BYTE_SAMPLE), SAML_BASE64_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given + * null. + */ + @Test(expected = NullPointerException.class) + public void testEncodeSAMLTokenNull() { + assertNotSame(PEPSUtil.encodeSAMLToken(null), SAML_BASE64_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given + * empty byte[] value. + */ + @Test + public void testEncodeSAMLTokenEmpty() { + assertEquals(PEPSUtil.encodeSAMLToken(EMPTY_BYTE), EMPTY_STRING); + } + + /** + * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given + * byte[] value. + */ + @Test + public void testDecodeSAMLToken() { + assertArrayEquals(PEPSUtil.decodeSAMLToken(SAML_BASE64_SAMPLE), + SAML_BYTE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given + * null value. + */ + @Test(expected = NullPointerException.class) + public void testDecodeSAMLTokenNull() { + assertNotSame(PEPSUtil.decodeSAMLToken(null), SAML_BYTE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given + * empty string value. + */ + @Test(expected = StringIndexOutOfBoundsException.class) + public void testDecodeSAMLTokenEmpty() { + assertTrue(PEPSUtil.decodeSAMLToken(EMPTY_STRING) == EMPTY_BYTE); + } + + /** + * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given + * byte[] value. + */ + @Test + public void testHashPersonalToken() { + assertArrayEquals(PEPSUtil.hashPersonalToken(SAML_BASE64_BYTE_SAMPLE), + HASH_BYTE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given + * null value. + */ + @Test(expected = InternalErrorPEPSException.class) + public void testHashPersonalTokenNull() { + assertNull(PEPSUtil.hashPersonalToken(null)); + } + + /** + * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given + * empty value. + */ + @Test + public void testHashPersonalTokenEmpty() { + assertArrayEquals(PEPSUtil.hashPersonalToken(EMPTY_BYTE), EMPTY_HASH_BYTE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * correct message. + */ + @Test + public void testGetStorkErrorCodeExists() { + assertEquals(PEPSUtil.getStorkErrorCode(MESSAGE_SAMPLE), ERROR_CODE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * invalid message. + */ + @Test + public void testGetStorkErrorCodeNoExists() { + assertNull(PEPSUtil.getStorkErrorCode(ERROR_MESSAGE_SAMPLE)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * empty message. + */ + @Test + public void testGetStorkErrorCodeEmpty() { + assertNull(PEPSUtil.getStorkErrorCode(EMPTY_STRING)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * null message. + */ + @Test + public void testGetStorkErrorCodeNull() { + assertNull(PEPSUtil.getStorkErrorCode(null)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * invalid message. + */ + @Test + public void testGetStorkErrorCodeWithSepFake() { + assertNull(PEPSUtil.getStorkErrorCode("-")); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * invalid message. + */ + @Test + public void testGetStorkErrorCodeWithSepAndCodeFake() { + assertNull(PEPSUtil.getStorkErrorCode("000001 -")); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given correct message. + */ + @Test + public void testGetStorkErrorMessageExists() { + assertEquals(PEPSUtil.getStorkErrorMessage(MESSAGE_SAMPLE), + ERROR_MESSAGE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given invalid message. + */ + @Test + public void testGetStorkErrorMessageNoExists() { + assertEquals(PEPSUtil.getStorkErrorMessage(ERROR_MESSAGE_SAMPLE), + ERROR_MESSAGE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given empty message. + */ + @Test + public void testGetStorkErrorMessageEmpty() { + assertEquals(PEPSUtil.getStorkErrorMessage(EMPTY_STRING), + EMPTY_STRING); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given null message. + */ + @Test + public void testGetStorkErrorMessageNull() { + assertNull(PEPSUtil.getStorkErrorMessage(null)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given invalid message. + */ + @Test + public void testGetStorkErrorMessageWithSepFake() { + assertEquals(PEPSUtil.getStorkErrorMessage("-"),"-"); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given invalid message. + */ + @Test + public void testGetStorkErrorMessageWithSepAndCodeFake() { + assertEquals(PEPSUtil.getStorkErrorMessage("000001 -"),"000001 -"); + } + +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java new file mode 100644 index 000000000..4721c09b6 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java @@ -0,0 +1,557 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKStatusCode; + +/** + * The PersonalAttributeList's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.5 $, $Date: 2010-11-17 05:17:02 $ + */ +public final class PersonalAttributeListTestCase { + + /** + * isAgeOver constant value. + */ + private static final String ISAGEOVER_CONS = "isAgeOver"; + + /** + * An empty attribute. + */ + @SuppressWarnings("unused") + private static final PersonalAttributeList EMPTY_ATTR_LIST = + new PersonalAttributeList(0); + + /** + * An attribute with a complex value (canonicalResidenceAddress). + */ + private static PersonalAttribute complexAttrValue = null; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST = + "isAgeOver:true:[15,]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST2 = + "isAgeOver:true:[18,]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST3 = + "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST3_REVERSE = + "isAgeOver:true:[18,]:Available;isAgeOver:true:[15,]:Available;"; + /** + * Simple attribute value list string. + */ + private static final String COMPLEX_ATTRLIST = + "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=Ed. B," + + "state=Porto,countryCodeAddress=PT,streetNumber=379," + + "streetName=Avenida Sidonio Pais,town=Porto,]:Available;"; + /** + * Mix attribute list string. + */ + private static final String STR_MIX_ATTR_LIST = + "isAgeOver:true:[15,]:Available;canonicalResidenceAddress:true:[" + + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT," + + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto,]:" + + "Available;"; + + /** + * Attribute List example. + */ + @SuppressWarnings({ "serial" }) + private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute( + "age", true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + /** + * Init PersonalAttributeListTestCase class. + */ + @SuppressWarnings("serial") + @BeforeClass + public static void runsBeforeTheTestSuite() { + final Map values = new HashMap() { + { + put("countryCodeAddress", "PT"); + put("state", "Porto"); + put("town", "Porto"); + put("postalCode", "4100"); + put("streetName", "Avenida Sidonio Pais"); + put("streetNumber", "379"); + put("apartmentNumber", "Ed. B"); + } + }; + + complexAttrValue = + new PersonalAttribute("canonicalResidenceAddress", true, values, + STORKStatusCode.STATUS_AVAILABLE.toString()); + + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must be + * size 1 - Simple attribute. + */ + @Test + public void testAddSimpleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(ATTR_VALUE); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must be + * size 1 - Complex attribute. + */ + @Test + public void testAddCompleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(complexAttrValue); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must be + * size 0 - no attribute. + */ + @Test + public void testAddNull() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(null); + Assert.assertTrue(attrList.size() == 0); + } + + /** + * Testing Personal Attribute List add method. Same attribute name added + * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added + * twice. + */ + @SuppressWarnings("serial") + @Test + public void testAddSameAttrName() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List add method. Same attribute name added + * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added + * twice. + */ + @SuppressWarnings("serial") + @Test + public void testAddSameAttrNameEmpty() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add(""); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 1 - Simple Value. + */ + @Test + public void testPutSimpleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(ATTR_VALUE.getName(), ATTR_VALUE); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 1 - Complex Value. + */ + @Test + public void testPutComplexAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(ATTR_VALUE.getName(), complexAttrValue); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 0 - no attribute. + */ + @Test + public void testPutNull() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put("", null); + Assert.assertTrue(attrList.size() == 0); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 2 - IsAgeOver attribute added twice. + */ + @SuppressWarnings("serial") + @Test + public void testPutSameAttrName() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must be + * size 2 - IsAgeOver attribute added twice. + */ + @SuppressWarnings("serial") + @Test + public void testPutSameAttrNameEmpty() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add(""); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List get method. Personal Attribute list must be + * size 1 - Simple attribute. + */ + @Test + public void testGetSimpleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(ATTR_VALUE); + Assert.assertEquals(ATTR_VALUE, attrList.get(ATTR_VALUE.getName())); + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must be + * size 1 - Complex attribute. + */ + @Test + public void testGetCompleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(complexAttrValue); + Assert.assertEquals(complexAttrValue.toString(), + attrList.get(complexAttrValue.getName()).toString()); + } + + /** + * Testing Personal Attribute List get method. Personal Attribute list must be + * size 2 - IsAgeOver attribute. + */ + @SuppressWarnings("serial") + @Test + public void testGetIsAgeOverAttr() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertEquals(SIMPLE_ATTRLIST, + attrList.get(attrValueUnder.getName()).toString()); + Assert.assertEquals(SIMPLE_ATTRLIST2, + attrList.get(attrValueOver.getName()).toString()); + } + + /** + * Testing Personal Attribute List populate method. Personal Attribute list + * must be size 1 - Simple attribute. + */ + @Test + public void testPopulateSimpleAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(SIMPLE_ATTRLIST); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List populate method. Personal Attribute list + * must be size 1 - Complex attribute. + */ + @Test + public void testPopulateComplexAttr() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(COMPLEX_ATTRLIST); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List populate method. Personal Attribute list + * must be size 1 - Simple and Complex attribute. + */ + @Test + public void testPopulateMixAttrs() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(STR_MIX_ATTR_LIST); + Assert.assertTrue(attrList.size() == 2); + } + + /** + * Testing Personal Attribute List toString method using add. + */ + @SuppressWarnings("serial") + @Test + public void testToStringFromAdd() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); + } + + /** + * Testing Personal Attribute List toString method using put. + * + */ + @SuppressWarnings("serial") + @Test + public void testToStringFromPut() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); + } + + /** + * Testing Personal Attribute List toString method using populate. + */ + @Test + public void testToStringFromSimplePopulate() { + final String strAttrList = "isAgeOver:true"; + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(strAttrList); + Assert.assertEquals("isAgeOver:true:[]:;", attrList.toString()); + } + + /** + * Testing Personal Attribute List toString method using populate. + */ + @Test + public void testToStringFromPopulate() { + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(SIMPLE_ATTRLIST3); + Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); + } + + /** + * Testing Personal Attribute List populate method, with invalid values. + */ + @Test + public void testPopulateWithInvalidValuesFormat() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate("name:type:values:status;"); + Assert.assertEquals(pal, new PersonalAttributeList()); + } + + /** + * Testing Personal Attribute List populate method, with invalid format. + */ + @Test + public void testPopulateWithInvalidFormat() { + + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate("name:type::status;"); + Assert.assertEquals(pal, new PersonalAttributeList()); + } + + /** + * Testing Personal Attribute List clone method using add. + */ + @SuppressWarnings("serial") + @Test + public void testCloneFromAdd() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertNotSame(attrList, attrList.clone()); + } + + /** + * Testing Personal Attribute List clone method using put. + */ + @SuppressWarnings("serial") + @Test + public void testCloneFromPut() { + final PersonalAttribute attrValueUnder = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver = + new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final PersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertNotSame(attrList, attrList.clone()); + } + + /** + * Testing Personal Attribute List clone method using populate. + */ + @Test + public void testCloneFromPopulate() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(SIMPLE_ATTRLIST3); + Assert.assertNotSame(pal, pal.clone()); + } + + /** + * Testing Personal Attribute List iterator. + */ + @Test + public void testIterator() { + final String strAttrList = + "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + final Iterator itAttr = pal.iterator(); + while (itAttr.hasNext()) { + final PersonalAttribute attr = itAttr.next(); + Assert.assertEquals(ISAGEOVER_CONS, attr.getName()); + } + } +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java new file mode 100644 index 000000000..458d510e0 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java @@ -0,0 +1,182 @@ +/* + * This work is Open Source and licensed by the European Commission under the + * conditions of the European Public License v1.1 + * + * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); + * + * any use of this file implies acceptance of the conditions of this license. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package eu.stork.peps.tests; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import junit.framework.Assert; + +import org.junit.BeforeClass; +import org.junit.Test; + +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.STORKStatusCode; + +/** + * The PersonalAttribute's Test Case. + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com + * @version $Revision: 1.4 $, $Date: 2010-11-17 05:17:03 $ + */ +public final class PersonalAttributeTestCase { + + /** + * An empty attribute. + */ + private static final PersonalAttribute EMPTYATTR = new PersonalAttribute(); + + /** + * An attribute with a complex value (canonicalResidenceAddress). + */ + private static PersonalAttribute complexAttrValue = null; + + /** + * An attribute with a simple value (age). + */ + @SuppressWarnings("serial") + private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute( + "age", true, new ArrayList() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + /** + * Init PersonalAttributeTestCase class. + */ + @SuppressWarnings("serial") + @BeforeClass + public static void runsBeforeTheTestSuite() { + final Map values = new HashMap() { + { + put("countryCodeAddress", "PT"); + put("state", "Porto"); + put("town", "Porto"); + put("postalCode", "4100"); + put("streetName", "Avenida Sidonio Pais"); + put("streetNumber", "379"); + put("apartmentNumber", "B"); + } + }; + + complexAttrValue = + new PersonalAttribute("canonicalResidenceAddress", true, values, + STORKStatusCode.STATUS_AVAILABLE.toString()); + + } + + /** + * Tests the {@link PersonalAttribute#toString()} method for the given simple + * attribute value. Values must match. + */ + @Test + public void testToStringValues() { + Assert.assertEquals("age:true:[15,]:Available;", ATTR_VALUE.toString()); + } + + /** + * Tests the {@link PersonalAttribute#toString()} method for the given complex + * attribute value. Values must match. + */ + @Test + public void testToStringComplexValues() { + Assert.assertEquals( + "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=B," + + "state=Porto,countryCodeAddress=PT,streetNumber=379," + + "streetName=Avenida Sidonio Pais,town=Porto,]:Available;", + complexAttrValue.toString()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given + * empty attribute. Must return true. + */ + @Test + public void testToIsEmptyStatusWithNull() { + Assert.assertTrue(EMPTYATTR.isEmptyStatus()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given + * new attribute. Must return true. + */ + @Test + public void testToIsEmptyStatusWithEmptyString() { + final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); + attr.setStatus(""); + Assert.assertTrue(attr.isEmptyStatus()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given + * empty attribute. Must return true. + */ + @Test + public void testToIsEmptyValueWithNull() { + final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); + attr.setValue(null); + Assert.assertTrue(attr.isEmptyValue()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given + * empty attribute. Must return true. + */ + @Test + public void testToIsEmptyValue() { + Assert.assertTrue(EMPTYATTR.isEmptyValue()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the + * given empty attribute. Must return true. + */ + @Test + public void testToIsEmptyComplexValueWithNull() { + final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); + attr.setComplexValue(null); + Assert.assertTrue(attr.isEmptyComplexValue()); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the + * given empty attribute. Must return true. + */ + @Test + public void testToIsEmptyComplexValueWithEmptyComplexValue() { + Assert.assertTrue(EMPTYATTR.isEmptyComplexValue()); + } + + /** + * Tests the {@link PersonalAttribute#clone()} method for the given attribute. + * Must return true. + */ + @Test + public void testCloneToComplexValue() { + Assert.assertNotSame(complexAttrValue, complexAttrValue.clone()); + } + + /** + * Tests the {@link PersonalAttribute#clone()} method for the given attribute. + * Must return true. + */ + @Test + public void testCloneToValue() { + Assert.assertNotSame(ATTR_VALUE, ATTR_VALUE.clone()); + } +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/package-info.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/package-info.java new file mode 100644 index 000000000..452602210 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/package-info.java @@ -0,0 +1,5 @@ +/** + * This package provides all JUnit test classes. + */ +package eu.stork.peps.tests; + diff --git a/id/server/stork2-commons/src/test/resources/.svn/all-wcprops b/id/server/stork2-commons/src/test/resources/.svn/all-wcprops new file mode 100644 index 000000000..a3a21b424 --- /dev/null +++ b/id/server/stork2-commons/src/test/resources/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 63 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/resources +END +log4j.xml +K 25 +svn:wc:ra_dav:version-url +V 73 +/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/resources/log4j.xml +END diff --git a/id/server/stork2-commons/src/test/resources/.svn/entries b/id/server/stork2-commons/src/test/resources/.svn/entries new file mode 100644 index 000000000..8876112fb --- /dev/null +++ b/id/server/stork2-commons/src/test/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/resources +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +log4j.xml +file + + + + +2013-12-20T12:27:56.542475Z +4e990a84da0033594135b05cd01a9cdd +2013-07-25T08:54:09.995385Z +7 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +645 + diff --git a/id/server/stork2-commons/src/test/resources/.svn/text-base/log4j.xml.svn-base b/id/server/stork2-commons/src/test/resources/.svn/text-base/log4j.xml.svn-base new file mode 100644 index 000000000..0ad2ea9a4 --- /dev/null +++ b/id/server/stork2-commons/src/test/resources/.svn/text-base/log4j.xml.svn-base @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/id/server/stork2-commons/src/test/resources/log4j.xml b/id/server/stork2-commons/src/test/resources/log4j.xml new file mode 100644 index 000000000..0ad2ea9a4 --- /dev/null +++ b/id/server/stork2-commons/src/test/resources/log4j.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/id/server/stork2-saml-engine/build/classes/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/.svn/all-wcprops new file mode 100644 index 000000000..a663100ff --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 52 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src +END diff --git a/id/server/stork2-saml-engine/build/classes/.svn/entries b/id/server/stork2-saml-engine/build/classes/.svn/entries new file mode 100644 index 000000000..7c9d1968f --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +test +dir + +main +dir + diff --git a/id/server/stork2-saml-engine/build/classes/main/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/.svn/all-wcprops new file mode 100644 index 000000000..f9f3d279b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 56 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main +END diff --git a/id/server/stork2-saml-engine/build/classes/main/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/.svn/entries new file mode 100644 index 000000000..dc9f007e9 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +java +dir + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/.svn/all-wcprops new file mode 100644 index 000000000..243067f06 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 61 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/.svn/entries new file mode 100644 index 000000000..e4a01af0d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +META-INF +dir + +eu +dir + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/all-wcprops new file mode 100644 index 000000000..8de21c7f2 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 70 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/META-INF +END +MANIFEST.MF +K 25 +svn:wc:ra_dav:version-url +V 82 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/META-INF/MANIFEST.MF +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/entries new file mode 100644 index 000000000..7ba7a8b7d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/META-INF +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +MANIFEST.MF +file + + + + +2013-12-20T12:27:57.282475Z +b10f37c8bb1803d98c127a01d1a71cc5 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +39 + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base new file mode 100644 index 000000000..5e9495128 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/MANIFEST.MF b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/MANIFEST.MF new file mode 100644 index 000000000..5e9495128 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/all-wcprops new file mode 100644 index 000000000..c2550210f --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/entries new file mode 100644 index 000000000..842aef3b7 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +stork +dir + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/all-wcprops new file mode 100644 index 000000000..4e9c9df08 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 70 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/entries new file mode 100644 index 000000000..15424fef8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +peps +dir + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/all-wcprops new file mode 100644 index 000000000..f6653073c --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 75 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/entries new file mode 100644 index 000000000..e80eb4f1f --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +auth +dir + +exceptions +dir + +configuration +dir + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/all-wcprops new file mode 100644 index 000000000..ea1d0ba15 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 80 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/entries new file mode 100644 index 000000000..274a429ea --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +engine +dir + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops new file mode 100644 index 000000000..a5df7ea64 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops @@ -0,0 +1,35 @@ +K 25 +svn:wc:ra_dav:version-url +V 87 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine +END +SAMLEngine.java +K 25 +svn:wc:ra_dav:version-url +V 103 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java +END +SAMLEngineUtils.java +K 25 +svn:wc:ra_dav:version-url +V 108 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 105 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/package-info.java +END +STORKSAMLEngine.java +K 25 +svn:wc:ra_dav:version-url +V 108 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java +END +X509PrincipalUtil.java +K 25 +svn:wc:ra_dav:version-url +V 110 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/entries new file mode 100644 index 000000000..ee72945c7 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/entries @@ -0,0 +1,201 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +SAMLEngine.java +file + + + + +2013-12-20T12:27:57.446475Z +06e800364af96f515b5e2b2e6da3c423 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +13855 + +SAMLEngineUtils.java +file + + + + +2013-12-20T12:27:57.446475Z +de13d8f36c3a8d7c25ed55f94f43a663 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +28573 + +package-info.java +file + + + + +2013-12-20T12:27:57.446475Z +db9d14c008d5504a156cfa955db13657 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +796 + +STORKSAMLEngine.java +file + + + + +2013-12-20T12:27:57.446475Z +4899e34f046f8a1ba1292c1e0c2f972f +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +106833 + +X509PrincipalUtil.java +file + + + + +2013-12-20T12:27:57.446475Z +5b1c22a27ba0a0bfd4c0bd4ef1890205 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2296 + +core +dir + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base new file mode 100644 index 000000000..f8f50fc74 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base @@ -0,0 +1,409 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine; + +import java.io.ByteArrayInputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import javax.xml.XMLConstants; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.opensaml.Configuration; +import org.opensaml.DefaultBootstrap; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.xml.ConfigurationException; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.Marshaller; +import org.opensaml.xml.io.MarshallerFactory; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.io.Unmarshaller; +import org.opensaml.xml.io.UnmarshallerFactory; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.parse.BasicParserPool; +import org.opensaml.xml.parse.XMLParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.auth.engine.core.STORKSAMLCore; +import eu.stork.peps.auth.engine.core.impl.SignModuleFactory; +import eu.stork.peps.configuration.ConfigurationCreator; +import eu.stork.peps.configuration.ConfigurationReader; +import eu.stork.peps.configuration.InstanceEngine; +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * Class that wraps the operations over SAML tokens, both generation and + * validation of SAML requests and SAML responses. Compliant with "OASIS Secure + * Assertion Markup Language (SAML) 2.0, May 2005", but taking into account + * STORK specific requirements. + * + * @author fjquevedo + * @author iinigo + */ + +public class SAMLEngine { + + /** The Document Builder Factory. */ + private static javax.xml.parsers.DocumentBuilderFactory dbf = null; + + /** The instance of every engine SAML. */ + private static Map instanceConfigs; + + /** The instances of SAML engine. */ + private static Map> instances; + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SAMLEngine.class + .getName()); + + /** The Constant MODULE_SIGN_CONF. */ + private static final String MODULE_SIGN_CONF = "SignatureConf"; + + /** The Constant SAML_ENGINE_SIGN_CLASS. */ + private static final String SAML_ENGINE_SIGN_CLASS = "class"; + + /** The Constant SAML_ENGINE_CONF. */ + private static final String SAML_ENGINE_CONF = "SamlEngineConf"; + + /** The Constant SAML_ENGINE_FILE_CONF. */ + private static final String SAML_ENGINE_FILE_CONF = "fileConfiguration"; + + /** The codification of characters. */ + private static final String CHARACTER_ENCODING = "UTF-8"; + + /** The SAML core. */ + private STORKSAMLCore samlCore; + + /** The Module of Signature. */ + private SAMLEngineSignI signer; + + + /** Initializes the SAML engine. */ + /** Configure Document Builder Factory. */ + + static { + startUp(); + loadDocumentFactory(); + } + + /** + * Load document factory. + */ + private static void loadDocumentFactory() { + + try { + dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance(); + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setNamespaceAware(true); + dbf.setIgnoringComments(true); + } catch (ParserConfigurationException e) { + LOG.error("Error parser configuration."); + throw new STORKSAMLEngineRuntimeException(e); + } + + } + + /** + * Method that initializes the basic services for the SAML Engine, like the + * OpenSAML library and the BouncyCastle provider. + */ + private static void startUp() { + + LOG.info("SAMLEngine: Initialize OpenSAML"); + + try { + DefaultBootstrap.bootstrap(); + } catch (ConfigurationException e) { + LOG.error("Problem initializing the OpenSAML library."); + throw new STORKSAMLEngineRuntimeException(e); + } + + LOG.debug("Read all file configurations. (instances of SAMLEngine)"); + try { + instanceConfigs = ConfigurationReader.readConfiguration(); + } catch (SAMLEngineException e) { + LOG.error("Error read configuration file."); + throw new STORKSAMLEngineRuntimeException(e); + } + + LOG.debug("Create all instaces of saml engine. (instances of SAMLEngine)"); + try { + instances = ConfigurationCreator + .createConfiguration(instanceConfigs); + } catch (STORKSAMLEngineException e) { + LOG.error("Error initializing instances from Stork SAML engine."); + throw new STORKSAMLEngineRuntimeException(e); + } + } + + /** + * Instantiates a new SAML engine. + */ + private SAMLEngine() { + + } + + /** + * Instantiates a new SAML engine. + * + * @param nameInstance the name instance + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + protected SAMLEngine(final String nameInstance) + throws STORKSAMLEngineException { + LOG.info("Loading Specific Configuration."); + + LOG.debug("Create intance of saml messages."); + + Map instance = instances.get(nameInstance); + + if (instance == null || instance.isEmpty()) { + LOG.error("Instance: " + nameInstance + " not exist."); + throw new STORKSAMLEngineException("Instance: " + nameInstance + + " not exist."); + } + + Properties properties = (Properties) instance.get(SAML_ENGINE_CONF); + + if (properties == null) { + LOG.error("SamlEngine.xml: not exist."); + throw new STORKSAMLEngineException("SamlEngine.xml: not exist."); + } + + samlCore = new STORKSAMLCore(properties); + + final HashMap propertiesSign = (HashMap) instance + .get(MODULE_SIGN_CONF); + + LOG.debug("Loading Module of sign."); + signer = SignModuleFactory.getInstance(propertiesSign + .get(SAML_ENGINE_SIGN_CLASS)); + + try { + LOG.info("Initialize module of sign."); + signer.init(propertiesSign.get(SAML_ENGINE_FILE_CONF)); + LOG.info("Load cryptographic service provider of module of sign."); + signer.loadCryptServiceProvider(); + } catch (SAMLEngineException e) { + LOG.error("Error create signature module: " + + propertiesSign.get(SAML_ENGINE_FILE_CONF)); + LOG.info("Exception" + e); + throw new STORKSAMLEngineException(e); + } + } + + /** + * Gets the Signer properties. + * + * @return the SAML Sign properties + */ + protected SAMLEngineSignI getSigner() { + return signer; + } + + /** + * Gets the SAML core properties. + * + * @return the SAML core properties + */ + protected final STORKSAMLCore getSamlCoreProperties() { + return samlCore; + } + + /** + * Method that transform the received SAML object into a byte array + * representation. + * + * @param samlToken the SAML token. + * + * @return the byte[] of the SAML token. + * + * @throws SAMLEngineException the SAML engine exception + */ + private byte[] marshall(final XMLObject samlToken) + throws SAMLEngineException { + + try { + javax.xml.parsers.DocumentBuilder docBuilder = null; + + final MarshallerFactory marshallerFactory = Configuration + .getMarshallerFactory(); + + final Marshaller marshaller = marshallerFactory + .getMarshaller(samlToken); + + docBuilder = dbf.newDocumentBuilder(); + + final Document doc = docBuilder.newDocument(); + + marshaller.marshall(samlToken, doc); + + // Obtain a byte array representation of the marshalled SAML object + final DOMSource domSource = new DOMSource(doc); + final StringWriter writer = new StringWriter(); + final StreamResult result = new StreamResult(writer); + final TransformerFactory transFactory = TransformerFactory + .newInstance(); + Transformer transformer; + + transformer = transFactory.newTransformer(); + transformer.transform(domSource, result); + LOG.debug("SAML request \n"+ writer.toString()); + return writer.toString().getBytes(CHARACTER_ENCODING); + + } catch (ParserConfigurationException e) { + LOG.error("ParserConfigurationException."); + throw new SAMLEngineException(e); + } catch (MarshallingException e) { + LOG.error("MarshallingException."); + throw new SAMLEngineException(e); + } catch (TransformerConfigurationException e) { + LOG.error("TransformerConfigurationException."); + throw new SAMLEngineException(e); + } catch (TransformerException e) { + LOG.error("TransformerException."); + throw new SAMLEngineException(e); + } catch (UnsupportedEncodingException e) { + LOG.error("UnsupportedEncodingException: " + CHARACTER_ENCODING); + throw new SAMLEngineException(e); + } + } + + /** + * Method that signs a SAML Token. + * + * @param tokenSaml the token SAML + * + * @return the SAML object sign + * + * @throws SAMLEngineException the SAML engine exception + */ + private SignableSAMLObject sign(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.debug("Sign SamlToken."); + signer.sign(tokenSaml); + return tokenSaml; + } + + /** + * Sign and transform to byte array. + * + * @param samlToken the SAML token + * + * @return the byte[] of the SAML token + * + * @throws SAMLEngineException the SAML engine exception + */ + protected final byte[] signAndMarshall(final SignableSAMLObject samlToken) + throws SAMLEngineException { + LOG.debug("Marshall Saml Token."); + SignableSAMLObject signElement = sign(samlToken); + return marshall(signElement); + } + + /** + * Method that unmarshalls a SAML Object from a byte array representation to + * an XML Object. + * + * @param samlToken Byte array representation of a SAML Object + * + * @return XML Object (superclass of SAMLObject) + * + * @throws SAMLEngineException the SAML engine exception + */ + protected final XMLObject unmarshall(final byte[] samlToken) + throws SAMLEngineException { + try { + // Get parser pool manager + final BasicParserPool ppMgr = new BasicParserPool(); + // Note: this is necessary due to an unresolved Xerces deferred DOM + // issue/bug + final HashMap features = new HashMap(); + features.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); + ppMgr.setBuilderFeatures(features); + + ppMgr.setNamespaceAware(true); + + // Parse SAMLToken + Document document = ppMgr.parse(new ByteArrayInputStream(samlToken)); + if (document != null){ + final Element root = document.getDocumentElement(); + // Get appropriate unmarshaller + final UnmarshallerFactory unmarshallerFact = Configuration.getUnmarshallerFactory(); + // Unmarshall using the SAML Token root element + if (unmarshallerFact != null && root != null){ + final Unmarshaller unmarshaller = unmarshallerFact.getUnmarshaller(root); + try { + return unmarshaller.unmarshall(root); + } catch (NullPointerException e){ + LOG.error("Error element tag incomplet or null."); + throw new SAMLEngineException("NullPointerException", e); + } + } else { + LOG.error("Error element tag incomplet or null."); + throw new SAMLEngineException("NullPointerException : unmarshallerFact or root is null"); + } + } else { + LOG.error("Error element tag incomplet or null."); + throw new SAMLEngineException("NullPointerException : document is null"); + } + } catch (XMLParserException e) { + LOG.error("XML Parsing Error.", e); + throw new SAMLEngineException(e); + } catch (UnmarshallingException e) { + LOG.error("TransformerException.", e); + throw new SAMLEngineException(e); + } catch (NullPointerException e) { + LOG.error("Error element tag incomplet or null.", e); + throw new SAMLEngineException(e); + } + } + + /** + * Method that validates an XML Signature contained in a SAML Token. + * + * @param samlToken the SAML token + * + * @return the SAML object + * + * @throws SAMLEngineException the SAML engine exception + */ + protected final SAMLObject validateSignature( + final SignableSAMLObject samlToken) throws SAMLEngineException { + + LOG.info("Validate Signature"); + signer.validateSignature(samlToken); + + return samlToken; + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base new file mode 100644 index 000000000..60f7c3091 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base @@ -0,0 +1,833 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.commons.lang.StringUtils; +import org.joda.time.DateTime; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLVersion; +import org.opensaml.common.impl.SecureRandomIdentifierGenerator; +import org.opensaml.saml2.common.Extensions; +import org.opensaml.saml2.common.impl.ExtensionsBuilder; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.AttributeQuery; +import org.opensaml.saml2.core.AttributeValue; +import org.opensaml.saml2.core.AuthnContext; +import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.core.AuthnStatement; +import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.NameID; +import org.opensaml.saml2.core.Response; +import org.opensaml.saml2.core.Status; +import org.opensaml.saml2.core.StatusCode; +import org.opensaml.saml2.core.StatusMessage; +import org.opensaml.saml2.core.Subject; +import org.opensaml.saml2.core.SubjectConfirmation; +import org.opensaml.saml2.core.SubjectConfirmationData; +import org.opensaml.saml2.core.SubjectLocality; +import org.opensaml.saml2.core.impl.AssertionBuilder; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSAny; +import org.opensaml.xml.schema.XSString; +import org.opensaml.xml.signature.KeyInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import eu.stork.peps.auth.engine.core.QAAAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.SPApplication; +import eu.stork.peps.auth.engine.core.SPCountry; +import eu.stork.peps.auth.engine.core.SPInstitution; +import eu.stork.peps.auth.engine.core.SPSector; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class SAMLEngineUtils. + * + * @author fjquevedo + * @author iinigo + */ +public final class SAMLEngineUtils { + + /** The Constant UTF_8. */ + public static final String UTF_8 = "UTF-8"; + + /** The Constant SHA_512. */ + public static final String SHA_512 = "SHA-512"; + + + /** The generator. */ + private static SecureRandomIdentifierGenerator generator; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(SAMLEngineUtils.class.getName()); + + /** + * Method that generates a random value according to NCName grammar. + * + * NCName ::= NCNameStartChar NCNameChar* NCNameChar ::= NameChar - ':' + * NCNameStartChar ::= Letter | '_' NameStartChar ::= ":" | [A-Z] | "_" | + * [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | + * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | + * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] + * NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | + * [#x203F-#x2040] Name ::= NameStartChar (NameChar)* Letter ::= BaseChar | + * Ideographic BaseChar ::= [#x0041-#x005A] | [#x0061-#x007A] | + * [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | + * [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | + * [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | + * [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | + * [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | + * [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | + * [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | + * [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | + * #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | + * [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | + * [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | + * [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | + * [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | + * [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | + * [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | + * [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | + * #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | + * [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | + * #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | + * [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | + * [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | + * [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | + * [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | + * [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | + * [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | + * [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | + * [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | + * [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | + * [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | + * [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | + * [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | + * #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | + * [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | + * [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | + * [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | + * [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | + * #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | + * #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | + * #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | + * [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | + * [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | + * [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | + * [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | + * [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | + * [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | + * [#xAC00-#xD7A3] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | + * [#x3021-#x3029] + * + * @return Random ID value + */ + + //Initialization of a generator of identifiers for all token SAML. + + static { + loadRandomIdentifierGenerator(); + } + + + /** + * Load random identifier generator. + * + *@throws STORKSAMLEngineRuntimeException the STORKSAML engine runtime exception + */ + private static void loadRandomIdentifierGenerator() { + + try { + generator = new SecureRandomIdentifierGenerator(); + } catch (NoSuchAlgorithmException ex) { + LOG.error("Error init SecureRandomIdentifierGenerator", ex); + throw new STORKSAMLEngineRuntimeException(ex); + } + + } + + /** + * Creates the SAML object. + * + * @param qname the QName + * + * @return the XML object + */ + public static XMLObject createSamlObject(final QName qname) { + return Configuration.getBuilderFactory().getBuilder(qname).buildObject( + qname); + } + + /** + * Creates the SAML object. + * + * @param qname the quality name + * @param qname1 the qname1 + * + * @return the xML object + */ + public static XMLObject createSamlObject(final QName qname, + final QName qname1) { + return Configuration.getBuilderFactory().getBuilder(qname1) + .buildObject(qname, qname1); + } + + /** + * Encode value with an specific algorithm. + * + * @param value the value + * @param alg the algorithm + * + * @return the string + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static String encode(final String value, final String alg) + throws STORKSAMLEngineException { + LOG.debug("Encode value with " + alg + " algorithm."); + byte[] buffer; + + final StringBuffer hash = new StringBuffer(""); + try { + buffer = value.getBytes(UTF_8); + MessageDigest msgDig; + msgDig = MessageDigest.getInstance(alg); + + + msgDig.update(buffer); + final byte[] digest = msgDig.digest(); + + final int signedByte = 0xff; + for (byte aux : digest) { + final int byt = aux & signedByte; + if (Integer.toHexString(byt).length() == 1) { + hash.append('0'); + } + hash.append(Integer.toHexString(byt)); + } + + } catch (UnsupportedEncodingException e1) { + LOG.error("UnsupportedEncodingException: " + UTF_8); + throw new STORKSAMLEngineException(e1); + } catch (NoSuchAlgorithmException e) { + LOG.error("NoSuchAlgorithmException: " + alg); + throw new STORKSAMLEngineException(e); + } + + return hash.toString(); + } + + /** + * Generate assertion. + * + * @param version the version + * @param identifier the identifier + * @param issueInstant the issue instant + * @param issuer the issuer + * + * @return the assertion + */ + public static Assertion generateAssertion(final SAMLVersion version, + final String identifier, final DateTime issueInstant, + final Issuer issuer) { + final AssertionBuilder assertionBuilder = new AssertionBuilder(); + final Assertion assertion = assertionBuilder.buildObject(); + assertion.setVersion(version); + assertion.setID(identifier); + assertion.setIssueInstant(issueInstant); + + // + assertion.setIssuer(issuer); + return assertion; + } + + /** + * Generate authentication statement. + * + * @param authnInstant the authentication instant + * @param authnContext the authentication context + * + * @return the authentication statement + */ + public static AuthnStatement generateAthnStatement(final DateTime authnInstant, + final AuthnContext authnContext) { + // + final AuthnStatement authnStatement = (AuthnStatement) SAMLEngineUtils + .createSamlObject(AuthnStatement.DEFAULT_ELEMENT_NAME); + + authnStatement.setAuthnInstant(authnInstant); + authnStatement.setAuthnContext(authnContext); + + return authnStatement; + } + + + + + + /** + * Generate attribute from a list of values. + * + * @param name the name of the attribute. + * @param status the status of the parameter: "Available", "NotAvailable" or + * "Withheld". + * @param values the value of the attribute. + * @param isHashing the is hashing with "SHA-512" algorithm. + * @return the attribute + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static Attribute generateAttrComplex(final String name, + final String status, final Map values, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.debug("Generate attribute complex: " + name); + final Attribute attribute = (Attribute) SAMLEngineUtils + .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); + + attribute.setName(name); + attribute.setNameFormat(Attribute.URI_REFERENCE); + + attribute.getUnknownAttributes().put( + new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", + SAMLCore.STORK10_PREFIX.getValue()), status); + + if (!values.isEmpty()) { + LOG.debug("Add attribute values."); + + // Create an attribute that contains all XSAny elements. + final XSAny attrValue = (XSAny) SAMLEngineUtils.createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, XSAny.TYPE_NAME); + + final Iterator> iterator = values.entrySet() + .iterator(); + while (iterator.hasNext()) { + final Map.Entry pairs = iterator.next(); + + final String value = pairs.getValue(); + + if (StringUtils.isNotBlank(value)) { + // Create the attribute statement + final XSAny attrValueSimple = (XSAny) SAMLEngineUtils + .createSamlObject(new QName(SAMLCore.STORK10_NS.getValue(), + pairs.getKey().toString(), + SAMLCore.STORK10_PREFIX.getValue()), XSAny.TYPE_NAME); + + // if it's necessary encode the information. + if (isHashing) { + attrValueSimple + .setTextContent(encode(value, SHA_512)); + } else { + attrValueSimple.setTextContent(value); + } + + attrValue.getUnknownXMLObjects().add(attrValueSimple); + attribute.getAttributeValues().add(attrValue); + } + } + + } + return attribute; + } + + /** + * Generate extension. + * + * @return the extensions + */ + public static Extensions generateExtension() { + final ExtensionsBuilder extensionsBuilder = new ExtensionsBuilder(); + return extensionsBuilder.buildObject( + "urn:oasis:names:tc:SAML:2.0:protocol", "Extensions", "saml2p"); + } + + + + + /** + * Generate issuer. + * + * @return the issuer + */ + public static Issuer generateIssuer() { + return (Issuer) SAMLEngineUtils + .createSamlObject(Issuer.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate key info. + * + * @return the key info + */ + public static KeyInfo generateKeyInfo() { + return (KeyInfo) SAMLEngineUtils + .createSamlObject(KeyInfo.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate name id. + * + * @return the name id + */ + public static NameID generateNameID() { + return (NameID) SAMLEngineUtils + .createSamlObject(NameID.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate name id. + * + * @param nameQualifier the name qualifier + * @param format the format + * @param spNameQualifier the sP name qualifier + * + * @return the name id + */ + public static NameID generateNameID(final String nameQualifier, + final String format, final String spNameQualifier) { + // + final NameID nameId = (NameID) Configuration.getBuilderFactory() + .getBuilder(NameID.DEFAULT_ELEMENT_NAME).buildObject( + NameID.DEFAULT_ELEMENT_NAME); + + // optional + nameId.setNameQualifier(nameQualifier); + + // optional + nameId.setFormat(format); + + // optional + nameId.setSPNameQualifier(spNameQualifier); + + return nameId; + } + + /** + * Generate NCName. + * + * @return the string + */ + public static String generateNCName() { + return generator.generateIdentifier(); + } + + + /** + * Generate the quality authentication assurance level. + * + * @param qaal the level of quality authentication assurance. + * + * @return the quality authentication assurance attribute + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static QAAAttribute generateQAAAttribute(final int qaal) + throws STORKSAMLEngineException { + LOG.debug("Generate QAAAttribute."); + + final QAAAttribute qaaAttribute = (QAAAttribute) SAMLEngineUtils + .createSamlObject(QAAAttribute.DEF_ELEMENT_NAME); + qaaAttribute.setQaaLevel(String.valueOf(qaal)); + return qaaAttribute; + } + + /** + * Generate requested attribute. + * + * @param name the name + * @param friendlyName the friendly name + * @param isRequired the is required + * @param value the value + * + * @return the requested attribute + */ + public static RequestedAttribute generateReqAuthnAttributeSimple( + final String name, final String friendlyName, + final String isRequired, final List value) { + LOG.debug("Generate the requested attribute."); + + final RequestedAttribute requested = (RequestedAttribute) SAMLEngineUtils + .createSamlObject(RequestedAttribute.DEF_ELEMENT_NAME); + requested.setName(name); + requested.setNameFormat(RequestedAttribute.URI_REFERENCE); + + requested.setFriendlyName(friendlyName); + + requested.setIsRequired(isRequired); + + // The value is optional in an authentication request. + if (!value.isEmpty()) { + for (int nextValue = 0; nextValue < value.size(); nextValue++) { + final String valor = value.get(nextValue); + if (StringUtils.isNotBlank(valor)) { + + if(!name.equals("http://www.stork.gov.eu/1.0/signedDoc")){ + + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + new QName(SAMLCore.STORK10_NS.getValue(), + "AttributeValue", + SAMLCore.STORK10_PREFIX.getValue()), + XSAny.TYPE_NAME); + + attrValue.setTextContent(valor.trim()); + requested.getAttributeValues().add(attrValue); + + }else{ + + DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + domFactory.setNamespaceAware(true); + Document document = null; + DocumentBuilder builder; + + // Parse the signedDoc value into an XML DOM Document + try { + builder = domFactory.newDocumentBuilder(); + InputStream is; + is = new ByteArrayInputStream(valor.trim().getBytes("UTF-8")); + document = builder.parse(is); + is.close(); + } catch (SAXException e1) { + LOG.error("SAX Error while parsing signModule attribute", e1); + throw new STORKSAMLEngineRuntimeException(e1); + } catch (ParserConfigurationException e2) { + LOG.error("Parser Configuration Error while parsing signModule attribute", e2); + throw new STORKSAMLEngineRuntimeException(e2); + } catch (UnsupportedEncodingException e3) { + LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); + throw new STORKSAMLEngineRuntimeException(e3); + } catch (IOException e4) { + LOG.error("IO Error while parsing signModule attribute", e4); + throw new STORKSAMLEngineRuntimeException(e4); + } + + // Create the XML statement(this will be overwritten with the previous DOM structure) + final XSAny xmlValue = (XSAny) SAMLEngineUtils + .createSamlObject( + new QName(SAMLCore.STORK10_NS.getValue(), + "XMLValue", + SAMLCore.STORK10_PREFIX.getValue()), + XSAny.TYPE_NAME); + + //Set the signedDoc XML content to this element + xmlValue.setDOM(document.getDocumentElement()); + + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + new QName(SAMLCore.STORK10_NS.getValue(), + "AttributeValue", + SAMLCore.STORK10_PREFIX.getValue()), + XSAny.TYPE_NAME); + + //Add previous signedDocXML to the AttributeValue Element + attrValue.getUnknownXMLObjects().add(xmlValue); + + requested.getAttributeValues().add(attrValue); + } + + + } + } + } + + return requested; + } + + /** + * Generate response. + * + * @param version the version + * @param identifier the identifier + * @param issueInstant the issue instant + * @param status the status + * + * @return the response + */ + public static Response generateResponse(final SAMLVersion version, + final String identifier, final DateTime issueInstant, + final Status status) { + final Response response = (Response) SAMLEngineUtils + .createSamlObject(Response.DEFAULT_ELEMENT_NAME); + response.setID(identifier); + response.setIssueInstant(issueInstant); + response.setStatus(status); + return response; + } + + /** + * Method that generates a SAML Authentication Request basing on the + * provided information. + * + * @param identifier the identifier + * @param version the version + * @param issueInstant the issue instant + * + * @return the authentication request + */ + public static AuthnRequest generateSAMLAuthnRequest(final String identifier, + final SAMLVersion version, final DateTime issueInstant) { + LOG.debug("Generate basic authentication request."); + final AuthnRequest authnRequest = (AuthnRequest) SAMLEngineUtils + .createSamlObject(AuthnRequest.DEFAULT_ELEMENT_NAME); + + authnRequest.setID(identifier); + authnRequest.setVersion(version); + authnRequest.setIssueInstant(issueInstant); + return authnRequest; + } + + public static AttributeQuery generateSAMLAttrQueryRequest(final String identifier, + final SAMLVersion version, final DateTime issueInstant) { + LOG.debug("Generate attribute query request."); + final AttributeQuery attrQueryRequest = (AttributeQuery) SAMLEngineUtils + .createSamlObject(AttributeQuery.DEFAULT_ELEMENT_NAME); + + attrQueryRequest.setID(identifier); + attrQueryRequest.setVersion(version); + attrQueryRequest.setIssueInstant(issueInstant); + return attrQueryRequest; + } + + /** + * Generate service provider application. + * + * @param spApplication the service provider application + * + * @return the sP application + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPApplication generateSPApplication(final String spApplication) + throws STORKSAMLEngineException { + LOG.debug("Generate SPApplication."); + + final SPApplication applicationAttr = (SPApplication) SAMLEngineUtils + .createSamlObject(SPApplication.DEF_ELEMENT_NAME); + applicationAttr.setSPApplication(spApplication); + return applicationAttr; + } + + /** + * Generate service provider country. + * + * @param spCountry the service provider country + * + * @return the service provider country + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPCountry generateSPCountry(final String spCountry) + throws STORKSAMLEngineException { + LOG.debug("Generate SPApplication."); + + final SPCountry countryAttribute = (SPCountry) SAMLEngineUtils + .createSamlObject(SPCountry.DEF_ELEMENT_NAME); + countryAttribute.setSPCountry(spCountry); + return countryAttribute; + } + + /** + * Generate service provider institution. + * + * @param spInstitution the service provider institution + * + * @return the service provider institution + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPInstitution generateSPInstitution(final String spInstitution) + throws STORKSAMLEngineException { + LOG.debug("Generate SPInstitution."); + + final SPInstitution institutionAttr = (SPInstitution) SAMLEngineUtils + .createSamlObject(SPInstitution.DEF_ELEMENT_NAME); + institutionAttr.setSPInstitution(spInstitution); + return institutionAttr; + } + + /** + * Generate service provider sector. + * + * @param spSector the service provider sector + * + * @return the service provider sector + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPSector generateSPSector(final String spSector) + throws STORKSAMLEngineException { + LOG.debug("Generate SPSector."); + + final SPSector sectorAttribute = (SPSector) SAMLEngineUtils + .createSamlObject(SPSector.DEF_ELEMENT_NAME); + sectorAttribute.setSPSector(spSector); + return sectorAttribute; + } + + /** + * Generate status. + * + * @param statusCode the status code + * + * @return the status + */ + public static Status generateStatus(final StatusCode statusCode) { + final Status status = (Status) SAMLEngineUtils + .createSamlObject(Status.DEFAULT_ELEMENT_NAME); + status.setStatusCode(statusCode); + return status; + } + + /** + * Generate status code. + * + * @param value the value + * + * @return the status code + */ + public static StatusCode generateStatusCode(final String value) { + final StatusCode statusCode = (StatusCode) SAMLEngineUtils + .createSamlObject(StatusCode.DEFAULT_ELEMENT_NAME); + statusCode.setValue(value); + return statusCode; + } + + + /** + * Generate status message. + * + * @param message the message + * + * @return the status message + */ + public static StatusMessage generateStatusMessage(final String message) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .createSamlObject(StatusMessage.DEFAULT_ELEMENT_NAME); + statusMessage.setMessage(message); + return statusMessage; + } + + /** + * Generate subject. + * + * @return the subject + */ + public static Subject generateSubject() { + return (Subject) SAMLEngineUtils + .createSamlObject(Subject.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate subject confirmation. + * + * @param method the method + * @param data the data + * + * @return the subject confirmation + */ + public static SubjectConfirmation generateSubjectConfirmation( + final String method, final SubjectConfirmationData data) { + final SubjectConfirmation subjectConf = (SubjectConfirmation) Configuration + .getBuilderFactory().getBuilder( + SubjectConfirmation.DEFAULT_ELEMENT_NAME).buildObject( + SubjectConfirmation.DEFAULT_ELEMENT_NAME); + + subjectConf.setMethod(method); + + subjectConf.setSubjectConfirmationData(data); + + return subjectConf; + } + + + /** + * Generate subject confirmation data. + * + * @param notOnOrAfter the not on or after + * @param recipient the recipient + * @param inResponseTo the in response to + * + * @return the subject confirmation data + */ + public static SubjectConfirmationData generateSubjectConfirmationData( + final DateTime notOnOrAfter, final String recipient, + final String inResponseTo) { + final SubjectConfirmationData subjectConfData = (SubjectConfirmationData) SAMLEngineUtils + .createSamlObject(SubjectConfirmationData.DEFAULT_ELEMENT_NAME); + subjectConfData.setNotOnOrAfter(notOnOrAfter); + subjectConfData.setRecipient(recipient); + subjectConfData.setInResponseTo(inResponseTo); + return subjectConfData; + } + + + /** + * Generate subject locality. + * + * @param address the address + * + * @return the subject locality + */ + public static SubjectLocality generateSubjectLocality(final String address) { + final SubjectLocality subjectLocality = (SubjectLocality) SAMLEngineUtils + .createSamlObject(SubjectLocality.DEFAULT_ELEMENT_NAME); + subjectLocality.setAddress(address); + return subjectLocality; + } + + + + + /** + * Method that returns the current time. + * + * @return the current time + */ + public static DateTime getCurrentTime() { + return new DateTime(); + } + + + /** + * Instantiates a new SAML engine utilities. + */ + private SAMLEngineUtils() { + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base new file mode 100644 index 000000000..3cac2f637 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base @@ -0,0 +1,2983 @@ +/* + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.commons.lang.StringUtils; +import org.bouncycastle.jce.X509Principal; +import org.joda.time.DateTime; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLVersion; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.common.Extensions; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.AttributeQuery; +import org.opensaml.saml2.core.AttributeStatement; +import org.opensaml.saml2.core.AttributeValue; +import org.opensaml.saml2.core.Audience; +import org.opensaml.saml2.core.AudienceRestriction; +import org.opensaml.saml2.core.AuthnContext; +import org.opensaml.saml2.core.AuthnContextDecl; +import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.core.AuthnStatement; +import org.opensaml.saml2.core.Conditions; +import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.NameID; +import org.opensaml.saml2.core.OneTimeUse; +import org.opensaml.saml2.core.Response; +import org.opensaml.saml2.core.Status; +import org.opensaml.saml2.core.StatusCode; +import org.opensaml.saml2.core.StatusMessage; +import org.opensaml.saml2.core.Subject; +import org.opensaml.saml2.core.SubjectConfirmation; +import org.opensaml.saml2.core.SubjectConfirmationData; +import org.opensaml.saml2.core.SubjectLocality; +import org.opensaml.saml2.core.impl.SubjectConfirmationBuilder; +import org.opensaml.xml.Namespace; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSAny; +import org.opensaml.xml.schema.impl.XSAnyBuilder; +import org.opensaml.xml.schema.impl.XSAnyImpl; +import org.opensaml.xml.schema.impl.XSAnyMarshaller; +import org.opensaml.xml.schema.impl.XSAnyUnmarshaller; +import org.opensaml.xml.schema.impl.XSStringImpl; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.util.Base64; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; +import org.opensaml.xml.validation.ValidatorSuite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAttrQueryRequest; +import eu.stork.peps.auth.commons.STORKAttrQueryResponse; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; +import eu.stork.peps.auth.engine.core.EIDSectorShare; +import eu.stork.peps.auth.engine.core.QAAAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.SPApplication; +import eu.stork.peps.auth.engine.core.SPCountry; +import eu.stork.peps.auth.engine.core.SPID; +import eu.stork.peps.auth.engine.core.SPInformation; +import eu.stork.peps.auth.engine.core.SPInstitution; +import eu.stork.peps.auth.engine.core.SPSector; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; +import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesBuilder; +import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesMarshaller; +import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeBuilder; +import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeMarshaller; +import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareBuilder; +import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareMarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareBuilder; +import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareMarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDSectorShareBuilder; +import eu.stork.peps.auth.engine.core.impl.EIDSectorShareMarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDSectorShareUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeBuilder; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeMarshaller; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeBuilder; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeMarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesBuilder; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesMarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPApplicationBuilder; +import eu.stork.peps.auth.engine.core.impl.SPApplicationMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPApplicationUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPCountryBuilder; +import eu.stork.peps.auth.engine.core.impl.SPCountryMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPCountryUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPIDBuilder; +import eu.stork.peps.auth.engine.core.impl.SPIDMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPIDUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInformationBuilder; +import eu.stork.peps.auth.engine.core.impl.SPInformationMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInformationUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInstitutionBuilder; +import eu.stork.peps.auth.engine.core.impl.SPInstitutionMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInstitutionUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPSectorBuilder; +import eu.stork.peps.auth.engine.core.impl.SPSectorMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPSectorUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesBuilder; +import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesMarshaller; +import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.validator.ExtensionsSchemaValidator; +import eu.stork.peps.auth.engine.core.validator.QAAAttributeSchemaValidator; +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * Class that wraps the operations over SAML tokens, both generation and + * validation of SAML STORK requests and SAML STORK responses. Complaint with + * "OASIS Secure Assertion Markup Language (SAML) 2.0, May 2005", but taking + * into account STORK specific requirements. + * + * @author fjquevedo + * @author iinigo + */ +public final class STORKSAMLEngine extends SAMLEngine { + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(STORKSAMLEngine.class.getName()); + + private static final String ATTRIBUTE_EMPTY_LITERAL = "Attribute name is null or empty."; + /** + * Gets the single instance of STORKSAMLEngine. + * + * @param nameInstance the name instance + * + * @return single instance of STORKSAMLEngine + */ + public static synchronized STORKSAMLEngine getInstance( + final String nameInstance) { + STORKSAMLEngine engine = null; + LOG.info("Get instance: " + nameInstance); + try { + engine = new STORKSAMLEngine(nameInstance.trim()); + } catch (Exception e) { + LOG.error("Error get instance: " + nameInstance); + } + return engine; + } + + /** + * Instantiate a new STORKSAML engine. + * + * @param nameInstance the name instance + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private STORKSAMLEngine(final String nameInstance) + throws STORKSAMLEngineException { + // Initialization OpenSAML. + super(nameInstance); + LOG.info("Register STORK objects provider."); + Configuration.registerObjectProvider(QAAAttribute.DEF_ELEMENT_NAME, + new QAAAttributeBuilder(), new QAAAttributeMarshaller(), + new QAAAttributeUnmarshaller()); + + Configuration.registerObjectProvider(EIDSectorShare.DEF_ELEMENT_NAME, + new EIDSectorShareBuilder(), new EIDSectorShareMarshaller(), + new EIDSectorShareUnmarshaller()); + + Configuration.registerObjectProvider( + EIDCrossSectorShare.DEF_ELEMENT_NAME, + new EIDCrossSectorShareBuilder(), + new EIDCrossSectorShareMarshaller(), + new EIDCrossSectorShareUnmarshaller()); + + Configuration.registerObjectProvider( + EIDCrossBorderShare.DEF_ELEMENT_NAME, + new EIDCrossBorderShareBuilder(), + new EIDCrossBorderShareMarshaller(), + new EIDCrossBorderShareUnmarshaller()); + + Configuration.registerObjectProvider(SPSector.DEF_ELEMENT_NAME, + new SPSectorBuilder(), new SPSectorMarshaller(), + new SPSectorUnmarshaller()); + + Configuration.registerObjectProvider(SPInstitution.DEF_ELEMENT_NAME, + new SPInstitutionBuilder(), new SPInstitutionMarshaller(), + new SPInstitutionUnmarshaller()); + + Configuration.registerObjectProvider(SPApplication.DEF_ELEMENT_NAME, + new SPApplicationBuilder(), new SPApplicationMarshaller(), + new SPApplicationUnmarshaller()); + + Configuration.registerObjectProvider(SPCountry.DEF_ELEMENT_NAME, + new SPCountryBuilder(), new SPCountryMarshaller(), + new SPCountryUnmarshaller()); + + Configuration.registerObjectProvider(XSAny.TYPE_NAME, + new XSAnyBuilder(), new XSAnyMarshaller(), + new XSAnyUnmarshaller()); + + Configuration.registerObjectProvider( + RequestedAttribute.DEF_ELEMENT_NAME, + new RequestedAttributeBuilder(), + new RequestedAttributeMarshaller(), + new RequestedAttributeUnmarshaller()); + + Configuration.registerObjectProvider( + RequestedAttributes.DEF_ELEMENT_NAME, + new RequestedAttributesBuilder(), + new RequestedAttributesMarshaller(), + new RequestedAttributesUnmarshaller()); + + Configuration.registerObjectProvider( + AuthenticationAttributes.DEF_ELEMENT_NAME, + new AuthenticationAttributesBuilder(), + new AuthenticationAttributesMarshaller(), + new AuthenticationAttributesUnmarshaller()); + + Configuration.registerObjectProvider( + VIDPAuthenticationAttributes.DEF_ELEMENT_NAME, + new VIDPAuthenticationAttributesBuilder(), + new VIDPAuthenticationAttributesMarshaller(), + new VIDPAuthenticationAttributesUnmarshaller()); + + Configuration.registerObjectProvider( + CitizenCountryCode.DEF_ELEMENT_NAME, + new CitizenCountryCodeBuilder(), + new CitizenCountryCodeMarshaller(), + new CitizenCountryCodeUnmarshaller()); + + Configuration.registerObjectProvider( + SPID.DEF_ELEMENT_NAME, + new SPIDBuilder(), + new SPIDMarshaller(), + new SPIDUnmarshaller()); + + Configuration.registerObjectProvider( + SPInformation.DEF_ELEMENT_NAME, + new SPInformationBuilder(), + new SPInformationMarshaller(), + new SPInformationUnmarshaller()); + + LOG.info("Register STORK object validators."); + final ValidatorSuite validatorSuite = new ValidatorSuite( + QAAAttribute.DEF_LOCAL_NAME); + + validatorSuite.registerValidator(QAAAttribute.DEF_ELEMENT_NAME, + new QAAAttributeSchemaValidator()); + final Extensions extensions = SAMLEngineUtils.generateExtension(); + validatorSuite.registerValidator(extensions.getElementQName(), + new ExtensionsSchemaValidator()); + + Configuration.registerValidatorSuite( + "stork:QualityAuthenticationAssuranceLevel", validatorSuite); + + } + + /** + * Generate authentication response base. + * + * @param status the status + * @param assertConsumerURL the assert consumer URL. + * @param inResponseTo the in response to + * + * @return the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Response genAuthnRespBase(final Status status, + final String assertConsumerURL, final String inResponseTo) + throws STORKSAMLEngineException { + LOG.debug("Generate Authentication Response base."); + final Response response = SAMLEngineUtils.generateResponse( + SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), + SAMLEngineUtils.getCurrentTime(), status); + + // Set name Spaces + this.setNameSpaces(response); + + // Mandatory STORK + LOG.debug("Generate Issuer"); + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + issuer.setValue(super.getSamlCoreProperties().getResponder()); + + // Format Entity Optional STORK + issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); + + response.setIssuer(issuer); + + // destination Mandatory Stork + response.setDestination(assertConsumerURL.trim()); + + // inResponseTo Mandatory Stork + response.setInResponseTo(inResponseTo.trim()); + + // Optional STORK + response.setConsent(super.getSamlCoreProperties() + .getConsentAuthnResponse()); + + return response; + } + + /** + * Generate attribute query response base. + * + * @param status the status + * @param destinationURL the assert consumer URL. + * @param inResponseTo the in response to + * + * @return the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Response genAttrQueryRespBase(final Status status, + final String destinationURL, final String inResponseTo) + throws STORKSAMLEngineException { + LOG.debug("Generate Attribute query Response base."); + final Response response = SAMLEngineUtils.generateResponse( + SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), + SAMLEngineUtils.getCurrentTime(), status); + + // Set name Spaces + this.setNameSpaces(response); + + // Mandatory STORK + LOG.debug("Generate Issuer"); + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + issuer.setValue(super.getSamlCoreProperties().getResponder()); + + // Format Entity Optional STORK + issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); + + response.setIssuer(issuer); + + // destination Mandatory Stork + response.setDestination(destinationURL.trim()); + + // inResponseTo Mandatory Stork + response.setInResponseTo(inResponseTo.trim()); + + // Optional STORK + response.setConsent(super.getSamlCoreProperties() + .getConsentAuthnResponse()); + + return response; + } + + /** + * Generate assertion. + * + * @param ipAddress the IP address. + * @param assertConsumerURL the assert consumer URL. + * @param inResponseTo the in response to + * @param issuer the issuer + * @param notOnOrAfter the not on or after + * + * @return the assertion + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Assertion generateAssertion(final String ipAddress, + final String assertConsumerURL, final String inResponseTo, + final String issuer, final DateTime notOnOrAfter) + throws STORKSAMLEngineException { + LOG.info("Generate Assertion."); + + // Mandatory STORK + LOG.debug("Generate Issuer to Assertion"); + final Issuer issuerAssertion = SAMLEngineUtils.generateIssuer(); + issuerAssertion.setValue(super.getSamlCoreProperties().getResponder()); + + // Format Entity Optional STORK + issuerAssertion.setFormat(super.getSamlCoreProperties() + .getFormatEntity()); + + final Assertion assertion = SAMLEngineUtils.generateAssertion( + SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), + SAMLEngineUtils.getCurrentTime(), issuerAssertion); + + final Subject subject = SAMLEngineUtils.generateSubject(); + + // Mandatory STORK verified + // String format = NameID.UNSPECIFIED + // specification: 'SAML:2.0' exist + // opensaml: "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" + // opensaml "urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified" + final String format = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"; + + final String nameQualifier = ""; + + LOG.debug("Generate NameID"); + final NameID nameId = SAMLEngineUtils.generateNameID(super + .getSamlCoreProperties().getResponder(), format, nameQualifier); + nameId.setValue(format); + subject.setNameID(nameId); + + // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. + // Optional in other case. + LOG.debug("Generate SubjectConfirmationData."); + final SubjectConfirmationData dataBearer = SAMLEngineUtils + .generateSubjectConfirmationData(SAMLEngineUtils + .getCurrentTime(), assertConsumerURL, inResponseTo); + + // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. + // Optional in other case. + LOG.debug("Generate SubjectConfirmation"); + final SubjectConfirmation subjectConf = SAMLEngineUtils + .generateSubjectConfirmation(SubjectConfirmation.METHOD_BEARER, + dataBearer); + + final ArrayList listSubjectConf = new ArrayList(); + listSubjectConf.add(subjectConf); + + for (final Iterator iter = listSubjectConf + .iterator(); iter.hasNext();) { + final SubjectConfirmation element = iter.next(); + + if (SubjectConfirmation.METHOD_BEARER.equals(element.getMethod())) { + // ipAddress Mandatory if method is Bearer. + + if (StringUtils.isBlank(ipAddress)) { + throw new STORKSAMLEngineException( + "ipAddress is null or empty"); + } + element.getSubjectConfirmationData().setAddress( + ipAddress.trim()); + } + + element.getSubjectConfirmationData() + .setRecipient(assertConsumerURL); + element.getSubjectConfirmationData().setNotOnOrAfter(notOnOrAfter); + } + + // The SAML 2.0 specification allows multiple SubjectConfirmations + subject.getSubjectConfirmations().addAll(listSubjectConf); + + // Mandatory Stork + assertion.setSubject(subject); + + // Conditions that MUST be evaluated when assessing the validity of + // and/or when using the assertion. + final Conditions conditions = this.generateConditions(SAMLEngineUtils + .getCurrentTime(), notOnOrAfter, issuer); + + assertion.setConditions(conditions); + + LOG.debug("Generate stork Authentication Statement."); + final AuthnStatement storkAuthnStat = this + .generateStorkAuthStatement(ipAddress); + assertion.getAuthnStatements().add(storkAuthnStat); + + return assertion; + } + + private String getAttributeName(final PersonalAttribute attribute) throws STORKSAMLEngineException { + if (StringUtils.isBlank(attribute.getName())) { + LOG.error(ATTRIBUTE_EMPTY_LITERAL); + throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); + } + + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.error("Attribute name: {} it is not known.", attribute + .getName()); + throw new STORKSAMLEngineException("Attribute name: " + + attribute.getName() + " it is not known."); + } + return attributeName; + } + /** + * Generate attribute statement. + * + * @param personalAttrList the personal attribute list + * @param isHashing the is hashing + * + * @return the attribute statement + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + * @throws IOException + */ + private AttributeStatement generateAttributeStatement( + final IPersonalAttributeList personalAttrList, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.debug("Generate attribute statement"); + + final AttributeStatement attrStatement = (AttributeStatement) SAMLEngineUtils + .createSamlObject(AttributeStatement.DEFAULT_ELEMENT_NAME); + + for (PersonalAttribute attribute : personalAttrList) { + + String attributeName = getAttributeName(attribute); + + // Verification that only one value it's permitted, simple or + // complex, not both. + + final boolean simpleNull = (attribute.getValue() == null); + final boolean simpleEmpty = (simpleNull || (!simpleNull && attribute + .getValue().isEmpty())); + + final boolean complexNull = (attribute.getComplexValue() == null); + final boolean complexEmpty = (complexNull || (!complexNull && attribute + .getComplexValue().isEmpty())); + + if ((!simpleEmpty && !complexEmpty)) { + throw new STORKSAMLEngineException( + "Attribute name: " + + attribute.getName() + + " must be contain one value, simple or complex value."); + } else { + + if (!simpleEmpty) { + attrStatement.getAttributes().add( + this.generateAttrSimple(attributeName, attribute + .getStatus(), attribute.getValue(), + isHashing)); + } else if (!complexEmpty) { + attrStatement.getAttributes().add( + SAMLEngineUtils.generateAttrComplex(attributeName, + attribute.getStatus(), attribute + .getComplexValue(), isHashing)); + } else if (!simpleNull) { + attrStatement.getAttributes().add( + this.generateAttrSimple(attributeName, attribute + .getStatus(), new ArrayList(), + isHashing)); + } else { + // Add attribute complex. + attrStatement.getAttributes().add( + SAMLEngineUtils.generateAttrComplex(attributeName, + attribute.getStatus(), + new HashMap(), isHashing)); + } + } + } + return attrStatement; + } + private XSAny createAttributeValueForSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { + DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + domFactory.setNamespaceAware(true); + Document document = null; + DocumentBuilder builder; + + // Parse the signedDoc value into an XML DOM Document + try { + builder = domFactory.newDocumentBuilder(); + InputStream is; + is = new ByteArrayInputStream(value.trim().getBytes("UTF-8")); + document = builder.parse(is); + is.close(); + } catch (SAXException e1) { + LOG.error("SAX Error while parsing signModule attribute", e1); + throw new STORKSAMLEngineRuntimeException(e1); + } catch (ParserConfigurationException e2) { + LOG.error("Parser Configuration Error while parsing signModule attribute", e2); + throw new STORKSAMLEngineRuntimeException(e2); + } catch (UnsupportedEncodingException e3) { + LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); + throw new STORKSAMLEngineRuntimeException(e3); + } catch (IOException e4) { + LOG.error("IO Error while parsing signModule attribute", e4); + throw new STORKSAMLEngineRuntimeException(e4); + } + + // Create the attribute statement + final XSAny xmlValue = (XSAny) SAMLEngineUtils + .createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, + XSAny.TYPE_NAME); + + //Set the signedDoc XML content to this element + xmlValue.setDOM(document.getDocumentElement()); + + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, + XSAny.TYPE_NAME); + + //Add previous signedDocXML to the AttributeValue Element + + // if it's necessary encode the information. + if (!isHashing) { + attrValue.getUnknownXMLObjects().add(xmlValue); + } + return attrValue; + } + + private XSAny createAttributeValueForNonSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, + XSAny.TYPE_NAME); + // if it's necessary encode the information. + if (isHashing) { + attrValue.setTextContent(SAMLEngineUtils.encode(value, SAMLEngineUtils.SHA_512)); + } else { + attrValue.setTextContent(value); + } + return attrValue; + } + + /** + * Generate attribute from a list of values. + * + * @param name the name of the attribute. + * @param values the value of the attribute. + * @param isHashing the is hashing with "SHA-512" algorithm. + * @param status the status of the parameter: "Available", "NotAvailable" or + * "Withheld". + * + * @return the attribute + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Attribute generateAttrSimple(final String name, + final String status, final List values, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.debug("Generate attribute simple: " + name); + final Attribute attribute = (Attribute) SAMLEngineUtils + .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); + + attribute.setName(name); + attribute.setNameFormat(Attribute.URI_REFERENCE); + + attribute.getUnknownAttributes().put( + new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", + SAMLCore.STORK10_PREFIX.getValue()), status); + + if (values != null) { + LOG.debug("Add attribute values."); + for (int i = 0; i < values.size(); i++) { + final String value = values.get(i); + if (StringUtils.isNotBlank(value)) { + XSAny attrValue = null; + if (!name.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + // Create the attribute statement + attrValue = createAttributeValueForNonSignedDoc(value, isHashing); + + } else { + attrValue = createAttributeValueForSignedDoc(value, isHashing); + attribute.getAttributeValues().add(attrValue); + } + attribute.getAttributeValues().add(attrValue); + } + } + } + return attribute; + } + + /** + * Generate conditions that MUST be evaluated when assessing the validity of + * and/or when using the assertion. + * + * @param notBefore the not before + * @param notOnOrAfter the not on or after + * @param audienceURI the audience URI. + * + * @return the conditions + */ + private Conditions generateConditions(final DateTime notBefore, + final DateTime notOnOrAfter, final String audienceURI) { + LOG.debug("Generate conditions."); + final Conditions conditions = (Conditions) SAMLEngineUtils + .createSamlObject(Conditions.DEFAULT_ELEMENT_NAME); + conditions.setNotBefore(notBefore); + conditions.setNotOnOrAfter(notOnOrAfter); + + final AudienceRestriction restrictions = (AudienceRestriction) SAMLEngineUtils + .createSamlObject(AudienceRestriction.DEFAULT_ELEMENT_NAME); + + final Audience audience = (Audience) SAMLEngineUtils + .createSamlObject(Audience.DEFAULT_ELEMENT_NAME); + audience.setAudienceURI(audienceURI); + + restrictions.getAudiences().add(audience); + conditions.getAudienceRestrictions().add(restrictions); + + if (super.getSamlCoreProperties().isOneTimeUse()) { + final OneTimeUse oneTimeUse = (OneTimeUse) SAMLEngineUtils + .createSamlObject(OneTimeUse.DEFAULT_ELEMENT_NAME); + conditions.getConditions().add(oneTimeUse); + } + return conditions; + } + + /** + * Generate personal attribute list. + * + * @param assertion the assertion + * + * @return the personal attribute list + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private IPersonalAttributeList generatePersonalAttributeList( + final Assertion assertion) throws STORKSAMLEngineException { + LOG.debug("Generate personal attribute list from XMLObject."); + final List listExtensions = assertion.getOrderedChildren(); + + boolean find = false; + AttributeStatement requestedAttr = null; + + // Search the attribute statement. + for (int i = 0; i < listExtensions.size() && !find; i++) { + final XMLObject xml = listExtensions.get(i); + if (xml instanceof AttributeStatement) { + requestedAttr = (AttributeStatement) xml; + find = true; + } + } + + if (!find) { + LOG.error("Error: AttributeStatement it's not present."); + throw new STORKSAMLEngineException( + "AttributeStatement it's not present."); + } + + final List reqAttrs = requestedAttr.getAttributes(); + + final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); + String attributeName; + + // Process the attributes. + for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { + final Attribute attribute = reqAttrs.get(nextAttribute); + + final PersonalAttribute personalAttribute = new PersonalAttribute(); + + attributeName = attribute.getName(); + personalAttribute.setName(attributeName.substring(attributeName + .lastIndexOf('/') + 1)); + + personalAttribute.setStatus(attribute.getUnknownAttributes().get( + new QName(SAMLCore.STORK10_NS.getValue(), + "AttributeStatus", SAMLCore.STORK10_PREFIX + .getValue()))); + + final ArrayList simpleValues = new ArrayList(); + final HashMap multiValues = new HashMap(); + + final List values = attribute.getOrderedChildren(); + + + // Process the values. + for (int nextValue = 0; nextValue < values.size(); nextValue++) { + + final XMLObject xmlObject = values.get(nextValue); + + if (xmlObject instanceof XSStringImpl) { + + // Process simple value. + simpleValues.add(((XSStringImpl) xmlObject).getValue()); + + } else if (xmlObject instanceof XSAnyImpl) { + + if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextValue); + + TransformerFactory transFactory = TransformerFactory + .newInstance(); + Transformer transformer = null; + try { + transformer = transFactory.newTransformer(); + transformer.setOutputProperty( + OutputKeys.OMIT_XML_DECLARATION, "yes"); + } catch (TransformerConfigurationException e) { + LOG.error("Error transformer configuration exception", e); + } + StringWriter buffer = new StringWriter(); + try { + if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ + transformer.transform(new DOMSource(xmlString + .getUnknownXMLObjects().get(0).getDOM()), + new StreamResult(buffer)); + } + } catch (TransformerException e) { + LOG.error("Error transformer exception", e); + } + String str = buffer.toString(); + + simpleValues.add(str); + + } else if (attributeName + .equals("http://www.stork.gov.eu/1.0/canonicalResidenceAddress")) + { + LOG.info("canonicalResidenceAddress found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + + } + else if (attributeName + .equals("http://www.stork.gov.eu/1.0/newAttribute2")) + { + LOG.info("newAttribute2 found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + } + else if (attributeName + .equals("http://www.stork.gov.eu/1.0/hasDegree")) + { + LOG.info("hasDegree found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + } + else if(attributeName + .equals("http://www.stork.gov.eu/1.0/mandateContent")) + { + LOG.info("mandateContent found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + } + else { + // Process simple value. + simpleValues.add(((XSAnyImpl) xmlObject) + .getTextContent()); + } + + } else { + LOG.error("Error: attribute value it's unknown."); + throw new STORKSAMLEngineException( + "Attribute value it's unknown."); + } + } + + personalAttribute.setValue(simpleValues); + personalAttribute.setComplexValue(multiValues); + personalAttrList.add(personalAttribute); + } + + return personalAttrList; + } + + /** + * Generate stork authentication request. + * + * @param request the request that contain all parameters for generate an + * authentication request. + * + * @return the STORK authentication request that has been processed. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnRequest generateSTORKAuthnRequest( + final STORKAuthnRequest request) throws STORKSAMLEngineException { + LOG.info("Generate SAMLAuthnRequest."); + + // Validate Parameters mandatories + validateParamAuthnReq(request); + + final AuthnRequest authnRequestAux = SAMLEngineUtils + .generateSAMLAuthnRequest(SAMLEngineUtils.generateNCName(), + SAMLVersion.VERSION_20, SAMLEngineUtils + .getCurrentTime()); + + // Set name spaces. + setNameSpaces(authnRequestAux); + + // Add parameter Mandatory STORK + authnRequestAux.setForceAuthn(Boolean.TRUE); + + // Add parameter Mandatory STORK + authnRequestAux.setIsPassive(Boolean.FALSE); + + authnRequestAux.setAssertionConsumerServiceURL(request + .getAssertionConsumerServiceURL()); + + authnRequestAux.setProviderName(request.getProviderName()); + + // Add protocol binding + authnRequestAux.setProtocolBinding(super.getSamlCoreProperties() + .getProtocolBinding()); + + // Add parameter optional STORK + // Destination is mandatory if the destination is a C-PEPS + // The application must to know if the destination is a C-PEPS. + if (StringUtils.isNotBlank(request.getDestination())) { + authnRequestAux.setDestination(request.getDestination()); + } + + // Consent is optional. Set from SAMLEngine.xml - consent. + authnRequestAux.setConsent(super.getSamlCoreProperties() + .getConsentAuthnRequest()); + + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + + if(request.getIssuer()!=null){ + issuer.setValue(request.getIssuer()); + } else { + issuer.setValue(super.getSamlCoreProperties().getRequester()); + } + + // Optional STORK + final String formatEntity = super.getSamlCoreProperties() + .getFormatEntity(); + if (StringUtils.isNotBlank(formatEntity)) { + issuer.setFormat(formatEntity); + } + + authnRequestAux.setIssuer(issuer); + + // Generate stork extensions. + final Extensions storkExtensions = this + .generateSTORKExtensions(request); + // add the extensions to the SAMLAuthnRequest + authnRequestAux.setExtensions(storkExtensions); + + // the result contains an authentication request token (byte[]), + // identifier of the token, and all parameters from the request. + final STORKAuthnRequest authRequest = processExtensions(authnRequestAux + .getExtensions()); + + try { + authRequest.setTokenSaml(super.signAndMarshall(authnRequestAux)); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + + authRequest.setSamlId(authnRequestAux.getID()); + authRequest.setDestination(authnRequestAux.getDestination()); + authRequest.setAssertionConsumerServiceURL(authnRequestAux + .getAssertionConsumerServiceURL()); + + authRequest.setProviderName(authnRequestAux.getProviderName()); + authRequest.setIssuer(authnRequestAux.getIssuer().getValue()); + + return authRequest; + } + + /** + * Generate stork authentication response. + * + * @param request the request + * @param responseAuthReq the response authentication request + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse generateSTORKAuthnResponse( + final STORKAuthnRequest request, + final STORKAuthnResponse responseAuthReq, final String ipAddress, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.info("generateSTORKAuthnResponse"); + + // Validate parameters + validateParamResponse(request, responseAuthReq); + + // Mandatory SAML + LOG.debug("Generate StatusCode"); + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(StatusCode.SUCCESS_URI); + + LOG.debug("Generate Status"); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + LOG.debug("Generate StatusMessage"); + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(StatusCode.SUCCESS_URI); + + status.setStatusMessage(statusMessage); + + LOG.debug("Generate Response"); + + // RESPONSE + final Response response = genAuthnRespBase(status, request + .getAssertionConsumerServiceURL(), request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, request + .getAssertionConsumerServiceURL(), request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + final AttributeStatement attrStatement = this + .generateAttributeStatement(responseAuthReq + .getPersonalAttributeList(), isHashing); + + assertion.getAttributeStatements().add(attrStatement); + + // Add assertions + response.getAssertions().add(assertion); + + final STORKAuthnResponse authresponse = new STORKAuthnResponse(); + + try { + authresponse.setTokenSaml(super.signAndMarshall(response)); + authresponse.setSamlId(response.getID()); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + return authresponse; + } + + /** + * Generate stork authentication response fail. + * + * @param request the request + * @param response the response + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse generateSTORKAuthnResponseFail( + final STORKAuthnRequest request, final STORKAuthnResponse response, + final String ipAddress, final boolean isHashing) + throws STORKSAMLEngineException { + LOG.info("generateSTORKAuthnResponseFail"); + + validateParamResponseFail(request, response); + + // Mandatory + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(response.getStatusCode()); + + // Mandatory SAML + LOG.debug("Generate StatusCode."); + // Subordinate code it's optional in case not covered into next codes: + // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed + // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue + // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy + // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied + // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported + + if (StringUtils.isNotBlank(response.getSubStatusCode())) { + final StatusCode newStatusCode = SAMLEngineUtils + .generateStatusCode(response.getSubStatusCode()); + statusCode.setStatusCode(newStatusCode); + } + + LOG.debug("Generate Status."); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + if (StringUtils.isNotBlank(response.getMessage())) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(response.getMessage()); + + status.setStatusMessage(statusMessage); + } + + LOG.debug("Generate Response."); + // RESPONSE + final Response responseFail = genAuthnRespBase(status, request + .getAssertionConsumerServiceURL(), request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, request + .getAssertionConsumerServiceURL(), request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + responseFail.getAssertions().add(assertion); + + LOG.debug("Sign and Marshall ResponseFail."); + + final STORKAuthnResponse storkResponse = new STORKAuthnResponse(); + + try { + storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); + storkResponse.setSamlId(responseFail.getID()); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException.", e); + throw new STORKSAMLEngineException(e); + } + return storkResponse; + } + + /** + * Generate stork attribute query request. + * + * @param request the request that contain all parameters for generate an + * attribute query request. + * + * @return the STORK attribute query request that has been processed. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryRequest generateSTORKAttrQueryRequest( + final STORKAttrQueryRequest request) throws STORKSAMLEngineException { + LOG.info("Generate STORKAttrQueryRequest."); + + // Validate Parameters mandatories + validateParamAttrQueryReq(request); + + final AttributeQuery attrQueryRequestAux = SAMLEngineUtils + .generateSAMLAttrQueryRequest(SAMLEngineUtils.generateNCName(), + SAMLVersion.VERSION_20, SAMLEngineUtils + .getCurrentTime()); + + // Set name spaces. + setNameSpaces(attrQueryRequestAux); + + + // Add parameter optional STORK + // Destination is mandatory if the destination is a C-PEPS + // The application must to know if the destination is a C-PEPS. + if (StringUtils.isNotBlank(request.getDestination())) { + attrQueryRequestAux.setDestination(request.getDestination()); + } + + // Consent is optional. Set from SAMLEngine.xml - consent. + attrQueryRequestAux.setConsent(super.getSamlCoreProperties() + .getConsentAuthnRequest()); + + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + + //Set the subject - needed for attribute query validation + Subject subject = SAMLEngineUtils.generateSubject(); + SubjectConfirmationBuilder builder = new SubjectConfirmationBuilder(); + SubjectConfirmation subjectConfirmation = builder.buildObject(); + subjectConfirmation.setMethod("urn:oasis:names:tc:SAML:2.0:cm:bearer"); + subject.getSubjectConfirmations().add(subjectConfirmation); + attrQueryRequestAux.setSubject(subject); + + if(request.getIssuer()!=null){ + issuer.setValue(request.getIssuer()); + } else { + issuer.setValue(super.getSamlCoreProperties().getRequester()); + } + + // Optional STORK + final String formatEntity = super.getSamlCoreProperties() + .getFormatEntity(); + if (StringUtils.isNotBlank(formatEntity)) { + issuer.setFormat(formatEntity); + } + + attrQueryRequestAux.setIssuer(issuer); + + // Generate stork extensions. + final Extensions storkExtensions = this + .generateSTORKAttrExtensions(request); + // add the extensions to the SAMLAuthnRequest + attrQueryRequestAux.setExtensions(storkExtensions); + + // the result contains an authentication request token (byte[]), + // identifier of the token, and all parameters from the request. + final STORKAttrQueryRequest attrQueryRequest = processAttrExtensions(attrQueryRequestAux + .getExtensions()); + + try { + attrQueryRequest.setTokenSaml(super.signAndMarshall(attrQueryRequestAux)); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + + attrQueryRequest.setSamlId(attrQueryRequestAux.getID()); + attrQueryRequest.setDestination(attrQueryRequestAux.getDestination()); + + attrQueryRequest.setIssuer(attrQueryRequestAux.getIssuer().getValue()); + + return attrQueryRequest; + } + + /** + * Generate stork attribute query response. + * + * @param request the request + * @param responseAttrQueryReq the response authentication request + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse generateSTORKAttrQueryResponse( + final STORKAttrQueryRequest request, + final STORKAttrQueryResponse responseAttrQueryReq, final String ipAddress, + final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException { + LOG.info("generateSTORKAttrQueryResponse"); + + // Validate parameters + validateParamAttrQueryResponse(request, responseAttrQueryReq); + + // Mandatory SAML + LOG.debug("Generate StatusCode"); + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(StatusCode.SUCCESS_URI); + + LOG.debug("Generate Status"); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + LOG.debug("Generate StatusMessage"); + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(StatusCode.SUCCESS_URI); + + status.setStatusMessage(statusMessage); + + LOG.debug("Generate Response"); + + // RESPONSE + final Response response = genAuthnRespBase(status, destinationUrl, + request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, "" + ,request.getSamlId(), request.getIssuer(), notOnOrAfter); + + final AttributeStatement attrStatement = this + .generateAttributeStatement(responseAttrQueryReq + .getPersonalAttributeList(), isHashing); + + assertion.getAttributeStatements().add(attrStatement); + + // Add assertions + response.getAssertions().add(assertion); + + final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); + + try { + attrQueryResponse.setTokenSaml(super.signAndMarshall(response)); + attrQueryResponse.setSamlId(response.getID()); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + return attrQueryResponse; + } + + /** + * Generate stork attribute query response fail. + * + * @param request the request + * @param response the response + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the STORK attribute query response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse generateSTORKAttrQueryResponseFail( + final STORKAttrQueryRequest request, final STORKAttrQueryResponse response, + final String ipAddress, final String destinationUrl, final boolean isHashing) + throws STORKSAMLEngineException { + LOG.info("generateSTORKAttrQueryResponseFail"); + + validateParamAttrQueryResponseFail(request, response); + + // Mandatory + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(response.getStatusCode()); + + // Mandatory SAML + LOG.debug("Generate StatusCode."); + // Subordinate code it's optional in case not covered into next codes: + // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed + // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue + // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy + // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied + // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported + + if (StringUtils.isNotBlank(response.getSubStatusCode())) { + final StatusCode newStatusCode = SAMLEngineUtils + .generateStatusCode(response.getSubStatusCode()); + statusCode.setStatusCode(newStatusCode); + } + + LOG.debug("Generate Status."); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + if (StringUtils.isNotBlank(response.getMessage())) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(response.getMessage()); + + status.setStatusMessage(statusMessage); + } + + LOG.debug("Generate Response."); + // RESPONSE + final Response responseFail = genAuthnRespBase(status, destinationUrl, + request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, "", + request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + responseFail.getAssertions().add(assertion); + + LOG.debug("Sign and Marshall ResponseFail."); + + final STORKAttrQueryResponse storkResponse = new STORKAttrQueryResponse(); + + try { + storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); + storkResponse.setSamlId(responseFail.getID()); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException.", e); + throw new STORKSAMLEngineException(e); + } + return storkResponse; + } + + /** + * Generate stork authentication statement for the authentication statement. + * + * @param ipAddress the IP address + * + * @return the authentication statement + */ + private AuthnStatement generateStorkAuthStatement(final String ipAddress) { + LOG.debug("Generate stork authenticate statement."); + final SubjectLocality subjectLocality = SAMLEngineUtils + .generateSubjectLocality(ipAddress); + + final AuthnContext authnContext = (AuthnContext) SAMLEngineUtils + .createSamlObject(AuthnContext.DEFAULT_ELEMENT_NAME); + + final AuthnContextDecl authnContextDecl = (AuthnContextDecl) SAMLEngineUtils + .createSamlObject(AuthnContextDecl.DEFAULT_ELEMENT_NAME); + + authnContext.setAuthnContextDecl(authnContextDecl); + + final AuthnStatement authnStatement = SAMLEngineUtils + .generateAthnStatement(new DateTime(), authnContext); + + // Optional STORK + authnStatement.setSessionIndex(null); + authnStatement.setSubjectLocality(subjectLocality); + + return authnStatement; + } + + /** + * Generate stork extensions. + * + * @param request the request + * + * @return the extensions + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Extensions generateSTORKExtensions(final STORKAuthnRequest request) + throws STORKSAMLEngineException { + LOG.debug("Generate STORKExtensions"); + + final Extensions extensions = SAMLEngineUtils.generateExtension(); + + LOG.debug("Generate QAAAttribute"); + final QAAAttribute qaaAttribute = SAMLEngineUtils + .generateQAAAttribute(request.getQaa()); + extensions.getUnknownXMLObjects().add(qaaAttribute); + + + if (StringUtils.isNotEmpty(request + .getSpSector())) { + // Add information about service provider. + LOG.debug("Generate SPSector"); + final SPSector sector = SAMLEngineUtils.generateSPSector(request + .getSpSector()); + extensions.getUnknownXMLObjects().add(sector); + } + + //Delete from specification. Kept for compatibility with Provider Name value + LOG.debug("Generate SPInstitution"); + final SPInstitution institution = SAMLEngineUtils + .generateSPInstitution(request.getProviderName()); + extensions.getUnknownXMLObjects().add(institution); + + + if (StringUtils.isNotEmpty(request.getSpApplication())) { + LOG.debug("Generate SPApplication"); + final SPApplication application = SAMLEngineUtils + .generateSPApplication(request.getSpApplication()); + extensions.getUnknownXMLObjects().add(application); + } + + if (StringUtils.isNotEmpty(request.getSpCountry())) { + LOG.debug("Generate SPCountry"); + final SPCountry country = SAMLEngineUtils.generateSPCountry(request + .getSpCountry()); + extensions.getUnknownXMLObjects().add(country); + } + + //eIDSectorShare: optional; default value: false. + String valueSectorShare = super.getSamlCoreProperties() + .iseIDSectorShare(); + + if (StringUtils.isNotEmpty(valueSectorShare)) { + // Add information about the use of the SAML message. + LOG.debug("Generate EIDSectorShare"); + final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils + .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); + + eIdSectorShare.setEIDSectorShare(String.valueOf(Boolean.valueOf(valueSectorShare))); + + extensions.getUnknownXMLObjects().add(eIdSectorShare); + } + + String valueCrossSectorShare = super.getSamlCoreProperties() + .iseIDCrossSectorShare(); + + if (StringUtils.isNotEmpty(valueCrossSectorShare)) { + LOG.debug("Generate EIDCrossSectorShare"); + final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils + .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); + eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(Boolean.valueOf(valueCrossSectorShare))); + extensions.getUnknownXMLObjects().add(eIdCrossSecShare); + } + + + String valueCrossBorderShare = super.getSamlCoreProperties() + .iseIDCrossBorderShare(); + + if (StringUtils.isNotEmpty(valueCrossBorderShare)) { + LOG.debug("Generate EIDCrossBorderShare"); + final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils + .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); + eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(Boolean.valueOf(valueCrossBorderShare))); + extensions.getUnknownXMLObjects().add(eIdCrossBordShare); + } + + + // Add information about requested attributes. + LOG.debug("Generate RequestedAttributes."); + final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils + .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); + + LOG.debug("SAML Engine configuration properties load."); + final Iterator iterator = request + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + if (attribute == null || StringUtils.isBlank(attribute.getName())) { + LOG.error(ATTRIBUTE_EMPTY_LITERAL); + throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); + } + + // Verified if exits the attribute name. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.debug("Attribute name: {} was not found.", attribute + .getName()); + throw new STORKSAMLEngineException("Attribute name: " + + attribute.getName() + " was not found."); + } + + // Friendly name it's an optional attribute. + String friendlyName = null; + + if (super.getSamlCoreProperties().isFriendlyName()) { + friendlyName = attribute.getName(); + } + + + String isRequired = null; + if (super.getSamlCoreProperties().isRequired()) { + isRequired = String.valueOf(attribute.isRequired()); + } + + + LOG.debug("Generate requested attribute: " + attributeName); + final RequestedAttribute requestedAttr = SAMLEngineUtils + .generateReqAuthnAttributeSimple(attributeName, + friendlyName, isRequired, attribute + .getValue()); + + // Add requested attribute. + reqAttributes.getAttributes().add(requestedAttr); + } + + // Add requested attributes. + extensions.getUnknownXMLObjects().add(reqAttributes); + + CitizenCountryCode citizenCountryCode = null; + if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ + LOG.debug("Generate CitizenCountryCode"); + citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils + .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); + + citizenCountryCode.setCitizenCountryCode(request + .getCitizenCountryCode().toUpperCase()); + } + + SPID spid = null; + if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { + LOG.debug("Generate SPID"); + spid = (SPID) SAMLEngineUtils + .createSamlObject(SPID.DEF_ELEMENT_NAME); + + spid.setSPID(request.getSPID().toUpperCase()); + } + + AuthenticationAttributes authenticationAttr = (AuthenticationAttributes) SAMLEngineUtils + .createSamlObject(AuthenticationAttributes.DEF_ELEMENT_NAME); + + final VIDPAuthenticationAttributes vIDPauthenticationAttr = (VIDPAuthenticationAttributes) SAMLEngineUtils + .createSamlObject(VIDPAuthenticationAttributes.DEF_ELEMENT_NAME); + + final SPInformation spInformation = (SPInformation) SAMLEngineUtils + .createSamlObject(SPInformation.DEF_ELEMENT_NAME); + + if(citizenCountryCode!=null){ + vIDPauthenticationAttr.setCitizenCountryCode(citizenCountryCode); + } + + if(spid!=null){ + spInformation.setSPID(spid); + } + + vIDPauthenticationAttr.setSPInformation(spInformation); + + authenticationAttr + .setVIDPAuthenticationAttributes(vIDPauthenticationAttr); + extensions.getUnknownXMLObjects().add(authenticationAttr); + + + return extensions; + + } + + /** + * Generate stork extensions. + * + * @param request the attribute query request + * + * @return the extensions + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Extensions generateSTORKAttrExtensions(final STORKAttrQueryRequest request) + throws STORKSAMLEngineException { + LOG.debug("Generate STORKExtensions"); + + final Extensions extensions = SAMLEngineUtils.generateExtension(); + + LOG.debug("Generate QAAAttribute"); + final QAAAttribute qaaAttribute = SAMLEngineUtils + .generateQAAAttribute(request.getQaa()); + extensions.getUnknownXMLObjects().add(qaaAttribute); + + + if (StringUtils.isNotEmpty(request + .getSpSector())) { + // Add information about service provider. + LOG.debug("Generate SPSector"); + final SPSector sector = SAMLEngineUtils.generateSPSector(request + .getSpSector()); + extensions.getUnknownXMLObjects().add(sector); + } + + + if (StringUtils.isNotEmpty(request.getSpApplication())) { + LOG.debug("Generate SPApplication"); + final SPApplication application = SAMLEngineUtils + .generateSPApplication(request.getSpApplication()); + extensions.getUnknownXMLObjects().add(application); + } + + if (StringUtils.isNotEmpty(request.getSpCountry())) { + LOG.debug("Generate SPCountry"); + final SPCountry country = SAMLEngineUtils.generateSPCountry(request + .getSpCountry()); + extensions.getUnknownXMLObjects().add(country); + } + + final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils + .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); + + eIdSectorShare.setEIDSectorShare(String.valueOf(request.isEIDSectorShare())); + + extensions.getUnknownXMLObjects().add(eIdSectorShare); + + final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils + .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); + eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(request.isEIDCrossSectorShare())); + extensions.getUnknownXMLObjects().add(eIdCrossSecShare); + + final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils + .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); + eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(request.isEIDCrossBorderShare())); + extensions.getUnknownXMLObjects().add(eIdCrossBordShare); + + + // Add information about requested attributes. + LOG.debug("Generate RequestedAttributes."); + final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils + .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); + + LOG.debug("SAML Engine configuration properties load."); + final Iterator iterator = request + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + if (attribute == null || StringUtils.isBlank(attribute.getName())) { + LOG.error(ATTRIBUTE_EMPTY_LITERAL); + throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); + } + + // Verified if exits the attribute name. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.debug("Attribute name: {} was not found.", attribute + .getName()); + throw new STORKSAMLEngineException("Attribute name: " + + attribute.getName() + " was not found."); + } + + // Friendly name it's an optional attribute. + String friendlyName = null; + + if (super.getSamlCoreProperties().isFriendlyName()) { + friendlyName = attribute.getName(); + } + + + String isRequired = null; + if (super.getSamlCoreProperties().isRequired()) { + isRequired = String.valueOf(attribute.isRequired()); + } + + + LOG.debug("Generate requested attribute: " + attributeName); + final RequestedAttribute requestedAttr = SAMLEngineUtils + .generateReqAuthnAttributeSimple(attributeName, + friendlyName, isRequired, attribute + .getValue()); + + // Add requested attribute. + reqAttributes.getAttributes().add(requestedAttr); + } + + // Add requested attributes. + extensions.getUnknownXMLObjects().add(reqAttributes); + + CitizenCountryCode citizenCountryCode = null; + if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ + LOG.debug("Generate CitizenCountryCode"); + citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils + .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); + + citizenCountryCode.setCitizenCountryCode(request + .getCitizenCountryCode().toUpperCase()); + } + + SPID spid = null; + if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { + LOG.debug("Generate SPID"); + spid = (SPID) SAMLEngineUtils + .createSamlObject(SPID.DEF_ELEMENT_NAME); + + spid.setSPID(request.getSPID().toUpperCase()); + } + + + return extensions; + + } + + /** + * Gets the alias from X.509 Certificate at keystore. + * + * @param keyInfo the key info + * @param storkOwnKeyStore + * @param storkOwnKeyStore + * + * @return the alias + */ + private String getAlias(final KeyInfo keyInfo, KeyStore storkOwnKeyStore) { + + LOG.debug("Recover alias information"); + + String alias = null; + try { + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + // Transform the KeyInfo to X509Certificate. + CertificateFactory certFact; + certFact = CertificateFactory.getInstance("X.509"); + + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + final String tokenSerialNumber = cert.getSerialNumber().toString(16); + final X509Principal tokenIssuerDN = new X509Principal(cert.getIssuerDN().getName()); + + + String aliasCert; + X509Certificate certificate; + boolean find = false; + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements() + && !find; ) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + + final String serialNum = certificate.getSerialNumber() + .toString(16); + + X509Principal issuerDN = new X509Principal(certificate + .getIssuerDN().getName()); + + if(serialNum.equalsIgnoreCase(tokenSerialNumber) + && X509PrincipalUtil.equals2(issuerDN, tokenIssuerDN)){ + alias = aliasCert; + find = true; + } + + } + + } catch (KeyStoreException e) { + LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); + } catch (CertificateException e) { + LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); + } catch (RuntimeException e) { + LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); + } + return alias; + } + + /** + * Gets the country from X.509 Certificate. + * + * @param keyInfo the key info + * + * @return the country + */ + private String getCountry(final KeyInfo keyInfo) { + LOG.debug("Recover country information."); + + String result = ""; + try { + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + // Transform the KeyInfo to X509Certificate. + CertificateFactory certFact; + certFact = CertificateFactory.getInstance("X.509"); + + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + String distName = cert.getSubjectDN().toString(); + + distName = StringUtils.deleteWhitespace(StringUtils + .upperCase(distName)); + + final String countryCode = "C="; + final int init = distName.indexOf(countryCode); + + if (init > StringUtils.INDEX_NOT_FOUND) { // Exist country code. + int end = distName.indexOf(',', init); + + if (end <= StringUtils.INDEX_NOT_FOUND) { + end = distName.length(); + } + + if (init < end && end > StringUtils.INDEX_NOT_FOUND) { + result = distName.substring(init + countryCode.length(), + end); + //It must be a two characters value + if(result.length()>2){ + result = result.substring(0, 2); + } + } + } + + } catch (CertificateException e) { + LOG.error("Procces getCountry from certificate."); + } + return result.trim(); + } + + /** + * Process all elements XMLObjects from the extensions. + * + * @param extensions the extensions from the authentication request. + * + * @return the STORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private STORKAuthnRequest processExtensions(final Extensions extensions) + throws STORKSAMLEngineException { + LOG.debug("Procces the extensions."); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + final QAAAttribute qaa = (QAAAttribute) extensions + .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); + request.setQaa(Integer.parseInt(qaa.getQaaLevel())); + + List optionalElements = extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME).get(0); + request.setSpSector(sector.getSPSector()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPApplication application = (SPApplication) extensions + .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); + request.setSpApplication(application.getSPApplication()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPCountry application = (SPCountry) extensions + .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); + request.setSpCountry(application.getSPCountry()); + } + + + List listCrossBorderShare = extensions + .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); + + if (!listCrossBorderShare .isEmpty()) { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); + request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare + .getEIDCrossBorderShare())); + } + + + List listCrosSectorShare = extensions + .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); + + if (!listCrosSectorShare.isEmpty()) { + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); + request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare + .getEIDCrossSectorShare())); + } + + List listSectorShareExtension = extensions + .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); + if (!listSectorShareExtension.isEmpty()) { + final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); + request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); + } + + + + List authAttrs = extensions + .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); + + if (authAttrs != null && !authAttrs.isEmpty()) { + + final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs + .get(0); + + VIDPAuthenticationAttributes vidpAuthnAttr = null; + if (authnAttr != null && !authAttrs.isEmpty()){ + vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); + } + + CitizenCountryCode citizenCountryCodeElement = null; + SPInformation spInformation = null; + if (vidpAuthnAttr != null){ + citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); + spInformation = vidpAuthnAttr.getSPInformation(); + } + + String citizenCountryCode = null; + if(citizenCountryCodeElement!=null){ + citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); + } + + if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ + request.setCitizenCountryCode(citizenCountryCode); + } + + SPID spidElement = null; + if (spInformation != null){ + spidElement = spInformation.getSPID(); + } + + String spid = null; + if(spidElement!=null){ + spid = spidElement.getSPID(); + } + + if (spid != null && StringUtils.isNotBlank(spid)) { + request.setSPID(spid); + } + } + + if (extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { + LOG.error("Extensions not contains any requested attribute."); + throw new STORKSAMLEngineException( + "Extensions not contains any requested attribute."); + } + + final RequestedAttributes requestedAttr = (RequestedAttributes) extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) + .get(0); + + final List reqAttrs = requestedAttr.getAttributes(); + + final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); + + String attributeName; + for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { + final RequestedAttribute attribute = reqAttrs.get(nextAttribute); + final PersonalAttribute personalAttribute = new PersonalAttribute(); + personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); + personalAttribute.setFriendlyName(attribute.getFriendlyName()); + attributeName = attribute.getName(); + + // recover the last name from the string. + personalAttribute.setName(attributeName.substring(attributeName + .lastIndexOf('/') + 1)); + + final ArrayList valores = new ArrayList(); + final List values = attribute.getOrderedChildren(); + + for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { + + // Process attributes simples. An AuthenticationRequest only + // must contains simple values. + + final XMLObject xmlObject = values.get(nextSimpleValue); + + if(xmlObject instanceof XSStringImpl){ + + final XSStringImpl xmlString = (XSStringImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getValue()); + + }else{ + + if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + + TransformerFactory transFactory = TransformerFactory.newInstance(); + Transformer transformer = null; + try { + transformer = transFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + } catch (TransformerConfigurationException e) { + LOG.error("Error transformer configuration exception", e); + } + StringWriter buffer = new StringWriter(); + try { + if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ + transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), + new StreamResult(buffer)); + } + } catch (TransformerException e) { + LOG.error("Error transformer exception", e); + } + String str = buffer.toString(); + + valores.add(str); + + }else{ + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getTextContent()); + } + + + + } + } + personalAttribute.setValue(valores); + personalAttrList.add(personalAttribute); + } + + request.setPersonalAttributeList(personalAttrList); + + return request; + } + + + /** + * Process all elements XMLObjects from the extensions. + * + * @param extensions the extensions from the authentication request. + * + * @return the STORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private STORKAttrQueryRequest processAttrExtensions(final Extensions extensions) + throws STORKSAMLEngineException { + LOG.debug("Procces the atribute query extensions."); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + final QAAAttribute qaa = (QAAAttribute) extensions + .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); + request.setQaa(Integer.parseInt(qaa.getQaaLevel())); + + List optionalElements = extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME).get(0); + request.setSpSector(sector.getSPSector()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPApplication application = (SPApplication) extensions + .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); + request.setSpApplication(application.getSPApplication()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPCountry application = (SPCountry) extensions + .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); + request.setSpCountry(application.getSPCountry()); + } + + + List listCrossBorderShare = extensions + .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); + + if (!listCrossBorderShare .isEmpty()) { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); + request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare + .getEIDCrossBorderShare())); + } + + + List listCrosSectorShare = extensions + .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); + + if (!listCrosSectorShare.isEmpty()) { + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); + request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare + .getEIDCrossSectorShare())); + } + + List listSectorShareExtension = extensions + .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); + if (!listSectorShareExtension.isEmpty()) { + final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); + request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); + } + + + + List authAttrs = extensions + .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); + + if (authAttrs != null && !authAttrs.isEmpty()) { + + final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs + .get(0); + + VIDPAuthenticationAttributes vidpAuthnAttr = null; + if (authnAttr != null && !authAttrs.isEmpty()){ + vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); + } + + CitizenCountryCode citizenCountryCodeElement = null; + SPInformation spInformation = null; + if (vidpAuthnAttr != null){ + citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); + spInformation = vidpAuthnAttr.getSPInformation(); + } + + String citizenCountryCode = null; + if(citizenCountryCodeElement!=null){ + citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); + } + + if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ + request.setCitizenCountryCode(citizenCountryCode); + } + + SPID spidElement = null; + if (spInformation != null){ + spidElement = spInformation.getSPID(); + } + + String spid = null; + if(spidElement!=null){ + spid = spidElement.getSPID(); + } + + if (spid != null && StringUtils.isNotBlank(spid)) { + request.setSPID(spid); + } + } + + if (extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { + LOG.error("Extensions not contains any requested attribute."); + throw new STORKSAMLEngineException( + "Extensions not contains any requested attribute."); + } + + final RequestedAttributes requestedAttr = (RequestedAttributes) extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) + .get(0); + + final List reqAttrs = requestedAttr.getAttributes(); + + final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); + + String attributeName; + for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { + final RequestedAttribute attribute = reqAttrs.get(nextAttribute); + final PersonalAttribute personalAttribute = new PersonalAttribute(); + personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); + personalAttribute.setFriendlyName(attribute.getFriendlyName()); + attributeName = attribute.getName(); + + // recover the last name from the string. + personalAttribute.setName(attributeName.substring(attributeName + .lastIndexOf('/') + 1)); + + final ArrayList valores = new ArrayList(); + final List values = attribute.getOrderedChildren(); + + for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { + + // Process attributes simples. An AuthenticationRequest only + // must contains simple values. + + final XMLObject xmlObject = values.get(nextSimpleValue); + + if(xmlObject instanceof XSStringImpl){ + + final XSStringImpl xmlString = (XSStringImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getValue()); + + }else{ + + if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + + TransformerFactory transFactory = TransformerFactory.newInstance(); + Transformer transformer = null; + try { + transformer = transFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + } catch (TransformerConfigurationException e) { + LOG.error("Error transformer configuration exception", e); + } + StringWriter buffer = new StringWriter(); + try { + if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ + transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), + new StreamResult(buffer)); + } + } catch (TransformerException e) { + LOG.error("Error transformer exception", e); + } + String str = buffer.toString(); + + valores.add(str); + + }else{ + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getTextContent()); + } + + + + } + } + personalAttribute.setValue(valores); + personalAttrList.add(personalAttribute); + } + + request.setPersonalAttributeList(personalAttrList); + + return request; + } + + /** + * Sets the name spaces. + * + * @param tokenSaml the new name spaces + */ + private void setNameSpaces(final XMLObject tokenSaml) { + LOG.debug("Set namespaces."); + + final Namespace saml2 = new Namespace(SAMLConstants.SAML20_NS, + SAMLConstants.SAML20_PREFIX); + tokenSaml.addNamespace(saml2); + + final Namespace digSig = new Namespace( + "http://www.w3.org/2000/09/xmldsig#", "ds"); + tokenSaml.addNamespace(digSig); + + final Namespace storkp = new Namespace(SAMLCore.STORK10P_NS.getValue(), + SAMLCore.STORK10P_PREFIX.getValue()); + tokenSaml.addNamespace(storkp); + + final Namespace stork = new Namespace(SAMLCore.STORK10_NS.getValue(), + SAMLCore.STORK10_PREFIX.getValue()); + + tokenSaml.addNamespace(stork); + } + + /** + * Validate parameters from authentication request. + * + * @param request the request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAuthnReq(final STORKAuthnRequest request) + throws STORKSAMLEngineException { + LOG.info("Validate parameters from authentication request."); + + // URL to which Authentication Response must be sent. + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); + } + + // the name of the original service provider requesting the + // authentication. + if (StringUtils.isBlank(request.getProviderName())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Service Provider it's mandatory."); + } + + // object that contain all attributes requesting. + if (request.getPersonalAttributeList() == null + || request.getPersonalAttributeList().isEmpty()) { + throw new STORKSAMLEngineException( + "attributeQueries is null or empty."); + } + + // Quality authentication assurance level. + if ((request.getQaa() < QAAAttribute.MIN_VALUE) + || (request.getQaa() > QAAAttribute.MAX_VALUE)) { + throw new STORKSAMLEngineException("Qaal: " + request.getQaa() + + ", is invalid."); + } + + } + + /** + * Validate parameters from authentication request. + * + * @param request the request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAttrQueryReq(final STORKAttrQueryRequest request) + throws STORKSAMLEngineException { + LOG.info("Validate parameters from attribute query request."); + + // URL to which Authentication Response must be sent. + /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); + }*/ + + // the name of the original service provider requesting the + // authentication. + /*if (StringUtils.isBlank(request.getProviderName())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Service Provider it's mandatory."); + }*/ + + // object that contain all attributes requesting. + if (request.getPersonalAttributeList() == null + || request.getPersonalAttributeList().isEmpty()) { + throw new STORKSAMLEngineException( + "attributeQueries is null or empty."); + } + + // Quality authentication assurance level. + if ((request.getQaa() < QAAAttribute.MIN_VALUE) + || (request.getQaa() > QAAAttribute.MAX_VALUE)) { + throw new STORKSAMLEngineException("Qaal: " + request.getQaa() + + ", is invalid."); + } + + } + + + /** + * Validate parameters from response. + * + * @param request the request + * @param responseAuthReq the response authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamResponse(final STORKAuthnRequest request, + final STORKAuthnResponse responseAuthReq) + throws STORKSAMLEngineException { + LOG.info("Validate parameters response."); + if (StringUtils.isBlank(request.getIssuer())) { + throw new STORKSAMLEngineException( + "Issuer must be not empty or null."); + } + + if (responseAuthReq.getPersonalAttributeList() == null + || responseAuthReq.getPersonalAttributeList().isEmpty()) { + LOG.error("PersonalAttributeList is null or empty."); + throw new STORKSAMLEngineException( + "PersonalAttributeList is null or empty."); + } + + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "assertionConsumerServiceURL is null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate parameters from response. + * + * @param request the request + * @param responseAttrQueryReq the response authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAttrQueryResponse(final STORKAttrQueryRequest request, + final STORKAttrQueryResponse responseAttrQueryReq) + throws STORKSAMLEngineException { + LOG.info("Validate attribute querey parameters response."); + if (StringUtils.isBlank(request.getIssuer())) { + throw new STORKSAMLEngineException( + "Issuer must be not empty or null."); + } + + if (responseAttrQueryReq.getPersonalAttributeList() == null + || responseAttrQueryReq.getPersonalAttributeList().isEmpty()) { + LOG.error("PersonalAttributeList is null or empty."); + throw new STORKSAMLEngineException( + "PersonalAttributeList is null or empty."); + } + + /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "assertionConsumerServiceURL is null or empty."); + }*/ + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate parameter from response fail. + * + * @param request the request + * @param response the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamResponseFail(final STORKAuthnRequest request, + final STORKAuthnResponse response) throws STORKSAMLEngineException { + LOG.info("Validate parameters response fail."); + if (StringUtils.isBlank(response.getStatusCode())) { + throw new STORKSAMLEngineException("Code error it's null or empty."); + } + + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "assertionConsumerServiceURL is null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate parameter from response fail. + * + * @param request the request + * @param response the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAttrQueryResponseFail(final STORKAttrQueryRequest request, + final STORKAttrQueryResponse response) throws STORKSAMLEngineException { + LOG.info("Validate parameters response fail."); + if (StringUtils.isBlank(response.getStatusCode())) { + throw new STORKSAMLEngineException("Code error it's null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate stork authentication request. + * + * @param tokenSaml the token SAML + * + * @return the sTORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnRequest validateSTORKAuthnRequest(final byte[] tokenSaml) + throws STORKSAMLEngineException { + LOG.info("validateSTORKAuthnRequest"); + + final AuthnRequest samlRequest = (AuthnRequest) validateStorkSaml(tokenSaml); + + LOG.debug("Validate Extensions."); + final Validator validatorExt = new ExtensionsSchemaValidator(); + try { + validatorExt.validate(samlRequest.getExtensions()); + } catch (ValidationException e) { + LOG.error("ValidationException: validate Extensions.", e); + throw new STORKSAMLEngineException(e); + } + + LOG.debug("Generate STORKAuthnRequest."); + final STORKAuthnRequest authnRequest = processExtensions(samlRequest + .getExtensions()); + + authnRequest.setCountry(this.getCountry(samlRequest.getSignature() + .getKeyInfo())); + + authnRequest.setAlias(this.getAlias(samlRequest.getSignature() + .getKeyInfo(), super.getSigner().getTrustStore())); + + authnRequest.setSamlId(samlRequest.getID()); + authnRequest.setDestination(samlRequest.getDestination()); + authnRequest.setAssertionConsumerServiceURL(samlRequest + .getAssertionConsumerServiceURL()); + + authnRequest.setProviderName(samlRequest.getProviderName()); + authnRequest.setIssuer(samlRequest.getIssuer().getValue()); + + //Delete unknown elements from requested ones + final Iterator iterator = authnRequest.getPersonalAttributeList().iterator(); + IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) authnRequest.getPersonalAttributeList(); + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + // Verify if the attribute name exits. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); + cleanPerAttrList.remove(attribute.getName()); + } + + } + authnRequest.setPersonalAttributeList(cleanPerAttrList); + + return authnRequest; + + } + + /** + * Validate stork authentication request. + * + * @param tokenSaml the token SAML + * + * @return the sTORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryRequest validateSTORKAttrQueryRequest(final byte[] tokenSaml) + throws STORKSAMLEngineException { + LOG.info("validateSTORKAttrQueryRequest"); + + final AttributeQuery samlRequest = (AttributeQuery) validateStorkSaml(tokenSaml); + + LOG.debug("Validate Extensions."); + final Validator validatorExt = new ExtensionsSchemaValidator(); + try { + validatorExt.validate(samlRequest.getExtensions()); + } catch (ValidationException e) { + LOG.error("ValidationException: validate Extensions.", e); + throw new STORKSAMLEngineException(e); + } + + LOG.debug("Generate STORKAttrQueryRequest."); + final STORKAttrQueryRequest attrRequest = processAttrExtensions(samlRequest + .getExtensions()); + + attrRequest.setCountry(this.getCountry(samlRequest.getSignature() + .getKeyInfo())); + + attrRequest.setAlias(this.getAlias(samlRequest.getSignature() + .getKeyInfo(), super.getSigner().getTrustStore())); + + attrRequest.setSamlId(samlRequest.getID()); + attrRequest.setDestination(samlRequest.getDestination()); + /*attrRequest.setAssertionConsumerServiceURL(samlRequest + .getAssertionConsumerServiceURL()); + + authnRequest.setProviderName(samlRequest.getProviderName());*/ + attrRequest.setIssuer(samlRequest.getIssuer().getValue()); + + //Delete unknown elements from requested ones + final Iterator iterator = attrRequest.getPersonalAttributeList().iterator(); + IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) attrRequest.getPersonalAttributeList(); + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + // Verify if the attribute name exits. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); + cleanPerAttrList.remove(attribute.getName()); + } + + } + attrRequest.setPersonalAttributeList(cleanPerAttrList); + + return attrRequest; + + } + + /** + * Validate stork authentication response. + * + * @param tokenSaml the token SAML + * @param userIP the user IP + * + * @return the Stork authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse validateSTORKAuthnResponse( + final byte[] tokenSaml, final String userIP) + throws STORKSAMLEngineException { + + LOG.info("validateSTORKAuthnResponse"); + final Response samlResponse = (Response) validateStorkSaml(tokenSaml); + + LOG.debug("Create StorkAuthResponse."); + final STORKAuthnResponse authnResponse = new STORKAuthnResponse(); + + authnResponse.setCountry(this.getCountry(samlResponse.getSignature() + .getKeyInfo())); + + LOG.debug("Set ID."); + authnResponse.setSamlId(samlResponse.getID()); + LOG.debug("Set InResponseTo."); + authnResponse.setInResponseTo(samlResponse.getInResponseTo()); + LOG.debug("Set statusCode."); + authnResponse.setStatusCode(samlResponse.getStatus().getStatusCode() + .getValue()); + + // Subordinate code. + if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { + authnResponse.setSubStatusCode(samlResponse.getStatus() + .getStatusCode().getStatusCode().getValue()); + } + + if (samlResponse.getStatus().getStatusMessage() != null) { + LOG.debug("Set statusMessage."); + authnResponse.setMessage(samlResponse.getStatus() + .getStatusMessage().getMessage()); + } + + LOG.debug("validateStorkResponse"); + final Assertion assertion = (Assertion) validateStorkResponse( + samlResponse, userIP); + + if(assertion!=null){ + final DateTime serverDate = new DateTime(); + + if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { + LOG.error("Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + ", server_date: " + serverDate + ")"); + throw new STORKSAMLEngineException( + "Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + " ), server_date: " + serverDate); + } + + LOG.debug("Set notOnOrAfter."); + authnResponse.setNotOnOrAfter(assertion.getConditions() + .getNotOnOrAfter()); + + LOG.debug("Set notBefore."); + authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + authnResponse.setAudienceRestriction(((AudienceRestriction) assertion + .getConditions().getAudienceRestrictions().get(0)) + .getAudiences().get(0).getAudienceURI()); + } + + // Case no error. + if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(authnResponse + .getStatusCode())) { + LOG.debug("Status Success. Set PersonalAttributeList."); + authnResponse + .setPersonalAttributeList(generatePersonalAttributeList(assertion)); + authnResponse.setFail(false); + } else { + LOG.debug("Status Fail."); + authnResponse.setFail(true); + } + LOG.debug("Return result."); + return authnResponse; + + } + + /** + * Validate stork attribute query response. + * + * @param tokenSaml the token SAML + * @param userIP the user IP + * + * @return the Stork attribute query response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse validateSTORKAttrQueryResponse( + final byte[] tokenSaml, final String userIP) + throws STORKSAMLEngineException { + + LOG.info("validateSTORKAttrQueryResponse"); + final Response samlResponse = (Response) validateStorkSaml(tokenSaml); + + LOG.debug("Create StorkAttrQueryResponse."); + final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); + + attrQueryResponse.setCountry(this.getCountry(samlResponse.getSignature() + .getKeyInfo())); + + LOG.debug("Set ID."); + attrQueryResponse.setSamlId(samlResponse.getID()); + LOG.debug("Set InResponseTo."); + attrQueryResponse.setInResponseTo(samlResponse.getInResponseTo()); + LOG.debug("Set statusCode."); + attrQueryResponse.setStatusCode(samlResponse.getStatus().getStatusCode() + .getValue()); + + // Subordinate code. + if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { + attrQueryResponse.setSubStatusCode(samlResponse.getStatus() + .getStatusCode().getStatusCode().getValue()); + } + + if (samlResponse.getStatus().getStatusMessage() != null) { + LOG.debug("Set statusMessage."); + attrQueryResponse.setMessage(samlResponse.getStatus() + .getStatusMessage().getMessage()); + } + + LOG.debug("validateStorkResponse"); + final Assertion assertion = (Assertion) validateStorkResponse( + samlResponse, userIP); + + if(assertion!=null){ + final DateTime serverDate = new DateTime(); + + if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { + LOG.error("Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + ", server_date: " + serverDate + ")"); + throw new STORKSAMLEngineException( + "Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + " ), server_date: " + serverDate); + } + + LOG.debug("Set notOnOrAfter."); + attrQueryResponse.setNotOnOrAfter(assertion.getConditions() + .getNotOnOrAfter()); + + LOG.debug("Set notBefore."); + attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + attrQueryResponse.setAudienceRestriction(((AudienceRestriction) assertion + .getConditions().getAudienceRestrictions().get(0)) + .getAudiences().get(0).getAudienceURI()); + } + + // Case no error. + if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(attrQueryResponse + .getStatusCode())) { + LOG.debug("Status Success. Set PersonalAttributeList."); + attrQueryResponse + .setPersonalAttributeList(generatePersonalAttributeList(assertion)); + attrQueryResponse.setFail(false); + } else { + LOG.debug("Status Fail."); + attrQueryResponse.setFail(true); + } + LOG.debug("Return result."); + return attrQueryResponse; + + } + + /** + * Validate stork response. + * + * @param samlResponse the SAML response + * @param userIP the user IP + * + * @return the assertion + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Assertion validateStorkResponse(final Response samlResponse, + final String userIP) throws STORKSAMLEngineException { + // Exist only one Assertion + + if (samlResponse.getAssertions() == null + || samlResponse.getAssertions().isEmpty()) { + LOG.info("Assertion is null or empty."); //in replace of throw new STORKSAMLEngineException("Assertion is null or empty.") + return null; + } + + final Assertion assertion = (Assertion) samlResponse.getAssertions() + .get(0); + + LOG.debug("Verified method Bearer"); + for (final Iterator iter = assertion.getSubject() + .getSubjectConfirmations().iterator(); iter.hasNext();) { + final SubjectConfirmation element = iter.next(); + final boolean isBearer = SubjectConfirmation.METHOD_BEARER + .equals(element.getMethod()); + + final boolean ipValidate = super.getSamlCoreProperties() + .isIpValidation(); + + if (ipValidate) { + if (isBearer) { + if (StringUtils.isBlank(userIP)) { + LOG.error("browser_ip is null or empty."); + throw new STORKSAMLEngineException( + "browser_ip is null or empty."); + } else if (StringUtils.isBlank(element + .getSubjectConfirmationData().getAddress())) { + LOG.error("token_ip attribute is null or empty."); + throw new STORKSAMLEngineException( + "token_ip attribute is null or empty."); + } + } + + final boolean ipEqual = element.getSubjectConfirmationData() + .getAddress().equals(userIP); + + // Validation ipUser + if (!ipEqual && ipValidate) { + LOG.error("SubjectConfirmation BEARER: "); + throw new STORKSAMLEngineException( + "IPs doesn't match : token_ip (" + + element.getSubjectConfirmationData() + .getAddress() + ") browser_ip (" + + userIP + ")"); + } + } + + } + return assertion; + } + + /** + * Validate stork SAML. + * + * @param tokenSaml the token SAML + * + * @return the signable SAML object + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private SignableSAMLObject validateStorkSaml(final byte[] tokenSaml) + throws STORKSAMLEngineException { + + LOG.info("Validate StorkSaml message."); + + if (tokenSaml == null) { + LOG.error("Saml authentication request is null."); + throw new STORKSAMLEngineException( + "Saml authentication request is null."); + } + + LOG.debug("Generate AuthnRequest from request."); + SignableSAMLObject samlObject; + + try { + samlObject = (SignableSAMLObject) super.unmarshall(tokenSaml); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException unmarshall.", e); + throw new STORKSAMLEngineException(e); + } + + boolean validateSign = true; + + if (StringUtils.isNotBlank(super.getSamlCoreProperties().getProperty( + "validateSignature"))) { + validateSign = Boolean.valueOf(super.getSamlCoreProperties() + .getProperty("validateSignature")); + } + + if (validateSign) { + LOG.debug("Validate Signature."); + try { + super.validateSignature(samlObject); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException validateSignature.", e); + throw new STORKSAMLEngineException(e); + } + } + + LOG.debug("Validate Schema."); + final ValidatorSuite validatorSuite = Configuration + .getValidatorSuite("saml2-core-schema-validator"); + try { + validatorSuite.validate(samlObject); + } catch (ValidationException e) { + LOG.error("ValidationException.", e); + throw new STORKSAMLEngineException(e); + } + + return samlObject; + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base new file mode 100644 index 000000000..e38cc5f0b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base @@ -0,0 +1,69 @@ +package eu.stork.peps.auth.engine; + +import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.jce.X509Principal; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Utility class used to decrease complexity of comparison of 2 X509principal + * + * @author vanegdi + * @version $Revision: 1.00 $, $Date: 2013-05-24 20:53:51 $ + */ +public final class X509PrincipalUtil{ + + private static final DERObjectIdentifier[] DER_OBJECT_IDENTIFIERS_ARRAY= { + X509Principal.CN, + X509Principal.OU, + X509Principal.O, + X509Principal.L, + X509Principal.ST, + X509Principal.C, + X509Principal.E + }; + + private static final Logger LOG = LoggerFactory.getLogger(eu.stork.peps.auth.engine.X509PrincipalUtil.class); + + /** + * Compares 2 X509Principals to detect if they equals + * @param principal1 + * @param principal2 + * @return true if arguments are not null and equals + */ + public static boolean equals(X509Principal principal1, X509Principal principal2) { + boolean continueProcess = true; + if (principal1 == null || principal2 == null){ + return false; + } + + int cpt = 0; + while(continueProcess && cpt < DER_OBJECT_IDENTIFIERS_ARRAY.length){ + continueProcess = continueProcess && x509ValuesByIdentifierEquals(principal1, principal2, DER_OBJECT_IDENTIFIERS_ARRAY[cpt]); + cpt++; + } + return continueProcess; + } + + public static boolean equals2(X509Principal principal1, X509Principal principal2) { + + if (principal1 == null || principal2 == null){ + return false; + } + + if (principal1.getName().equals(principal2.getName())) + return true; + else + return false; + + } + + private static boolean x509ValuesByIdentifierEquals(X509Principal principal1, X509Principal principal2, DERObjectIdentifier identifier){ + return principal1.getValues(identifier).equals(principal2.getValues(identifier)); + } + + private X509PrincipalUtil(){ + // default contructor + LOG.error("Fake X509PrincipalUtil : never be called"); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..d3e353e51 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes necessary to create a SAML message. + */ +package eu.stork.peps.auth.engine; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngine.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngine.class new file mode 100644 index 000000000..b9bec502f Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngine.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.class new file mode 100644 index 000000000..0b5531618 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.class new file mode 100644 index 000000000..cf63d0c5f Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.class new file mode 100644 index 000000000..7b5031ecc Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops new file mode 100644 index 000000000..5bda1b07b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops @@ -0,0 +1,119 @@ +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 110 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/package-info.java +END +CitizenCountryCode.java +K 25 +svn:wc:ra_dav:version-url +V 116 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.java +END +RequestedAttribute.java +K 25 +svn:wc:ra_dav:version-url +V 116 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.java +END +AuthenticationAttributes.java +K 25 +svn:wc:ra_dav:version-url +V 122 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java +END +QAAAttribute.java +K 25 +svn:wc:ra_dav:version-url +V 110 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.java +END +STORKSAMLCore.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.java +END +SPInformation.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPInformation.java +END +SPInstitution.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPInstitution.java +END +EIDCrossBorderShare.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java +END +SPID.java +K 25 +svn:wc:ra_dav:version-url +V 102 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPID.java +END +SPSector.java +K 25 +svn:wc:ra_dav:version-url +V 106 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPSector.java +END +EIDSectorShare.java +K 25 +svn:wc:ra_dav:version-url +V 112 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.java +END +SAMLCore.java +K 25 +svn:wc:ra_dav:version-url +V 106 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SAMLCore.java +END +SPApplication.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPApplication.java +END +SPCountry.java +K 25 +svn:wc:ra_dav:version-url +V 107 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPCountry.java +END +RequestedAttributes.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.java +END +VIDPAuthenticationAttributes.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.java +END +SAMLEngineSignI.java +K 25 +svn:wc:ra_dav:version-url +V 113 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.java +END +EIDCrossSectorShare.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.java +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/entries new file mode 100644 index 000000000..72f16fa28 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/entries @@ -0,0 +1,680 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +SPID.java +file + + + + +2013-12-20T12:27:57.446475Z +5befd7eed677372d2acb48b3f66e9f02 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1679 + +SPSector.java +file + + + + +2013-12-20T12:27:57.442475Z +00956c4124a9c9062fd408ab886d0a29 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1767 + +EIDSectorShare.java +file + + + + +2013-12-20T12:27:57.442475Z +4277603e70eeeea24e59449136fee007 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1788 + +SAMLCore.java +file + + + + +2013-12-20T12:27:57.442475Z +3ef05a16db7f280124687fbebbd0ca37 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2633 + +validator +dir + +SPApplication.java +file + + + + +2013-12-20T12:27:57.442475Z +97dc9337dfb28ca32ffb50a3b5329651 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1827 + +SPCountry.java +file + + + + +2013-12-20T12:27:57.442475Z +e955976114b4fa9dba61ebc3fdf3c267 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1779 + +RequestedAttributes.java +file + + + + +2013-12-20T12:27:57.442475Z +d93c2c38f6dec952d22f60827b24ee9e +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1652 + +VIDPAuthenticationAttributes.java +file + + + + +2013-12-20T12:27:57.442475Z +b3a8f3746ce11111d80d9e942339a54e +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2224 + +SAMLEngineSignI.java +file + + + + +2013-12-20T12:27:57.442475Z +fb834797256e1ed6873be19ebe860092 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2429 + +EIDCrossSectorShare.java +file + + + + +2013-12-20T12:27:57.442475Z +a693707c2bb3a43e62d8e3ed20e8844d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1856 + +impl +dir + +package-info.java +file + + + + +2013-12-20T12:27:57.446475Z +34cf10993955447fa31dd616aa4978c9 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +808 + +CitizenCountryCode.java +file + + + + +2013-12-20T12:27:57.442475Z +a741f6d7c36860e65f64186ef5cd8610 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1817 + +RequestedAttribute.java +file + + + + +2013-12-20T12:27:57.446475Z +9707a0f5bdad6888a2e021182f80b245 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3828 + +QAAAttribute.java +file + + + + +2013-12-20T12:27:57.446475Z +f0d7a0516989582d342d5ce2a3f08c9d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1917 + +AuthenticationAttributes.java +file + + + + +2013-12-20T12:27:57.446475Z +86b9b4aebe1ca7ca90ce818785374ea7 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1948 + +SPInformation.java +file + + + + +2013-12-20T12:27:57.446475Z +0159e00cdec105564bb6ac394355533b +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1705 + +STORKSAMLCore.java +file + + + + +2013-12-20T12:27:57.446475Z +0e02e7a4c0f208fd5f05191fca5ba91a +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +14229 + +SPInstitution.java +file + + + + +2013-12-20T12:27:57.446475Z +21eda2ef1cb604ce4f952fc608e7772f +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1833 + +EIDCrossBorderShare.java +file + + + + +2013-12-20T12:27:57.446475Z +17d390896e4f96f24df0da4ec83321ec +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1861 + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base new file mode 100644 index 000000000..07157073c --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base @@ -0,0 +1,57 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface AuthenticationAttributes. + * @author fjquevedo + */ +public interface AuthenticationAttributes extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "AuthenticationAttributes"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "AuthenticationAttributesType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the citizen country code. + * + * @return the citizen country code + */ + VIDPAuthenticationAttributes getVIDPAuthenticationAttributes(); + + + /** + * Sets the vIDP authentication attributes. + * + * @param newVIDPAuthenticationAttr the new vIDP authentication attributes + */ + void setVIDPAuthenticationAttributes(VIDPAuthenticationAttributes newVIDPAuthenticationAttr); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base new file mode 100644 index 000000000..859d37feb --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author fjquevedo + */ +public interface CitizenCountryCode extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "CitizenCountryCode"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "CitizenCountryCodeType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the SP country. + * + * @return the sP country + */ + String getCitizenCountryCode(); + + + /** + * Sets the citizen country code. + * + * @param citizenCountryCode the new citizen country code + */ + void setCitizenCountryCode(String citizenCountryCode); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base new file mode 100644 index 000000000..c892eae78 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base @@ -0,0 +1,58 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author fjquevedo + */ +public interface EIDCrossBorderShare extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "eIDCrossBorderShare"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "eIDCrossBorderShareType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the eID cross border share. + * + * @return the eID cross border share + */ + String getEIDCrossBorderShare(); + + + /** + * Sets the eID cross border share. + * + * @param eIDCrossBorderShare the new eID cross border share + */ + void setEIDCrossBorderShare(String eIDCrossBorderShare); + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base new file mode 100644 index 000000000..f879914f9 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossSectorShare. + * @author fjquevedo + */ +public interface EIDCrossSectorShare extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String ELEM_LOCAL_NAME = "eIDCrossSectorShare"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), ELEM_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "eIDCrossSectorShareType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the eID cross sector share. + * + * @return the eID cross sector share + */ + String getEIDCrossSectorShare(); + + /** + * Sets the eID cross sector share. + * + * @param eIDCrossSectorShare the new eID cross sector share + */ + void setEIDCrossSectorShare(String eIDCrossSectorShare); + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base new file mode 100644 index 000000000..dc88f3318 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base @@ -0,0 +1,57 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDSectorShare. + * @author fjquevedo + */ +public interface EIDSectorShare extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "eIDSectorShare"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "eIDSectorShare"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the eID sector share. + * + * @return the eID sector share + */ + String getEIDSectorShare(); + + /** + * Sets the eID sector share. + * + * @param eIDSectorShare the new eID sector share + */ + void setEIDSectorShare(String eIDSectorShare); + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base new file mode 100644 index 000000000..2c09cf85b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base @@ -0,0 +1,63 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * STORK Quality Authentication Assurance Level Attribute Interface. + * + * @author fjquevedo + */ +public interface QAAAttribute extends SAMLObject { + + /** Element local name. */ + String DEF_LOCAL_NAME = "QualityAuthenticationAssuranceLevel"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "QualityAuthenticationAssuranceLevelAbstractType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The minimum value allowed. */ + int MIN_VALUE = 1; + + /** The Max value allowed. */ + int MAX_VALUE = 4; + + /** + * Gets the qAA level. + * + * @return the qAA level + */ + String getQaaLevel(); + + /** + * Sets the qAA level. + * + * @param qaaLevel the new qAA level + * + */ + void setQaaLevel(String qaaLevel); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base new file mode 100644 index 000000000..02be9e104 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base @@ -0,0 +1,140 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; +import org.opensaml.xml.AttributeExtensibleXMLObject; +import org.opensaml.xml.schema.XSBooleanValue; +import org.opensaml.xml.XMLObject; + +/** + * The Interface RequestedAttribute. + * + * @author fjquevedo + */ +public interface RequestedAttribute extends SAMLObject, + AttributeExtensibleXMLObject { + + /** Element local name. */ + String DEF_LOCAL_NAME = "RequestedAttribute"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "RequestedAttributeAbstractType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** NAME_ATTRIB_NAME attribute name. */ + String NAME_ATTRIB_NAME = "Name"; + + /** NAME_FORMAT_ATTRIB_NAME attribute name. */ + String NAME_FORMAT_ATTR = "NameFormat"; + + /** IS_REQUIRED_ATTRIB_NAME attribute name. */ + String IS_REQUIRED_ATTR = "isRequired"; + + /** FRIENDLY_NAME_ATTRIB_NAME attribute name. */ + String FRIENDLY_NAME_ATT = "FriendlyName"; + + /** Unspecified attribute format ID. */ + String UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"; + + /** URI reference attribute format ID. */ + String URI_REFERENCE = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"; + + /** Basic attribute format ID. */ + String BASIC = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"; + + /** + * Gets the name. + * + * @return the name + */ + String getName(); + + /** + * Sets the name. + * + * @param name the new name + */ + void setName(String name); + + /** + * Gets the name format. + * + * @return the name format + */ + String getNameFormat(); + + /** + * Sets the name format. + * + * @param nameFormat the new name format + */ + void setNameFormat(String nameFormat); + + /** + * Gets the friendly name. + * + * @return the friendly name + */ + String getFriendlyName(); + + /** + * Sets the friendly name. + * + * @param friendlyName the new friendly name + */ + void setFriendlyName(String friendlyName); + + /** + * Gets the checks if is required. + * + * @return the checks if is required + */ + String isRequired(); + + /** + * Gets the checks if is required xs boolean. + * + * @return the checks if is required xs boolean + */ + String getIsRequiredXSBoolean(); + + /** + * Sets the checks if is required. + * + * @param newIsRequired the new checks if is required + */ + void setIsRequired(String newIsRequired); + + /** + * Gets the attribute values. + * + * @return the attribute values + */ + List getAttributeValues(); + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base new file mode 100644 index 000000000..9004b10f4 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface RequestedAttributes. + * + * @author fjquevedo + */ +public interface RequestedAttributes extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "RequestedAttributes"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "RequestedAttributesType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the attributes. + * + * @return the attributes + */ + List getAttributes(); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base new file mode 100644 index 000000000..e511bbaeb --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base @@ -0,0 +1,98 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +/** + * The Enumeration SAMLCore. + * + * @author fjquevedo + */ + +public enum SAMLCore { + + /** The consent authentication request. */ + CONSENT_AUTHN_REQ("consentAuthnRequest"), + + /** The consent authentication response. */ + CONSENT_AUTHN_RES("consentAuthnResponse"), + + /** The FORC e_ auth n_ tag. */ + FORCE_AUTHN_TAG("forceAuthN"), + + /** The I s_ passiv e_ tag. */ + IS_PASSIVE_TAG("isPassive"), + + /** The FORMA t_ entity. */ + FORMAT_ENTITY("formatEntity"), + + /** The FRIENDLY name. */ + FRIENDLY_NAME("friendlyName"), + + /** The IS_REQUIRED AN ATTRIBUTE */ + IS_REQUIRED("isRequired"), + + /** The PRO t_ bindin g_ tag. */ + PROT_BINDING_TAG("protocolBinding"), + + /** The ASSER t_ con s_ tag. */ + ASSERT_CONS_TAG("assertionConsumerServiceURL"), + + /** The REQUESTE r_ tag. */ + REQUESTER_TAG("requester"), + + /** The RESPONDE r_ tag. */ + RESPONDER_TAG("responder"), + + /** The STOR k10_ ns. */ + STORK10_NS("urn:eu:stork:names:tc:STORK:1.0:assertion"), + + /** The STOR k10 p_ ns. */ + STORK10P_NS("urn:eu:stork:names:tc:STORK:1.0:protocol"), + + /** The STOR k10_ prefix. */ + STORK10_PREFIX("stork"), + + /** The STOR k10 p_ prefix. */ + STORK10P_PREFIX("storkp"), + + /** The STOR k10_ bas e_ uri. */ + STORK10_BASE_URI("http://www.stork.gov.eu/1.0/"), + + /** The ON e_ tim e_ use. */ + ONE_TIME_USE("oneTimeUse"); + + /** The value. */ + private String value; + + /** + * Instantiates a new sAML core. + * + * @param fullName the full name + */ + private SAMLCore(final String fullName) { + this.value = fullName; + } + + /** + * Gets the value. + * + * @return the value + */ + public String getValue() { + return value; + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base new file mode 100644 index 000000000..b382646be --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base @@ -0,0 +1,88 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.security.KeyStore; +import java.security.cert.X509Certificate; + +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; + +import eu.stork.peps.exceptions.SAMLEngineException; + +/** + * The Interface SAMLEngineSignI. + * + * @author fjquevedo + */ +public interface SAMLEngineSignI { + + /** + * Sign. + * + * @param tokenSaml the token SAML + * + * @return the sAML object + * + * @throws SAMLEngineException the SAML engine exception + */ + SAMLObject sign(SignableSAMLObject tokenSaml) throws SAMLEngineException; + + /** + * Gets the certificate. + * + * @return the certificate + */ + X509Certificate getCertificate(); + + /** + * Gets the trustStore used when validating SAMLTokens + * + * @return the trustStore + * + */ + KeyStore getTrustStore(); + + /** + * Validate signature. + * + * @param tokenSaml the token SAML + * + * @return the sAML object + * + * @throws SAMLEngineException the SAML engine exception + */ + SAMLObject validateSignature(SignableSAMLObject tokenSaml) + throws SAMLEngineException; + + /** + * Initialize the signature module. + * + * @param fileConf the configuration file. + * + * @throws SAMLEngineException the STORKSAML engine runtime + * exception + */ + void init(String fileConf) throws SAMLEngineException; + + /** + * Load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + */ + void loadCryptServiceProvider() throws SAMLEngineException; + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base new file mode 100644 index 000000000..9ace6d37c --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface SPApplication. + * + * @author fjquevedo + */ +public interface SPApplication extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spApplication"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spApplicationType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider application. + * + * @return the service provider application + */ + String getSPApplication(); + + /** + * Sets the service provider application. + * + * @param spApplication the new service provider application + */ + void setSPApplication(String spApplication); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base new file mode 100644 index 000000000..569ea48c2 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface SPCountry. + * + * @author fjquevedo + */ +public interface SPCountry extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spCountry"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spCountryType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider country. + * + * @return the service provider country + */ + String getSPCountry(); + + /** + * Sets the service provider country. + * + * @param spCountry the new service provider country + */ + void setSPCountry(String spCountry); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base new file mode 100644 index 000000000..c0cf02ad0 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author iinigo + */ +public interface SPID extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "SPID"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "SPIDType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the SP ID. + * + * @return the SP ID + */ + String getSPID(); + + + /** + * Sets the SP ID. + * + * @param SPID the new SP ID + */ + void setSPID(String newSPID); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base new file mode 100644 index 000000000..34ba9c9c5 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author iinigo + */ +public interface SPInformation extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "SPInformation"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "SPInformationType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the SP Id. + * + * @return the SP Id + */ + SPID getSPID(); + + + /** + * Sets the SP Id. + * + * @param newSPId the new SP Id + */ + void setSPID(SPID newSPID); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base new file mode 100644 index 000000000..33dad474b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * + * @author fjquevedo + */ +public interface SPInstitution extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spInstitution"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spInstitutionType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider institution. + * + * @return the service provider institution + */ + String getSPInstitution(); + + /** + * Sets the service provider institution. + * + * @param spInstitution the new service provider institution + */ + void setSPInstitution(String spInstitution); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base new file mode 100644 index 000000000..1f49a4015 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface SPSector. + * + * @author fjquevedo + */ +public interface SPSector extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spSector"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spSectorType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider sector. + * + * @return the service provider sector + */ + String getSPSector(); + + /** + * Sets the service provider sector. + * + * @param spSector the new service provider sector + */ + void setSPSector(String spSector); +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base new file mode 100644 index 000000000..19c71dd74 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base @@ -0,0 +1,508 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.NameIDType; +import org.opensaml.saml2.core.RequestAbstractType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class SAMLCore. + * + * @author fjquevedo + */ +public final class STORKSAMLCore { + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(STORKSAMLCore.class.getName()); + + /** The consent authentication request. */ + private String consentAuthnReq = null; + + /** The consent authentication response. */ + private String consentAuthnResp = null; + + /** The id cross border share. */ + private String eIDCrossBordShare = null; + + /** The e id cross sect share. */ + private String eIDCrossSectShare = null; + + /** The e id sector share. */ + private String eIDSectorShare = null; + + /** The format entity. */ + private String formatEntity = null; + + /** The friendly name. */ + private boolean friendlyName = false; + + /** The IP validation. */ + private boolean ipValidation = false; + + /** The one time use. */ + private boolean oneTimeUse = true; + + /** The protocol binding. */ + private String protocolBinding = null; + + /** The requester. */ + private String requester = null; + + + /** The responder. */ + private String responder = null; + + /** The SAML core properties. */ + private Properties samlCoreProp = null; + + /** The time not on or after. */ + private Integer timeNotOnOrAfter = null; + + /** The is required parameter. */ + private boolean isRequired = true; + + private static final String SAML_ENGINE_LITERAL = "SamlEngine.xml: "; + + /** + * Gets the isRequired. + * + * @return the isRequired + */ + public boolean isRequired() { + return isRequired; + } + + /** + * Sets the isRequired. + * + * @param isRequired the required. + */ + public void setRequired(boolean isRequired) { + this.isRequired = isRequired; + } + + /** + * Instantiates a new sAML core. + * + * @param instance the instance + */ + public STORKSAMLCore(final Properties instance) { + loadConfiguration(instance); + } + + /** + * Gets the consent. + * + * @return the consent + */ + public String getConsentAuthnRequest() { + return consentAuthnReq; + } + + /** + * Gets the consent authentication response. + * + * @return the consent authentication response. + */ + public String getConsentAuthnResp() { + return consentAuthnResp; + } + + /** + * Gets the consent authentication response. + * + * @return the consent authentication response + */ + public String getConsentAuthnResponse() { + return consentAuthnResp; + } + + /** + * Gets the format entity. + * + * @return the format entity + */ + public String getFormatEntity() { + return formatEntity; + } + + /** + * Gets the property. + * + * @param key the key + * + * @return the property + */ + public String getProperty(final String key) { + return samlCoreProp.getProperty(key); + } + + /** + * Gets the protocol binding. + * + * @return the protocol binding + */ + public String getProtocolBinding() { + return protocolBinding; + } + + /** + * Gets the requester. + * + * @return the requester + */ + public String getRequester() { + return requester; + } + + /** + * Gets the responder. + * + * @return the responder + */ + public String getResponder() { + return responder; + } + + /** + * Gets the time not on or after. + * + * @return the time not on or after + */ + public Integer getTimeNotOnOrAfter() { + return timeNotOnOrAfter; + } + + /** + * Checks if is e id cross border share. + * + * @return true, if is e id cross border share + */ + public String iseIDCrossBorderShare() { + return eIDCrossBordShare; + } + + /** + * Checks if is e id cross border share. + * + * @return true, if is e id cross border share + */ + public String iseIDCrossBordShare() { + return eIDCrossBordShare; + } + + /** + * Checks if is e id cross sector share. + * + * @return true, if is e id cross sector share + */ + public String iseIDCrossSectorShare() { + return eIDCrossSectShare; + } + + /** + * Checks if is e id cross sect share. + * + * @return true, if is e id cross sect share + */ + public String iseIDCrossSectShare() { + return eIDCrossSectShare; + } + + /** + * Checks if is e id sector share. + * + * @return true, if is e id sector share + */ + public String iseIDSectorShare() { + return eIDSectorShare; + } + + /** + * Checks if is friendly name. + * + * @return true, if checks if is friendly name + */ + public boolean isFriendlyName() { + return friendlyName; + } + + /** + * Checks if is IP validation. + * + * @return true, if is IP validation + */ + public boolean isIpValidation() { + return ipValidation; + } + + /** + * Checks if is one time use. + * + * @return true, if is one time use + */ + public boolean isOneTimeUse() { + return oneTimeUse; + } + + /** + * Method that loads the configuration file for the SAML Engine. + * + * @param instance the instance of the Engine properties. + */ + private void loadConfiguration(final Properties instance) { + + try { + LOGGER.info("SAMLCore: Loading SAMLEngine properties."); + + samlCoreProp = instance; + + final String parameter = samlCoreProp + .getProperty(SAMLCore.FORMAT_ENTITY.getValue()); + + if ("entity".equalsIgnoreCase(parameter)) { + formatEntity = NameIDType.ENTITY; + } + + friendlyName = Boolean.valueOf(samlCoreProp + .getProperty(SAMLCore.FRIENDLY_NAME.getValue())); + + String isRequiredValue = samlCoreProp. + getProperty(SAMLCore.IS_REQUIRED.getValue()); + if (isRequiredValue != null) { + isRequired = Boolean.valueOf(isRequiredValue); + } + + eIDSectorShare = samlCoreProp + .getProperty("eIDSectorShare"); + eIDCrossSectShare = samlCoreProp + .getProperty("eIDCrossSectorShare"); + eIDCrossBordShare = samlCoreProp + .getProperty("eIDCrossBorderShare"); + + ipValidation = Boolean.valueOf(samlCoreProp + .getProperty("ipAddrValidation")); + + final String oneTimeUseProp = samlCoreProp + .getProperty(SAMLCore.ONE_TIME_USE.getValue()); + + if (StringUtils.isNotBlank(oneTimeUseProp)) { + oneTimeUse = Boolean.valueOf(oneTimeUseProp); + } + + // Protocol Binding + loadProtocolBiding(); + + // Consent Authentication Request + consentAuthnReq = samlCoreProp + .getProperty(SAMLCore.CONSENT_AUTHN_REQ.getValue()); + + if ("unspecified".equalsIgnoreCase(consentAuthnReq)) { + consentAuthnReq = RequestAbstractType.UNSPECIFIED_CONSENT; + } + + loadConsentAuthResp(); + + timeNotOnOrAfter = Integer.valueOf(samlCoreProp + .getProperty("timeNotOnOrAfter")); + + if (timeNotOnOrAfter.intValue() < 0) { + LOGGER.error(SAML_ENGINE_LITERAL + "timeNotOnOrAfter" + + " is negative number."); + + throw new SAMLEngineException(SAML_ENGINE_LITERAL + + "timeNotOnOrAfter" + " is negative number."); + } + + requester = samlCoreProp.getProperty(SAMLCore.REQUESTER_TAG.getValue()); + responder = samlCoreProp.getProperty(SAMLCore.RESPONDER_TAG.getValue()); + + } catch (SAMLEngineException e) { + LOGGER.error("SAMLCore: error loadConfiguration. ", e); + throw new STORKSAMLEngineRuntimeException(e); + } catch (RuntimeException e) { + LOGGER.error("SAMLCore: error loadConfiguration. ", e); + throw new STORKSAMLEngineRuntimeException(e); + } + } + + /** + * Load consent authentication response. + */ + private void loadConsentAuthResp() { + // Consent Authentication Response + consentAuthnResp = samlCoreProp + .getProperty(SAMLCore.CONSENT_AUTHN_RES.getValue()); + + if ("obtained".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = RequestAbstractType.OBTAINED_CONSENT; + } else if ("prior".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = RequestAbstractType.PRIOR_CONSENT; + } else if ("curent-implicit".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = + "urn:oasis:names:tc:SAML:2.0:consent:current-implicit"; + } else if ("curent-explicit".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = + "urn:oasis:names:tc:SAML:2.0:consent:current-explicit"; + } else if ("unspecified".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = RequestAbstractType.UNSPECIFIED_CONSENT; + } + } + + /** + * Load protocol biding. + * + * @throws SAMLEngineException the SAML engine exception + */ + private void loadProtocolBiding() throws SAMLEngineException { + // Protocol Binding + protocolBinding = samlCoreProp.getProperty(SAMLCore.PROT_BINDING_TAG.getValue()); + + if (StringUtils.isBlank(protocolBinding)) { + LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG + + " it's mandatory."); + throw new SAMLEngineException(SAML_ENGINE_LITERAL + + SAMLCore.PROT_BINDING_TAG + " it's mandatory."); + } else if (protocolBinding.equalsIgnoreCase("HTTP-POST")) { + protocolBinding = SAMLConstants.SAML2_POST_BINDING_URI; + } else { + LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG + + " it's not supporting."); + + throw new SAMLEngineException(SAML_ENGINE_LITERAL + + SAMLCore.PROT_BINDING_TAG + " it's not supporting."); + } + } + + /** + * Sets the consent authentication response. + * + * @param newConsAuthnResp the new consent authentication response + */ + public void setConsentAuthnResp(final String newConsAuthnResp) { + this.consentAuthnResp = newConsAuthnResp; + } + + /** + * Sets an eID that can be shared outside of the Service Provider’s member state. + * + * @param newEIDCrossBord the new eid cross border share + */ + public void setEIDCrossBordShare(final String newEIDCrossBord) { + this.eIDCrossBordShare = newEIDCrossBord; + } + + /** + * Sets an eID that can be shared outside of the Service Provider’s sector. + * + * @param newEIDCrossSect the new eid cross sect share + */ + public void setEIDCrossSectShare(final String newEIDCrossSect) { + this.eIDCrossSectShare = newEIDCrossSect; + } + + /** + * Sets an eID that can be shared within the Service Provider’s sector. + * + * @param newEIDSectorShare the new eid sector share + */ + public void seteIDSectorShare(final String newEIDSectorShare) { + this.eIDSectorShare = newEIDSectorShare; + } + + /** + * Sets the format entity. + * + * @param newFormatEntity the new format entity + */ + public void setFormatEntity(final String newFormatEntity) { + this.formatEntity = newFormatEntity; + } + + /** + * Sets the friendly name. + * + * @param newFriendlyName the new friendly name + */ + public void setFriendlyName(final boolean newFriendlyName) { + this.friendlyName = newFriendlyName; + } + + /** + * Sets the IP validation. + * + * @param newIpValidation the new IP validation + */ + public void setIpValidation(final boolean newIpValidation) { + this.ipValidation = newIpValidation; + } + + /** + * Sets the one time use. + * + * @param newOneTimeUse the new one time use + */ + public void setOneTimeUse(final boolean newOneTimeUse) { + this.oneTimeUse = newOneTimeUse; + } + + /** + * Sets the protocol binding. + * + * @param newProtBinding the new protocol binding + */ + public void setProtocolBinding(final String newProtBinding) { + this.protocolBinding = newProtBinding; + } + + /** + * Sets the requester. + * + * @param newRequester the new requester + */ + public void setRequester(final String newRequester) { + this.requester = newRequester; + } + + /** + * Sets the responder. + * + * @param newResponder the new responder + */ + public void setResponder(final String newResponder) { + this.responder = newResponder; + } + + /** + * Sets the time not on or after. + * + * @param newTimeNotOnOrAft the new time not on or after + */ + public void setTimeNotOnOrAfter(final Integer newTimeNotOnOrAft) { + this.timeNotOnOrAfter = newTimeNotOnOrAft; + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base new file mode 100644 index 000000000..3f812393e --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base @@ -0,0 +1,72 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface VIDPAuthenticationAttributes. + * + * @author fjquevedo + */ +public interface VIDPAuthenticationAttributes extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "VIDPAuthenticationAttributes"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "VIDPAuthenticationAttributesType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the citizen country code. + * + * @return the citizen country code + */ + CitizenCountryCode getCitizenCountryCode(); + + /** + * Sets the citizen country code. + * + * @param newCitizenCountryCode the new citizen country code + */ + void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode); + + /** + * Gets the SP information + * + * @return the SP information + */ + SPInformation getSPInformation(); + + /** + * Sets the SP information + * + * @param newSPInformation the new SPInformation + */ + void setSPInformation(SPInformation newSPInformation); + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..3393dcf78 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Interfaces for STORK 1.0 core specification types and elements. + */ +package eu.stork.peps.auth.engine.core; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.class new file mode 100644 index 000000000..7ab792ba7 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.class new file mode 100644 index 000000000..beeb81ab1 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.class new file mode 100644 index 000000000..616d6fb8e Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.class new file mode 100644 index 000000000..cc59003d2 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.class new file mode 100644 index 000000000..31f4eb7f4 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.class new file mode 100644 index 000000000..3482ee661 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.class new file mode 100644 index 000000000..55581e6dc Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.class new file mode 100644 index 000000000..2eac3dcd3 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLCore.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLCore.class new file mode 100644 index 000000000..512b52614 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLCore.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.class new file mode 100644 index 000000000..37ab6c686 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPApplication.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPApplication.class new file mode 100644 index 000000000..c823866bc Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPApplication.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPCountry.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPCountry.class new file mode 100644 index 000000000..d3314a424 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPCountry.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPID.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPID.class new file mode 100644 index 000000000..5db4d67b0 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPID.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInformation.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInformation.class new file mode 100644 index 000000000..183983a58 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInformation.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInstitution.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInstitution.class new file mode 100644 index 000000000..e50ab4392 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInstitution.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPSector.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPSector.class new file mode 100644 index 000000000..591acbe39 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPSector.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.class new file mode 100644 index 000000000..623ea5822 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.class new file mode 100644 index 000000000..77ce2f041 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops new file mode 100644 index 000000000..7eb0de6e7 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops @@ -0,0 +1,395 @@ +K 25 +svn:wc:ra_dav:version-url +V 97 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl +END +RequestedAttributeImpl.java +K 25 +svn:wc:ra_dav:version-url +V 125 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.java +END +EIDCrossBorderShareMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 132 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.java +END +SPIDMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.java +END +SPInformationImpl.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.java +END +SPInstitutionUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.java +END +EIDSectorShareBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 124 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.java +END +SPCountryBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.java +END +EIDCrossBorderShareImpl.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.java +END +EIDSectorShareUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.java +END +RequestedAttributesMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 132 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.java +END +RequestedAttributesImpl.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.java +END +SignHW.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java +END +QAAAttributeUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 127 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.java +END +SPInstitutionMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.java +END +SPIDUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.java +END +SPInstitutionImpl.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.java +END +EIDSectorShareMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 127 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.java +END +SPSectorUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.java +END +VIDPAuthenticationAttributesBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 138 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 115 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/package-info.java +END +VIDPAuthenticationAttributesMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 141 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.java +END +SPApplicationUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.java +END +EIDSectorShareImpl.java +K 25 +svn:wc:ra_dav:version-url +V 121 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.java +END +CitizenCountryCodeBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.java +END +EIDCrossSectorShareUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 134 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.java +END +RequestedAttributeBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.java +END +SignModuleFactory.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.java +END +RequestedAttributeMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 131 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.java +END +QAAAttributeMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 125 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.java +END +CitizenCountryCodeUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 133 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.java +END +AuthenticationAttributesUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 139 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java +END +SPIDBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.java +END +QAAAttributeImpl.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.java +END +SPSectorMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 121 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.java +END +SPApplicationMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.java +END +SPIDImpl.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.java +END +SPCountryUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 124 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.java +END +SPSectorImpl.java +K 25 +svn:wc:ra_dav:version-url +V 115 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.java +END +VIDPAuthenticationAttributesUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 143 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.java +END +SPApplicationImpl.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.java +END +EIDCrossSectorShareMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 132 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.java +END +QAAAttributeBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 122 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.java +END +CitizenCountryCodeMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 131 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.java +END +SPInformationBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.java +END +EIDCrossSectorShareImpl.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.java +END +AuthenticationAttributesMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 137 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.java +END +EIDCrossBorderShareBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java +END +RequestedAttributeUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 133 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.java +END +SPInformationUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.java +END +CitizenCountryCodeImpl.java +K 25 +svn:wc:ra_dav:version-url +V 125 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.java +END +AuthenticationAttributesImpl.java +K 25 +svn:wc:ra_dav:version-url +V 131 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.java +END +SPSectorBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 118 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.java +END +EIDCrossBorderShareUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 134 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.java +END +SignSW.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java +END +SPApplicationBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.java +END +RequestedAttributesBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.java +END +SPCountryMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 122 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.java +END +SignP12.java +K 25 +svn:wc:ra_dav:version-url +V 110 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java +END +EIDCrossSectorShareBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.java +END +RequestedAttributesUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 134 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.java +END +SPCountryImpl.java +K 25 +svn:wc:ra_dav:version-url +V 116 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.java +END +VIDPAuthenticationAttributesImpl.java +K 25 +svn:wc:ra_dav:version-url +V 135 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.java +END +AuthenticationAttributesBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 134 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java +END +SPInformationMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.java +END +SPInstitutionBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.java +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries new file mode 100644 index 000000000..1c6a5c2a8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries @@ -0,0 +1,2238 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +VIDPAuthenticationAttributesUnmarshaller.java +file + + + + +2013-12-20T12:27:57.414475Z +379336b4e33025428a27f1cec8b44056 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2104 + +RequestedAttributesImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +27cbdb6010cc87d0da987d980e933181 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2964 + +CitizenCountryCodeMarshaller.java +file + + + + +2013-12-20T12:27:57.418475Z +d5237a27554ddbe26fd86e0b10800274 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1655 + +SPInformationBuilder.java +file + + + + +2013-12-20T12:27:57.414475Z +225f5a1c91da42fbcd3a0cb68318b32c +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1477 + +AuthenticationAttributesMarshaller.java +file + + + + +2013-12-20T12:27:57.418475Z +7c4410da9e4b223a39e8cfe7fe8baca8 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +986 + +EIDCrossBorderShareBuilder.java +file + + + + +2013-12-20T12:27:57.418475Z +87ddac844ca24e090fd90e8cd258c462 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1682 + +RequestedAttributeUnmarshaller.java +file + + + + +2013-12-20T12:27:57.418475Z +757de668eb8faac10e3d467a6fb75d8b +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3435 + +CitizenCountryCodeImpl.java +file + + + + +2013-12-20T12:27:57.418475Z +e823785bbced34f6d08bea9998975575 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2642 + +SPInstitutionMarshaller.java +file + + + + +2013-12-20T12:27:57.418475Z +cc15a0beeb86be9ca8ee405fb46e2bdb +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1627 + +AuthenticationAttributesImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +fa84458a078738803e160f1fd3ff6210 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3348 + +SignSW.java +file + + + + +2013-12-20T12:27:57.422475Z +1f905fe296e2dfb66e02ea925d3a7761 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +14730 + +SPApplicationBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +03f6145382be5dc9dbf50a09172d40ba +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1638 + +SPInstitutionImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +debba0c2baa76483e40e62a5de0e1123 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2618 + +RequestedAttributesBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +8516fe8723cb2405475a0fca0909e338 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1729 + +VIDPAuthenticationAttributesBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +60bafffa1fb9223231f49a0c12109ccd +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1607 + +SPApplicationUnmarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +143466710186caf840584c038fc365d4 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1408 + +EIDCrossSectorShareBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +95a940a01539d754a0f2d5fbc58dced2 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1746 + +VIDPAuthenticationAttributesImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +71986c6390a88c027fb622f342dda7dd +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3928 + +CitizenCountryCodeBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +d6adb4dcf3f02a2115e03e197f71e7d0 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1661 + +EIDCrossSectorShareUnmarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +8b7d6524324bf334695470c97a5ae8e9 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1636 + +RequestedAttributeBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +8e01d40d3d5d57e76e68335c4dfa33fd +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1719 + +SignModuleFactory.java +file + + + + +2013-12-20T12:27:57.422475Z +ca27edd3b64fe3994d694668441242c0 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1904 + +SPInstitutionBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +c154c661d7cf09d5deeb12ddf66b69a1 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1652 + +SPIDBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +081af3337ceb54c3a8e8c3fdbdd07757 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1531 + +RequestedAttributeImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +2b0a40b8c2b3640929adb2c1500ecfa8 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +5576 + +SPIDMarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +1f25673e4ed1a76ed9763d06e73942bf +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1549 + +SPCountryBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +a6e6d09f79e112c96d03f1dff4506843 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1627 + +SPApplicationMarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +d3053090b75974af918b25e32b3c16cb +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1627 + +EIDSectorShareUnmarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +e003885ad4f424b731178f3de53a9934 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1596 + +SPCountryUnmarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +e01b8f80dbcec3c100d563b8da6c206d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1376 + +SPApplicationImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +0df0bd3dc6acdf706be767ba9e5ca6fc +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2617 + +EIDCrossSectorShareMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +e80eee7bbdb571f5a481ea66fc6b047d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1687 + +QAAAttributeBuilder.java +file + + + + +2013-12-20T12:27:57.426475Z +965b74882dfafe06f391804601049c48 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1653 + +SignHW.java +file + + + + +2013-12-20T12:27:57.426475Z +7896afe7f189a7db5835e120aa6b6037 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +13749 + +EIDCrossSectorShareImpl.java +file + + + + +2013-12-20T12:27:57.426475Z +08ad1682d1f146a114625a1dc1626f6c +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2703 + +QAAAttributeUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +b5eede63027f8b9638f905d3e905046f +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1387 + +SPInformationUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +b504aef9588b7817e1e1d37fd157076e +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1775 + +SPSectorBuilder.java +file + + + + +2013-12-20T12:27:57.426475Z +4725ddc6ef146afbe0a3cca1a97a0102 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1606 + +EIDCrossBorderShareUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +c7cd8600b386369e011a2a7f4c5f0d9c +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1472 + +SPIDUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +7090a9ec17d610025260f1af3495044d +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1332 + +EIDSectorShareMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +ded11a8620d93cbb7fe703385583827a +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1712 + +SPSectorUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +16ec587f7357a4896411cc80a10f6523 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1372 + +SPCountryMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +f03343df1d204b3f461c7a54a1e6ed35 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1592 + +SignP12.java +file + + + + +2013-12-20T12:27:57.426475Z +2d6ec5552f62f50e8eb579e11def48f7 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +15576 + +package-info.java +file + + + + +2013-12-20T12:27:57.426475Z +76a0f72a61ed971b95da33c1c8b8aa69 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +817 + +VIDPAuthenticationAttributesMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +c099f28cf58fbc0f1db727b22f3a0d5a +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1120 + +RequestedAttributesUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +d18788d30b80c2a020dded672c9d937d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1844 + +EIDSectorShareImpl.java +file + + + + +2013-12-20T12:27:57.426475Z +eb771b1a638ae3751a0f90b187748495 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2622 + +SPCountryImpl.java +file + + + + +2013-12-20T12:27:57.426475Z +a2ddffd67762f74d21509471a2e1663c +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2528 + +AuthenticationAttributesBuilder.java +file + + + + +2013-12-20T12:27:57.426475Z +99840afca17ae5400257a49dd15c3d4f +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1792 + +RequestedAttributeMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +f4b4ab1af9ecd9aaf7230786ab73f6d7 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2969 + +QAAAttributeMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +9a0f0dd3957d29547adf15ae519b1ad4 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1612 + +CitizenCountryCodeUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +ff6f71c1e4e7a3d58f8696ae9080588e +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1447 + +SPInformationMarshaller.java +file + + + + +2013-12-20T12:27:57.430475Z +126729a7293d478709678748ec47277f +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1055 + +AuthenticationAttributesUnmarshaller.java +file + + + + +2013-12-20T12:27:57.430475Z +4f9cbca52f62feb055986ed1d6cc45ed +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1929 + +EIDCrossBorderShareMarshaller.java +file + + + + +2013-12-20T12:27:57.410475Z +0334c19bff0e6bfd196de52e7f1d1547 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1689 + +QAAAttributeImpl.java +file + + + + +2013-12-20T12:27:57.410475Z +bee5948d710cfab6256be7f47bb70096 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2647 + +SPInformationImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +93e4dc0e3432b0a6f355b70230f59edd +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2979 + +SPInstitutionUnmarshaller.java +file + + + + +2013-12-20T12:27:57.410475Z +11e598b7cc89fdea183e3f4f7c2019b3 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1407 + +EIDSectorShareBuilder.java +file + + + + +2013-12-20T12:27:57.414475Z +eef58e0f54cd2c89b3ccb73dbbaf4b24 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1672 + +SPSectorMarshaller.java +file + + + + +2013-12-20T12:27:57.414475Z +1d5f1bf8fa1b6170804abc1a64ad52c4 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1584 + +EIDCrossBorderShareImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +9514676b0d03b2288c82db3d46ef150a +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2722 + +SPIDImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +17b9d0d330854aa4aaa855345c09e9c0 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2381 + +RequestedAttributesMarshaller.java +file + + + + +2013-12-20T12:27:57.414475Z +84d34f73f399fdecde91f58068f2fcd0 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1116 + +SPSectorImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +1751902990706e32763e3e931b70622e +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2411 + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base new file mode 100644 index 000000000..74840e135 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; + +/** + * The Class AuthenticationAttributesBuilder. + * + * @author fjquevedo + */ +public class AuthenticationAttributesBuilder extends + AbstractSAMLObjectBuilder { + + + + /** + * Builds the object. + * + * @return the authentication attributes + */ + public final AuthenticationAttributes buildObject() { + return buildObject(AuthenticationAttributes.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace URI + * @param localName the local name + * @param namespacePrefix the namespace prefix + * + * @return the authentication attributes + */ + public final AuthenticationAttributes buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new AuthenticationAttributesImpl(namespaceURI, localName, + namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base new file mode 100644 index 000000000..1e43e7ec3 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base @@ -0,0 +1,109 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSignableSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class AuthenticationAttributesImpl. + * + * @author fjquevedo + */ +public final class AuthenticationAttributesImpl extends AbstractSignableSAMLObject implements +AuthenticationAttributes { + + private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticationAttributesImpl.class.getName()); + + /** The indexed children. */ + private VIDPAuthenticationAttributes vIDPAuthenAttr; + + /** + * Instantiates a new authentication attributes implementation. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected AuthenticationAttributesImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * + */ + public List getOrderedChildren() { + final ArrayList children = new ArrayList(); + + children.add(vIDPAuthenAttr); + + if (getSignature() != null) { + children.add(getSignature()); + } + + return Collections.unmodifiableList(children); + } + + /** + * Gets the signature reference id. + * + * @return the signature reference id + * + */ + public String getSignatureReferenceID() { + return null; + } + + /** + * Gets the vidp authentication attributes. + * + * @return the VIDP authentication attributes + * + */ + public VIDPAuthenticationAttributes getVIDPAuthenticationAttributes() { + return vIDPAuthenAttr; + } + + /** + * Sets the vidp authentication attributes. + * + * @param newVIDPAuthenAttr the new vidp authen attr + * + */ + public void setVIDPAuthenticationAttributes( + final VIDPAuthenticationAttributes newVIDPAuthenAttr) { + vIDPAuthenAttr = prepareForAssignment(this.vIDPAuthenAttr, newVIDPAuthenAttr); + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base new file mode 100644 index 000000000..698bf56b9 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base @@ -0,0 +1,30 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class AuthenticationAttributesMarshaller. + * + * @author fjquevedo + */ +public class AuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { + + + + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base new file mode 100644 index 000000000..af3e5c234 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base @@ -0,0 +1,54 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; + +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; + +/** + * The Class AuthenticationAttributesUnmarshaller. + * + * @author fjquevedo + */ +public class AuthenticationAttributesUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException the unmarshalling exception + * + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final AuthenticationAttributes attrStatement = (AuthenticationAttributes) parentObject; + + if (childObject instanceof VIDPAuthenticationAttributes) { + attrStatement.setVIDPAuthenticationAttributes((VIDPAuthenticationAttributes) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base new file mode 100644 index 000000000..64651691f --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base @@ -0,0 +1,50 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; + +/** + * The Class CitizenCountryCodeBuilder. + * + * @author fjquevedo + */ +public class CitizenCountryCodeBuilder extends AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the citizen country code + */ + public final CitizenCountryCode buildObject() { + return buildObject(CitizenCountryCode.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the citizen country code + */ + public final CitizenCountryCode buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new CitizenCountryCodeImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base new file mode 100644 index 000000000..4df8084a9 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base @@ -0,0 +1,82 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class CitizenCountryCodeImpl. + * + * @author fjquevedo + */ +public class CitizenCountryCodeImpl extends AbstractSAMLObject implements CitizenCountryCode { + + private static final Logger LOGGER = LoggerFactory.getLogger(CitizenCountryCodeImpl.class.getName()); + /** The citizen country code. */ + private String citizenCountryCode; + + /** + * Instantiates a new sP country impl. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected CitizenCountryCodeImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the citizen country code. + * + * @return the citizen country code + */ + public final String getCitizenCountryCode() { + return citizenCountryCode; + } + + /** + * Sets the citizen country code. + * + * @param newCitizenCountryCode the new citizen country code + */ + public final void setCitizenCountryCode(final String newCitizenCountryCode) { + this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base new file mode 100644 index 000000000..decae04c5 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; + +/** + * The Class SPCountryMarshaller. + * + * @author fjquevedo + */ +public class CitizenCountryCodeMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; + XMLHelper.appendTextContent(domElement, citizenCountryCode.getCitizenCountryCode()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base new file mode 100644 index 000000000..93132b508 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; + +/** + * The Class CitizenCountryCodeUnmarshaller. + * + * @author fjquevedo + */ +public class CitizenCountryCodeUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; + citizenCountryCode.setCitizenCountryCode(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base new file mode 100644 index 000000000..b939da776 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; + +/** + * The Class EIDCrossBorderShareBuilder. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareBuilder extends AbstractSAMLObjectBuilder { + + + /** + * Builds the object. + * + * @return the identifier cross border share + */ + public final EIDCrossBorderShare buildObject() { + return buildObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); + } + + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the eID cross border share + */ + public final EIDCrossBorderShare buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new EIDCrossBorderShareImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base new file mode 100644 index 000000000..50a997031 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base @@ -0,0 +1,87 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class EIDCrossBorderShareImpl. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareImpl extends AbstractSAMLObject implements + EIDCrossBorderShare { + + private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossBorderShareImpl.class.getName()); + /** The citizen country code. */ + private String eIDCrossBorderShare; + + /** + * Instantiates a new eID cross border share implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected EIDCrossBorderShareImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + + /** + * Gets the eID cross border share. + * + * @return the eID cross border share + */ + public final String getEIDCrossBorderShare() { + return eIDCrossBorderShare; + } + + + /** + * Sets the eID cross border share. + * + * @param newEIDCrossBorderShare the new eID cross border share + */ + public final void setEIDCrossBorderShare(String newEIDCrossBorderShare) { + this.eIDCrossBorderShare = prepareForAssignment(this.eIDCrossBorderShare, newEIDCrossBorderShare); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * {@inheritDoc} + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base new file mode 100644 index 000000000..58fa8af65 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base @@ -0,0 +1,47 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; + + +/** + * The Class EIDCrossBorderShareMarshaller. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareMarshaller extends AbstractSAMLObjectMarshaller { + + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; + XMLHelper.appendTextContent(domElement, crossBorderShare.getEIDCrossBorderShare()); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base new file mode 100644 index 000000000..457e70c23 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base @@ -0,0 +1,43 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; + +/** + * The Class EIDCrossBorderShareUnmarshaller. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; + crossBorderShare.setEIDCrossBorderShare(elementContent); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base new file mode 100644 index 000000000..9683d2ad8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; + +/** + * The Class EIDCrossSectorShareBuilder. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the eID cross sector share + */ + public final EIDCrossSectorShare buildObject() { + return buildObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the eID cross sector share implementation + */ + public final EIDCrossSectorShareImpl buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new EIDCrossSectorShareImpl(namespaceURI, localName, + namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base new file mode 100644 index 000000000..30502f429 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base @@ -0,0 +1,89 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; + +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * The Class EIDCrossSectorShareImpl. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareImpl extends AbstractSAMLObject implements + EIDCrossSectorShare { + + private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossSectorShareImpl.class.getName()); + /** The citizen country code. */ + private String eIDCrossSectorShare; + + + /** + * Instantiates a new eID cross sector share implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected EIDCrossSectorShareImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + + /** + * Gets the eID cross sector share. + * + * @return the eID cross sector share + */ + public final String getEIDCrossSectorShare() { + return eIDCrossSectorShare; + } + + + /** + * Sets the eID cross sector share. + * + * @param newEIDCrossSectorShare the new eID cross sector share + */ + public final void setEIDCrossSectorShare(String newEIDCrossSectorShare) { + this.eIDCrossSectorShare = prepareForAssignment(this.eIDCrossSectorShare, newEIDCrossSectorShare); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base new file mode 100644 index 000000000..dfd2b81dc --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; + + +/** + * The Class EIDCrossSectorShareMarshaller. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; + XMLHelper.appendTextContent(domElement, crossSectorShare.getEIDCrossSectorShare()); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base new file mode 100644 index 000000000..6a9711ca2 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base @@ -0,0 +1,47 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; + +/** + * The Class EIDCrossSectorShareUnmarshaller. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void processElementContent(final XMLObject samlObject, + final String domElement) { + + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; + crossSectorShare.setEIDCrossSectorShare(domElement); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base new file mode 100644 index 000000000..75062dc69 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; + +/** + * The Class EIDSectorShareBuilder. + * + * @author fjquevedo + */ +public class EIDSectorShareBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the eID sector share + */ + public final EIDSectorShare buildObject() { + return buildObject(EIDSectorShare.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the eID sector share + */ + public final EIDSectorShare buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new EIDSectorShareImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base new file mode 100644 index 000000000..c548841f7 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base @@ -0,0 +1,85 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +// TODO: Auto-generated Javadoc +/** + * The Class EIDSectorShareImpl. + * + * @author fjquevedo + */ +public class EIDSectorShareImpl extends AbstractSAMLObject implements + EIDSectorShare { + + private static final Logger LOGGER = LoggerFactory.getLogger(EIDSectorShareImpl.class.getName()); + + /** The e id sector share. */ + private String eIDSectorShare; + /** + * Instantiates a new eID sector share implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected EIDSectorShareImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * Gets the eID sector share. + * + * @return the eID sector share + */ + public final String getEIDSectorShare() { + return eIDSectorShare; + } + + /** + * Sets the eID sector share. + * + * @param newEIDSectorShare the new eID sector share + */ + public final void setEIDSectorShare(String newEIDSectorShare) { + this.eIDSectorShare = prepareForAssignment(this.eIDSectorShare, newEIDSectorShare); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base new file mode 100644 index 000000000..87ab23660 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.saml2.core.impl.AbstractNameIDTypeMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; + +/** + * The Class EIDSectorShareMarshaller. + * + * @author fjquevedo + */ +public class EIDSectorShareMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; + XMLHelper.appendTextContent(domElement, sectorShare.getEIDSectorShare()); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base new file mode 100644 index 000000000..9c661813f --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base @@ -0,0 +1,47 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; + + +/** + * The Class EIDSectorShareUnmarshaller. + * + * @author fjquevedo + */ +public class EIDSectorShareUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void processElementContent(final XMLObject samlObject, + final String domElement) { + final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; + sectorShare.setEIDSectorShare(domElement); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base new file mode 100644 index 000000000..41676931b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeBuilder. + * + * @author fjquevedo + */ +public class QAAAttributeBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the quality authentication assurance object + */ + public final QAAAttribute buildObject() { + return buildObject(QAAAttribute.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the quality authentication assurance object + + */ + public final QAAAttribute buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new QAAAttributeImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base new file mode 100644 index 000000000..c08986026 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.QAAAttribute; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class QAAAttributeImpl. + * + * @author fjquevedo + */ +public class QAAAttributeImpl extends AbstractSAMLObject implements + QAAAttribute { + + private static final Logger LOGGER = LoggerFactory.getLogger(QAAAttributeImpl.class.getName()); + /** The quality authentication assurance level. */ + private String qaaLevel; + + /** + * Constructor. + * + * @param namespaceURI the namespace the element is in + * @param elementLocalName the local name of the XML element this Object + * represents + * @param namespacePrefix the prefix for the given namespace + */ + protected QAAAttributeImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the quality authentication assurance level. + * + * @return the quality authentication assurance level + */ + public final String getQaaLevel() { + return qaaLevel; + } + + /** + * Sets the quality authentication assurance level. + * + * @param newQaaLevel the new quality authentication assurance level + */ + public final void setQaaLevel(final String newQaaLevel) { + this.qaaLevel = prepareForAssignment(this.qaaLevel, newQaaLevel); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base new file mode 100644 index 000000000..000879368 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeMarshaller. + * + * @author fjquevedo + */ +public class QAAAttributeMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final QAAAttribute qaaAttribute = (QAAAttribute) samlObject; + XMLHelper.appendTextContent(domElement, qaaAttribute.getQaaLevel()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base new file mode 100644 index 000000000..8445e4eeb --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeUnmarshaller. + * + * @author fjquevedo + */ +public class QAAAttributeUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final QAAAttribute qaaLevel = (QAAAttribute) samlObject; + qaaLevel.setQaaLevel(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base new file mode 100644 index 000000000..70bd6ac1f --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base @@ -0,0 +1,54 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; + +/** + * The Class RequestedAttributeBuilder. + * + * @author fjquevedo + */ +public class RequestedAttributeBuilder extends + AbstractSAMLObjectBuilder { + + + /** + * Builds the object. + * + * @return the requested attribute + */ + public final RequestedAttribute buildObject() { + return buildObject(RequestedAttribute.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the requested attribute + */ + public final RequestedAttribute buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new RequestedAttributeImpl(namespaceURI, localName, + namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base new file mode 100644 index 000000000..ad759230a --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base @@ -0,0 +1,220 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSBooleanValue; +import org.opensaml.xml.util.AttributeMap; +import org.opensaml.xml.util.XMLObjectChildrenList; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +// TODO: Auto-generated Javadoc +/** + * The Class RequestedAttributeImpl. + * + * @author fjquevedo + */ +public class RequestedAttributeImpl extends AbstractSAMLObject implements + RequestedAttribute { + + private static final Logger LOGGER = LoggerFactory.getLogger(RequestedAttributeImpl.class.getName()); + /** + * The attribute values. + */ + private final XMLObjectChildrenList attributeValues; + + /** + * The friendly name. + * + */ + private String friendlyName; + + /** + * The is required. + */ + private String isRequired; + + /** + * The name. + * + */ + private String name; + + /** + * The name format. + * + */ + private String nameFormat; + + /** + * The unknown attributes. + * + */ + private AttributeMap unknownAttributes; + + /** + * Instantiates a new requested attribute impl. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected RequestedAttributeImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + unknownAttributes = new AttributeMap(this); + attributeValues = new XMLObjectChildrenList(this); + } + + + /** + * Gets the attribute values. + * + * @return the attribute values + */ + public final List getAttributeValues() { + return attributeValues; + } + + /** + * Gets the friendly name. + * + * @return the friendly name. + */ + public final String getFriendlyName() { + return friendlyName; + } + + + /** + * Gets the checks if is required. + * + * @return the boolean if it's required. + */ + public final String isRequired() { + return isRequired; + } + + + /** + * Gets the is required xs boolean. + * + * @return the XSBoolean if it's required. + */ + public final String getIsRequiredXSBoolean() { + return isRequired; + } + + + /** + * Gets the name. + * + * @return the name + */ + public final String getName() { + return name; + } + + + /** + * Gets the name format. + * + * @return the name format. + */ + public final String getNameFormat() { + return nameFormat; + } + + /** + * Gets the ordered children. + * + * @return the list of XMLObject. + */ + public final List getOrderedChildren() { + final ArrayList children = new ArrayList(); + children.addAll(attributeValues); + return Collections.unmodifiableList(children); + } + + /** + * Gets the unknown attributes. + * + * @return the attribute map + */ + public final AttributeMap getUnknownAttributes() { + return unknownAttributes; + } + + /** + * Sets the friendly name. + * + * @param newFriendlyName the new friendly name format + */ + public final void setFriendlyName(final String newFriendlyName) { + this.friendlyName = prepareForAssignment(this.friendlyName, + newFriendlyName); + } + + /** + * Set new boolean value isRequired. + * @param newIsRequired then new value + */ + public final void setIsRequired(final String newIsRequired) { + isRequired = prepareForAssignment(this.isRequired, newIsRequired); + + } + + /** + * Sets the name. + * + * @param newName the new name + */ + public final void setName(final String newName) { + this.name = prepareForAssignment(this.name, newName); + } + + /** + * Sets the name format. + * + * @param newNameFormat the new name format + */ + public final void setNameFormat(final String newNameFormat) { + this.nameFormat = prepareForAssignment(this.nameFormat, newNameFormat); + } + + /** + * Sets the unknown attributes. + * + * @param newUnknownAttr the new unknown attributes + */ + public final void setUnknownAttributes(final AttributeMap newUnknownAttr) { + this.unknownAttributes = newUnknownAttr; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base new file mode 100644 index 000000000..6d0669241 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base @@ -0,0 +1,89 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.Map.Entry; + +import javax.xml.namespace.QName; + +import org.opensaml.Configuration; +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; + +/** + * The Class RequestedAttributeMarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributeMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall attributes. + * + * @param samlElement the SAML element + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallAttributes(final XMLObject samlElement, + final Element domElement) throws MarshallingException { + final RequestedAttribute requestedAttr = (RequestedAttribute) samlElement; + + if (requestedAttr.getName() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.NAME_ATTRIB_NAME, requestedAttr + .getName()); + } + + if (requestedAttr.getNameFormat() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.NAME_FORMAT_ATTR, requestedAttr + .getNameFormat()); + } + + if (requestedAttr.getFriendlyName() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.FRIENDLY_NAME_ATT, requestedAttr + .getFriendlyName()); + } + + if (requestedAttr.getIsRequiredXSBoolean() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.IS_REQUIRED_ATTR, requestedAttr + .getIsRequiredXSBoolean().toString()); + } + + Attr attr; + for (Entry entry : requestedAttr.getUnknownAttributes() + .entrySet()) { + attr = XMLHelper.constructAttribute(domElement.getOwnerDocument(), + entry.getKey()); + attr.setValue(entry.getValue()); + domElement.setAttributeNodeNS(attr); + if (Configuration.isIDAttribute(entry.getKey()) + || requestedAttr.getUnknownAttributes().isIDAttribute( + entry.getKey())) { + attr.getOwnerElement().setIdAttributeNode(attr, true); + } + } + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base new file mode 100644 index 000000000..551f4239d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base @@ -0,0 +1,96 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import javax.xml.namespace.QName; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.schema.XSBooleanValue; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Attr; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.SAMLCore; + +/** + * The Class RequestedAttributeUnmarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributeUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentSAMLObject parent SAMLObject + * @param childSAMLObject child SAMLObject + * + * @throws UnmarshallingException error at unmarshall XML object + */ + protected final void processChildElement(final XMLObject parentSAMLObject, + final XMLObject childSAMLObject) throws UnmarshallingException { + + final RequestedAttribute requestedAttr = (RequestedAttribute) parentSAMLObject; + + final QName childQName = childSAMLObject.getElementQName(); + if (childQName.getLocalPart().equals("AttributeValue") + && childQName.getNamespaceURI().equals(SAMLCore.STORK10_NS.getValue())) { + requestedAttr.getAttributeValues().add(childSAMLObject); + } else { + super.processChildElement(parentSAMLObject, childSAMLObject); + } + } + + /** + * Process attribute. + * + * @param samlObject the SAML object + * @param attribute the attribute + * @throws UnmarshallingException the unmarshalling exception + */ + protected final void processAttribute(final XMLObject samlObject, + final Attr attribute) throws UnmarshallingException { + + final RequestedAttribute requestedAttr = (RequestedAttribute) samlObject; + + if (attribute.getLocalName() + .equals(RequestedAttribute.NAME_ATTRIB_NAME)) { + requestedAttr.setName(attribute.getValue()); + } else if (attribute.getLocalName().equals( + RequestedAttribute.NAME_FORMAT_ATTR)) { + requestedAttr.setNameFormat(attribute.getValue()); + } else if (attribute.getLocalName().equals( + RequestedAttribute.FRIENDLY_NAME_ATT)) { + requestedAttr.setFriendlyName(attribute.getValue()); + } else if (attribute.getLocalName().equals( + RequestedAttribute.IS_REQUIRED_ATTR)) { + requestedAttr.setIsRequired(attribute + .getValue()); + + } else { + final QName attribQName = XMLHelper.getNodeQName(attribute); + if (attribute.isId()) { + requestedAttr.getUnknownAttributes().registerID(attribQName); + } + requestedAttr.getUnknownAttributes().put(attribQName, + attribute.getValue()); + } + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base new file mode 100644 index 000000000..138177995 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base @@ -0,0 +1,54 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.RequestedAttributes; + +/** + * The Class RequestedAttributesBuilder. + * + * @author fjquevedo + */ +public class RequestedAttributesBuilder extends + AbstractSAMLObjectBuilder { + + + /** + * Builds the object. + * + * @return the requested attributes + */ + public final RequestedAttributes buildObject() { + return buildObject(RequestedAttributes.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the requested attributes + */ + public final RequestedAttributes buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new RequestedAttributesImpl(namespaceURI, localName, + namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base new file mode 100644 index 000000000..a58a08a05 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base @@ -0,0 +1,95 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.util.IndexedXMLObjectChildrenList; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; + +/** + * The Class RequestedAttributesImpl. + * + * @author fjquevedo + */ +public class RequestedAttributesImpl extends AbstractSAMLObject implements + RequestedAttributes { + + /** + * Instantiates a new requested attributes implement. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected RequestedAttributesImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + indexedChildren = new IndexedXMLObjectChildrenList(this); + } + + /** The indexed children. */ + private final IndexedXMLObjectChildrenList indexedChildren; + + /** + * Gets the indexed children. + * + * @return the indexed children + */ + public final IndexedXMLObjectChildrenList getIndexedChildren() { + return indexedChildren; + } + + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + + final ArrayList children = new ArrayList(); + + children.addAll(indexedChildren); + + return Collections.unmodifiableList(children); + + } + + /** + * Gets the attributes. + * + * @return the attributes + * + * @see eu.stork.peps.auth.engine.core.RequestedAttributes#getAttributes() + */ + @SuppressWarnings("unchecked") + public final List getAttributes() { + return (List) indexedChildren + .subList(RequestedAttribute.DEF_ELEMENT_NAME); + } + + @Override + public int hashCode() { + throw new UnsupportedOperationException("hashCode method not implemented"); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base new file mode 100644 index 000000000..955fe0318 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base @@ -0,0 +1,33 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class RequestedAttributesMarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributesMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Instantiates a new requested attributes marshaller. + */ + public RequestedAttributesMarshaller() { + super(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base new file mode 100644 index 000000000..132d6cc59 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; + +/** + * The Class RequestedAttributesUnmarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributesUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException error in unmarshall + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final RequestedAttributes attrStatement = (RequestedAttributes) parentObject; + + if (childObject instanceof RequestedAttribute) { + attrStatement.getAttributes().add((RequestedAttribute) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base new file mode 100644 index 000000000..a35c77936 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPApplication; + +/** + * The Class SPApplicationBuilder. + * + * @author fjquevedo + */ +public class SPApplicationBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the service provider application + */ + public final SPApplication buildObject() { + return buildObject(SPApplication.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider application + */ + public final SPApplication buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPApplicationImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base new file mode 100644 index 000000000..6bb631a74 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPApplication; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPApplicationImpl. + * + * @author fjquevedo + */ +public class SPApplicationImpl extends AbstractSAMLObject implements + SPApplication { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPApplicationImpl.class.getName()); + /** The service provider application. */ + private String spApplication; + + /** + * Instantiates a new service provider application. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPApplicationImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the service provider application. + * + * @return the service provider application + */ + public final String getSPApplication() { + return spApplication; + } + + /** + * Sets the service provider application. + * + * @param newSpApplication the new service provider application + */ + public final void setSPApplication(final String newSpApplication) { + this.spApplication = prepareForAssignment(this.spApplication, + newSpApplication); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base new file mode 100644 index 000000000..4866c3535 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPApplication; + +/** + * The Class SPApplicationMarshaller. + * + * @author fjquevedo + */ +public class SPApplicationMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPApplication spApplication = (SPApplication) samlObject; + XMLHelper.appendTextContent(domElement, spApplication + .getSPApplication()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base new file mode 100644 index 000000000..a28432a13 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base @@ -0,0 +1,42 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPApplication; + + +/** + * The Class SPApplicationUnmarshaller. + * + * @author fjquevedo + */ +public class SPApplicationUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPApplication spApplication = (SPApplication) samlObject; + spApplication.setSPApplication(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base new file mode 100644 index 000000000..48ec92f49 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPCountry; + +/** + * The Class SPCountryBuilder. + * + * @author fjquevedo + */ +public class SPCountryBuilder extends AbstractSAMLObjectBuilder { + + + /** + * Builds the object SPCountry. + * + * @return the service provider country + */ + public final SPCountry buildObject() { + return buildObject(SPCountry.DEF_ELEMENT_NAME); + } + + + /** + * Builds the object SPCountry. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider country + */ + public final SPCountry buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPCountryImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base new file mode 100644 index 000000000..db58fb8be --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base @@ -0,0 +1,82 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPCountry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPCountryImpl. + * + * @author fjquevedo + */ +public class SPCountryImpl extends AbstractSAMLObject implements SPCountry { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPCountryImpl.class.getName()); + /** The service provider country. */ + private String spCountry; + + /** + * Instantiates a new service provider country. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPCountryImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the service provider country. + * + * @return the service provider country + */ + public final String getSPCountry() { + return spCountry; + } + + /** + * Sets the service provider country. + * + * @param newSpCountry the new service provider country + */ + public final void setSPCountry(final String newSpCountry) { + this.spCountry = prepareForAssignment(this.spCountry, newSpCountry); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base new file mode 100644 index 000000000..e82634749 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPCountry; + +/** + * The Class SPCountryMarshaller. + * + * @author fjquevedo + */ +public class SPCountryMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPCountry spCountry = (SPCountry) samlObject; + XMLHelper.appendTextContent(domElement, spCountry.getSPCountry()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base new file mode 100644 index 000000000..deb695ac6 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base @@ -0,0 +1,42 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPCountry; + + +/** + * The Class SPCountryUnmarshaller. + * + * @author fjquevedo + */ +public class SPCountryUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPCountry spCountry = (SPCountry) samlObject; + spCountry.setSPCountry(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base new file mode 100644 index 000000000..b3640947b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base @@ -0,0 +1,50 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPID; + +/** + * The Class SPIDBuilder. + * + * @author iinigo + */ +public class SPIDBuilder extends AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the SP ID + */ + public final SPID buildObject() { + return buildObject(SPID.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the citizen country code + */ + public final SPID buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPIDImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base new file mode 100644 index 000000000..0c7127273 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base @@ -0,0 +1,82 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPIDImpl. + * + * @author iinigo + */ +public class SPIDImpl extends AbstractSAMLObject implements SPID { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPIDImpl.class.getName()); + /** The citizen country code. */ + private String spId; + + /** + * Instantiates a new sP country impl. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPIDImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the SP ID. + * + * @return the SP ID + */ + public final String getSPID() { + return spId; + } + + /** + * Sets the SP ID. + * + * @param newSPID the new SP ID + */ + public final void setSPID(final String newSPID) { + this.spId = prepareForAssignment(this.spId, newSPID); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base new file mode 100644 index 000000000..24389522e --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPID; + +/** + * The Class SPIDMarshaller. + * + * @author iinigo + */ +public class SPIDMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPID spid = (SPID) samlObject; + XMLHelper.appendTextContent(domElement, spid.getSPID()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base new file mode 100644 index 000000000..e4d230b94 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPID; + +/** + * The Class SPIDUnmarshaller. + * + * @author iinigo + */ +public class SPIDUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPID spid = (SPID) samlObject; + spid.setSPID(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base new file mode 100644 index 000000000..a6e1fe686 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.SPInformation; + +/** + * The Class SPInformation. + * + * @author iinigo + */ +public final class SPInformationBuilder extends AbstractSAMLObjectBuilder { + + + /** {@inheritDoc} */ + public SPInformation buildObject() { + return buildObject(SAMLCore.STORK10P_NS.getValue(), SPInformation.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); + } + + /** {@inheritDoc} */ + public SPInformation buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { + return new SPInformationImpl(namespaceURI, localName, namespacePrefix); + } + +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base new file mode 100644 index 000000000..b5609600d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base @@ -0,0 +1,110 @@ +/* + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSignableSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPID; +import eu.stork.peps.auth.engine.core.SPInformation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * The Class SPInformationImpl. + * + * @author iinigo + */ +public final class SPInformationImpl extends AbstractSignableSAMLObject implements +SPInformation { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPInformationImpl.class.getName()); + /** The citizen country code. */ + private SPID spId; + + + /** + * Instantiates a new requested attributes implement. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPInformationImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * getSPId. + * + * @return the SP ID + */ + public SPID getSPID() { + return spId; + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * + */ + public List getOrderedChildren() { + final ArrayList children = new ArrayList(); + + children.add(spId); + + if (getSignature() != null) { + children.add(getSignature()); + } + + return Collections.unmodifiableList(children); + + } + + /** + * Gets the signature reference id. + * + * @return the signature reference id + * + */ + public String getSignatureReferenceID() { + return null; + } + + /** + * Sets the SP Id. + * + * @param newSPId the new SP Id + * + */ + public void setSPID(SPID newSPId) { + this.spId = prepareForAssignment(this.spId, newSPId); + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base new file mode 100644 index 000000000..44845948c --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base @@ -0,0 +1,33 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class SPInformationMarshaller. + * + * @author iinigo + */ +public class SPInformationMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Instantiates a new SP Information marshaller. + */ + public SPInformationMarshaller() { + super(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base new file mode 100644 index 000000000..79b0b0f35 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.SPID; +import eu.stork.peps.auth.engine.core.SPInformation; + +/** + * The Class SPInformationUnmarshaller. + * + * @author iinigo + */ +public class SPInformationUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException the unmarshalling exception + * + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final SPInformation spInformation = (SPInformation) parentObject; + + if (childObject instanceof SPID) { + spInformation.setSPID((SPID) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base new file mode 100644 index 000000000..fe47cf99c --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPInstitution; + +/** + * The Class SPInstitutionBuilder. + * + * @author fjquevedo + */ +public class SPInstitutionBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the service provider institution + */ + public final SPInstitution buildObject() { + return buildObject(SPInstitution.DEF_ELEMENT_NAME); + } + + /** + * Builds the object SPInstitution. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider institution + */ + public final SPInstitution buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPInstitutionImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base new file mode 100644 index 000000000..cf1760446 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPInstitution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPInstitutionImpl. + * + * @author fjquevedo + */ +public class SPInstitutionImpl extends AbstractSAMLObject implements + SPInstitution { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPInstitutionImpl.class.getName()); + /** The service provider institution. */ + private String spInstitution; + + /** + * Instantiates a new service provider institution. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPInstitutionImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the service provider institution. + * + * @return the service provider institution + */ + public final String getSPInstitution() { + return spInstitution; + } + + /** + * Sets the service provider institution. + * + * @param newSpInstitution the new service provider institution + */ + public final void setSPInstitution(final String newSpInstitution) { + this.spInstitution = prepareForAssignment(this.spInstitution, + newSpInstitution); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } + } diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base new file mode 100644 index 000000000..504a1f035 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPInstitution; + +/** + * The Class SPInstitutionMarshaller. + * + * @author fjquevedo + */ +public class SPInstitutionMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPInstitution spInstitution = (SPInstitution) samlObject; + XMLHelper.appendTextContent(domElement, spInstitution + .getSPInstitution()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base new file mode 100644 index 000000000..103d5f2b2 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPInstitution; + +/** + * The Class SPInstitutionUnmarshaller. + * + * @author fjquevedo + */ +public class SPInstitutionUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPInstitution spInstitution = (SPInstitution) samlObject; + spInstitution.setSPInstitution(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base new file mode 100644 index 000000000..a691b9008 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base @@ -0,0 +1,50 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPSector; + +/** + * The Class SPSectorBuilder. + * + * @author fjquevedo + */ +public class SPSectorBuilder extends AbstractSAMLObjectBuilder { + + /** + * Builds the object SPSector. + * + * @return the service provider sector. + */ + public final SPSector buildObject() { + return buildObject(SPSector.DEF_ELEMENT_NAME); + } + + /** + * Builds the object SPSector. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider sector + */ + public final SPSector buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPSectorImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base new file mode 100644 index 000000000..a29810dd4 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPSector; + + +/** + * The Class SPSectorImpl. + * + * @author fjquevedo + */ +public class SPSectorImpl extends AbstractSAMLObject implements SPSector { + + /** The service provider sector. */ + private String spSector; + + /** + * Instantiates a new Service provider sector implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPSectorImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * Gets the service provider sector. + * + * @return the SP sector + * + * @see eu.stork.peps.auth.engine.core.SPSector#getSPSector() + */ + public final String getSPSector() { + return spSector; + } + + + /** + * Sets the service provider sector. + * + * @param newSpSector the new service provider sector + */ + public final void setSPSector(final String newSpSector) { + this.spSector = prepareForAssignment(this.spSector, newSpSector); + } + + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + throw new UnsupportedOperationException("hashCode method not implemented"); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base new file mode 100644 index 000000000..c5331e8f4 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPSector; + +/** + * The Class SPSectorMarshaller. + * + * @author fjquevedo + */ +public class SPSectorMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPSector spSector = (SPSector) samlObject; + XMLHelper.appendTextContent(domElement, spSector.getSPSector()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base new file mode 100644 index 000000000..cbb05c6e5 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base @@ -0,0 +1,42 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPSector; + +/** + * The Class SPSectorUnmarshaller. + * + * @author fjquevedo + */ +public class SPSectorUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPSector spSector = (SPSector) samlObject; + spSector.setSPSector(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base new file mode 100644 index 000000000..2db14f543 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base @@ -0,0 +1,399 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Properties; + +import eu.stork.peps.auth.engine.X509PrincipalUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.NotImplementedException; +import org.bouncycastle.jce.X509Principal; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.security.SecurityConfiguration; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; +import org.opensaml.xml.security.keyinfo.KeyInfoHelper; +import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; +import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.x509.BasicX509Credential; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.validation.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.SAMLEngineException; + +/** + * The Class HWSign. Module of sign. + * + * @author fjquevedo + */ +public final class SignHW implements SAMLEngineSignI { + + /** The Constant CONFIGURATION_FILE. */ + private static final String CONF_FILE = "configurationFile"; + + /** The Constant KEYSTORE_TYPE. + private static final String KEYSTORE_TYPE = "keystoreType" */ + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SignHW.class + .getName()); + + /** The stork own key store. */ + private KeyStore storkOwnKeyStore = null; + + /** + * Gets the stork own key store. + * + * @return the stork own key store + */ + public KeyStore getStorkOwnKeyStore() { + return storkOwnKeyStore; + } + + /** + * Gets the stork trustStore. + * + * @return the stork own key store + */ + public KeyStore getTrustStore() { + return storkOwnKeyStore; + } + + /** + * Sets the stork own key store. + * + * @param newkOwnKeyStore the new stork own key store + */ + public void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { + this.storkOwnKeyStore = newkOwnKeyStore; + } + + /** + * Gets the properties. + * + * @return the properties + */ + public Properties getProperties() { + return properties; + } + + /** + * Sets the properties. + * + * @param newProperties the new properties + */ + public void setProperties(final Properties newProperties) { + this.properties = newProperties; + } + + /** The HW sign prop. */ + private Properties properties = null; + + /** + * @see + * eu.stork.peps.auth.engine.core.SAMLEngineSignI#init(java.lang.String) + * @param fileConf file of configuration + * @throws SAMLEngineException error in read file + */ + public void init(final String fileConf) + throws SAMLEngineException { + InputStream inputStr = null; + try { + inputStr = SignHW.class.getResourceAsStream("/" + + fileConf); + properties = new Properties(); + + properties.loadFromXML(inputStr); + } catch (final InvalidPropertiesFormatException e) { + LOG.info("Exception: invalid properties format."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOG.info("Exception: invalid file: " + fileConf); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(inputStr); + } + } + + + /** + * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() + * @return the X509Certificate. + */ + public X509Certificate getCertificate() { + throw new NotImplementedException(); + } + + /** + * @see + * eu.stork.peps.auth.engine.core.SAMLEngineSignI#sign(SignableSAMLObject tokenSaml) + * @param tokenSaml signable SAML Object + * @return the SAMLObject signed. + * @throws SAMLEngineException error in sign token saml + */ + public SAMLObject sign(final SignableSAMLObject tokenSaml) throws SAMLEngineException { + + try { + LOG.info("Star procces of sign"); + final char[] pin = properties.getProperty("keyPassword") + .toCharArray(); + + storkOwnKeyStore.load(null, pin); + + final String serialNumber = properties.getProperty("serialNumber"); + final String issuer = properties.getProperty("issuer"); + + String alias = null; + String aliasCert; + X509Certificate certificate; + + boolean find = false; + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements() && !find;) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + // Verified serial number, issuer + + final String serialNum = certificate.getSerialNumber() + .toString(16); + X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); + X509Principal issuerDNConf = new X509Principal(issuer); + + if(serialNum.equalsIgnoreCase(serialNumber) + && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ + alias = aliasCert; + find = true; + } + + } + + if (!find) { + throw new SAMLEngineException("Certificate cannot be found in keystore "); + } + certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); + final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( + alias, pin); + + LOG.info("Recover BasicX509Credential."); + final BasicX509Credential credential = new BasicX509Credential(); + + LOG.debug("Load certificate"); + credential.setEntityCertificate(certificate); + + LOG.debug("Load privateKey"); + credential.setPrivateKey(privateKey); + + LOG.info("Star procces of sign"); + final Signature signature = (Signature) org.opensaml.xml.Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + + LOG.debug("Begin signature with openSaml"); + signature.setSigningCredential(credential); + + signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + + + + final SecurityConfiguration securityConf = + org.opensaml.xml.Configuration.getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager = securityConf + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac + .newInstance(); + + final KeyInfo keyInfo = keyInfoGenerator.generate(credential); + + signature.setKeyInfo(keyInfo); + + LOG.debug("Set Canonicalization Algorithm"); + signature.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + tokenSaml.setSignature(signature); + + LOG.debug("Marshall samlToken."); + org.opensaml.xml.Configuration.getMarshallerFactory() + .getMarshaller(tokenSaml).marshall(tokenSaml); + + LOG.info("Sign samlToken."); + Signer.signObject(signature); + + } catch (final MarshallingException e) { + LOG.error("MarshallingException"); + throw new SAMLEngineException(e); + } catch (final NoSuchAlgorithmException e) { + LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); + throw new SAMLEngineException(e); + } catch (final KeyStoreException e) { + LOG.error("Generic KeyStore exception."); + throw new SAMLEngineException(e); + } catch (final SignatureException e) { + LOG.error("Signature exception."); + throw new SAMLEngineException(e); + } catch (final SecurityException e) { + LOG.error("Security exception."); + throw new SAMLEngineException(e); + } catch (final CertificateException e) { + LOG.error("Certificate exception."); + throw new SAMLEngineException(e); + } catch (final IOException e) { + LOG.error("IO exception."); + throw new SAMLEngineException(e); + } catch (final UnrecoverableKeyException e) { + LOG.error("UnrecoverableKeyException exception."); + throw new SAMLEngineException(e); + } + + return tokenSaml; + } + + /** + * @see + * eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(SignableSAMLObject) + * @param tokenSaml the token saml + * @return the SAMLObject validated. + * @throws SAMLEngineException exception in validate signature + */ + public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start signature validation."); + try { + + // Validate structure signature + final SAMLSignatureProfileValidator signProfValidator = + new SAMLSignatureProfileValidator(); + + // Indicates signature id conform to SAML Signature profile + signProfValidator.validate(tokenSaml.getSignature()); + + String aliasCert; + X509Certificate certificate; + + final List trustedCred = new ArrayList(); + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements();) { + aliasCert = e.nextElement(); + final BasicX509Credential credential = new BasicX509Credential(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + credential.setEntityCertificate(certificate); + trustedCred.add(credential); + } + + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); + final List listCertificates = KeyInfoHelper + .getCertificates(keyInfo); + + if (listCertificates.size() != 1) { + throw new SAMLEngineException("Only must be one certificate"); + } + + // Exist only one certificate + final BasicX509Credential entityX509Cred = new BasicX509Credential(); + entityX509Cred.setEntityCertificate(listCertificates.get(0)); + + final ExplicitKeyTrustEvaluator keyTrustEvaluator = + new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustedCred)) { + throw new SAMLEngineException("Certificate it is not trusted."); + } + + final SignatureValidator sigValidator = new SignatureValidator( + entityX509Cred); + + sigValidator.validate(tokenSaml.getSignature()); + + } catch (final ValidationException e) { + LOG.error("ValidationException.", e); + throw new SAMLEngineException(e); + } catch (final KeyStoreException e) { + LOG.error("ValidationException.", e); + throw new SAMLEngineException(e); + } catch (final CertificateException e) { + LOG.error("CertificateException.", e); + throw new SAMLEngineException(e); + } + return tokenSaml; + } + + /** + * load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + * Note this class was using pkcs11Provider + * final Provider pkcs11Provider = new sun.security.pkcs11.SunPKCS11(inputStream) + * if (Security.getProperty(pkcs11Provider.getName()) == null) { + * Security.insertProviderAt(pkcs11Provider, Security .getProviders().length) + * } + * storkOwnKeyStore = KeyStore.getInstance(properties.getProperty(KEYSTORE_TYPE)) + */ + public void loadCryptServiceProvider() throws SAMLEngineException { + LOG.info("Load Cryptographic Service Provider"); + InputStream inputStream = null; + + try { + inputStream = SignHW.class.getResourceAsStream("/" + + properties.getProperty(CONF_FILE)); + + } catch (final Exception e) { + throw new SAMLEngineException( + "Error loading CryptographicServiceProvider", e); + } finally { + IOUtils.closeQuietly(inputStream); + } + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base new file mode 100644 index 000000000..2adefddbd --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base @@ -0,0 +1,64 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class ModuleSignFactory. + * + * @author fjquevedo + * + */ + +public final class SignModuleFactory { + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(SignModuleFactory.class.getName()); + + /** + * Instantiates a new module sign factory. + */ + private SignModuleFactory() { + + } + + /** + * Gets the single instance of SignModuleFactory. + * + * @param className the class name + * + * @return single instance of SignModuleFactory + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SAMLEngineSignI getInstance(final String className) + throws STORKSAMLEngineException { + LOG.info("[START]SignModuleFactory static"); + try { + final Class cls = Class.forName(className); + return (SAMLEngineSignI) cls.newInstance(); + } catch (Exception e) { + throw new STORKSAMLEngineException(e); + } + + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base new file mode 100644 index 000000000..33ed05515 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base @@ -0,0 +1,468 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Properties; + +import eu.stork.peps.auth.engine.X509PrincipalUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.NotImplementedException; +import org.bouncycastle.jce.X509Principal; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.security.SecurityConfiguration; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; +import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; +import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.x509.BasicX509Credential; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.util.Base64; +import org.opensaml.xml.validation.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.SAMLEngineException; + +/** + * The Class SWSign. Class responsible for signing and validating of messages + * SAML with a certificate store software. + * + * @author fjquevedo + */ +public final class SignP12 implements SAMLEngineSignI { + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SignP12.class + .getName()); + + + /** The p12 store. */ + private KeyStore p12Store = null; + + + /** The trust store. */ + private KeyStore trustStore = null; + + + /** + * Gets the trust store. + * + * @return the trust store + */ + public KeyStore getTrustStore() { + return trustStore; + } + + /** + * Sets the trust store. + * + * @param newTrustStore the new trust store + */ + public void setTrustStore(final KeyStore newTrustStore) { + this.trustStore = newTrustStore; + } + + /** + * The instance. + * + * @return the properties + */ + + public Properties getProperties() { + return properties; + } + + + + /** + * Gets the p12 store. + * + * @return the p12 store + */ + public KeyStore getP12Store() { + return p12Store; + } + + + + /** + * Sets the p12 store. + * + * @param newP12Store the new p12 store + */ + public void setP12Store(final KeyStore newP12Store) { + this.p12Store = newP12Store; + } + + + + /** + * Sets the properties. + * + * @param newProperties the new properties + */ + public void setProperties(final Properties newProperties) { + this.properties = newProperties; + } + + /** The SW sign prop. */ + private Properties properties = null; + + + /** + * Initialize the file configuration. + * + * @param fileConf name of the file configuration + * + * @throws SAMLEngineException error at the load from file configuration + */ + public void init(final String fileConf) throws SAMLEngineException { + InputStream fileProperties = null; + properties = new Properties(); + try { + try { + LOG.debug("Fichero a cargar " + fileConf); + fileProperties = new FileInputStream(fileConf); + properties.loadFromXML(fileProperties); + } catch (Exception e) { + LOG.error("Fallo al cargar el recurso externo. Se reintenta como fichero interno."); + fileProperties = SignP12.class.getResourceAsStream("/" + fileConf); + if (fileProperties == null) { + fileProperties = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileConf); + if (fileProperties == null) { + Enumeration files = ClassLoader.getSystemClassLoader().getResources(fileConf); + if (files != null && files.hasMoreElements()) { + LOG.info("Se han encontrado recurso/s. Se toma el primero."); + fileProperties = ClassLoader.getSystemClassLoader().getResourceAsStream(files.nextElement().getFile()); + } else { + throw new IOException("No se pudo recuperar el fichero: " + fileConf, e); + } + } + } + LOG.debug("Recuperados " + fileProperties.available() + " bytes"); + properties.loadFromXML(fileProperties); + } + } catch (InvalidPropertiesFormatException e) { + LOG.info("Exception: invalid properties format."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOG.info("Exception: invalid file: " + fileConf); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(fileProperties); + } + } + + /** + * Gets the certificate. + * + * @return the X509Certificate + * + */ + public X509Certificate getCertificate() { + throw new NotImplementedException(); + } + + /** + * Sign the token SAML. + * + * @param tokenSaml token SAML + * + * @return the X509Certificate signed. + * + * @throws SAMLEngineException error at sign SAML token + * + */ + public SAMLObject sign(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start Sign process"); + try { + + final String serialNumber = properties.getProperty("serialNumber"); + final String issuer = properties.getProperty("issuer"); + + String alias = null; + String aliasCert; + X509Certificate certificate; + + boolean find = false; + for (final Enumeration e = p12Store.aliases(); e + .hasMoreElements() && !find;) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) p12Store + .getCertificate(aliasCert); + + final String serialNum = certificate.getSerialNumber() + .toString(16); + + X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); + X509Principal issuerDNConf = new X509Principal(issuer); + + if(serialNum.equalsIgnoreCase(serialNumber) + && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ + alias = aliasCert; + find = true; + } + + } + + certificate = (X509Certificate) p12Store + .getCertificate(alias); + final PrivateKey privateKey = (PrivateKey) p12Store.getKey( + alias, properties.getProperty("keyPassword").toCharArray()); + + LOG.info("Recover BasicX509Credential."); + final BasicX509Credential credential = new BasicX509Credential(); + + LOG.debug("Load certificate"); + credential.setEntityCertificate(certificate); + + LOG.debug("Load privateKey"); + credential.setPrivateKey(privateKey); + + LOG.debug("Begin signature with openSaml"); + final Signature signature = (Signature) Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + + signature.setSigningCredential(credential); + + signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + + final SecurityConfiguration secConfiguration = Configuration + .getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac + .newInstance(); + + final KeyInfo keyInfo = keyInfoGenerator.generate(credential); + + signature.setKeyInfo(keyInfo); + signature.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + tokenSaml.setSignature(signature); + + LOG.info("Marshall samlToken."); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + + LOG.info("Sign samlToken."); + Signer.signObject(signature); + + } catch (MarshallingException e) { + LOG.error("MarshallingException"); + throw new SAMLEngineException(e); + } catch (NoSuchAlgorithmException e) { + LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("Generic KeyStore exception."); + throw new SAMLEngineException(e); + } catch (SignatureException e) { + LOG.error("Signature exception."); + throw new SAMLEngineException(e); + } catch (SecurityException e) { + LOG.error("Security exception."); + throw new SAMLEngineException(e); + } catch (UnrecoverableKeyException e) { + LOG.error("UnrecoverableKey exception."); + throw new SAMLEngineException(e); + } + + return tokenSaml; + } + + /** + * Validate signature. + * + * @param tokenSaml token SAML + * + * @return the SAMLObject validated. + * + * @throws SAMLEngineException error validate signature + * + */ + public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start signature validation."); + try { + + // Validate structure signature + final SAMLSignatureProfileValidator sigProfValidator = + new SAMLSignatureProfileValidator(); + try { + // Indicates signature id conform to SAML Signature profile + sigProfValidator.validate(tokenSaml.getSignature()); + } catch (ValidationException e) { + LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); + throw new SAMLEngineException(e); + } + + String aliasCert = null; + X509Certificate certificate; + + final List trustCred = new ArrayList(); + + for (final Enumeration e = trustStore.aliases(); e + .hasMoreElements();) { + aliasCert = e.nextElement(); + final BasicX509Credential credential = new BasicX509Credential(); + certificate = (X509Certificate) trustStore + .getCertificate(aliasCert); + credential.setEntityCertificate(certificate); + trustCred.add(credential); + } + + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); + + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + final CertificateFactory certFact = CertificateFactory + .getInstance("X.509"); + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + // Exist only one certificate + final BasicX509Credential entityX509Cred = new BasicX509Credential(); + entityX509Cred.setEntityCertificate(cert); + + // Validate trust certificates + final ExplicitKeyTrustEvaluator keyTrustEvaluator = + new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { + throw new SAMLEngineException("Certificate it is not trusted."); + } + + // Validate signature + final SignatureValidator sigValidator = new SignatureValidator( + entityX509Cred); + sigValidator.validate(tokenSaml.getSignature()); + + } catch (ValidationException e) { + LOG.error("ValidationException."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("KeyStoreException.", e); + throw new SAMLEngineException(e); + } catch (GeneralSecurityException e) { + LOG.error("GeneralSecurityException.", e); + throw new SAMLEngineException(e); + } + return tokenSaml; + } + + + /** + * Load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + */ + public void loadCryptServiceProvider() throws SAMLEngineException { + LOG.info("Load Cryptographic Service Provider"); + + FileInputStream fis = null; + FileInputStream fisTrustStore = null; + + try { + // Dynamically register Bouncy Castle provider. + boolean found = false; + // Check if BouncyCastle is already registered as a provider + final Provider[] providers = Security.getProviders(); + for (int i = 0; i < providers.length; i++) { + if (providers[i].getName().equals( + BouncyCastleProvider.PROVIDER_NAME)) { + found = true; + } + } + + // Register only if the provider has not been previously registered + if (!found) { + LOG.debug("SAMLCore: Register Bouncy Castle provider."); + Security.insertProviderAt(new BouncyCastleProvider(), Security + .getProviders().length); + } + + p12Store = KeyStore.getInstance(properties + .getProperty("keystoreType")); + + fis = new FileInputStream(properties + .getProperty("keystorePath")); + + p12Store.load(fis, properties.getProperty( + "keyStorePassword").toCharArray()); + + + trustStore = KeyStore.getInstance(properties + .getProperty("trustStoreType")); + + fisTrustStore = new FileInputStream(properties + .getProperty("trustStorePath")); + trustStore.load(fisTrustStore, properties.getProperty( + "trustStorePassword").toCharArray()); + + } catch (Exception e) { + throw new SAMLEngineException( + "Error loading CryptographicServiceProvider", e); + } finally { + IOUtils.closeQuietly(fis); + IOUtils.closeQuietly(fisTrustStore); + } + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base new file mode 100644 index 000000000..4c7bb18a3 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base @@ -0,0 +1,423 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Properties; + +import eu.stork.peps.auth.engine.X509PrincipalUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.NotImplementedException; +import org.bouncycastle.jce.X509Principal; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.security.SecurityConfiguration; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; +import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; +import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.x509.BasicX509Credential; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.util.Base64; +import org.opensaml.xml.validation.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.SAMLEngineException; + + +/** + * The Class SWSign. Class responsible for signing and validating of messages + * SAML with a certificate store software. + * + * @author fjquevedo + */ +public class SignSW implements SAMLEngineSignI { + + /** The Constant KEYSTORE_TYPE. */ + private static final String KEYSTORE_TYPE = "keystoreType"; + + /** The Constant KEY_STORE_PASSWORD. */ + private static final String KEY_STORE_PASS = "keyStorePassword"; + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SignSW.class + .getName()); + + /** The stork own key store. */ + private KeyStore storkOwnKeyStore = null; + + /** + * The instance. + * + * @return the properties + */ + + public final Properties getProperties() { + return properties; + } + + /** + * Gets the stork own key store. + * + * @return the stork own key store + */ + public final KeyStore getStorkOwnKeyStore() { + return storkOwnKeyStore; + } + + /** + * Gets the stork trustStore. + * + * @return the stork own key store + */ + public KeyStore getTrustStore() { + return storkOwnKeyStore; + } + + /** + * Sets the stork own key store. + * + * @param newkOwnKeyStore the new stork own key store + */ + public final void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { + this.storkOwnKeyStore = newkOwnKeyStore; + } + + /** + * Sets the properties. + * + * @param newProperties the new properties + */ + public final void setProperties(final Properties newProperties) { + this.properties = newProperties; + } + + /** The SW sign prop. */ + private Properties properties = null; + + + /** + * Inits the file configuration. + * + * @param fileConf name of the file configuration + * + * @throws SAMLEngineException error at the load from file configuration + */ + public final void init(final String fileConf) + throws SAMLEngineException { + InputStream fileProperties = null; + try { + fileProperties = SignSW.class.getResourceAsStream("/" + + fileConf); + properties = new Properties(); + + properties.loadFromXML(fileProperties); + fileProperties.close(); + } catch (InvalidPropertiesFormatException e) { + LOG.info("Exception: invalid properties format."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOG.info("Exception: invalid file: " + fileConf); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(fileProperties); + } + } + + /** + * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() + * @return the X509Certificate + */ + public final X509Certificate getCertificate() { + throw new NotImplementedException(); + } + + + /** + * Sign the token SAML. + * + * @param tokenSaml the token SAML. + * + * @return the SAML object + * + * @throws SAMLEngineException the SAML engine exception + * + */ + public final SAMLObject sign(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start Sign process."); + try { + final String serialNumber = properties.getProperty("serialNumber"); + final String issuer = properties.getProperty("issuer"); + + String alias = null; + String aliasCert; + X509Certificate certificate; + boolean find = false; + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements() && !find; ) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + + final String serialNum = certificate.getSerialNumber() + .toString(16); + + X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); + X509Principal issuerDNConf = new X509Principal(issuer); + + if(serialNum.equalsIgnoreCase(serialNumber) + && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ + alias = aliasCert; + find = true; + } + } + if (!find) { + throw new SAMLEngineException("Certificate cannot be found in keystore "); + } + certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); + final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( + alias, properties.getProperty("keyPassword").toCharArray()); + + LOG.info("Recover BasicX509Credential."); + final BasicX509Credential credential = new BasicX509Credential(); + + LOG.debug("Load certificate"); + credential.setEntityCertificate(certificate); + + LOG.debug("Load privateKey"); + credential.setPrivateKey(privateKey); + + LOG.debug("Begin signature with openSaml"); + final Signature signature = (Signature) Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + + signature.setSigningCredential(credential); + + signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + + + final SecurityConfiguration secConfiguration = Configuration + .getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac + .newInstance(); + + KeyInfo keyInfo = keyInfoGenerator.generate(credential); + + signature.setKeyInfo(keyInfo); + signature.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + tokenSaml.setSignature(signature); + + LOG.info("Marshall samlToken."); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + + LOG.info("Sign samlToken."); + Signer.signObject(signature); + + } catch (MarshallingException e) { + LOG.error("MarshallingException"); + throw new SAMLEngineException(e); + } catch (NoSuchAlgorithmException e) { + LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("Generic KeyStore exception."); + throw new SAMLEngineException(e); + } catch (SignatureException e) { + LOG.error("Signature exception."); + throw new SAMLEngineException(e); + } catch (SecurityException e) { + LOG.error("Security exception."); + throw new SAMLEngineException(e); + } catch (UnrecoverableKeyException e) { + LOG.error("UnrecoverableKey exception."); + throw new SAMLEngineException(e); + } + + return tokenSaml; + } + + /** + * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(org.opensaml.common.SignableSAMLObject) + * @param tokenSaml token SAML + * @return the SAMLObject validated. + * @throws SAMLEngineException error validate signature + */ + public final SAMLObject validateSignature(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start signature validation."); + try { + + // Validate structure signature + final SAMLSignatureProfileValidator sigProfValidator = + new SAMLSignatureProfileValidator(); + try { + // Indicates signature id conform to SAML Signature profile + sigProfValidator.validate(tokenSaml.getSignature()); + } catch (ValidationException e) { + LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); + throw new SAMLEngineException(e); + } + + String aliasCert = null; + X509Certificate certificate; + + final List trustCred = new ArrayList(); + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements();) { + aliasCert = e.nextElement(); + final BasicX509Credential credential = new BasicX509Credential(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + credential.setEntityCertificate(certificate); + trustCred.add(credential); + } + + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); + + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + final CertificateFactory certFact = CertificateFactory + .getInstance("X.509"); + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + // Exist only one certificate + final BasicX509Credential entityX509Cred = new BasicX509Credential(); + entityX509Cred.setEntityCertificate(cert); + + // Validate trust certificates + final ExplicitKeyTrustEvaluator keyTrustEvaluator = + new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { + throw new SAMLEngineException("Certificate is not trusted."); + } + + // Validate signature + final SignatureValidator sigValidator = new SignatureValidator( + entityX509Cred); + sigValidator.validate(tokenSaml.getSignature()); + + } catch (ValidationException e) { + LOG.error("ValidationException."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("KeyStoreException.", e); + throw new SAMLEngineException(e); + } catch (GeneralSecurityException e) { + LOG.error("GeneralSecurityException.", e); + throw new SAMLEngineException(e); + } + LOG.info(tokenSaml.getSignatureReferenceID()); + LOG.info("Start signature validation - END." ); + return tokenSaml; + } + + + /** + * Load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + */ + public final void loadCryptServiceProvider() throws SAMLEngineException { + LOG.info("Load Cryptographic Service Provider"); + FileInputStream fis = null; + try { + // Dynamically register Bouncy Castle provider. + boolean found = false; + // Check if BouncyCastle is already registered as a provider + final Provider[] providers = Security.getProviders(); + for (int i = 0; i < providers.length; i++) { + if (providers[i].getName().equals( + BouncyCastleProvider.PROVIDER_NAME)) { + found = true; + } + } + + // Register only if the provider has not been previously registered + if (!found) { + LOG.info("SAMLCore: Register Bouncy Castle provider."); + Security.insertProviderAt(new BouncyCastleProvider(), Security + .getProviders().length); + } + + storkOwnKeyStore = KeyStore.getInstance(properties + .getProperty(KEYSTORE_TYPE)); + + LOG.info("Loading KeyInfo from keystore file " + properties.getProperty("keystorePath")); + fis = new FileInputStream(properties + .getProperty("keystorePath")); + + storkOwnKeyStore.load(fis, properties.getProperty( + KEY_STORE_PASS).toCharArray()); + + } catch (Exception e) { + LOG.error("Error loading CryptographicServiceProvider", e); + throw new SAMLEngineException( + "Error loading CryptographicServiceProvider", e); + } finally { + IOUtils.closeQuietly(fis); + } + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base new file mode 100644 index 000000000..a60515593 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; + +/** + * The Class VIDPAuthenticationAttributesBuilder. + * + * @author fjquevedo + */ +public final class VIDPAuthenticationAttributesBuilder extends AbstractSAMLObjectBuilder { + + + /** {@inheritDoc} */ + public VIDPAuthenticationAttributes buildObject() { + return buildObject(SAMLCore.STORK10P_NS.getValue(), VIDPAuthenticationAttributes.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); + } + + /** {@inheritDoc} */ + public VIDPAuthenticationAttributes buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { + return new VIDPAuthenticationAttributesImpl(namespaceURI, localName, namespacePrefix); + } + +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base new file mode 100644 index 000000000..a6e7e7f60 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base @@ -0,0 +1,132 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSignableSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.SPInformation; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class VIDPAuthenticationAttributesImpl. + * + * @author fjquevedo + */ +public final class VIDPAuthenticationAttributesImpl extends AbstractSignableSAMLObject implements +VIDPAuthenticationAttributes { + + private static final Logger LOGGER = LoggerFactory.getLogger(VIDPAuthenticationAttributesImpl.class.getName()); + /** The citizen country code. */ + private CitizenCountryCode citizenCountryCode; + + /** The SP information. */ + private SPInformation spInformation; + + /** + * Instantiates a new requested attributes implement. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected VIDPAuthenticationAttributesImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * getCitizenCountryCode. + * + * @return the citizen country code + */ + public CitizenCountryCode getCitizenCountryCode() { + return citizenCountryCode; + } + + /** + * getSPInformation + * + * @return the SP information + */ + public SPInformation getSPInformation() { + return spInformation; + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * + */ + public List getOrderedChildren() { + final ArrayList children = new ArrayList(); + + children.add(citizenCountryCode); + children.add(spInformation); + + if (getSignature() != null) { + children.add(getSignature()); + } + + return Collections.unmodifiableList(children); + + } + + /** + * Gets the signature reference id. + * + * @return the signature reference id + * + */ + public String getSignatureReferenceID() { + return null; + } + + /** + * Sets the citizen country code. + * + * @param newCitizenCountryCode the new citizen country code + * + */ + public void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode) { + this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); + } + + /** + * Sets the SP information. + * + * @param newSPInformation the new SP information + * + */ + public void setSPInformation(SPInformation newSPInformation) { + this.spInformation = prepareForAssignment(this.spInformation, newSPInformation); + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base new file mode 100644 index 000000000..5635ddd6b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base @@ -0,0 +1,33 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class VIDPAuthenticationAttributesMarshaller. + * + * @author fjquevedo + */ +public class VIDPAuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Instantiates a new vIDP authentication attributes marshaller. + */ + public VIDPAuthenticationAttributesMarshaller() { + super(); + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base new file mode 100644 index 000000000..1de300c03 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base @@ -0,0 +1,55 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.SPInformation; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; + +/** + * The Class VIDPAuthenticationAttributesUnmarshaller. + * + * @author fjquevedo + */ +public class VIDPAuthenticationAttributesUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException the unmarshalling exception + * + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final VIDPAuthenticationAttributes vIDPAuthenticationAttr = (VIDPAuthenticationAttributes) parentObject; + + if (childObject instanceof CitizenCountryCode) { + vIDPAuthenticationAttr.setCitizenCountryCode((CitizenCountryCode) childObject); + } else if (childObject instanceof SPInformation) { + vIDPAuthenticationAttr.setSPInformation((SPInformation) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..e26da6d04 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Implementations of STORK 1.0 core specification types and elements. + */ +package eu.stork.peps.auth.engine.core.impl; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.class new file mode 100644 index 000000000..afc14d3f2 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.class new file mode 100644 index 000000000..6f172c1aa Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.class new file mode 100644 index 000000000..a6652789e Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.class new file mode 100644 index 000000000..e7dc21755 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.class new file mode 100644 index 000000000..9cac304bc Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.class new file mode 100644 index 000000000..aed48708c Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.class new file mode 100644 index 000000000..f2c8bfebf Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.class new file mode 100644 index 000000000..203db3aa9 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.class new file mode 100644 index 000000000..6d2a92266 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.class new file mode 100644 index 000000000..853785a39 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.class new file mode 100644 index 000000000..380ed7f51 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.class new file mode 100644 index 000000000..cbacf3d68 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.class new file mode 100644 index 000000000..7526f5cd5 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.class new file mode 100644 index 000000000..e7fe1ebcd Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.class new file mode 100644 index 000000000..f7b83f795 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.class new file mode 100644 index 000000000..c52ffcb3a Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.class new file mode 100644 index 000000000..3a339f9b6 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.class new file mode 100644 index 000000000..1b7c57587 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.class new file mode 100644 index 000000000..0ef2bb926 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.class new file mode 100644 index 000000000..aa6cec8bc Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.class new file mode 100644 index 000000000..d71b8a49f Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.class new file mode 100644 index 000000000..2e63811cb Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.class new file mode 100644 index 000000000..7ca4a54b4 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.class new file mode 100644 index 000000000..9d792d441 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.class new file mode 100644 index 000000000..6e09ce030 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.class new file mode 100644 index 000000000..77cde25fb Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.class new file mode 100644 index 000000000..e632197eb Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.class new file mode 100644 index 000000000..9d417de23 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.class new file mode 100644 index 000000000..42e05a404 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.class new file mode 100644 index 000000000..384a6e7dd Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.class new file mode 100644 index 000000000..fda5bb7a6 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.class new file mode 100644 index 000000000..e53adc5f3 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.class new file mode 100644 index 000000000..ef70ad990 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.class new file mode 100644 index 000000000..dbedcb2e0 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.class new file mode 100644 index 000000000..6850640c8 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.class new file mode 100644 index 000000000..a41a3c9a6 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.class new file mode 100644 index 000000000..b67c2a5d2 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.class new file mode 100644 index 000000000..be7ca2276 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.class new file mode 100644 index 000000000..e27c35c5a Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.class new file mode 100644 index 000000000..a1e50ebc1 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.class new file mode 100644 index 000000000..c0c6c0767 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.class new file mode 100644 index 000000000..8d9daeb02 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.class new file mode 100644 index 000000000..557b015a2 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.class new file mode 100644 index 000000000..f719c2b52 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.class new file mode 100644 index 000000000..a8e9e515b Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.class new file mode 100644 index 000000000..2cd4cb86c Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.class new file mode 100644 index 000000000..0c6d72ad0 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.class new file mode 100644 index 000000000..f60490c63 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.class new file mode 100644 index 000000000..2fbf6110a Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.class new file mode 100644 index 000000000..40f461f2f Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.class new file mode 100644 index 000000000..b3b226c46 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.class new file mode 100644 index 000000000..bec370625 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.class new file mode 100644 index 000000000..beb527290 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.class new file mode 100644 index 000000000..d03d3452c Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.class new file mode 100644 index 000000000..f2595a336 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.class new file mode 100644 index 000000000..117a436c9 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.class new file mode 100644 index 000000000..bd026d321 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.class new file mode 100644 index 000000000..3fa205f5b Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.class new file mode 100644 index 000000000..5980b2c08 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.class new file mode 100644 index 000000000..30d44b660 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.class new file mode 100644 index 000000000..caf4c794e Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.class new file mode 100644 index 000000000..73d233cc0 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.class new file mode 100644 index 000000000..95005e521 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.class new file mode 100644 index 000000000..4523e4d8f Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/package-info.class new file mode 100644 index 000000000..d096453e9 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/package-info.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/package-info.class new file mode 100644 index 000000000..6782c35f5 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/package-info.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops new file mode 100644 index 000000000..d5bd68d13 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops @@ -0,0 +1,23 @@ +K 25 +svn:wc:ra_dav:version-url +V 102 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/package-info.java +END +ExtensionsSchemaValidator.java +K 25 +svn:wc:ra_dav:version-url +V 133 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.java +END +QAAAttributeSchemaValidator.java +K 25 +svn:wc:ra_dav:version-url +V 135 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.java +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries new file mode 100644 index 000000000..abba3b480 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +package-info.java +file + + + + +2013-12-20T12:27:57.310475Z +cf18b043ca5fc2869360c23c2f78c37c +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +810 + +ExtensionsSchemaValidator.java +file + + + + +2013-12-20T12:27:57.310475Z +88793567b50e1817e8b534b99b7fd40e +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2003 + +QAAAttributeSchemaValidator.java +file + + + + +2013-12-20T12:27:57.310475Z +126bf77d5e22d5609d042e0445160382 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2061 + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base new file mode 100644 index 000000000..760d9c188 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base @@ -0,0 +1,61 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.validator; + +import java.util.List; + +import org.opensaml.saml2.common.Extensions; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class ExtensionsSchemaValidator. + * + * @author fjquevedo + */ +public class ExtensionsSchemaValidator implements Validator { + + + /** + * validate the extensions. + * + * @param extensions the extensions + * + * @throws ValidationException the validation exception + */ + public final void validate(final Extensions extensions) + throws ValidationException { + if (extensions.getUnknownXMLObjects() == null + || extensions.getUnknownXMLObjects().size() <= 0) { + throw new ValidationException("Extension element is empty or not exist."); + } + + List qaa = extensions.getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME); + + if (qaa.size() == 1) { + final Validator validatorQaa = new QAAAttributeSchemaValidator(); + validatorQaa.validate((QAAAttribute) qaa.get(0)); + } else { + throw new ValidationException( + "Extensions must contain only one element QAALevel."); + } + + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base new file mode 100644 index 000000000..be5dc8c34 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base @@ -0,0 +1,65 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.validator; + +import org.opensaml.xml.util.DatatypeHelper; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeSchemaValidator. + * + * @author fjquevedo + */ +public class QAAAttributeSchemaValidator implements Validator { + + + /** + * Validate action. + * + * @param qaa the quality authentication assurance level attribute + * + * @throws ValidationException the validation exception + */ + public final void validate(final QAAAttribute qaa) throws ValidationException { + validateAction(qaa); + } + + + /** + * Validate action. + * + * @param qaaAttribute the quality authentication assurance level attribute. + * + * @throws ValidationException the validation exception + */ + protected final void validateAction(final QAAAttribute qaaAttribute) + throws ValidationException { + if (DatatypeHelper.isEmpty(qaaAttribute.getQaaLevel())) { + throw new ValidationException("QAALevel label must be specified."); + } + + final int qaa = Integer.valueOf(qaaAttribute.getQaaLevel()); + + if (qaa < QAAAttribute.MIN_VALUE || qaa > QAAAttribute.MAX_VALUE) { + throw new ValidationException( + "QAALevel label must be greater than 0."); + } + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..b98cf7157 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Validation rules for STORK 1.0 core types and elements. + */ +package eu.stork.peps.auth.engine.core.validator; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.class new file mode 100644 index 000000000..484b3e944 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.class new file mode 100644 index 000000000..1fbb6d315 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/package-info.class new file mode 100644 index 000000000..f7c2913cd Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/package-info.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/package-info.class new file mode 100644 index 000000000..de91b8302 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/package-info.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/all-wcprops new file mode 100644 index 000000000..96b3f2328 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/all-wcprops @@ -0,0 +1,41 @@ +K 25 +svn:wc:ra_dav:version-url +V 89 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 107 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/package-info.java +END +ConfigurationCreator.java +K 25 +svn:wc:ra_dav:version-url +V 115 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java +END +ConfigurationReader.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java +END +ConfigurationSingleton.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationSingleton.java +END +InstanceEngine.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/InstanceEngine.java +END +ConfigurationEngine.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationEngine.java +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/entries new file mode 100644 index 000000000..b811dc64b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +ConfigurationReader.java +file + + + + +2013-12-20T12:27:57.462475Z +31bb8b4c7e74e039c561bf974dea7c33 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +6979 + +ConfigurationSingleton.java +file + + + + +2013-12-20T12:27:57.466475Z +4350e34e9ec48ce7ad03db6a130559f2 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2367 + +InstanceEngine.java +file + + + + +2013-12-20T12:27:57.466475Z +36fb20db43ded05922bf0bbf785e5d48 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1820 + +ConfigurationEngine.java +file + + + + +2013-12-20T12:27:57.466475Z +99eae7ae70fa5bf4667edfb7912696c2 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1726 + +package-info.java +file + + + + +2013-12-20T12:27:57.462475Z +36f3c0e11d20c8f980d3115b21a23df0 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +806 + +ConfigurationCreator.java +file + + + + +2013-12-20T12:27:57.462475Z +4c130e8c9749dd63e58d57d4d699b7ee +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +4114 + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base new file mode 100644 index 000000000..2fabff7d6 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base @@ -0,0 +1,127 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.InvalidPropertiesFormatException; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class InstanceCreator. + * + * @author fjquevedo + */ +public final class ConfigurationCreator { + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(ConfigurationCreator.class.getName()); + + /** + * Creates the configuration. + * + * @param instanceConfs the instance configuration + * + * @return the map< string, map< string, object>> + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static Map> createConfiguration( + final Map instanceConfs) throws STORKSAMLEngineException { + + final HashMap> instances = + new HashMap>(); + + LOGGER.info("Create configuration."); + try { + // Only create instances for SAMLEngine configuration. + // INSTANCE + for (Map.Entry entry : instanceConfs + .entrySet()) { + final InstanceEngine iEngine = entry.getValue(); + + final Map intance = new HashMap(); + + // CONFIGURATION + for (ConfigurationEngine configuration : iEngine + .getConfiguration()) { + // Properties only for configuration SamlEngine. + if (configuration.getName().equalsIgnoreCase( + "SamlEngineConf")) { + intance.put(configuration.getName(), + getNewInstance(configuration.getParameters() + .get("fileConfiguration"))); + } else { + intance.put(configuration.getName(), configuration + .getParameters()); + } + } + instances.put(entry.getKey(), intance); + } + } catch (STORKSAMLEngineException ex) { + LOGGER.error("Can not create instance from file configuration."); + throw new STORKSAMLEngineException(ex); + } + return instances; + } + + + /** + * Gets the new instance. + * + * @param fileName the file name + * + * @return the properties from the new instance + * + * @throws STORKSAMLEngineException the STORKSAML engine + * runtime exception + */ + private static Properties getNewInstance(final String fileName) + throws STORKSAMLEngineException { + LOGGER.info("Create file configuration properties to Stork Saml Engine."); + InputStream fileEngineProp = null; + try { + fileEngineProp = ConfigurationCreator.class + .getResourceAsStream("/" + fileName); + final Properties configuration = new Properties(); + configuration.loadFromXML(fileEngineProp); + return configuration; + } catch (InvalidPropertiesFormatException e) { + LOGGER.error("Invalid properties format."); + throw new STORKSAMLEngineException(e); + } catch (IOException e) { + LOGGER.error("Error read file: " + fileName); + throw new STORKSAMLEngineException(e); + } finally { + IOUtils.closeQuietly(fileEngineProp); + } + } + + /** + * Instantiates a new instance creator. + */ + private ConfigurationCreator() { + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base new file mode 100644 index 000000000..910f4398e --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base @@ -0,0 +1,69 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.util.Map; + +/** + * The Class ConfigurationEngine. + * + * @author fjquevedo + */ +public class ConfigurationEngine { + + /** The name of the configuration file. */ + private String name; + + /** The parameters. */ + private Map parameters; + + /** + * Gets the name. + * + * @return the name + */ + public final String getName() { + return name; + } + + /** + * Gets the parameters. + * + * @return the parameters + */ + public final Map getParameters() { + return parameters; + } + + /** + * Sets the name. + * + * @param newName the new name + */ + public final void setName(final String newName) { + this.name = newName; + } + + /** + * Sets the parameters. + * + * @param newParameters the parameters + */ + public final void setParameters(final Map newParameters) { + this.parameters = newParameters; + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base new file mode 100644 index 000000000..374cf3fc3 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base @@ -0,0 +1,224 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class ConfigurationReader. + * + * @author fjquevedo + */ +public final class ConfigurationReader { + + /** The Constant SAML_ENGINE_CONFIGURATION_FILE. */ + private static final String ENGINE_CONF_FILE = "SamlEngine.xml"; + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(ConfigurationReader.class.getName()); + + /** The Constant NODE_CONFIGURATION. */ + private static final String NODE_CONF = "configuration"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_CONF_NAME = "name"; + + /** The Constant NODE_INSTANCE_NAME. */ + private static final String NODE_INST_NAME = "name"; + + /** The Constant NODE_INSTANCE. */ + private static final String NODE_INSTANCE = "instance"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_PARAM_NAME = "name"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_PARAM_VALUE = "value"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_PARAMETER = "parameter"; + + /** + * Generate parameters. + * + * @param configurationNode the configuration node + * + * @return the map< string, string> + */ + private static Map generateParam( + final Element configurationNode) { + + final HashMap parameters = new HashMap(); + + final NodeList parameterNodes = configurationNode + .getElementsByTagName(NODE_PARAMETER); + + String parameterName; + String parameterValue; + + for (int k = 0; k < parameterNodes.getLength(); ++k) { + // for every parameter find, process. + final Element parameterNode = (Element) parameterNodes.item(k); + parameterName = parameterNode.getAttribute(NODE_PARAM_NAME); + parameterValue = parameterNode.getAttribute(NODE_PARAM_VALUE); + + // verified the content. + if (StringUtils.isBlank(parameterName) + || StringUtils.isBlank(parameterValue)) { + throw new STORKSAMLEngineRuntimeException( + "Error reader parameters (name - value)."); + } else { + parameters.put(parameterName.trim(), parameterValue.trim()); + } + } + return parameters; + } + + /** + * Read configuration. + * + * @return the map< string, instance engine> + * + * @throws SAMLEngineException the STORKSAML engine runtime + * exception + */ + public static Map readConfiguration() + throws SAMLEngineException { + + LOGGER.info("Init reader: " + ENGINE_CONF_FILE); + final Map instanceConfs = + new HashMap(); + + Document document = null; + // Load configuration file + final DocumentBuilderFactory factory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder builder; + + InputStream engineConf = null; + try { + + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + + builder = factory.newDocumentBuilder(); + + engineConf = ConfigurationReader.class + .getResourceAsStream("/" + ENGINE_CONF_FILE); + + document = builder.parse(engineConf); + + // Read instance + final NodeList list = document.getElementsByTagName(NODE_INSTANCE); + + for (int indexElem = 0; indexElem < list.getLength(); ++indexElem) { + final Element element = (Element) list.item(indexElem); + + final InstanceEngine instanceConf = new InstanceEngine(); + + // read every configuration. + final String instanceName = element + .getAttribute(NODE_INST_NAME); + + if (StringUtils.isBlank(instanceName)) { + throw new STORKSAMLEngineRuntimeException( + "Error reader instance name."); + } + instanceConf.setName(instanceName.trim()); + + final NodeList confNodes = element + .getElementsByTagName(NODE_CONF); + + for (int indexNode = 0; indexNode < confNodes.getLength(); ++indexNode) { + + final Element configurationNode = (Element) confNodes + .item(indexNode); + + final String configurationName = configurationNode + .getAttribute(NODE_CONF_NAME); + + if (StringUtils.isBlank(configurationName)) { + throw new STORKSAMLEngineRuntimeException( + "Error reader configuration name."); + } + + final ConfigurationEngine confSamlEngine = + new ConfigurationEngine(); + + // Set configuration name. + confSamlEngine.setName(configurationName.trim()); + + // Read every parameter for this configuration. + final Map parameters = + generateParam(configurationNode); + + // Set parameters + confSamlEngine.setParameters(parameters); + + // Add parameters to the configuration. + instanceConf.getConfiguration().add(confSamlEngine); + } + + // Add to the list of configurations. + instanceConfs.put(element.getAttribute(NODE_INST_NAME), + instanceConf); + } + + } catch (SAXException e) { + LOGGER.error("Error: init library parser."); + throw new SAMLEngineException(e); + } catch (ParserConfigurationException e) { + LOGGER.error("Error: parser configuration file xml."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOGGER.error("Error: read configuration file."); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(engineConf); + } + + return instanceConfs; + } + + /** + * Instantiates a new configuration reader. + */ + private ConfigurationReader() { + + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base new file mode 100644 index 000000000..53cea621d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base @@ -0,0 +1,74 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class InstanceCreator. + * + * @author fjquevedo + */ +public final class ConfigurationSingleton { + + /** The instance of every engine SAML. */ + private static Map instanceConfigs; + + /** The instances of SAML engine. */ + private static Map> instances; + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(ConfigurationSingleton.class.getName()); + + static { + LOGGER.debug("Read all file configurations. (instances of SAMLEngine)"); + try { + instanceConfigs = ConfigurationReader.readConfiguration(); + } catch (SAMLEngineException e) { + LOGGER.error("Error read configuration file."); + throw new STORKSAMLEngineRuntimeException(e); + } + } + + /** + * Gets the new instance. + * + * @param fileName the file name + * + * @return the properties from the new instance + * + * @throws STORKSAMLEngineException the STORKSAML engine runtime exception + */ + private static Map> getInstance( + final String fileName) throws STORKSAMLEngineException { + return ConfigurationCreator.createConfiguration(instanceConfigs); + } + + /** + * Instantiates a new instance creator. + */ + private ConfigurationSingleton() { + } + +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base new file mode 100644 index 000000000..e0e2d1965 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base @@ -0,0 +1,70 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.util.ArrayList; +import java.util.List; + +/** + * The Class InstanceConfiguration. + * + * @author fjquevedo + */ +public class InstanceEngine { + + /** The configuration. */ + private List configuration = new ArrayList(); + + /** The name. */ + private String name; + + /** + * Gets the parameters. + * + * @return the parameters + */ + public final List getConfiguration() { + return this.configuration; + } + + /** + * Gets the name. + * + * @return the name + */ + public final String getName() { + return name; + } + + /** + * Sets the parameters. + * + * @param newConfiguration the new parameters + */ + public final void setConfiguration(final List newConfiguration) { + this.configuration = newConfiguration; + } + + /** + * Sets the name. + * + * @param newName the new name + */ + public final void setName(final String newName) { + this.name = newName; + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..6d0b54297 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes necessary to create a SAML message instance. + */ +package eu.stork.peps.configuration; diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationCreator.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationCreator.class new file mode 100644 index 000000000..533ca2f81 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationCreator.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationEngine.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationEngine.class new file mode 100644 index 000000000..9cb1ebaba Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationEngine.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationReader.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationReader.class new file mode 100644 index 000000000..e65e54d4f Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationReader.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationSingleton.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationSingleton.class new file mode 100644 index 000000000..91bb3d652 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationSingleton.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/InstanceEngine.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/InstanceEngine.class new file mode 100644 index 000000000..9d07bac68 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/InstanceEngine.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/package-info.class new file mode 100644 index 000000000..917e6943f Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/package-info.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/all-wcprops new file mode 100644 index 000000000..d4b9b9008 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25 +svn:wc:ra_dav:version-url +V 86 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions +END +SAMLEngineException.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java +END +STORKSAMLEngineException.java +K 25 +svn:wc:ra_dav:version-url +V 116 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 104 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/package-info.java +END +STORKSAMLEngineRuntimeException.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.java +END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/entries new file mode 100644 index 000000000..6493ed6e8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +STORKSAMLEngineRuntimeException.java +file + + + + +2013-12-20T12:27:57.454475Z +aebe4e4afb2f11cf42448486970a5d85 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1812 + +SAMLEngineException.java +file + + + + +2013-12-20T12:27:57.454475Z +38d2d1ec4d590abab4bb36d845d9f86b +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1710 + +STORKSAMLEngineException.java +file + + + + +2013-12-20T12:27:57.454475Z +622c95d2e770b38dafe815bcfaae8994 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3460 + +package-info.java +file + + + + +2013-12-20T12:27:57.454475Z +56145f85c2084454a3c223dd9e103846 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +792 + diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base new file mode 100644 index 000000000..366379ad0 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base @@ -0,0 +1,57 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.exceptions; + +/** + * The Class SAMLEngineException. + * + * @author fjquevedo + */ +public class SAMLEngineException extends Exception { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 2611361164977849837L; + + /** + * Instantiates a new SAMLEngine exception. + * + * @param wrappedException the wrapped exception + */ + public SAMLEngineException(final Exception wrappedException) { + super(wrappedException); + } + + /** + * Instantiates a new SAMLEngine exception. + * + * @param message the message + */ + public SAMLEngineException(final String message) { + super(message); + } + + /** + * Instantiates a new SAMLEngine exception. + * + * @param message the message + * @param wrappedException the wrapped exception + */ + public SAMLEngineException(final String message, + final Exception wrappedException) { + super(message, wrappedException); + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base new file mode 100644 index 000000000..bddcbd1b3 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base @@ -0,0 +1,135 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.exceptions; + +/** + * The Class STORKSAMLEngineException. + * + * @author fjquevedo + */ +public class STORKSAMLEngineException extends Exception { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = -8319723167019122930L; + + /** The error code. */ + private String errorCode; + + /** The error detail. */ + private String errorDetail; + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineException(final Exception wrappedException) { + super(wrappedException); + } + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param errorMessage the error message + */ + public STORKSAMLEngineException(final String errorMessage) { + super(errorMessage); + } + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param message the message + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineException(final String message, + final Exception wrappedException) { + super(message, wrappedException); + } + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param newErrorCode the error code + * @param errorMessage the error message + * @param newErrorDetail the error detail + */ + public STORKSAMLEngineException(final String newErrorCode, + final String errorMessage, final String newErrorDetail) { + super(errorMessage); + this.errorCode = newErrorCode; + this.errorDetail = newErrorDetail; + } + + /** + * Gets the error code. + * + * @return the error code + */ + public final String getErrorCode() { + return this.errorCode; + } + + /** + * Gets the error detail. + * + * @return the error detail + */ + public final String getErrorDetail() { + return errorDetail; + } + + /** + * Gets the error message. + * + * @return the error message + */ + public final String getErrorMessage() { + return super.getMessage(); + } + + + /** + * Gets the message. + * + * @return the message of the exception. + * + * @see java.lang.Throwable#getMessage() + */ + public final String getMessage() { + return "Error (no. " + errorCode + ") processing request : " + + super.getMessage(); + } + + /** + * Sets the error code. + * + * @param newErrorCode the new error code + */ + public final void setErrorCode(final String newErrorCode) { + this.errorCode = newErrorCode; + } + + /** + * Sets the error detail. + * + * @param newErrorDetail the new error detail + */ + public final void setErrorDetail(final String newErrorDetail) { + this.errorDetail = newErrorDetail; + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base new file mode 100644 index 000000000..30b9b49b4 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.exceptions; + +/** + * The Class STORKSAMLEngineRuntimeException. + * + * @author fjquevedo + */ +public class STORKSAMLEngineRuntimeException extends RuntimeException { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 5829810358581493517L; + + /** + * Instantiates a new sTORKSAML engine runtime exception. + * + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineRuntimeException(final Exception wrappedException) { + super(wrappedException); + } + + /** + * Creates a new instance of application exception. + * + * @param cause the exception cause. + */ + public STORKSAMLEngineRuntimeException(final String cause) { + super(cause); + } + + /** + * Instantiates a new sTORKSAML engine runtime exception. + * + * @param message the message + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineRuntimeException(final String message, + final Exception wrappedException) { + super(message, wrappedException); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..0c34528fc --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes for STORK exceptions management. + */ +package eu.stork.peps.exceptions; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/SAMLEngineException.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/SAMLEngineException.class new file mode 100644 index 000000000..9db600cf5 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/SAMLEngineException.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.class new file mode 100644 index 000000000..dcda3167b Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.class new file mode 100644 index 000000000..d3ad1ee3c Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.class differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/package-info.class new file mode 100644 index 000000000..7edb99f3b Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/package-info.class differ diff --git a/id/server/stork2-saml-engine/build/classes/test/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/.svn/all-wcprops new file mode 100644 index 000000000..ead80d4e8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 57 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test +END diff --git a/id/server/stork2-saml-engine/build/classes/test/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/.svn/entries new file mode 100644 index 000000000..1b6d0b3e1 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +resources +dir + +java +dir + diff --git a/id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops new file mode 100644 index 000000000..56c8ee113 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 62 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java +END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/.svn/entries new file mode 100644 index 000000000..ca124ed28 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +eu +dir + diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/all-wcprops new file mode 100644 index 000000000..e00b13d5a --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 65 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu +END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/entries new file mode 100644 index 000000000..cc3e19816 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +stork +dir + diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/all-wcprops new file mode 100644 index 000000000..ac0852630 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 71 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork +END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/entries new file mode 100644 index 000000000..66d2ea82a --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +peps +dir + diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/all-wcprops new file mode 100644 index 000000000..5555d11e2 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 76 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps +END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/entries new file mode 100644 index 000000000..e20bc1c1d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +test +dir + diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops new file mode 100644 index 000000000..ee98ec5bd --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 81 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test +END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/entries new file mode 100644 index 000000000..a7074362f --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +simple +dir + diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops new file mode 100644 index 000000000..063e2de18 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops @@ -0,0 +1,47 @@ +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple +END +StorkResponseTest.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java +END +StorkAttrQueryResponseTest.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java +END +SimpleBaseTest.java +K 25 +svn:wc:ra_dav:version-url +V 107 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 105 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/package-info.java +END +SSETestUtils.java +K 25 +svn:wc:ra_dav:version-url +V 105 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java +END +StorkAttrQueryRequestTest.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java +END +StorkAuthRequestTest.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java +END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries new file mode 100644 index 000000000..0fbc1b254 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +SSETestUtils.java +file + + + + +2013-12-20T12:27:57.274475Z +f9c51e04914afb9a99d52e642c8a6a42 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +5521 + +StorkAttrQueryRequestTest.java +file + + + + +2013-12-20T12:27:57.274475Z +66e336a173f22c2ba55b933157c703c8 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +25393 + +StorkAuthRequestTest.java +file + + + + +2013-12-20T12:27:57.274475Z +c1e89785bc4af791adb9760fd42b7d56 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +31301 + +StorkResponseTest.java +file + + + + +2013-12-20T12:27:57.274475Z +016c270fa1231e25cc1ccf67d0ebf6cf +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +39179 + +StorkAttrQueryResponseTest.java +file + + + + +2013-12-20T12:27:57.274475Z +44021c766949a57b10b61cd466a57b55 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +39559 + +SimpleBaseTest.java +file + + + + +2013-12-20T12:27:57.274475Z +6effea1d03de1bd17fd8d07d3778df58 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1871 + +package-info.java +file + + + + +2013-12-20T12:27:57.274475Z +3cd87d2f80f4a5a4f42ab5bc844dd2f3 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +811 + diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base new file mode 100644 index 000000000..b1443bb0e --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base @@ -0,0 +1,173 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; + +import javax.xml.XMLConstants; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.commons.io.IOUtils; +import org.bouncycastle.util.encoders.Base64; +import org.opensaml.Configuration; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.Marshaller; +import org.opensaml.xml.io.MarshallerFactory; +import org.opensaml.xml.io.MarshallingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * The Class SSETestUtils. + */ +public final class SSETestUtils { + + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(SSETestUtils.class.getName()); + + /** + * Instantiates a new sSE test utils. + */ + private SSETestUtils() { + } + + /** + * Prints the tree DOM. + * + * @param samlToken the SAML token + * @param isIndent the is indent + * + * @return the string + * @throws TransformerException the exception + */ + public static String printTreeDOM(final Element samlToken, final boolean isIndent) throws TransformerException { + // set up a transformer + final TransformerFactory transfac = TransformerFactory.newInstance(); + final Transformer trans = transfac.newTransformer(); + trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + trans.setOutputProperty(OutputKeys.INDENT, String.valueOf(isIndent)); + + // create string from XML tree + final StringWriter stringWriter = new StringWriter(); + final StreamResult result = new StreamResult(stringWriter); + final DOMSource source = new DOMSource(samlToken); + trans.transform(source, result); + final String xmlString = stringWriter.toString(); + + return xmlString; + } + + /** + * Marshall. + * + * @param samlToken the SAML token + * + * @return the byte[] + * + * @throws MarshallingException the marshalling exception + * @throws ParserConfigurationException the parser configuration exception + * @throws TransformerException the transformer exception + */ + public static byte[] marshall(final XMLObject samlToken) + throws MarshallingException, ParserConfigurationException, + TransformerException { + + final javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory + .newInstance(); + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setNamespaceAware(true); + dbf.setIgnoringComments(true); + final javax.xml.parsers.DocumentBuilder docBuild = dbf + .newDocumentBuilder(); + + // Get the marshaller factory + final MarshallerFactory marshallerFactory = Configuration + .getMarshallerFactory(); + + // Get the Subject marshaller + final Marshaller marshaller = marshallerFactory + .getMarshaller(samlToken); + + final Document doc = docBuild.newDocument(); + + // Marshall the SAML token + marshaller.marshall(samlToken, doc); + + // Obtain a byte array representation of the marshalled SAML object + final DOMSource domSource = new DOMSource(doc); + final StringWriter writer = new StringWriter(); + final StreamResult result = new StreamResult(writer); + final TransformerFactory transFact = TransformerFactory.newInstance(); + final Transformer transformer = transFact.newTransformer(); + transformer.transform(domSource, result); + + return writer.toString().getBytes(); + } + + /** + * Encode SAML token. + * + * @param samlToken the SAML token + * + * @return the string + */ + public static String encodeSAMLToken(final byte[] samlToken) { + return new String(Base64.encode(samlToken)); + } + + /** + * Read stork SAML from file. + * + * @param resource the resource + * + * @return the byte[] + * @throws IOException the exception + * + */ + public static byte[] readStorkSamlFromFile(final String resource) + throws IOException { + InputStream inputStream = null; + byte[] bytes; + + try { + inputStream = StorkAuthRequestTest.class + .getResourceAsStream(resource); + + // Create the byte array to hold the data + bytes = new byte[(int) inputStream.available()]; + inputStream.read(bytes); + } catch (IOException e) { + LOG.error("Error read from file: " + resource); + throw e; + } finally { + IOUtils.closeQuietly(inputStream); + } + return bytes; + + } +} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base new file mode 100644 index 000000000..97fa4b7cc --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base @@ -0,0 +1,62 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import org.junit.Test; + +import junit.framework.Assert; +import junit.framework.TestCase; +import eu.stork.peps.auth.engine.STORKSAMLEngine; + +/** + * The Class SimpleBaseTest. Defines a set of test the initialization of the + * SAML engine. + */ +public class SimpleBaseTest extends TestCase { + + /** + * Test SAML engine correct configuration name. + */ + @Test + public final void testSamlEngineCorrectInit() { + Assert.assertNotNull(STORKSAMLEngine.getInstance("CONF1")); + } + + /** + * Test SAML engine error configuration name. + */ + @Test + public final void testSamlEngineErrorNameConf() { + Assert.assertNull(STORKSAMLEngine.getInstance("CONF_ERROR")); + } + + /** + * Test SAML engine error name null. + */ + @Test + public final void testSamlEngineErrorNameNull() { + Assert.assertNull(STORKSAMLEngine.getInstance(null)); + } + + /** + * Test SAML engine correct name configuration with spaces. + */ + @Test + public final void testSamlEngineErrorNameSpaces() { + Assert.assertNotNull(STORKSAMLEngine.getInstance(" CONF1 ")); + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base new file mode 100644 index 000000000..7fa305d3b --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base @@ -0,0 +1,790 @@ +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.Arrays; + +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAttrQueryRequest; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +public class StorkAttrQueryRequestTest { + + /** The engines. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0"); + private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); + private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); + + + /** + * Instantiates a new stork authentication request test. + */ + public StorkAttrQueryRequestTest() { + pal = new PersonalAttributeList(); + + final PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + final ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + final PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + final PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + eIDNumber.setValue(Arrays.asList("ES/IS/1234567890")); + pal.add(eIDNumber); + + final PersonalAttribute givenName = new PersonalAttribute(); + givenName.setName("givenName"); + givenName.setIsRequired(true); + givenName.setValue(Arrays.asList("Sveinbjorn")); + pal.add(givenName); + + destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest"; + //assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + + } + + /** The destination. */ + private String destination; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The service provider id. */ + private String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The List of Personal Attributes. */ + private IPersonalAttributeList pal; + + /** The attribute query request. */ + private static byte[] attrRequest; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkAttrQueryRequestTest.class.getName()); + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + } + + /** + * Test generate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryRequest() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // new parameters + request.setEIDSectorShare(false); + request.setEIDCrossSectorShare(false); + request.setEIDCrossBorderShare(false); + + STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request); + byte[] reqByte = req1.getTokenSaml(); + FileOutputStream output = null; + + try { + output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml")); + output.write(reqByte); + } catch (Exception e) { + e.printStackTrace(); + throw new STORKSAMLEngineException(e); + } finally { + try { output.close(); } catch (Exception e) { throw new STORKSAMLEngineException(e); } + } + + + + + LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); + + request.setCitizenCountryCode("IS"); + LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); + } + + /** + * Test generate authentication request error personal attribute name error. + */ + @Test + public final void testGenerateAttrQueryRequestPALsErr1() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("attrNotValid"); + worngAttr.setIsRequired(true); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + + // news parameters + request.setEIDSectorShare(false); + request.setEIDCrossSectorShare(false); + request.setEIDCrossBorderShare(false); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + /** + * Test generate authentication request error personal attribute value error. + */ + @Test + public final void testGenerateAttrQueryRequestPALsErr2() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute attrNotValid = new PersonalAttribute(); + attrNotValid.setName("attrNotValid"); + attrNotValid.setIsRequired(true); + palWrong.add(attrNotValid); + + + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request authentication assurance level + * negative value. + */ + @Test + public final void testGenerateAttrQueryRequestQaalErr1() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(-1); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request service provider sector null. + */ + @Test + public final void testGenerateAttrQueryRequestSectorErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + + } + } + + /** + * Test generate authentication request service provider institution null. + */ + @Test + public final void testGenerateAttrQueryRequestInstitutionrErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(null); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAttrQueryRequestApplicationErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(null); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider country null. + */ + @Test + public final void testGenerateAttrQueryRequestCountryErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(null); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request error with quality authentication + * assurance level wrong. + */ + @Test + public final void testGenerateAttrQueryRequestQaalErr2() { + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(0); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request personal attribute list null value. + */ + @Test + public final void testGenerateAttrQueryRequestPALErr1() { + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(null); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request null parameter. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestNullParam() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAttrQueryRequest(null); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request error bytes encode. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestErrorEncode() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAttrQueryRequest("messageError".getBytes()); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequest() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + attrRequest = engine.generateSTORKAttrQueryRequest(request).getTokenSaml(); + + final STORKAttrQueryRequest validatedRequest = engine.validateSTORKAttrQueryRequest(attrRequest); + + assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); + + } + + /** + * Test validate data authenticate request. Verified parameters after + * validation. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateDataAttrQueryRequest() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = engine.validateSTORKAttrQueryRequest(attrRequest); + + assertEquals("Sestination incorrect: ", request.getDestination(), destination); + + assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); + + assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); + assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); + assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); + assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); + assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), null); + + } + + /** + * Test validate file attribute query request. Validate from XML file. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAttrQueryRequest() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml"); + + try { + engine.validateSTORKAttrQueryRequest(bytes); + fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + } + } + + /** + * Test validate file authentication request tag delete. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAttrRequestTagDelete() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml"); + + try { + engine.validateSTORKAttrQueryRequest(bytes); + fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + + } + } + + /** + * Test validate authentication request not trusted token. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestNotTrustedErr1() + throws STORKSAMLEngineException { + + try { + final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine + .getInstance("CONF2"); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineNotTrusted + .generateSTORKAttrQueryRequest(request).getTokenSaml(); + + engine.validateSTORKAttrQueryRequest(authReqNotTrust); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("validateSTORKAttrQueryRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test validate authentication request trusted. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestTrusted() + throws STORKSAMLEngineException { + + final STORKSAMLEngine engineTrusted = STORKSAMLEngine + .getInstance("CONF3"); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest( + request).getTokenSaml(); + + // engine ("CONF1") no have trust certificate from "CONF2" + engine.validateSTORKAttrQueryRequest(authReqNotTrust); + + } + + + + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAttrQueryRequestNADA() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(null); + request.setSpApplication(null); + request.setSpCountry(null); + + try { + + engine.validateSTORKAttrQueryRequest(attrRequest); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test validate authentication request with unknown elements. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestWithUnknownElements() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute unknown = new PersonalAttribute(); + unknown.setName("unknown"); + unknown.setIsRequired(true); + pAttList.add(unknown); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + STORKAttrQueryRequest req = new STORKAttrQueryRequest(); + + req = engine3.generateSTORKAttrQueryRequest(request); + + req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); + + assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); + assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); + + } + + /** + * Test generate Request with required elements by default + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + STORKAttrQueryRequest req = new STORKAttrQueryRequest(); + STORKAttrQueryRequest reqTrue = new STORKAttrQueryRequest(); + STORKAttrQueryRequest reqFalse = new STORKAttrQueryRequest(); + + reqTrue = engine.generateSTORKAttrQueryRequest(request); + reqFalse = engine2.generateSTORKAttrQueryRequest(request); + req = engine3.generateSTORKAttrQueryRequest(request); + + + String token = new String(req.getTokenSaml()); + String reqTrueToken = new String(reqTrue.getTokenSaml()); + String reqFalseToken = new String(reqFalse.getTokenSaml()); + + assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); + assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); + assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); + + } + + /** + * Test validating attribute query and getting alias used to save + * the saml trusted certificate into trustore + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAtrrQueryRequestGettingItsAlias() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + STORKAttrQueryRequest req = new STORKAttrQueryRequest(); + + req = engine3.generateSTORKAttrQueryRequest(request); + req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + + req = engine2.generateSTORKAttrQueryRequest(request); + req = engine2.validateSTORKAttrQueryRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base new file mode 100644 index 000000000..27c6cfe39 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base @@ -0,0 +1,920 @@ +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.junit.Ignore; +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAttrQueryRequest; +import eu.stork.peps.auth.commons.STORKAttrQueryResponse; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.commons.STORKStatusCode; +import eu.stork.peps.auth.commons.STORKSubStatusCode; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +public class StorkAttrQueryResponseTest { + + /** The engine. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + + /** + * Gets the engine. + * + * @return the engine + */ + public static STORKSAMLEngine getEngine() { + return engine; + } + + /** + * Sets the engine. + * + * @param newEngine the new engine + */ + public static void setEngine(final STORKSAMLEngine newEngine) { + StorkAttrQueryResponseTest.engine = newEngine; + } + + /** The destination. */ + private static String destination; + + /** The service provider sector. */ + private static String spSector; + + /** The service provider institution. */ + private static String spInstitution; + + /** The service provider application. */ + private static String spApplication; + + /** The service provider country. */ + private static String spCountry; + + /** The service provider id. */ + private static String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The state. */ + private static String state = "IS"; + + /** The town. */ + private static String town = "Reykjavik"; + + /** The postal code. */ + private static String postalCode = "105"; + + /** The street name. */ + private static String streetName = "Gudrunartun"; + + /** The street number. */ + private static String streetNumber = "10"; + + /** The List of Personal Attributes. */ + private static IPersonalAttributeList pal; + + /** The assertion consumer URL. */ + private static String assertConsumerUrl; + + /** The attribute query request. */ + private static byte[] attrQueryRequest; + + /** The attribute query response. */ + private static byte[] attrQueryResponse; + + /** The attribute query request. */ + private static STORKAttrQueryRequest attrQueryenRequest; + + /** The attribute query response. */ + private static STORKAttrQueryResponse attrQeuryenResponse; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkAttrQueryResponseTest.class.getName()); + + /** + * Instantiates a new stork response test. + */ + public StorkAttrQueryResponseTest() { + super(); + } + + /** The IP address. */ + private static String ipAddress; + + /** The destination URL. */ + private static String destinationUrl; + + /** The is hashing. */ + private final boolean isHashing = Boolean.TRUE; + + /** The is not hashing. */ + private final boolean isNotHashing = Boolean.FALSE; + + /** The ERROR text. */ + private static final String ERROR_TXT = "generateAttrQueryResponse(...) should've thrown an STORKSAMLEngineException!"; + + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + + pal = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + pal.add(eIDNumber); + + final PersonalAttribute givenName = new PersonalAttribute(); + givenName.setName("givenName"); + givenName.setIsRequired(true); + pal.add(givenName); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + pal.add(canRessAddress); + + PersonalAttribute newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + pal.add(newAttribute); + + destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + spSector = "EDU001"; + spInstitution = "OXF001"; + spApplication = "APP001"; + spCountry = "EN"; + + spId = "EDU001-APP001-APP001"; + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + request.setDestination(destination); + //request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + //request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(request) + .getTokenSaml(); + + attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest); + + } catch (STORKSAMLEngineException e) { + fail("Error create STORKAuthnRequest"); + } + + ipAddress = "111.222.333.444"; + + destinationUrl = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + + pal = new PersonalAttributeList(); + + isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ages = new ArrayList(); + + ages.add("16"); + ages.add("18"); + + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(isAgeOver); + + dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(dateOfBirth); + + eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789IS"); + eIDNumber.setValue(idNumber); + eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(eIDNumber); + + canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + + canRessAddress.setComplexValue(address); + pal.add(canRessAddress); + + newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap values = new HashMap(); + + values.put("value1", "value1"); + values.put("value2", "value2"); + values.put("value3", "value3"); + values.put("value4", "value4"); + + newAttribute.setComplexValue(values); + pal.add(newAttribute); + + } + + /** + * Test generate attribute query request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryResponse() throws STORKSAMLEngineException { + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + final STORKAttrQueryResponse storkResponse = getEngine() + .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, + destinationUrl, isNotHashing); + + attrQueryResponse = storkResponse.getTokenSaml(); + + FileOutputStream output = null; + + try { + output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml")); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + output.write(attrQueryResponse); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); + + + } + + /** + * Test validation id parameter mandatory. + */ + @Test + public final void testResponseMandatoryId() { + final String identifier = attrQueryenRequest.getSamlId(); + attrQueryenRequest.setSamlId(null); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, destinationUrl, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setSamlId(identifier); + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response in response to err1. + */ + @Test + public final void testResponseMandatoryIssuer() { + + final String issuer = attrQueryenRequest.getIssuer(); + attrQueryenRequest.setIssuer(null); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, destinationUrl, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setIssuer(issuer); + LOG.error("Error"); + } + } + + + /** + * Test generate attribute query response assertion consumer null. + */ + /*@Test + public final void testResponseMandatoryAssertionConsumerServiceURL() { + final String asserConsumerUrl = attrQueryenRequest + .getAssertionConsumerServiceURL(); + attrQueryenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response IP address null. + */ + @Test + public final void testResponseValidationIP() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, null, + destinationUrl, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response with personal attribute list null. + */ + @Test + public final void testResponseMandatoryPersonalAttributeList() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(null); + + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, destinationUrl, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate attribute query response token null. + */ + @Test + public final void testResponseInvalidParametersToken() { + try { + getEngine().validateSTORKAttrQueryResponse(null, ipAddress); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate attribute query response IP null. + */ + @Test + public final void STORKAttrQueryResponse() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response parameter name wrong. + */ + @Test + public final void testResponseInvalidParametersAttr() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("AttrWrong"); + wrongList.add(worngAttr); + + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrSimpleValue() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoValue() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoName() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null complex value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrComplexValue() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setComplexValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test validate attribute query response IP distinct and disabled validation + * IP. + */ + @Test + public final void testResponseInvalidParametersIPDistinct() { + try { + // ipAddress origin "111.222.333.444" + // ipAddrValidation = false + // Subject Confirmation Bearer. + + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, "127.0.0.1"); + } catch (STORKSAMLEngineException e) { + fail("validateAttributeQueryResponse(...) should've thrown an STORKSAMLEngineException!"); + LOG.error("Error"); + } + } + + /** + * Test response invalid parameters invalid token. + */ + @Test + public final void testResponseInvalidParametersTokenMsg() { + try { + // ipAddress origin "111.222.333.444" + // Subject Confirmation Bearer. + getEngine().validateSTORKAttrQueryResponse("errorMessage".getBytes(), + ipAddress); + fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate attribute query response is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + /*@Test + public final void testValidateAuthenticationResponseIsFail() + throws STORKSAMLEngineException { + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertFalse("Generate incorrect response: ", attrQeuryenResponse.isFail()); + } + + /** + * Test validate attribute query response destination. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseDestination() + throws STORKSAMLEngineException { + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertEquals("Destination incorrect: ", + attrQeuryenResponse.getInResponseTo(), attrQueryenRequest.getSamlId()); + } + + /** + * Test validate attribute query response values. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseValuesComplex() + throws STORKSAMLEngineException { + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertEquals("Country incorrect:", attrQeuryenResponse.getCountry(), "ES"); + + final Iterator iterator = attrQeuryenResponse + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + final PersonalAttribute attribute = iterator.next(); + if (attribute.getName().equalsIgnoreCase( + "canonicalResidenceAddress")) { + assertEquals("State incorrect: ", state, attribute + .getComplexValue().get("state")); + assertEquals("Town incorrect: ", town, attribute + .getComplexValue().get("town")); + assertEquals("Postal code incorrect: ", postalCode, attribute + .getComplexValue().get("postalCode")); + assertEquals("Street name incorrect: ", streetName, attribute + .getComplexValue().get("streetName")); + assertEquals("Street number incorrect: ", streetNumber, + attribute.getComplexValue().get("streetNumber")); + } + } + } + + /** + * Test generate attribute query response fail in response to it's null. + * @throws STORKSAMLEngineException + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test //( expected=STORKSAMLEngineException.class) + public final void testGenerateAttrQueryResponseFailInResponseToNull() throws STORKSAMLEngineException { + final String identifier = attrQueryenRequest.getSamlId(); + attrQueryenRequest.setSamlId(null); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setSamlId(identifier); + LOG.error("Error"); + //throw new STORKSAMLEngineException(e); + } + } + + /** + * Test generate attribute query response fail assertion consumer URL err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + /*@Test + public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() + throws STORKSAMLEngineException { + + final String assertConsumerUrl = attrQueryenRequest + .getAssertionConsumerServiceURL(); + attrQueryenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + attrQueryResponse = getEngine().generateSTORKAuthnResponseFail(attrQueryenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response fail code error err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryResponseFailCodeErrorNull() + throws STORKSAMLEngineException { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setStatusCode(null); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + fail("generateAttrQueryResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test generate attribute query request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryResponse() throws STORKSAMLEngineException { + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(dateOfBirth); + + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + complex.put("one", "two"); + + //eIDNumber.setValue(null); + //eIDNumber.setValue(idNumber); + //eIDNumber.setComplexValue(complex); + + eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); + palist.add(eIDNumber); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + + canRessAddress.setComplexValue(address); + palist.add(canRessAddress); + + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAttrQueryResponse storkResponse = getEngine() + .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, + destinationUrl, isNotHashing); + + attrQueryResponse = storkResponse.getTokenSaml(); + LOG.info("Request id: " + attrQueryenRequest.getSamlId()); + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); + + + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + LOG.info("RESPONSE ID: " + attrQeuryenResponse.getSamlId()); + LOG.info("RESPONSE IN_RESPONSE_TO: " + attrQeuryenResponse.getInResponseTo()); + LOG.info("RESPONSE COUNTRY: " + attrQeuryenResponse.getCountry()); + + } + + + + + + /** + * Test validate attribute query response fail is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryResponseFailIsFail() + throws STORKSAMLEngineException { + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage("message"); + + attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + + LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(attrQueryResponse)); + + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + LOG.info("COUNTRY: " + attrQeuryenResponse.getCountry()); + assertTrue("Generate incorrect response: ", attrQeuryenResponse.isFail()); + } + + /** + * Test generate/validate response with signedDoc + * + * @throws STORKSAMLEngineException + * the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryResponseWithSignedDoc() + throws STORKSAMLEngineException { + + String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + palist.add(isAgeOver); + + attrQueryenRequest.setPersonalAttributeList(palist); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAttrQueryResponse storkResponse = getEngine() + .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, + destinationUrl, isNotHashing); + + attrQueryResponse = storkResponse.getTokenSaml(); + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse + .getPersonalAttributeList().get("signedDoc").getValue().get(0) + .equals(signedDocResponse)); + + } +} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base new file mode 100644 index 000000000..7223ab483 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base @@ -0,0 +1,966 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class StorkAuthRequestTest defines a class to . + */ +public class StorkAuthRequestTest { + + /** The engines. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); + private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); + + + /** + * Instantiates a new stork authentication request test. + */ + public StorkAuthRequestTest() { + pal = new PersonalAttributeList(); + + final PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + final ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + final PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + final PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + pal.add(eIDNumber); + + destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + + spName = "University of Oxford"; + spSector = "EDU001"; + spInstitution = "OXF001"; + spApplication = "APP001"; + spCountry = "EN"; + + spId = "EDU001-OXF001-APP001"; + + } + + /** The destination. */ + private String destination; + + /** The service provider name. */ + private String spName; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The service provider id. */ + private String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The List of Personal Attributes. */ + private IPersonalAttributeList pal; + + /** The assertion consumer URL. */ + private String assertConsumerUrl; + + /** The authentication request. */ + private static byte[] authRequest; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkAuthRequestTest.class.getName()); + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + } + + /** + * Test generate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnRequest() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + //engine.generateSTORKAuthnRequest(request); + + LOG.info("STORKAuthnRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); + request.setCitizenCountryCode("ES"); + LOG.info("STORKAuthnRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); + } + + + /** + * Test generate authentication request error personal attribute name error. + */ + @Test + public final void testGenerateAuthnRequestPALsErr1() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("attrNotValid"); + worngAttr.setIsRequired(true); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + /** + * Test generate authentication request error personal attribute value error. + */ + @Test + public final void testGenerateAuthnRequestPALsErr2() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute attrNotValid = new PersonalAttribute(); + attrNotValid.setName("attrNotValid"); + attrNotValid.setIsRequired(true); + palWrong.add(attrNotValid); + + + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request error provider name null. + */ + @Test + public final void testGenerateAuthnRequestSPNAmeErr1() { + + + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(null); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try + { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + catch (STORKSAMLEngineException e) + { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request authentication assurance level + * negative value. + */ + @Test + public final void testGenerateAuthnRequestQaalErr1() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(-1); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request service provider sector null. + */ + @Test + public final void testGenerateAuthnRequestSectorErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + + } + } + + /** + * Test generate authentication request service provider institution null. + */ + @Test + public final void testGenerateAuthnRequestInstitutionrErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(null); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAuthnRequestApplicationErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(null); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider country null. + */ + @Test + public final void testGenerateAuthnRequestCountryErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(null); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request error with quality authentication + * assurance level wrong. + */ + @Test + public final void testGenerateAuthnRequestQaalErr2() { + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(0); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request personal attribute list null value. + */ + @Test + public final void testGenerateAuthnRequestPALErr1() { + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(null); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request error with assertion consumer URL + * null. + */ + @Test + public final void testGenerateAuthnRequestAssertionConsumerErr1() { + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(null); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request null parameter. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestNullParam() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAuthnRequest(null); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request error bytes encode. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestErrorEncode() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAuthnRequest("messageError".getBytes()); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequest() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + authRequest = engine.generateSTORKAuthnRequest(request).getTokenSaml(); + + final STORKAuthnRequest validatedRequest = engine.validateSTORKAuthnRequest(authRequest); + + assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); + + } + + /** + * Test validate data authenticate request. Verified parameters after + * validation. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateDataAuthnRequest() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = engine.validateSTORKAuthnRequest(authRequest); + + assertEquals("Sestination incorrect: ", request.getDestination(), destination); + + assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); + + assertEquals("Service provider incorrect: ", request.getProviderName(), spName); + assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); + assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); + assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); + assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); + assertEquals("Asserition consumer URL incorrect: ", request.getAssertionConsumerServiceURL(), assertConsumerUrl); + + assertEquals("SP Country incorrect: ", request.getSpCountry(), spCountry); + assertEquals("SP Id incorrect: ", request.getSPID(), spId); + assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), "ES"); + + } + + /** + * Test validate file authentication request. Validate from XML file. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAuthnRequest() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml"); + + try { + engine.validateSTORKAuthnRequest(bytes); + fail("testValidateFileAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + } + } + + /** + * Test validate file authentication request tag delete. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAuthnRequestTagDelete() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml"); + + try { + engine.validateSTORKAuthnRequest(bytes); + fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + + } + } + + /** + * Test validate authentication request not trusted token. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestNotTrustedErr1() + throws STORKSAMLEngineException { + + try { + final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine + .getInstance("CONF2"); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineNotTrusted + .generateSTORKAuthnRequest(request).getTokenSaml(); + + engine.validateSTORKAuthnRequest(authReqNotTrust); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("validateSTORKAuthnRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test validate authentication request trusted. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestTrusted() + throws STORKSAMLEngineException { + + final STORKSAMLEngine engineTrusted = STORKSAMLEngine + .getInstance("CONF3"); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineTrusted.generateSTORKAuthnRequest( + request).getTokenSaml(); + + // engine ("CONF1") no have trust certificate from "CONF2" + engine.validateSTORKAuthnRequest(authReqNotTrust); + + } + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAuthnRequestNADA() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(null); + request.setSpApplication(null); + request.setSpCountry(null); + + try { + engine.validateSTORKAuthnRequest(authRequest); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error: " + e.getMessage()); + } + } + + /** + * Test validate authentication request with unknown elements. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestWithUnknownElements() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute unknown = new PersonalAttribute(); + unknown.setName("unknown"); + unknown.setIsRequired(true); + pAttList.add(unknown); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + + req = engine3.generateSTORKAuthnRequest(request); + + req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); + + assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); + assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); + + } + + /** + * Test generate Request with required elements by default + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + STORKAuthnRequest reqTrue = new STORKAuthnRequest(); + STORKAuthnRequest reqFalse = new STORKAuthnRequest(); + + reqTrue = engine.generateSTORKAuthnRequest(request); + reqFalse = engine2.generateSTORKAuthnRequest(request); + req = engine3.generateSTORKAuthnRequest(request); + + + String token = new String(req.getTokenSaml()); + String reqTrueToken = new String(reqTrue.getTokenSaml()); + String reqFalseToken = new String(reqFalse.getTokenSaml()); + + assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); + assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); + assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); + + } + + /** + * Test validating request and getting alias used to save + * the saml trusted certificate into trustore + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestGettingItsAlias() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + + req = engine3.generateSTORKAuthnRequest(request); + req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + + req = engine2.generateSTORKAuthnRequest(request); + req = engine2.validateSTORKAuthnRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + + + + } + + /** + * Test generating/validating request with signedDoc + * + * @throws STORKSAMLEngineException + * the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnRequestWithSignedDoc() + throws STORKSAMLEngineException { + + String signedDocRequest = "VGVzdCB0ZXh0"; + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + PersonalAttributeList paler = new PersonalAttributeList(); + + final PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + paler.add(eIDNumber); + + final PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + final ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + paler.add(isAgeOver); + + final PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + final ArrayList signedDocs = new ArrayList(); + signedDocs.add(signedDocRequest); + signedDoc.setValue(signedDocs); + signedDoc.setIsRequired(false); + paler.add(signedDoc); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(paler); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + + req = engine.generateSTORKAuthnRequest(request); + req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); + + assertTrue("SignedDoc request should be the same: ", req + .getPersonalAttributeList().get("signedDoc").getValue().get(0) + .equals(signedDocRequest)); + + + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base new file mode 100644 index 000000000..481cbc28c --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base @@ -0,0 +1,931 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.commons.STORKStatusCode; +import eu.stork.peps.auth.commons.STORKSubStatusCode; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class AuthRequestTest. + */ +public class StorkResponseTest { + + /** The engine. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + + /** + * Gets the engine. + * + * @return the engine + */ + public static STORKSAMLEngine getEngine() { + return engine; + } + + /** + * Sets the engine. + * + * @param newEngine the new engine + */ + public static void setEngine(final STORKSAMLEngine newEngine) { + StorkResponseTest.engine = newEngine; + } + + /** The destination. */ + private static String destination; + + /** The service provider name. */ + private static String spName; + + /** The service provider sector. */ + private static String spSector; + + /** The service provider institution. */ + private static String spInstitution; + + /** The service provider application. */ + private static String spApplication; + + /** The service provider country. */ + private static String spCountry; + + /** The service provider id. */ + private static String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The state. */ + private static String state = "ES"; + + /** The town. */ + private static String town = "Madrid"; + + /** The municipality code. */ + private static String municipalityCode = "MA001"; + + /** The postal code. */ + private static String postalCode = "28038"; + + /** The street name. */ + private static String streetName = "Marchamalo"; + + /** The street number. */ + private static String streetNumber = "3"; + + /** The apartament number. */ + private static String apartamentNumber = "5º E"; + + /** The List of Personal Attributes. */ + private static IPersonalAttributeList pal; + + /** The assertion consumer URL. */ + private static String assertConsumerUrl; + + /** The authentication request. */ + private static byte[] authRequest; + + /** The authentication response. */ + private static byte[] authResponse; + + /** The authentication request. */ + private static STORKAuthnRequest authenRequest; + + /** The authentication response. */ + private static STORKAuthnResponse authnResponse; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkResponseTest.class.getName()); + + /** + * Instantiates a new stork response test. + */ + public StorkResponseTest() { + super(); + } + + /** The IP address. */ + private static String ipAddress; + + /** The is hashing. */ + private final boolean isHashing = Boolean.TRUE; + + /** The is not hashing. */ + private final boolean isNotHashing = Boolean.FALSE; + + /** The ERROR text. */ + private static final String ERROR_TXT = "generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"; + + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + + pal = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + pal.add(eIDNumber); + + final PersonalAttribute givenName = new PersonalAttribute(); + givenName.setName("givenName"); + givenName.setIsRequired(true); + pal.add(givenName); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + pal.add(canRessAddress); + + PersonalAttribute newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + pal.add(newAttribute); + + destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + spName = "University Oxford"; + + spName = "University of Oxford"; + spSector = "EDU001"; + spInstitution = "OXF001"; + spApplication = "APP001"; + spCountry = "EN"; + + spId = "EDU001-APP001-APP001"; + + final STORKAuthnRequest request = new STORKAuthnRequest(); + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + authRequest = getEngine().generateSTORKAuthnRequest(request) + .getTokenSaml(); + + authenRequest = getEngine().validateSTORKAuthnRequest(authRequest); + + } catch (STORKSAMLEngineException e) { + fail("Error create STORKAuthnRequest"); + } + + ipAddress = "111.222.333.444"; + + pal = new PersonalAttributeList(); + + isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ages = new ArrayList(); + + ages.add("16"); + ages.add("18"); + + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(isAgeOver); + + dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(dateOfBirth); + + eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + eIDNumber.setValue(idNumber); + eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(eIDNumber); + + canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("municipalityCode", municipalityCode); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + address.put("apartamentNumber", apartamentNumber); + + canRessAddress.setComplexValue(address); + pal.add(canRessAddress); + + newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap values = new HashMap(); + + values.put("value1", "value1"); + values.put("value2", "value2"); + values.put("value3", "value3"); + values.put("value4", "value4"); + + newAttribute.setComplexValue(values); + pal.add(newAttribute); + + } + + /** + * Test generate authentication request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnResponse() throws STORKSAMLEngineException { + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + final STORKAuthnResponse storkResponse = getEngine() + .generateSTORKAuthnResponse(authenRequest, response, ipAddress, + isNotHashing); + + authResponse = storkResponse.getTokenSaml(); + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); + } + + /** + * Test validation id parameter mandatory. + */ + @Test + public final void testResponseMandatoryId() { + final String identifier = authenRequest.getSamlId(); + authenRequest.setSamlId(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + authenRequest.setSamlId(identifier); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response in response to err1. + */ + @Test + public final void testResponseMandatoryIssuer() { + + final String issuer = authenRequest.getIssuer(); + authenRequest.setIssuer(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + authenRequest.setIssuer(issuer); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response assertion consumer null. + */ + @Test + public final void testResponseMandatoryAssertionConsumerServiceURL() { + final String asserConsumerUrl = authenRequest + .getAssertionConsumerServiceURL(); + authenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + authenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response IP address null. + */ + @Test + public final void testResponseValidationIP() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, null, + isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication response with personal attribute list null. + */ + @Test + public final void testResponseMandatoryPersonalAttributeList() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(null); + + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication response token null. + */ + @Test + public final void testResponseInvalidParametersToken() { + try { + getEngine().validateSTORKAuthnResponse(null, ipAddress); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication response IP null. + */ + @Test + public final void testResponseInvalidParametersIP() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response parameter name wrong. + */ + @Test + public final void testResponseInvalidParametersAttr() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("AttrWrong"); + wrongList.add(worngAttr); + + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrSimpleValue() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoValue() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoName() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null complex value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrComplexValue() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setComplexValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test validate authentication response IP distinct and disabled validation + * IP. + */ + @Test + public final void testResponseInvalidParametersIPDistinct() { + try { + // ipAddress origin "111.222.333.444" + // ipAddrValidation = false + // Subject Confirmation Bearer. + + getEngine().validateSTORKAuthnResponse(authResponse, "127.0.0.1"); + fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test response invalid parameters invalid token. + */ + @Test + public final void testResponseInvalidParametersTokenMsg() { + try { + // ipAddress origin "111.222.333.444" + // Subject Confirmation Bearer. + getEngine().validateSTORKAuthnResponse("errorMessage".getBytes(), + ipAddress); + fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication response is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseIsFail() + throws STORKSAMLEngineException { + try { + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + fail("Generate incorrect response"); + } catch (Exception e) { + LOG.error("ERROR: " + e.getMessage()); + } + } + + /** + * Test validate authentication response destination. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseDestination() + throws STORKSAMLEngineException { + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + assertEquals("Destination incorrect: ", + authnResponse.getInResponseTo(), authenRequest.getSamlId()); + } + + /** + * Test validate authentication response values. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public final void testValidateAuthenticationResponseValuesComplex() + throws STORKSAMLEngineException { + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + assertEquals("Country incorrect:", authnResponse.getCountry(), "EN"); + + final Iterator iterator = authnResponse + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + final PersonalAttribute attribute = iterator.next(); + if (attribute.getName().equalsIgnoreCase( + "canonicalResidenceAddress")) { + assertEquals("State incorrect: ", state, attribute + .getComplexValue().get("state")); + assertEquals("Municipality Code incorrect: ", municipalityCode, + attribute.getComplexValue().get("municipalityCode")); + assertEquals("Town incorrect: ", town, attribute + .getComplexValue().get("town")); + assertEquals("Postal code incorrect: ", postalCode, attribute + .getComplexValue().get("postalCode")); + assertEquals("Street name incorrect: ", streetName, attribute + .getComplexValue().get("streetName")); + assertEquals("Street number incorrect: ", streetNumber, + attribute.getComplexValue().get("streetNumber")); + assertEquals("Apartament number incorrect: ", apartamentNumber, + attribute.getComplexValue().get("apartamentNumber")); + } + } + } + + /** + * Test generate authenticate response fail in response to it's null. + * @throws STORKSAMLEngineException + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test //( expected=STORKSAMLEngineException.class) + public final void testGenerateAuthnResponseFailInResponseToNull() throws STORKSAMLEngineException { + final String identifier = authenRequest.getSamlId(); + authenRequest.setSamlId(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + authenRequest.setSamlId(identifier); + LOG.error("Error"); + //throw new STORKSAMLEngineException(e); + } + } + + /** + * Test generate authenticate response fail assertion consumer URL err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() + throws STORKSAMLEngineException { + + final String assertConsumerUrl = authenRequest + .getAssertionConsumerServiceURL(); + authenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + authenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response fail code error err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnResponseFailCodeErrorNull() + throws STORKSAMLEngineException { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(null); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test generate authentication request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnResponse() throws STORKSAMLEngineException { + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(dateOfBirth); + + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + complex.put("one", "two"); + + //eIDNumber.setValue(null); + //eIDNumber.setValue(idNumber); + //eIDNumber.setComplexValue(complex); + + eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); + palist.add(eIDNumber); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("municipalityCode", municipalityCode); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + address.put("apartamentNumber", apartamentNumber); + + canRessAddress.setComplexValue(address); + palist.add(canRessAddress); + + + final STORKAuthnResponse response = new STORKAuthnResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAuthnResponse storkResponse = getEngine() + .generateSTORKAuthnResponse(authenRequest, response, ipAddress, + isNotHashing); + + authResponse = storkResponse.getTokenSaml(); + LOG.info("Request id: " + authenRequest.getSamlId()); + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); + + + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + LOG.info("RESPONSE ID: " + authnResponse.getSamlId()); + LOG.info("RESPONSE IN_RESPONSE_TO: " + authnResponse.getInResponseTo()); + LOG.info("RESPONSE COUNTRY: " + authnResponse.getCountry()); + + } + + + + + + /** + * Test validate authentication response fail is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseFailIsFail() + throws STORKSAMLEngineException { + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage("message"); + + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + + LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(authResponse)); + + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + LOG.info("COUNTRY: " + authnResponse.getCountry()); + assertTrue("Generate incorrect response: ", authnResponse.isFail()); + } + + /** + * Test generate/validate response with signedDoc + * + * @throws STORKSAMLEngineException + * the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthenResponseWithSignedDoc() + throws STORKSAMLEngineException { + + String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + palist.add(isAgeOver); + + authenRequest.setPersonalAttributeList(palist); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAuthnResponse storkResponse = getEngine() + .generateSTORKAuthnResponse(authenRequest, response, ipAddress, + isNotHashing); + + authResponse = storkResponse.getTokenSaml(); + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + assertTrue("SignedDoc response should be the same: ", authnResponse + .getPersonalAttributeList().get("signedDoc").getValue().get(0) + .equals(signedDocResponse)); + + } + +} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..34fed0e39 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,20 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes necessary to create a SAML message. + * @since 1.0 + */ +package eu.stork.peps.test.simple; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class new file mode 100644 index 000000000..77bb2ca96 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class new file mode 100644 index 000000000..3bccdf89c Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class new file mode 100644 index 000000000..ffaf0cf57 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class new file mode 100644 index 000000000..8737e0538 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class new file mode 100644 index 000000000..667bee6d3 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class new file mode 100644 index 000000000..4bce51cc6 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class new file mode 100644 index 000000000..1956264c7 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/all-wcprops new file mode 100644 index 000000000..fe8b26f95 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/all-wcprops @@ -0,0 +1,101 @@ +K 25 +svn:wc:ra_dav:version-url +V 67 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources +END +keyStoreCountry1.jks +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry1.jks +END +keyStoreCountry2.jks +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry2.jks +END +keyStoreCountry3.jks +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry3.jks +END +p11Conf.cfg +K 25 +svn:wc:ra_dav:version-url +V 78 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/p11Conf.cfg +END +logback-test.xml +K 25 +svn:wc:ra_dav:version-url +V 83 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/logback-test.xml +END +SamlEngine.xml +K 25 +svn:wc:ra_dav:version-url +V 81 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/SamlEngine.xml +END +SignModule_P11.xml +K 25 +svn:wc:ra_dav:version-url +V 85 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/SignModule_P11.xml +END +StorkSamlEngine_Conf0.xml +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf0.xml +END +StorkSamlEngine_Conf1.xml +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf1.xml +END +SignModule_Conf0.xml +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf0.xml +END +StorkSamlEngine_Conf2.xml +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf2.xml +END +SignModule_Conf1.xml +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf1.xml +END +StorkSamlEngine_Conf3.xml +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf3.xml +END +SignModule_Conf2.xml +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf2.xml +END +SignModule_Conf3.xml +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf3.xml +END +keyStoreCountry0.jks +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry0.jks +END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/entries new file mode 100644 index 000000000..1afc5a426 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/entries @@ -0,0 +1,575 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +data +dir + +logback-test.xml +file + + + + +2013-12-20T12:27:57.250475Z +9645eaa7005e2fd5856a650a46e58b75 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +530 + +SamlEngine.xml +file + + + + +2013-12-20T12:27:57.250475Z +e2a6926fe3dabd0b07ea0c7f61a5c9a9 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2236 + +SignModule_P11.xml +file + + + + +2013-12-20T12:27:57.254475Z +13d70d84e25f491976cbbd9a0e3edafe +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +436 + +StorkSamlEngine_Conf0.xml +file + + + + +2013-12-20T12:27:57.250475Z +4ec0bc5ac4fafef57b60184cded62f9f +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3912 + +StorkSamlEngine_Conf1.xml +file + + + + +2013-12-20T12:27:57.250475Z +4ec0bc5ac4fafef57b60184cded62f9f +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3912 + +SignModule_Conf0.xml +file + + + + +2013-12-20T12:27:57.250475Z +ad61baa5b5d5a0c648b2e4c05b637add +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +541 + +StorkSamlEngine_Conf2.xml +file + + + + +2013-12-20T12:27:57.250475Z +7092c091691b1862d989f856cdc57b82 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2827 + +SignModule_Conf1.xml +file + + + + +2013-12-20T12:27:57.250475Z +16be2497f59cbd9c57acc81b783ecff1 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +522 + +StorkSamlEngine_Conf3.xml +file + + + + +2013-12-20T12:27:57.250475Z +44066ee14d9b2a03f7ee2f72c965c287 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2774 + +SignModule_Conf2.xml +file + + + + +2013-12-20T12:27:57.250475Z +fb7a26c03ef7400fe296b7d60837dff0 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +522 + +SignModule_Conf3.xml +file + + + + +2013-12-20T12:27:57.250475Z +128795cf3937e23a2af256cc5db88b84 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +540 + +keyStoreCountry0.jks +file + + + + +2013-12-20T12:27:57.250475Z +241d66f1af1a3937dfbbcccc7b7432c8 +2013-12-16T15:04:09.136643Z +316 +emsomavmi +has-props + + + + + + + + + + + + + + + + + + + + +1376 + +keyStoreCountry1.jks +file + + + + +2013-12-20T12:27:57.250475Z +821660c55e39b47f7cd6c750e366531d +2013-12-16T15:04:09.136643Z +316 +emsomavmi +has-props + + + + + + + + + + + + + + + + + + + + +1313 + +keyStoreCountry2.jks +file + + + + +2013-12-20T12:27:57.250475Z +821660c55e39b47f7cd6c750e366531d +2013-12-16T15:04:09.136643Z +316 +emsomavmi +has-props + + + + + + + + + + + + + + + + + + + + +1313 + +keyStoreCountry3.jks +file + + + + +2013-12-20T12:27:57.250475Z +821660c55e39b47f7cd6c750e366531d +2013-12-16T15:04:09.136643Z +316 +emsomavmi +has-props + + + + + + + + + + + + + + + + + + + + +1313 + +p11Conf.cfg +file + + + + +2013-12-20T12:27:57.250475Z +d7154f1fb90d3edbad739f703a30ff3d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +510 + diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base new file mode 100644 index 000000000..5e9587e65 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base new file mode 100644 index 000000000..5e9587e65 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base new file mode 100644 index 000000000..5e9587e65 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base new file mode 100644 index 000000000..5e9587e65 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SamlEngine.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SamlEngine.xml.svn-base new file mode 100644 index 000000000..6bb61ae29 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SamlEngine.xml.svn-base @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base new file mode 100644 index 000000000..eb9ed6f5d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry0.jks + local-demo + local-demo + CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS + 529E05C8 + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base new file mode 100644 index 000000000..af68d33aa --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry1.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base new file mode 100644 index 000000000..b13cb390a --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry2.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base new file mode 100644 index 000000000..ed933020a --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry3.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_P11.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_P11.xml.svn-base new file mode 100644 index 000000000..64eb426c8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_P11.xml.svn-base @@ -0,0 +1,11 @@ + + + + + HWModule sign with interface PKCS11. + p11Config.cfg + ******* + CN=XXXXXXXXX + xxxxxxxxxxxxxx + PKCS11 + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base new file mode 100644 index 000000000..0a28a5de8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base @@ -0,0 +1,91 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base new file mode 100644 index 000000000..0a28a5de8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base @@ -0,0 +1,91 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base new file mode 100644 index 000000000..435ef4b82 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base @@ -0,0 +1,64 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base new file mode 100644 index 000000000..bec8934f8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base @@ -0,0 +1,61 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + http://www.stork.gov.eu/1.0/unknown + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base new file mode 100644 index 000000000..289e952fe Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/logback-test.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/logback-test.xml.svn-base new file mode 100644 index 000000000..ff900e124 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/logback-test.xml.svn-base @@ -0,0 +1,23 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/p11Conf.cfg.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/p11Conf.cfg.svn-base new file mode 100644 index 000000000..b712219c1 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/p11Conf.cfg.svn-base @@ -0,0 +1,24 @@ +//ATTRIBUTE VALUE +//name name suffix of this provider instance +//library pathname of PKCS#11 implementation +//slotListIndex slot index + +//PREFIX DESCRIPTION +//CKO_ Object class +//CKA_ Attribute +//CKK_ Key type + +//attributes(operation, keytype, keyalgorithm) = { +// name1 = value1 +// [...] +//} + +name=nameProvider +library=library.dll +slotListIndex=0 +attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={ + CKA_VERIFY=true +} +attributes(*,CKO_PRIVATE_KEY,CKK_RSA)={ + CKA_SIGN=true +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SamlEngine.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SamlEngine.xml new file mode 100644 index 000000000..6bb61ae29 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/SamlEngine.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf0.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf0.xml new file mode 100644 index 000000000..eb9ed6f5d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf0.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry0.jks + local-demo + local-demo + CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS + 529E05C8 + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf1.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf1.xml new file mode 100644 index 000000000..af68d33aa --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf1.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry1.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf2.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf2.xml new file mode 100644 index 000000000..b13cb390a --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf2.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry2.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf3.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf3.xml new file mode 100644 index 000000000..ed933020a --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf3.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry3.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_P11.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_P11.xml new file mode 100644 index 000000000..64eb426c8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_P11.xml @@ -0,0 +1,11 @@ + + + + + HWModule sign with interface PKCS11. + p11Config.cfg + ******* + CN=XXXXXXXXX + xxxxxxxxxxxxxx + PKCS11 + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf0.xml b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf0.xml new file mode 100644 index 000000000..0a28a5de8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf0.xml @@ -0,0 +1,91 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf1.xml b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf1.xml new file mode 100644 index 000000000..0a28a5de8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf1.xml @@ -0,0 +1,91 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf2.xml b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf2.xml new file mode 100644 index 000000000..435ef4b82 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf2.xml @@ -0,0 +1,64 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf3.xml b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf3.xml new file mode 100644 index 000000000..bec8934f8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf3.xml @@ -0,0 +1,61 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + http://www.stork.gov.eu/1.0/unknown + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/all-wcprops new file mode 100644 index 000000000..3843fc6b7 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 72 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data +END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/entries new file mode 100644 index 000000000..2eb50bbe8 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +eu +dir + diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/all-wcprops new file mode 100644 index 000000000..56d18dd28 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 75 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu +END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/entries new file mode 100644 index 000000000..798ea16b3 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +stork +dir + diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/all-wcprops new file mode 100644 index 000000000..16ec86311 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 81 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork +END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/entries new file mode 100644 index 000000000..8ec7f9903 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +STORKSAMLEngine +dir + diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops new file mode 100644 index 000000000..178273e8c --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops @@ -0,0 +1,41 @@ +K 25 +svn:wc:ra_dav:version-url +V 97 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine +END +AuthnRequestTagDelete.xml +K 25 +svn:wc:ra_dav:version-url +V 122 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml +END +AttrQueryRequestTagDelete.xml +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml +END +AuthnRequest.xml +K 25 +svn:wc:ra_dav:version-url +V 113 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml +END +AttrQueryRequest.xml +K 25 +svn:wc:ra_dav:version-url +V 118 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml +END +AuthnRequestTagDeleteEncoded.xml +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml +END +AttrQueryResponse.xml +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml +END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries new file mode 100644 index 000000000..16e2ccd8d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +AttrQueryResponse.xml +file + + + + +2013-12-20T12:27:57.242475Z +8f576c406bd8b2756899bbe1738e56d6 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +6092 + +AuthnRequestTagDelete.xml +file + + + + +2013-12-20T12:27:57.242475Z +13df3f7c9b0fb6e10ac782c43b8f3cdb +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2611 + +AttrQueryRequestTagDelete.xml +file + + + + +2013-12-20T12:27:57.242475Z +cd245752b96826be0c3b72e3428c6aac +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +4045 + +AuthnRequest.xml +file + + + + +2013-12-20T12:27:57.242475Z +e993b1b24f5abbfa974485b0cbbc0211 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3898 + +AttrQueryRequest.xml +file + + + + +2013-12-20T12:27:57.242475Z +d78d68c7f18dc10e7cd7343954388987 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +4253 + +AuthnRequestTagDeleteEncoded.xml +file + + + + +2013-12-20T12:27:57.242475Z +c5122af357fd2a8339239853479b4aed +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2612 + diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base new file mode 100644 index 000000000..852727dc5 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base @@ -0,0 +1,11 @@ +http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl +eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT +VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 +MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph +dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt +by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 +2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj +9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G +CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl +XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK +W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base new file mode 100644 index 000000000..9f9fe5156 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base @@ -0,0 +1,15 @@ +http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v +LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG +A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv +Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab +ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU +0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n +6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 +y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z +9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F +6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM +pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT +/NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq +yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 +Ppm8IFVTk8mYfX8/jw==3falsefalsefalse1618SveinbjörnES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base new file mode 100644 index 000000000..b7e578c2d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base @@ -0,0 +1,10 @@ +http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v +MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM +BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k +ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja +Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ +525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG +SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr +y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG +1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base new file mode 100644 index 000000000..c822702df --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base @@ -0,0 +1,26 @@ +http://S-PEPS.gov.xx + + + + + + + + + +yzsqaxBNicOrixBUno5cL0CBOpE= + + + +Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC +wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi +YIN/BUEtXkoYTjPtkmA= + +MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw +MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu +h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r +/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk +3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K +eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq +KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base new file mode 100644 index 000000000..2a54c7d59 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base @@ -0,0 +1,14 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base new file mode 100644 index 000000000..3239cf6e7 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base @@ -0,0 +1,14 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml new file mode 100644 index 000000000..852727dc5 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml @@ -0,0 +1,11 @@ +http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl +eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT +VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 +MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph +dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt +by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 +2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj +9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G +CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl +XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK +W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml new file mode 100644 index 000000000..9f9fe5156 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml @@ -0,0 +1,15 @@ +http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v +LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG +A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv +Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab +ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU +0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n +6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 +y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z +9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F +6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM +pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT +/NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq +yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 +Ppm8IFVTk8mYfX8/jw==3falsefalsefalse1618SveinbjörnES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml new file mode 100644 index 000000000..b7e578c2d --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml @@ -0,0 +1,10 @@ +http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v +MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM +BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k +ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja +Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ +525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG +SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr +y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG +1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml new file mode 100644 index 000000000..c822702df --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml @@ -0,0 +1,26 @@ +http://S-PEPS.gov.xx + + + + + + + + + +yzsqaxBNicOrixBUno5cL0CBOpE= + + + +Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC +wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi +YIN/BUEtXkoYTjPtkmA= + +MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw +MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu +h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r +/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk +3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K +eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq +KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml new file mode 100644 index 000000000..2a54c7d59 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml @@ -0,0 +1,14 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml new file mode 100644 index 000000000..3239cf6e7 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml @@ -0,0 +1,14 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry0.jks b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry0.jks new file mode 100644 index 000000000..289e952fe Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry0.jks differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry1.jks b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry1.jks new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry1.jks differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry2.jks b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry2.jks new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry2.jks differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry3.jks b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry3.jks new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry3.jks differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/logback-test.xml b/id/server/stork2-saml-engine/build/classes/test/resources/logback-test.xml new file mode 100644 index 000000000..ff900e124 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/logback-test.xml @@ -0,0 +1,23 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/p11Conf.cfg b/id/server/stork2-saml-engine/build/classes/test/resources/p11Conf.cfg new file mode 100644 index 000000000..b712219c1 --- /dev/null +++ b/id/server/stork2-saml-engine/build/classes/test/resources/p11Conf.cfg @@ -0,0 +1,24 @@ +//ATTRIBUTE VALUE +//name name suffix of this provider instance +//library pathname of PKCS#11 implementation +//slotListIndex slot index + +//PREFIX DESCRIPTION +//CKO_ Object class +//CKA_ Attribute +//CKK_ Key type + +//attributes(operation, keytype, keyalgorithm) = { +// name1 = value1 +// [...] +//} + +name=nameProvider +library=library.dll +slotListIndex=0 +attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={ + CKA_VERIFY=true +} +attributes(*,CKO_PRIVATE_KEY,CKK_RSA)={ + CKA_SIGN=true +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/pom.xml b/id/server/stork2-saml-engine/pom.xml new file mode 100644 index 000000000..1fbc13b1e --- /dev/null +++ b/id/server/stork2-saml-engine/pom.xml @@ -0,0 +1,194 @@ + + 4.0.0 + eu.stork + saml-engine + jar + STORKSAMLEngine + + UTF-8 + 1.1.0 + 0.5.2 + 0.5.1 + 1.1.0 + 2.6.0 + ${maven.build.timestamp} + + ${saml.version} + + The STORKSAMLEngine library provides tools to support developers working with the Security Assertion Markup Language (SAML). + + + + + + shibboleth-release + Internet2 Releases + default + https://build.shibboleth.net/nexus/content/repositories/releases + + false + + + + + + + + eu.stork + stork-commons + ${commons.version} + + + + org.opensaml + opensaml + ${opensaml.version} + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + log4j-over-slf4j + + + org.slf4j + jul-to-slf4j + + + + + + org.slf4j + slf4j-api + 1.7.5 + + + org.slf4j + slf4j-simple + 1.7.5 + + + org.slf4j + jcl-over-slf4j + 1.7.5 + + + org.slf4j + log4j-over-slf4j + 1.7.5 + + + org.slf4j + jul-to-slf4j + 1.7.5 + + + + commons-io + commons-io + 2.2 + compile + + + xerces + xercesImpl + 2.11.0 + test + + + junit + junit + 4.11 + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + verify + + jar + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + + ${saml.version} + ${samlspecacept.version} + ${samlspec.version} + None + ${timestamp} + + + + + + + + + metrics + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.5.1 + + + html + xml + + + + + + + + + + diff --git a/id/server/stork2-saml-engine/src/.svn/all-wcprops b/id/server/stork2-saml-engine/src/.svn/all-wcprops new file mode 100644 index 000000000..a663100ff --- /dev/null +++ b/id/server/stork2-saml-engine/src/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 52 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src +END diff --git a/id/server/stork2-saml-engine/src/.svn/entries b/id/server/stork2-saml-engine/src/.svn/entries new file mode 100644 index 000000000..7c9d1968f --- /dev/null +++ b/id/server/stork2-saml-engine/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +test +dir + +main +dir + diff --git a/id/server/stork2-saml-engine/src/main/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/.svn/all-wcprops new file mode 100644 index 000000000..f9f3d279b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 56 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main +END diff --git a/id/server/stork2-saml-engine/src/main/.svn/entries b/id/server/stork2-saml-engine/src/main/.svn/entries new file mode 100644 index 000000000..dc9f007e9 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +java +dir + diff --git a/id/server/stork2-saml-engine/src/main/java/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/.svn/all-wcprops new file mode 100644 index 000000000..243067f06 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 61 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java +END diff --git a/id/server/stork2-saml-engine/src/main/java/.svn/entries b/id/server/stork2-saml-engine/src/main/java/.svn/entries new file mode 100644 index 000000000..e4a01af0d --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +META-INF +dir + +eu +dir + diff --git a/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/all-wcprops new file mode 100644 index 000000000..8de21c7f2 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 70 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/META-INF +END +MANIFEST.MF +K 25 +svn:wc:ra_dav:version-url +V 82 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/META-INF/MANIFEST.MF +END diff --git a/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/entries b/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/entries new file mode 100644 index 000000000..7ba7a8b7d --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/META-INF +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +MANIFEST.MF +file + + + + +2013-12-20T12:27:57.282475Z +b10f37c8bb1803d98c127a01d1a71cc5 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +39 + diff --git a/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base b/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base new file mode 100644 index 000000000..5e9495128 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/id/server/stork2-saml-engine/src/main/java/META-INF/MANIFEST.MF b/id/server/stork2-saml-engine/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 000000000..5e9495128 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/.svn/all-wcprops new file mode 100644 index 000000000..c2550210f --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/.svn/entries new file mode 100644 index 000000000..842aef3b7 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +stork +dir + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/all-wcprops new file mode 100644 index 000000000..4e9c9df08 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 70 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/entries new file mode 100644 index 000000000..15424fef8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +peps +dir + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/all-wcprops new file mode 100644 index 000000000..f6653073c --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 75 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/entries new file mode 100644 index 000000000..e80eb4f1f --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +auth +dir + +exceptions +dir + +configuration +dir + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/all-wcprops new file mode 100644 index 000000000..ea1d0ba15 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 80 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/entries new file mode 100644 index 000000000..274a429ea --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +engine +dir + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops new file mode 100644 index 000000000..a5df7ea64 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops @@ -0,0 +1,35 @@ +K 25 +svn:wc:ra_dav:version-url +V 87 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine +END +SAMLEngine.java +K 25 +svn:wc:ra_dav:version-url +V 103 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java +END +SAMLEngineUtils.java +K 25 +svn:wc:ra_dav:version-url +V 108 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 105 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/package-info.java +END +STORKSAMLEngine.java +K 25 +svn:wc:ra_dav:version-url +V 108 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java +END +X509PrincipalUtil.java +K 25 +svn:wc:ra_dav:version-url +V 110 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/entries new file mode 100644 index 000000000..ee72945c7 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/entries @@ -0,0 +1,201 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +SAMLEngine.java +file + + + + +2013-12-20T12:27:57.446475Z +06e800364af96f515b5e2b2e6da3c423 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +13855 + +SAMLEngineUtils.java +file + + + + +2013-12-20T12:27:57.446475Z +de13d8f36c3a8d7c25ed55f94f43a663 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +28573 + +package-info.java +file + + + + +2013-12-20T12:27:57.446475Z +db9d14c008d5504a156cfa955db13657 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +796 + +STORKSAMLEngine.java +file + + + + +2013-12-20T12:27:57.446475Z +4899e34f046f8a1ba1292c1e0c2f972f +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +106833 + +X509PrincipalUtil.java +file + + + + +2013-12-20T12:27:57.446475Z +5b1c22a27ba0a0bfd4c0bd4ef1890205 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2296 + +core +dir + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base new file mode 100644 index 000000000..f8f50fc74 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base @@ -0,0 +1,409 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine; + +import java.io.ByteArrayInputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import javax.xml.XMLConstants; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.opensaml.Configuration; +import org.opensaml.DefaultBootstrap; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.xml.ConfigurationException; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.Marshaller; +import org.opensaml.xml.io.MarshallerFactory; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.io.Unmarshaller; +import org.opensaml.xml.io.UnmarshallerFactory; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.parse.BasicParserPool; +import org.opensaml.xml.parse.XMLParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.auth.engine.core.STORKSAMLCore; +import eu.stork.peps.auth.engine.core.impl.SignModuleFactory; +import eu.stork.peps.configuration.ConfigurationCreator; +import eu.stork.peps.configuration.ConfigurationReader; +import eu.stork.peps.configuration.InstanceEngine; +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * Class that wraps the operations over SAML tokens, both generation and + * validation of SAML requests and SAML responses. Compliant with "OASIS Secure + * Assertion Markup Language (SAML) 2.0, May 2005", but taking into account + * STORK specific requirements. + * + * @author fjquevedo + * @author iinigo + */ + +public class SAMLEngine { + + /** The Document Builder Factory. */ + private static javax.xml.parsers.DocumentBuilderFactory dbf = null; + + /** The instance of every engine SAML. */ + private static Map instanceConfigs; + + /** The instances of SAML engine. */ + private static Map> instances; + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SAMLEngine.class + .getName()); + + /** The Constant MODULE_SIGN_CONF. */ + private static final String MODULE_SIGN_CONF = "SignatureConf"; + + /** The Constant SAML_ENGINE_SIGN_CLASS. */ + private static final String SAML_ENGINE_SIGN_CLASS = "class"; + + /** The Constant SAML_ENGINE_CONF. */ + private static final String SAML_ENGINE_CONF = "SamlEngineConf"; + + /** The Constant SAML_ENGINE_FILE_CONF. */ + private static final String SAML_ENGINE_FILE_CONF = "fileConfiguration"; + + /** The codification of characters. */ + private static final String CHARACTER_ENCODING = "UTF-8"; + + /** The SAML core. */ + private STORKSAMLCore samlCore; + + /** The Module of Signature. */ + private SAMLEngineSignI signer; + + + /** Initializes the SAML engine. */ + /** Configure Document Builder Factory. */ + + static { + startUp(); + loadDocumentFactory(); + } + + /** + * Load document factory. + */ + private static void loadDocumentFactory() { + + try { + dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance(); + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setNamespaceAware(true); + dbf.setIgnoringComments(true); + } catch (ParserConfigurationException e) { + LOG.error("Error parser configuration."); + throw new STORKSAMLEngineRuntimeException(e); + } + + } + + /** + * Method that initializes the basic services for the SAML Engine, like the + * OpenSAML library and the BouncyCastle provider. + */ + private static void startUp() { + + LOG.info("SAMLEngine: Initialize OpenSAML"); + + try { + DefaultBootstrap.bootstrap(); + } catch (ConfigurationException e) { + LOG.error("Problem initializing the OpenSAML library."); + throw new STORKSAMLEngineRuntimeException(e); + } + + LOG.debug("Read all file configurations. (instances of SAMLEngine)"); + try { + instanceConfigs = ConfigurationReader.readConfiguration(); + } catch (SAMLEngineException e) { + LOG.error("Error read configuration file."); + throw new STORKSAMLEngineRuntimeException(e); + } + + LOG.debug("Create all instaces of saml engine. (instances of SAMLEngine)"); + try { + instances = ConfigurationCreator + .createConfiguration(instanceConfigs); + } catch (STORKSAMLEngineException e) { + LOG.error("Error initializing instances from Stork SAML engine."); + throw new STORKSAMLEngineRuntimeException(e); + } + } + + /** + * Instantiates a new SAML engine. + */ + private SAMLEngine() { + + } + + /** + * Instantiates a new SAML engine. + * + * @param nameInstance the name instance + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + protected SAMLEngine(final String nameInstance) + throws STORKSAMLEngineException { + LOG.info("Loading Specific Configuration."); + + LOG.debug("Create intance of saml messages."); + + Map instance = instances.get(nameInstance); + + if (instance == null || instance.isEmpty()) { + LOG.error("Instance: " + nameInstance + " not exist."); + throw new STORKSAMLEngineException("Instance: " + nameInstance + + " not exist."); + } + + Properties properties = (Properties) instance.get(SAML_ENGINE_CONF); + + if (properties == null) { + LOG.error("SamlEngine.xml: not exist."); + throw new STORKSAMLEngineException("SamlEngine.xml: not exist."); + } + + samlCore = new STORKSAMLCore(properties); + + final HashMap propertiesSign = (HashMap) instance + .get(MODULE_SIGN_CONF); + + LOG.debug("Loading Module of sign."); + signer = SignModuleFactory.getInstance(propertiesSign + .get(SAML_ENGINE_SIGN_CLASS)); + + try { + LOG.info("Initialize module of sign."); + signer.init(propertiesSign.get(SAML_ENGINE_FILE_CONF)); + LOG.info("Load cryptographic service provider of module of sign."); + signer.loadCryptServiceProvider(); + } catch (SAMLEngineException e) { + LOG.error("Error create signature module: " + + propertiesSign.get(SAML_ENGINE_FILE_CONF)); + LOG.info("Exception" + e); + throw new STORKSAMLEngineException(e); + } + } + + /** + * Gets the Signer properties. + * + * @return the SAML Sign properties + */ + protected SAMLEngineSignI getSigner() { + return signer; + } + + /** + * Gets the SAML core properties. + * + * @return the SAML core properties + */ + protected final STORKSAMLCore getSamlCoreProperties() { + return samlCore; + } + + /** + * Method that transform the received SAML object into a byte array + * representation. + * + * @param samlToken the SAML token. + * + * @return the byte[] of the SAML token. + * + * @throws SAMLEngineException the SAML engine exception + */ + private byte[] marshall(final XMLObject samlToken) + throws SAMLEngineException { + + try { + javax.xml.parsers.DocumentBuilder docBuilder = null; + + final MarshallerFactory marshallerFactory = Configuration + .getMarshallerFactory(); + + final Marshaller marshaller = marshallerFactory + .getMarshaller(samlToken); + + docBuilder = dbf.newDocumentBuilder(); + + final Document doc = docBuilder.newDocument(); + + marshaller.marshall(samlToken, doc); + + // Obtain a byte array representation of the marshalled SAML object + final DOMSource domSource = new DOMSource(doc); + final StringWriter writer = new StringWriter(); + final StreamResult result = new StreamResult(writer); + final TransformerFactory transFactory = TransformerFactory + .newInstance(); + Transformer transformer; + + transformer = transFactory.newTransformer(); + transformer.transform(domSource, result); + LOG.debug("SAML request \n"+ writer.toString()); + return writer.toString().getBytes(CHARACTER_ENCODING); + + } catch (ParserConfigurationException e) { + LOG.error("ParserConfigurationException."); + throw new SAMLEngineException(e); + } catch (MarshallingException e) { + LOG.error("MarshallingException."); + throw new SAMLEngineException(e); + } catch (TransformerConfigurationException e) { + LOG.error("TransformerConfigurationException."); + throw new SAMLEngineException(e); + } catch (TransformerException e) { + LOG.error("TransformerException."); + throw new SAMLEngineException(e); + } catch (UnsupportedEncodingException e) { + LOG.error("UnsupportedEncodingException: " + CHARACTER_ENCODING); + throw new SAMLEngineException(e); + } + } + + /** + * Method that signs a SAML Token. + * + * @param tokenSaml the token SAML + * + * @return the SAML object sign + * + * @throws SAMLEngineException the SAML engine exception + */ + private SignableSAMLObject sign(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.debug("Sign SamlToken."); + signer.sign(tokenSaml); + return tokenSaml; + } + + /** + * Sign and transform to byte array. + * + * @param samlToken the SAML token + * + * @return the byte[] of the SAML token + * + * @throws SAMLEngineException the SAML engine exception + */ + protected final byte[] signAndMarshall(final SignableSAMLObject samlToken) + throws SAMLEngineException { + LOG.debug("Marshall Saml Token."); + SignableSAMLObject signElement = sign(samlToken); + return marshall(signElement); + } + + /** + * Method that unmarshalls a SAML Object from a byte array representation to + * an XML Object. + * + * @param samlToken Byte array representation of a SAML Object + * + * @return XML Object (superclass of SAMLObject) + * + * @throws SAMLEngineException the SAML engine exception + */ + protected final XMLObject unmarshall(final byte[] samlToken) + throws SAMLEngineException { + try { + // Get parser pool manager + final BasicParserPool ppMgr = new BasicParserPool(); + // Note: this is necessary due to an unresolved Xerces deferred DOM + // issue/bug + final HashMap features = new HashMap(); + features.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); + ppMgr.setBuilderFeatures(features); + + ppMgr.setNamespaceAware(true); + + // Parse SAMLToken + Document document = ppMgr.parse(new ByteArrayInputStream(samlToken)); + if (document != null){ + final Element root = document.getDocumentElement(); + // Get appropriate unmarshaller + final UnmarshallerFactory unmarshallerFact = Configuration.getUnmarshallerFactory(); + // Unmarshall using the SAML Token root element + if (unmarshallerFact != null && root != null){ + final Unmarshaller unmarshaller = unmarshallerFact.getUnmarshaller(root); + try { + return unmarshaller.unmarshall(root); + } catch (NullPointerException e){ + LOG.error("Error element tag incomplet or null."); + throw new SAMLEngineException("NullPointerException", e); + } + } else { + LOG.error("Error element tag incomplet or null."); + throw new SAMLEngineException("NullPointerException : unmarshallerFact or root is null"); + } + } else { + LOG.error("Error element tag incomplet or null."); + throw new SAMLEngineException("NullPointerException : document is null"); + } + } catch (XMLParserException e) { + LOG.error("XML Parsing Error.", e); + throw new SAMLEngineException(e); + } catch (UnmarshallingException e) { + LOG.error("TransformerException.", e); + throw new SAMLEngineException(e); + } catch (NullPointerException e) { + LOG.error("Error element tag incomplet or null.", e); + throw new SAMLEngineException(e); + } + } + + /** + * Method that validates an XML Signature contained in a SAML Token. + * + * @param samlToken the SAML token + * + * @return the SAML object + * + * @throws SAMLEngineException the SAML engine exception + */ + protected final SAMLObject validateSignature( + final SignableSAMLObject samlToken) throws SAMLEngineException { + + LOG.info("Validate Signature"); + signer.validateSignature(samlToken); + + return samlToken; + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base new file mode 100644 index 000000000..60f7c3091 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base @@ -0,0 +1,833 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.commons.lang.StringUtils; +import org.joda.time.DateTime; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLVersion; +import org.opensaml.common.impl.SecureRandomIdentifierGenerator; +import org.opensaml.saml2.common.Extensions; +import org.opensaml.saml2.common.impl.ExtensionsBuilder; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.AttributeQuery; +import org.opensaml.saml2.core.AttributeValue; +import org.opensaml.saml2.core.AuthnContext; +import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.core.AuthnStatement; +import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.NameID; +import org.opensaml.saml2.core.Response; +import org.opensaml.saml2.core.Status; +import org.opensaml.saml2.core.StatusCode; +import org.opensaml.saml2.core.StatusMessage; +import org.opensaml.saml2.core.Subject; +import org.opensaml.saml2.core.SubjectConfirmation; +import org.opensaml.saml2.core.SubjectConfirmationData; +import org.opensaml.saml2.core.SubjectLocality; +import org.opensaml.saml2.core.impl.AssertionBuilder; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSAny; +import org.opensaml.xml.schema.XSString; +import org.opensaml.xml.signature.KeyInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import eu.stork.peps.auth.engine.core.QAAAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.SPApplication; +import eu.stork.peps.auth.engine.core.SPCountry; +import eu.stork.peps.auth.engine.core.SPInstitution; +import eu.stork.peps.auth.engine.core.SPSector; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class SAMLEngineUtils. + * + * @author fjquevedo + * @author iinigo + */ +public final class SAMLEngineUtils { + + /** The Constant UTF_8. */ + public static final String UTF_8 = "UTF-8"; + + /** The Constant SHA_512. */ + public static final String SHA_512 = "SHA-512"; + + + /** The generator. */ + private static SecureRandomIdentifierGenerator generator; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(SAMLEngineUtils.class.getName()); + + /** + * Method that generates a random value according to NCName grammar. + * + * NCName ::= NCNameStartChar NCNameChar* NCNameChar ::= NameChar - ':' + * NCNameStartChar ::= Letter | '_' NameStartChar ::= ":" | [A-Z] | "_" | + * [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | + * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | + * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] + * NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | + * [#x203F-#x2040] Name ::= NameStartChar (NameChar)* Letter ::= BaseChar | + * Ideographic BaseChar ::= [#x0041-#x005A] | [#x0061-#x007A] | + * [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | + * [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | + * [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | + * [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | + * [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | + * [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | + * [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | + * [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | + * #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | + * [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | + * [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | + * [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | + * [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | + * [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | + * [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | + * [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | + * #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | + * [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | + * #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | + * [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | + * [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | + * [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | + * [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | + * [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | + * [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | + * [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | + * [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | + * [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | + * [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | + * [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | + * [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | + * #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | + * [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | + * [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | + * [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | + * [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | + * #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | + * #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | + * #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | + * [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | + * [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | + * [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | + * [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | + * [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | + * [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | + * [#xAC00-#xD7A3] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | + * [#x3021-#x3029] + * + * @return Random ID value + */ + + //Initialization of a generator of identifiers for all token SAML. + + static { + loadRandomIdentifierGenerator(); + } + + + /** + * Load random identifier generator. + * + *@throws STORKSAMLEngineRuntimeException the STORKSAML engine runtime exception + */ + private static void loadRandomIdentifierGenerator() { + + try { + generator = new SecureRandomIdentifierGenerator(); + } catch (NoSuchAlgorithmException ex) { + LOG.error("Error init SecureRandomIdentifierGenerator", ex); + throw new STORKSAMLEngineRuntimeException(ex); + } + + } + + /** + * Creates the SAML object. + * + * @param qname the QName + * + * @return the XML object + */ + public static XMLObject createSamlObject(final QName qname) { + return Configuration.getBuilderFactory().getBuilder(qname).buildObject( + qname); + } + + /** + * Creates the SAML object. + * + * @param qname the quality name + * @param qname1 the qname1 + * + * @return the xML object + */ + public static XMLObject createSamlObject(final QName qname, + final QName qname1) { + return Configuration.getBuilderFactory().getBuilder(qname1) + .buildObject(qname, qname1); + } + + /** + * Encode value with an specific algorithm. + * + * @param value the value + * @param alg the algorithm + * + * @return the string + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static String encode(final String value, final String alg) + throws STORKSAMLEngineException { + LOG.debug("Encode value with " + alg + " algorithm."); + byte[] buffer; + + final StringBuffer hash = new StringBuffer(""); + try { + buffer = value.getBytes(UTF_8); + MessageDigest msgDig; + msgDig = MessageDigest.getInstance(alg); + + + msgDig.update(buffer); + final byte[] digest = msgDig.digest(); + + final int signedByte = 0xff; + for (byte aux : digest) { + final int byt = aux & signedByte; + if (Integer.toHexString(byt).length() == 1) { + hash.append('0'); + } + hash.append(Integer.toHexString(byt)); + } + + } catch (UnsupportedEncodingException e1) { + LOG.error("UnsupportedEncodingException: " + UTF_8); + throw new STORKSAMLEngineException(e1); + } catch (NoSuchAlgorithmException e) { + LOG.error("NoSuchAlgorithmException: " + alg); + throw new STORKSAMLEngineException(e); + } + + return hash.toString(); + } + + /** + * Generate assertion. + * + * @param version the version + * @param identifier the identifier + * @param issueInstant the issue instant + * @param issuer the issuer + * + * @return the assertion + */ + public static Assertion generateAssertion(final SAMLVersion version, + final String identifier, final DateTime issueInstant, + final Issuer issuer) { + final AssertionBuilder assertionBuilder = new AssertionBuilder(); + final Assertion assertion = assertionBuilder.buildObject(); + assertion.setVersion(version); + assertion.setID(identifier); + assertion.setIssueInstant(issueInstant); + + // + assertion.setIssuer(issuer); + return assertion; + } + + /** + * Generate authentication statement. + * + * @param authnInstant the authentication instant + * @param authnContext the authentication context + * + * @return the authentication statement + */ + public static AuthnStatement generateAthnStatement(final DateTime authnInstant, + final AuthnContext authnContext) { + // + final AuthnStatement authnStatement = (AuthnStatement) SAMLEngineUtils + .createSamlObject(AuthnStatement.DEFAULT_ELEMENT_NAME); + + authnStatement.setAuthnInstant(authnInstant); + authnStatement.setAuthnContext(authnContext); + + return authnStatement; + } + + + + + + /** + * Generate attribute from a list of values. + * + * @param name the name of the attribute. + * @param status the status of the parameter: "Available", "NotAvailable" or + * "Withheld". + * @param values the value of the attribute. + * @param isHashing the is hashing with "SHA-512" algorithm. + * @return the attribute + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static Attribute generateAttrComplex(final String name, + final String status, final Map values, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.debug("Generate attribute complex: " + name); + final Attribute attribute = (Attribute) SAMLEngineUtils + .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); + + attribute.setName(name); + attribute.setNameFormat(Attribute.URI_REFERENCE); + + attribute.getUnknownAttributes().put( + new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", + SAMLCore.STORK10_PREFIX.getValue()), status); + + if (!values.isEmpty()) { + LOG.debug("Add attribute values."); + + // Create an attribute that contains all XSAny elements. + final XSAny attrValue = (XSAny) SAMLEngineUtils.createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, XSAny.TYPE_NAME); + + final Iterator> iterator = values.entrySet() + .iterator(); + while (iterator.hasNext()) { + final Map.Entry pairs = iterator.next(); + + final String value = pairs.getValue(); + + if (StringUtils.isNotBlank(value)) { + // Create the attribute statement + final XSAny attrValueSimple = (XSAny) SAMLEngineUtils + .createSamlObject(new QName(SAMLCore.STORK10_NS.getValue(), + pairs.getKey().toString(), + SAMLCore.STORK10_PREFIX.getValue()), XSAny.TYPE_NAME); + + // if it's necessary encode the information. + if (isHashing) { + attrValueSimple + .setTextContent(encode(value, SHA_512)); + } else { + attrValueSimple.setTextContent(value); + } + + attrValue.getUnknownXMLObjects().add(attrValueSimple); + attribute.getAttributeValues().add(attrValue); + } + } + + } + return attribute; + } + + /** + * Generate extension. + * + * @return the extensions + */ + public static Extensions generateExtension() { + final ExtensionsBuilder extensionsBuilder = new ExtensionsBuilder(); + return extensionsBuilder.buildObject( + "urn:oasis:names:tc:SAML:2.0:protocol", "Extensions", "saml2p"); + } + + + + + /** + * Generate issuer. + * + * @return the issuer + */ + public static Issuer generateIssuer() { + return (Issuer) SAMLEngineUtils + .createSamlObject(Issuer.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate key info. + * + * @return the key info + */ + public static KeyInfo generateKeyInfo() { + return (KeyInfo) SAMLEngineUtils + .createSamlObject(KeyInfo.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate name id. + * + * @return the name id + */ + public static NameID generateNameID() { + return (NameID) SAMLEngineUtils + .createSamlObject(NameID.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate name id. + * + * @param nameQualifier the name qualifier + * @param format the format + * @param spNameQualifier the sP name qualifier + * + * @return the name id + */ + public static NameID generateNameID(final String nameQualifier, + final String format, final String spNameQualifier) { + // + final NameID nameId = (NameID) Configuration.getBuilderFactory() + .getBuilder(NameID.DEFAULT_ELEMENT_NAME).buildObject( + NameID.DEFAULT_ELEMENT_NAME); + + // optional + nameId.setNameQualifier(nameQualifier); + + // optional + nameId.setFormat(format); + + // optional + nameId.setSPNameQualifier(spNameQualifier); + + return nameId; + } + + /** + * Generate NCName. + * + * @return the string + */ + public static String generateNCName() { + return generator.generateIdentifier(); + } + + + /** + * Generate the quality authentication assurance level. + * + * @param qaal the level of quality authentication assurance. + * + * @return the quality authentication assurance attribute + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static QAAAttribute generateQAAAttribute(final int qaal) + throws STORKSAMLEngineException { + LOG.debug("Generate QAAAttribute."); + + final QAAAttribute qaaAttribute = (QAAAttribute) SAMLEngineUtils + .createSamlObject(QAAAttribute.DEF_ELEMENT_NAME); + qaaAttribute.setQaaLevel(String.valueOf(qaal)); + return qaaAttribute; + } + + /** + * Generate requested attribute. + * + * @param name the name + * @param friendlyName the friendly name + * @param isRequired the is required + * @param value the value + * + * @return the requested attribute + */ + public static RequestedAttribute generateReqAuthnAttributeSimple( + final String name, final String friendlyName, + final String isRequired, final List value) { + LOG.debug("Generate the requested attribute."); + + final RequestedAttribute requested = (RequestedAttribute) SAMLEngineUtils + .createSamlObject(RequestedAttribute.DEF_ELEMENT_NAME); + requested.setName(name); + requested.setNameFormat(RequestedAttribute.URI_REFERENCE); + + requested.setFriendlyName(friendlyName); + + requested.setIsRequired(isRequired); + + // The value is optional in an authentication request. + if (!value.isEmpty()) { + for (int nextValue = 0; nextValue < value.size(); nextValue++) { + final String valor = value.get(nextValue); + if (StringUtils.isNotBlank(valor)) { + + if(!name.equals("http://www.stork.gov.eu/1.0/signedDoc")){ + + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + new QName(SAMLCore.STORK10_NS.getValue(), + "AttributeValue", + SAMLCore.STORK10_PREFIX.getValue()), + XSAny.TYPE_NAME); + + attrValue.setTextContent(valor.trim()); + requested.getAttributeValues().add(attrValue); + + }else{ + + DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + domFactory.setNamespaceAware(true); + Document document = null; + DocumentBuilder builder; + + // Parse the signedDoc value into an XML DOM Document + try { + builder = domFactory.newDocumentBuilder(); + InputStream is; + is = new ByteArrayInputStream(valor.trim().getBytes("UTF-8")); + document = builder.parse(is); + is.close(); + } catch (SAXException e1) { + LOG.error("SAX Error while parsing signModule attribute", e1); + throw new STORKSAMLEngineRuntimeException(e1); + } catch (ParserConfigurationException e2) { + LOG.error("Parser Configuration Error while parsing signModule attribute", e2); + throw new STORKSAMLEngineRuntimeException(e2); + } catch (UnsupportedEncodingException e3) { + LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); + throw new STORKSAMLEngineRuntimeException(e3); + } catch (IOException e4) { + LOG.error("IO Error while parsing signModule attribute", e4); + throw new STORKSAMLEngineRuntimeException(e4); + } + + // Create the XML statement(this will be overwritten with the previous DOM structure) + final XSAny xmlValue = (XSAny) SAMLEngineUtils + .createSamlObject( + new QName(SAMLCore.STORK10_NS.getValue(), + "XMLValue", + SAMLCore.STORK10_PREFIX.getValue()), + XSAny.TYPE_NAME); + + //Set the signedDoc XML content to this element + xmlValue.setDOM(document.getDocumentElement()); + + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + new QName(SAMLCore.STORK10_NS.getValue(), + "AttributeValue", + SAMLCore.STORK10_PREFIX.getValue()), + XSAny.TYPE_NAME); + + //Add previous signedDocXML to the AttributeValue Element + attrValue.getUnknownXMLObjects().add(xmlValue); + + requested.getAttributeValues().add(attrValue); + } + + + } + } + } + + return requested; + } + + /** + * Generate response. + * + * @param version the version + * @param identifier the identifier + * @param issueInstant the issue instant + * @param status the status + * + * @return the response + */ + public static Response generateResponse(final SAMLVersion version, + final String identifier, final DateTime issueInstant, + final Status status) { + final Response response = (Response) SAMLEngineUtils + .createSamlObject(Response.DEFAULT_ELEMENT_NAME); + response.setID(identifier); + response.setIssueInstant(issueInstant); + response.setStatus(status); + return response; + } + + /** + * Method that generates a SAML Authentication Request basing on the + * provided information. + * + * @param identifier the identifier + * @param version the version + * @param issueInstant the issue instant + * + * @return the authentication request + */ + public static AuthnRequest generateSAMLAuthnRequest(final String identifier, + final SAMLVersion version, final DateTime issueInstant) { + LOG.debug("Generate basic authentication request."); + final AuthnRequest authnRequest = (AuthnRequest) SAMLEngineUtils + .createSamlObject(AuthnRequest.DEFAULT_ELEMENT_NAME); + + authnRequest.setID(identifier); + authnRequest.setVersion(version); + authnRequest.setIssueInstant(issueInstant); + return authnRequest; + } + + public static AttributeQuery generateSAMLAttrQueryRequest(final String identifier, + final SAMLVersion version, final DateTime issueInstant) { + LOG.debug("Generate attribute query request."); + final AttributeQuery attrQueryRequest = (AttributeQuery) SAMLEngineUtils + .createSamlObject(AttributeQuery.DEFAULT_ELEMENT_NAME); + + attrQueryRequest.setID(identifier); + attrQueryRequest.setVersion(version); + attrQueryRequest.setIssueInstant(issueInstant); + return attrQueryRequest; + } + + /** + * Generate service provider application. + * + * @param spApplication the service provider application + * + * @return the sP application + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPApplication generateSPApplication(final String spApplication) + throws STORKSAMLEngineException { + LOG.debug("Generate SPApplication."); + + final SPApplication applicationAttr = (SPApplication) SAMLEngineUtils + .createSamlObject(SPApplication.DEF_ELEMENT_NAME); + applicationAttr.setSPApplication(spApplication); + return applicationAttr; + } + + /** + * Generate service provider country. + * + * @param spCountry the service provider country + * + * @return the service provider country + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPCountry generateSPCountry(final String spCountry) + throws STORKSAMLEngineException { + LOG.debug("Generate SPApplication."); + + final SPCountry countryAttribute = (SPCountry) SAMLEngineUtils + .createSamlObject(SPCountry.DEF_ELEMENT_NAME); + countryAttribute.setSPCountry(spCountry); + return countryAttribute; + } + + /** + * Generate service provider institution. + * + * @param spInstitution the service provider institution + * + * @return the service provider institution + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPInstitution generateSPInstitution(final String spInstitution) + throws STORKSAMLEngineException { + LOG.debug("Generate SPInstitution."); + + final SPInstitution institutionAttr = (SPInstitution) SAMLEngineUtils + .createSamlObject(SPInstitution.DEF_ELEMENT_NAME); + institutionAttr.setSPInstitution(spInstitution); + return institutionAttr; + } + + /** + * Generate service provider sector. + * + * @param spSector the service provider sector + * + * @return the service provider sector + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPSector generateSPSector(final String spSector) + throws STORKSAMLEngineException { + LOG.debug("Generate SPSector."); + + final SPSector sectorAttribute = (SPSector) SAMLEngineUtils + .createSamlObject(SPSector.DEF_ELEMENT_NAME); + sectorAttribute.setSPSector(spSector); + return sectorAttribute; + } + + /** + * Generate status. + * + * @param statusCode the status code + * + * @return the status + */ + public static Status generateStatus(final StatusCode statusCode) { + final Status status = (Status) SAMLEngineUtils + .createSamlObject(Status.DEFAULT_ELEMENT_NAME); + status.setStatusCode(statusCode); + return status; + } + + /** + * Generate status code. + * + * @param value the value + * + * @return the status code + */ + public static StatusCode generateStatusCode(final String value) { + final StatusCode statusCode = (StatusCode) SAMLEngineUtils + .createSamlObject(StatusCode.DEFAULT_ELEMENT_NAME); + statusCode.setValue(value); + return statusCode; + } + + + /** + * Generate status message. + * + * @param message the message + * + * @return the status message + */ + public static StatusMessage generateStatusMessage(final String message) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .createSamlObject(StatusMessage.DEFAULT_ELEMENT_NAME); + statusMessage.setMessage(message); + return statusMessage; + } + + /** + * Generate subject. + * + * @return the subject + */ + public static Subject generateSubject() { + return (Subject) SAMLEngineUtils + .createSamlObject(Subject.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate subject confirmation. + * + * @param method the method + * @param data the data + * + * @return the subject confirmation + */ + public static SubjectConfirmation generateSubjectConfirmation( + final String method, final SubjectConfirmationData data) { + final SubjectConfirmation subjectConf = (SubjectConfirmation) Configuration + .getBuilderFactory().getBuilder( + SubjectConfirmation.DEFAULT_ELEMENT_NAME).buildObject( + SubjectConfirmation.DEFAULT_ELEMENT_NAME); + + subjectConf.setMethod(method); + + subjectConf.setSubjectConfirmationData(data); + + return subjectConf; + } + + + /** + * Generate subject confirmation data. + * + * @param notOnOrAfter the not on or after + * @param recipient the recipient + * @param inResponseTo the in response to + * + * @return the subject confirmation data + */ + public static SubjectConfirmationData generateSubjectConfirmationData( + final DateTime notOnOrAfter, final String recipient, + final String inResponseTo) { + final SubjectConfirmationData subjectConfData = (SubjectConfirmationData) SAMLEngineUtils + .createSamlObject(SubjectConfirmationData.DEFAULT_ELEMENT_NAME); + subjectConfData.setNotOnOrAfter(notOnOrAfter); + subjectConfData.setRecipient(recipient); + subjectConfData.setInResponseTo(inResponseTo); + return subjectConfData; + } + + + /** + * Generate subject locality. + * + * @param address the address + * + * @return the subject locality + */ + public static SubjectLocality generateSubjectLocality(final String address) { + final SubjectLocality subjectLocality = (SubjectLocality) SAMLEngineUtils + .createSamlObject(SubjectLocality.DEFAULT_ELEMENT_NAME); + subjectLocality.setAddress(address); + return subjectLocality; + } + + + + + /** + * Method that returns the current time. + * + * @return the current time + */ + public static DateTime getCurrentTime() { + return new DateTime(); + } + + + /** + * Instantiates a new SAML engine utilities. + */ + private SAMLEngineUtils() { + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base new file mode 100644 index 000000000..3cac2f637 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base @@ -0,0 +1,2983 @@ +/* + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.commons.lang.StringUtils; +import org.bouncycastle.jce.X509Principal; +import org.joda.time.DateTime; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLVersion; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.common.Extensions; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.AttributeQuery; +import org.opensaml.saml2.core.AttributeStatement; +import org.opensaml.saml2.core.AttributeValue; +import org.opensaml.saml2.core.Audience; +import org.opensaml.saml2.core.AudienceRestriction; +import org.opensaml.saml2.core.AuthnContext; +import org.opensaml.saml2.core.AuthnContextDecl; +import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.core.AuthnStatement; +import org.opensaml.saml2.core.Conditions; +import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.NameID; +import org.opensaml.saml2.core.OneTimeUse; +import org.opensaml.saml2.core.Response; +import org.opensaml.saml2.core.Status; +import org.opensaml.saml2.core.StatusCode; +import org.opensaml.saml2.core.StatusMessage; +import org.opensaml.saml2.core.Subject; +import org.opensaml.saml2.core.SubjectConfirmation; +import org.opensaml.saml2.core.SubjectConfirmationData; +import org.opensaml.saml2.core.SubjectLocality; +import org.opensaml.saml2.core.impl.SubjectConfirmationBuilder; +import org.opensaml.xml.Namespace; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSAny; +import org.opensaml.xml.schema.impl.XSAnyBuilder; +import org.opensaml.xml.schema.impl.XSAnyImpl; +import org.opensaml.xml.schema.impl.XSAnyMarshaller; +import org.opensaml.xml.schema.impl.XSAnyUnmarshaller; +import org.opensaml.xml.schema.impl.XSStringImpl; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.util.Base64; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; +import org.opensaml.xml.validation.ValidatorSuite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAttrQueryRequest; +import eu.stork.peps.auth.commons.STORKAttrQueryResponse; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; +import eu.stork.peps.auth.engine.core.EIDSectorShare; +import eu.stork.peps.auth.engine.core.QAAAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.SPApplication; +import eu.stork.peps.auth.engine.core.SPCountry; +import eu.stork.peps.auth.engine.core.SPID; +import eu.stork.peps.auth.engine.core.SPInformation; +import eu.stork.peps.auth.engine.core.SPInstitution; +import eu.stork.peps.auth.engine.core.SPSector; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; +import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesBuilder; +import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesMarshaller; +import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeBuilder; +import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeMarshaller; +import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareBuilder; +import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareMarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareBuilder; +import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareMarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDSectorShareBuilder; +import eu.stork.peps.auth.engine.core.impl.EIDSectorShareMarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDSectorShareUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeBuilder; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeMarshaller; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeBuilder; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeMarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesBuilder; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesMarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPApplicationBuilder; +import eu.stork.peps.auth.engine.core.impl.SPApplicationMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPApplicationUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPCountryBuilder; +import eu.stork.peps.auth.engine.core.impl.SPCountryMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPCountryUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPIDBuilder; +import eu.stork.peps.auth.engine.core.impl.SPIDMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPIDUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInformationBuilder; +import eu.stork.peps.auth.engine.core.impl.SPInformationMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInformationUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInstitutionBuilder; +import eu.stork.peps.auth.engine.core.impl.SPInstitutionMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInstitutionUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPSectorBuilder; +import eu.stork.peps.auth.engine.core.impl.SPSectorMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPSectorUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesBuilder; +import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesMarshaller; +import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.validator.ExtensionsSchemaValidator; +import eu.stork.peps.auth.engine.core.validator.QAAAttributeSchemaValidator; +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * Class that wraps the operations over SAML tokens, both generation and + * validation of SAML STORK requests and SAML STORK responses. Complaint with + * "OASIS Secure Assertion Markup Language (SAML) 2.0, May 2005", but taking + * into account STORK specific requirements. + * + * @author fjquevedo + * @author iinigo + */ +public final class STORKSAMLEngine extends SAMLEngine { + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(STORKSAMLEngine.class.getName()); + + private static final String ATTRIBUTE_EMPTY_LITERAL = "Attribute name is null or empty."; + /** + * Gets the single instance of STORKSAMLEngine. + * + * @param nameInstance the name instance + * + * @return single instance of STORKSAMLEngine + */ + public static synchronized STORKSAMLEngine getInstance( + final String nameInstance) { + STORKSAMLEngine engine = null; + LOG.info("Get instance: " + nameInstance); + try { + engine = new STORKSAMLEngine(nameInstance.trim()); + } catch (Exception e) { + LOG.error("Error get instance: " + nameInstance); + } + return engine; + } + + /** + * Instantiate a new STORKSAML engine. + * + * @param nameInstance the name instance + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private STORKSAMLEngine(final String nameInstance) + throws STORKSAMLEngineException { + // Initialization OpenSAML. + super(nameInstance); + LOG.info("Register STORK objects provider."); + Configuration.registerObjectProvider(QAAAttribute.DEF_ELEMENT_NAME, + new QAAAttributeBuilder(), new QAAAttributeMarshaller(), + new QAAAttributeUnmarshaller()); + + Configuration.registerObjectProvider(EIDSectorShare.DEF_ELEMENT_NAME, + new EIDSectorShareBuilder(), new EIDSectorShareMarshaller(), + new EIDSectorShareUnmarshaller()); + + Configuration.registerObjectProvider( + EIDCrossSectorShare.DEF_ELEMENT_NAME, + new EIDCrossSectorShareBuilder(), + new EIDCrossSectorShareMarshaller(), + new EIDCrossSectorShareUnmarshaller()); + + Configuration.registerObjectProvider( + EIDCrossBorderShare.DEF_ELEMENT_NAME, + new EIDCrossBorderShareBuilder(), + new EIDCrossBorderShareMarshaller(), + new EIDCrossBorderShareUnmarshaller()); + + Configuration.registerObjectProvider(SPSector.DEF_ELEMENT_NAME, + new SPSectorBuilder(), new SPSectorMarshaller(), + new SPSectorUnmarshaller()); + + Configuration.registerObjectProvider(SPInstitution.DEF_ELEMENT_NAME, + new SPInstitutionBuilder(), new SPInstitutionMarshaller(), + new SPInstitutionUnmarshaller()); + + Configuration.registerObjectProvider(SPApplication.DEF_ELEMENT_NAME, + new SPApplicationBuilder(), new SPApplicationMarshaller(), + new SPApplicationUnmarshaller()); + + Configuration.registerObjectProvider(SPCountry.DEF_ELEMENT_NAME, + new SPCountryBuilder(), new SPCountryMarshaller(), + new SPCountryUnmarshaller()); + + Configuration.registerObjectProvider(XSAny.TYPE_NAME, + new XSAnyBuilder(), new XSAnyMarshaller(), + new XSAnyUnmarshaller()); + + Configuration.registerObjectProvider( + RequestedAttribute.DEF_ELEMENT_NAME, + new RequestedAttributeBuilder(), + new RequestedAttributeMarshaller(), + new RequestedAttributeUnmarshaller()); + + Configuration.registerObjectProvider( + RequestedAttributes.DEF_ELEMENT_NAME, + new RequestedAttributesBuilder(), + new RequestedAttributesMarshaller(), + new RequestedAttributesUnmarshaller()); + + Configuration.registerObjectProvider( + AuthenticationAttributes.DEF_ELEMENT_NAME, + new AuthenticationAttributesBuilder(), + new AuthenticationAttributesMarshaller(), + new AuthenticationAttributesUnmarshaller()); + + Configuration.registerObjectProvider( + VIDPAuthenticationAttributes.DEF_ELEMENT_NAME, + new VIDPAuthenticationAttributesBuilder(), + new VIDPAuthenticationAttributesMarshaller(), + new VIDPAuthenticationAttributesUnmarshaller()); + + Configuration.registerObjectProvider( + CitizenCountryCode.DEF_ELEMENT_NAME, + new CitizenCountryCodeBuilder(), + new CitizenCountryCodeMarshaller(), + new CitizenCountryCodeUnmarshaller()); + + Configuration.registerObjectProvider( + SPID.DEF_ELEMENT_NAME, + new SPIDBuilder(), + new SPIDMarshaller(), + new SPIDUnmarshaller()); + + Configuration.registerObjectProvider( + SPInformation.DEF_ELEMENT_NAME, + new SPInformationBuilder(), + new SPInformationMarshaller(), + new SPInformationUnmarshaller()); + + LOG.info("Register STORK object validators."); + final ValidatorSuite validatorSuite = new ValidatorSuite( + QAAAttribute.DEF_LOCAL_NAME); + + validatorSuite.registerValidator(QAAAttribute.DEF_ELEMENT_NAME, + new QAAAttributeSchemaValidator()); + final Extensions extensions = SAMLEngineUtils.generateExtension(); + validatorSuite.registerValidator(extensions.getElementQName(), + new ExtensionsSchemaValidator()); + + Configuration.registerValidatorSuite( + "stork:QualityAuthenticationAssuranceLevel", validatorSuite); + + } + + /** + * Generate authentication response base. + * + * @param status the status + * @param assertConsumerURL the assert consumer URL. + * @param inResponseTo the in response to + * + * @return the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Response genAuthnRespBase(final Status status, + final String assertConsumerURL, final String inResponseTo) + throws STORKSAMLEngineException { + LOG.debug("Generate Authentication Response base."); + final Response response = SAMLEngineUtils.generateResponse( + SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), + SAMLEngineUtils.getCurrentTime(), status); + + // Set name Spaces + this.setNameSpaces(response); + + // Mandatory STORK + LOG.debug("Generate Issuer"); + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + issuer.setValue(super.getSamlCoreProperties().getResponder()); + + // Format Entity Optional STORK + issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); + + response.setIssuer(issuer); + + // destination Mandatory Stork + response.setDestination(assertConsumerURL.trim()); + + // inResponseTo Mandatory Stork + response.setInResponseTo(inResponseTo.trim()); + + // Optional STORK + response.setConsent(super.getSamlCoreProperties() + .getConsentAuthnResponse()); + + return response; + } + + /** + * Generate attribute query response base. + * + * @param status the status + * @param destinationURL the assert consumer URL. + * @param inResponseTo the in response to + * + * @return the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Response genAttrQueryRespBase(final Status status, + final String destinationURL, final String inResponseTo) + throws STORKSAMLEngineException { + LOG.debug("Generate Attribute query Response base."); + final Response response = SAMLEngineUtils.generateResponse( + SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), + SAMLEngineUtils.getCurrentTime(), status); + + // Set name Spaces + this.setNameSpaces(response); + + // Mandatory STORK + LOG.debug("Generate Issuer"); + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + issuer.setValue(super.getSamlCoreProperties().getResponder()); + + // Format Entity Optional STORK + issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); + + response.setIssuer(issuer); + + // destination Mandatory Stork + response.setDestination(destinationURL.trim()); + + // inResponseTo Mandatory Stork + response.setInResponseTo(inResponseTo.trim()); + + // Optional STORK + response.setConsent(super.getSamlCoreProperties() + .getConsentAuthnResponse()); + + return response; + } + + /** + * Generate assertion. + * + * @param ipAddress the IP address. + * @param assertConsumerURL the assert consumer URL. + * @param inResponseTo the in response to + * @param issuer the issuer + * @param notOnOrAfter the not on or after + * + * @return the assertion + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Assertion generateAssertion(final String ipAddress, + final String assertConsumerURL, final String inResponseTo, + final String issuer, final DateTime notOnOrAfter) + throws STORKSAMLEngineException { + LOG.info("Generate Assertion."); + + // Mandatory STORK + LOG.debug("Generate Issuer to Assertion"); + final Issuer issuerAssertion = SAMLEngineUtils.generateIssuer(); + issuerAssertion.setValue(super.getSamlCoreProperties().getResponder()); + + // Format Entity Optional STORK + issuerAssertion.setFormat(super.getSamlCoreProperties() + .getFormatEntity()); + + final Assertion assertion = SAMLEngineUtils.generateAssertion( + SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), + SAMLEngineUtils.getCurrentTime(), issuerAssertion); + + final Subject subject = SAMLEngineUtils.generateSubject(); + + // Mandatory STORK verified + // String format = NameID.UNSPECIFIED + // specification: 'SAML:2.0' exist + // opensaml: "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" + // opensaml "urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified" + final String format = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"; + + final String nameQualifier = ""; + + LOG.debug("Generate NameID"); + final NameID nameId = SAMLEngineUtils.generateNameID(super + .getSamlCoreProperties().getResponder(), format, nameQualifier); + nameId.setValue(format); + subject.setNameID(nameId); + + // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. + // Optional in other case. + LOG.debug("Generate SubjectConfirmationData."); + final SubjectConfirmationData dataBearer = SAMLEngineUtils + .generateSubjectConfirmationData(SAMLEngineUtils + .getCurrentTime(), assertConsumerURL, inResponseTo); + + // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. + // Optional in other case. + LOG.debug("Generate SubjectConfirmation"); + final SubjectConfirmation subjectConf = SAMLEngineUtils + .generateSubjectConfirmation(SubjectConfirmation.METHOD_BEARER, + dataBearer); + + final ArrayList listSubjectConf = new ArrayList(); + listSubjectConf.add(subjectConf); + + for (final Iterator iter = listSubjectConf + .iterator(); iter.hasNext();) { + final SubjectConfirmation element = iter.next(); + + if (SubjectConfirmation.METHOD_BEARER.equals(element.getMethod())) { + // ipAddress Mandatory if method is Bearer. + + if (StringUtils.isBlank(ipAddress)) { + throw new STORKSAMLEngineException( + "ipAddress is null or empty"); + } + element.getSubjectConfirmationData().setAddress( + ipAddress.trim()); + } + + element.getSubjectConfirmationData() + .setRecipient(assertConsumerURL); + element.getSubjectConfirmationData().setNotOnOrAfter(notOnOrAfter); + } + + // The SAML 2.0 specification allows multiple SubjectConfirmations + subject.getSubjectConfirmations().addAll(listSubjectConf); + + // Mandatory Stork + assertion.setSubject(subject); + + // Conditions that MUST be evaluated when assessing the validity of + // and/or when using the assertion. + final Conditions conditions = this.generateConditions(SAMLEngineUtils + .getCurrentTime(), notOnOrAfter, issuer); + + assertion.setConditions(conditions); + + LOG.debug("Generate stork Authentication Statement."); + final AuthnStatement storkAuthnStat = this + .generateStorkAuthStatement(ipAddress); + assertion.getAuthnStatements().add(storkAuthnStat); + + return assertion; + } + + private String getAttributeName(final PersonalAttribute attribute) throws STORKSAMLEngineException { + if (StringUtils.isBlank(attribute.getName())) { + LOG.error(ATTRIBUTE_EMPTY_LITERAL); + throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); + } + + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.error("Attribute name: {} it is not known.", attribute + .getName()); + throw new STORKSAMLEngineException("Attribute name: " + + attribute.getName() + " it is not known."); + } + return attributeName; + } + /** + * Generate attribute statement. + * + * @param personalAttrList the personal attribute list + * @param isHashing the is hashing + * + * @return the attribute statement + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + * @throws IOException + */ + private AttributeStatement generateAttributeStatement( + final IPersonalAttributeList personalAttrList, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.debug("Generate attribute statement"); + + final AttributeStatement attrStatement = (AttributeStatement) SAMLEngineUtils + .createSamlObject(AttributeStatement.DEFAULT_ELEMENT_NAME); + + for (PersonalAttribute attribute : personalAttrList) { + + String attributeName = getAttributeName(attribute); + + // Verification that only one value it's permitted, simple or + // complex, not both. + + final boolean simpleNull = (attribute.getValue() == null); + final boolean simpleEmpty = (simpleNull || (!simpleNull && attribute + .getValue().isEmpty())); + + final boolean complexNull = (attribute.getComplexValue() == null); + final boolean complexEmpty = (complexNull || (!complexNull && attribute + .getComplexValue().isEmpty())); + + if ((!simpleEmpty && !complexEmpty)) { + throw new STORKSAMLEngineException( + "Attribute name: " + + attribute.getName() + + " must be contain one value, simple or complex value."); + } else { + + if (!simpleEmpty) { + attrStatement.getAttributes().add( + this.generateAttrSimple(attributeName, attribute + .getStatus(), attribute.getValue(), + isHashing)); + } else if (!complexEmpty) { + attrStatement.getAttributes().add( + SAMLEngineUtils.generateAttrComplex(attributeName, + attribute.getStatus(), attribute + .getComplexValue(), isHashing)); + } else if (!simpleNull) { + attrStatement.getAttributes().add( + this.generateAttrSimple(attributeName, attribute + .getStatus(), new ArrayList(), + isHashing)); + } else { + // Add attribute complex. + attrStatement.getAttributes().add( + SAMLEngineUtils.generateAttrComplex(attributeName, + attribute.getStatus(), + new HashMap(), isHashing)); + } + } + } + return attrStatement; + } + private XSAny createAttributeValueForSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { + DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + domFactory.setNamespaceAware(true); + Document document = null; + DocumentBuilder builder; + + // Parse the signedDoc value into an XML DOM Document + try { + builder = domFactory.newDocumentBuilder(); + InputStream is; + is = new ByteArrayInputStream(value.trim().getBytes("UTF-8")); + document = builder.parse(is); + is.close(); + } catch (SAXException e1) { + LOG.error("SAX Error while parsing signModule attribute", e1); + throw new STORKSAMLEngineRuntimeException(e1); + } catch (ParserConfigurationException e2) { + LOG.error("Parser Configuration Error while parsing signModule attribute", e2); + throw new STORKSAMLEngineRuntimeException(e2); + } catch (UnsupportedEncodingException e3) { + LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); + throw new STORKSAMLEngineRuntimeException(e3); + } catch (IOException e4) { + LOG.error("IO Error while parsing signModule attribute", e4); + throw new STORKSAMLEngineRuntimeException(e4); + } + + // Create the attribute statement + final XSAny xmlValue = (XSAny) SAMLEngineUtils + .createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, + XSAny.TYPE_NAME); + + //Set the signedDoc XML content to this element + xmlValue.setDOM(document.getDocumentElement()); + + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, + XSAny.TYPE_NAME); + + //Add previous signedDocXML to the AttributeValue Element + + // if it's necessary encode the information. + if (!isHashing) { + attrValue.getUnknownXMLObjects().add(xmlValue); + } + return attrValue; + } + + private XSAny createAttributeValueForNonSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, + XSAny.TYPE_NAME); + // if it's necessary encode the information. + if (isHashing) { + attrValue.setTextContent(SAMLEngineUtils.encode(value, SAMLEngineUtils.SHA_512)); + } else { + attrValue.setTextContent(value); + } + return attrValue; + } + + /** + * Generate attribute from a list of values. + * + * @param name the name of the attribute. + * @param values the value of the attribute. + * @param isHashing the is hashing with "SHA-512" algorithm. + * @param status the status of the parameter: "Available", "NotAvailable" or + * "Withheld". + * + * @return the attribute + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Attribute generateAttrSimple(final String name, + final String status, final List values, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.debug("Generate attribute simple: " + name); + final Attribute attribute = (Attribute) SAMLEngineUtils + .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); + + attribute.setName(name); + attribute.setNameFormat(Attribute.URI_REFERENCE); + + attribute.getUnknownAttributes().put( + new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", + SAMLCore.STORK10_PREFIX.getValue()), status); + + if (values != null) { + LOG.debug("Add attribute values."); + for (int i = 0; i < values.size(); i++) { + final String value = values.get(i); + if (StringUtils.isNotBlank(value)) { + XSAny attrValue = null; + if (!name.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + // Create the attribute statement + attrValue = createAttributeValueForNonSignedDoc(value, isHashing); + + } else { + attrValue = createAttributeValueForSignedDoc(value, isHashing); + attribute.getAttributeValues().add(attrValue); + } + attribute.getAttributeValues().add(attrValue); + } + } + } + return attribute; + } + + /** + * Generate conditions that MUST be evaluated when assessing the validity of + * and/or when using the assertion. + * + * @param notBefore the not before + * @param notOnOrAfter the not on or after + * @param audienceURI the audience URI. + * + * @return the conditions + */ + private Conditions generateConditions(final DateTime notBefore, + final DateTime notOnOrAfter, final String audienceURI) { + LOG.debug("Generate conditions."); + final Conditions conditions = (Conditions) SAMLEngineUtils + .createSamlObject(Conditions.DEFAULT_ELEMENT_NAME); + conditions.setNotBefore(notBefore); + conditions.setNotOnOrAfter(notOnOrAfter); + + final AudienceRestriction restrictions = (AudienceRestriction) SAMLEngineUtils + .createSamlObject(AudienceRestriction.DEFAULT_ELEMENT_NAME); + + final Audience audience = (Audience) SAMLEngineUtils + .createSamlObject(Audience.DEFAULT_ELEMENT_NAME); + audience.setAudienceURI(audienceURI); + + restrictions.getAudiences().add(audience); + conditions.getAudienceRestrictions().add(restrictions); + + if (super.getSamlCoreProperties().isOneTimeUse()) { + final OneTimeUse oneTimeUse = (OneTimeUse) SAMLEngineUtils + .createSamlObject(OneTimeUse.DEFAULT_ELEMENT_NAME); + conditions.getConditions().add(oneTimeUse); + } + return conditions; + } + + /** + * Generate personal attribute list. + * + * @param assertion the assertion + * + * @return the personal attribute list + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private IPersonalAttributeList generatePersonalAttributeList( + final Assertion assertion) throws STORKSAMLEngineException { + LOG.debug("Generate personal attribute list from XMLObject."); + final List listExtensions = assertion.getOrderedChildren(); + + boolean find = false; + AttributeStatement requestedAttr = null; + + // Search the attribute statement. + for (int i = 0; i < listExtensions.size() && !find; i++) { + final XMLObject xml = listExtensions.get(i); + if (xml instanceof AttributeStatement) { + requestedAttr = (AttributeStatement) xml; + find = true; + } + } + + if (!find) { + LOG.error("Error: AttributeStatement it's not present."); + throw new STORKSAMLEngineException( + "AttributeStatement it's not present."); + } + + final List reqAttrs = requestedAttr.getAttributes(); + + final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); + String attributeName; + + // Process the attributes. + for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { + final Attribute attribute = reqAttrs.get(nextAttribute); + + final PersonalAttribute personalAttribute = new PersonalAttribute(); + + attributeName = attribute.getName(); + personalAttribute.setName(attributeName.substring(attributeName + .lastIndexOf('/') + 1)); + + personalAttribute.setStatus(attribute.getUnknownAttributes().get( + new QName(SAMLCore.STORK10_NS.getValue(), + "AttributeStatus", SAMLCore.STORK10_PREFIX + .getValue()))); + + final ArrayList simpleValues = new ArrayList(); + final HashMap multiValues = new HashMap(); + + final List values = attribute.getOrderedChildren(); + + + // Process the values. + for (int nextValue = 0; nextValue < values.size(); nextValue++) { + + final XMLObject xmlObject = values.get(nextValue); + + if (xmlObject instanceof XSStringImpl) { + + // Process simple value. + simpleValues.add(((XSStringImpl) xmlObject).getValue()); + + } else if (xmlObject instanceof XSAnyImpl) { + + if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextValue); + + TransformerFactory transFactory = TransformerFactory + .newInstance(); + Transformer transformer = null; + try { + transformer = transFactory.newTransformer(); + transformer.setOutputProperty( + OutputKeys.OMIT_XML_DECLARATION, "yes"); + } catch (TransformerConfigurationException e) { + LOG.error("Error transformer configuration exception", e); + } + StringWriter buffer = new StringWriter(); + try { + if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ + transformer.transform(new DOMSource(xmlString + .getUnknownXMLObjects().get(0).getDOM()), + new StreamResult(buffer)); + } + } catch (TransformerException e) { + LOG.error("Error transformer exception", e); + } + String str = buffer.toString(); + + simpleValues.add(str); + + } else if (attributeName + .equals("http://www.stork.gov.eu/1.0/canonicalResidenceAddress")) + { + LOG.info("canonicalResidenceAddress found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + + } + else if (attributeName + .equals("http://www.stork.gov.eu/1.0/newAttribute2")) + { + LOG.info("newAttribute2 found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + } + else if (attributeName + .equals("http://www.stork.gov.eu/1.0/hasDegree")) + { + LOG.info("hasDegree found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + } + else if(attributeName + .equals("http://www.stork.gov.eu/1.0/mandateContent")) + { + LOG.info("mandateContent found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + } + else { + // Process simple value. + simpleValues.add(((XSAnyImpl) xmlObject) + .getTextContent()); + } + + } else { + LOG.error("Error: attribute value it's unknown."); + throw new STORKSAMLEngineException( + "Attribute value it's unknown."); + } + } + + personalAttribute.setValue(simpleValues); + personalAttribute.setComplexValue(multiValues); + personalAttrList.add(personalAttribute); + } + + return personalAttrList; + } + + /** + * Generate stork authentication request. + * + * @param request the request that contain all parameters for generate an + * authentication request. + * + * @return the STORK authentication request that has been processed. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnRequest generateSTORKAuthnRequest( + final STORKAuthnRequest request) throws STORKSAMLEngineException { + LOG.info("Generate SAMLAuthnRequest."); + + // Validate Parameters mandatories + validateParamAuthnReq(request); + + final AuthnRequest authnRequestAux = SAMLEngineUtils + .generateSAMLAuthnRequest(SAMLEngineUtils.generateNCName(), + SAMLVersion.VERSION_20, SAMLEngineUtils + .getCurrentTime()); + + // Set name spaces. + setNameSpaces(authnRequestAux); + + // Add parameter Mandatory STORK + authnRequestAux.setForceAuthn(Boolean.TRUE); + + // Add parameter Mandatory STORK + authnRequestAux.setIsPassive(Boolean.FALSE); + + authnRequestAux.setAssertionConsumerServiceURL(request + .getAssertionConsumerServiceURL()); + + authnRequestAux.setProviderName(request.getProviderName()); + + // Add protocol binding + authnRequestAux.setProtocolBinding(super.getSamlCoreProperties() + .getProtocolBinding()); + + // Add parameter optional STORK + // Destination is mandatory if the destination is a C-PEPS + // The application must to know if the destination is a C-PEPS. + if (StringUtils.isNotBlank(request.getDestination())) { + authnRequestAux.setDestination(request.getDestination()); + } + + // Consent is optional. Set from SAMLEngine.xml - consent. + authnRequestAux.setConsent(super.getSamlCoreProperties() + .getConsentAuthnRequest()); + + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + + if(request.getIssuer()!=null){ + issuer.setValue(request.getIssuer()); + } else { + issuer.setValue(super.getSamlCoreProperties().getRequester()); + } + + // Optional STORK + final String formatEntity = super.getSamlCoreProperties() + .getFormatEntity(); + if (StringUtils.isNotBlank(formatEntity)) { + issuer.setFormat(formatEntity); + } + + authnRequestAux.setIssuer(issuer); + + // Generate stork extensions. + final Extensions storkExtensions = this + .generateSTORKExtensions(request); + // add the extensions to the SAMLAuthnRequest + authnRequestAux.setExtensions(storkExtensions); + + // the result contains an authentication request token (byte[]), + // identifier of the token, and all parameters from the request. + final STORKAuthnRequest authRequest = processExtensions(authnRequestAux + .getExtensions()); + + try { + authRequest.setTokenSaml(super.signAndMarshall(authnRequestAux)); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + + authRequest.setSamlId(authnRequestAux.getID()); + authRequest.setDestination(authnRequestAux.getDestination()); + authRequest.setAssertionConsumerServiceURL(authnRequestAux + .getAssertionConsumerServiceURL()); + + authRequest.setProviderName(authnRequestAux.getProviderName()); + authRequest.setIssuer(authnRequestAux.getIssuer().getValue()); + + return authRequest; + } + + /** + * Generate stork authentication response. + * + * @param request the request + * @param responseAuthReq the response authentication request + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse generateSTORKAuthnResponse( + final STORKAuthnRequest request, + final STORKAuthnResponse responseAuthReq, final String ipAddress, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.info("generateSTORKAuthnResponse"); + + // Validate parameters + validateParamResponse(request, responseAuthReq); + + // Mandatory SAML + LOG.debug("Generate StatusCode"); + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(StatusCode.SUCCESS_URI); + + LOG.debug("Generate Status"); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + LOG.debug("Generate StatusMessage"); + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(StatusCode.SUCCESS_URI); + + status.setStatusMessage(statusMessage); + + LOG.debug("Generate Response"); + + // RESPONSE + final Response response = genAuthnRespBase(status, request + .getAssertionConsumerServiceURL(), request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, request + .getAssertionConsumerServiceURL(), request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + final AttributeStatement attrStatement = this + .generateAttributeStatement(responseAuthReq + .getPersonalAttributeList(), isHashing); + + assertion.getAttributeStatements().add(attrStatement); + + // Add assertions + response.getAssertions().add(assertion); + + final STORKAuthnResponse authresponse = new STORKAuthnResponse(); + + try { + authresponse.setTokenSaml(super.signAndMarshall(response)); + authresponse.setSamlId(response.getID()); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + return authresponse; + } + + /** + * Generate stork authentication response fail. + * + * @param request the request + * @param response the response + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse generateSTORKAuthnResponseFail( + final STORKAuthnRequest request, final STORKAuthnResponse response, + final String ipAddress, final boolean isHashing) + throws STORKSAMLEngineException { + LOG.info("generateSTORKAuthnResponseFail"); + + validateParamResponseFail(request, response); + + // Mandatory + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(response.getStatusCode()); + + // Mandatory SAML + LOG.debug("Generate StatusCode."); + // Subordinate code it's optional in case not covered into next codes: + // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed + // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue + // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy + // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied + // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported + + if (StringUtils.isNotBlank(response.getSubStatusCode())) { + final StatusCode newStatusCode = SAMLEngineUtils + .generateStatusCode(response.getSubStatusCode()); + statusCode.setStatusCode(newStatusCode); + } + + LOG.debug("Generate Status."); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + if (StringUtils.isNotBlank(response.getMessage())) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(response.getMessage()); + + status.setStatusMessage(statusMessage); + } + + LOG.debug("Generate Response."); + // RESPONSE + final Response responseFail = genAuthnRespBase(status, request + .getAssertionConsumerServiceURL(), request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, request + .getAssertionConsumerServiceURL(), request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + responseFail.getAssertions().add(assertion); + + LOG.debug("Sign and Marshall ResponseFail."); + + final STORKAuthnResponse storkResponse = new STORKAuthnResponse(); + + try { + storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); + storkResponse.setSamlId(responseFail.getID()); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException.", e); + throw new STORKSAMLEngineException(e); + } + return storkResponse; + } + + /** + * Generate stork attribute query request. + * + * @param request the request that contain all parameters for generate an + * attribute query request. + * + * @return the STORK attribute query request that has been processed. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryRequest generateSTORKAttrQueryRequest( + final STORKAttrQueryRequest request) throws STORKSAMLEngineException { + LOG.info("Generate STORKAttrQueryRequest."); + + // Validate Parameters mandatories + validateParamAttrQueryReq(request); + + final AttributeQuery attrQueryRequestAux = SAMLEngineUtils + .generateSAMLAttrQueryRequest(SAMLEngineUtils.generateNCName(), + SAMLVersion.VERSION_20, SAMLEngineUtils + .getCurrentTime()); + + // Set name spaces. + setNameSpaces(attrQueryRequestAux); + + + // Add parameter optional STORK + // Destination is mandatory if the destination is a C-PEPS + // The application must to know if the destination is a C-PEPS. + if (StringUtils.isNotBlank(request.getDestination())) { + attrQueryRequestAux.setDestination(request.getDestination()); + } + + // Consent is optional. Set from SAMLEngine.xml - consent. + attrQueryRequestAux.setConsent(super.getSamlCoreProperties() + .getConsentAuthnRequest()); + + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + + //Set the subject - needed for attribute query validation + Subject subject = SAMLEngineUtils.generateSubject(); + SubjectConfirmationBuilder builder = new SubjectConfirmationBuilder(); + SubjectConfirmation subjectConfirmation = builder.buildObject(); + subjectConfirmation.setMethod("urn:oasis:names:tc:SAML:2.0:cm:bearer"); + subject.getSubjectConfirmations().add(subjectConfirmation); + attrQueryRequestAux.setSubject(subject); + + if(request.getIssuer()!=null){ + issuer.setValue(request.getIssuer()); + } else { + issuer.setValue(super.getSamlCoreProperties().getRequester()); + } + + // Optional STORK + final String formatEntity = super.getSamlCoreProperties() + .getFormatEntity(); + if (StringUtils.isNotBlank(formatEntity)) { + issuer.setFormat(formatEntity); + } + + attrQueryRequestAux.setIssuer(issuer); + + // Generate stork extensions. + final Extensions storkExtensions = this + .generateSTORKAttrExtensions(request); + // add the extensions to the SAMLAuthnRequest + attrQueryRequestAux.setExtensions(storkExtensions); + + // the result contains an authentication request token (byte[]), + // identifier of the token, and all parameters from the request. + final STORKAttrQueryRequest attrQueryRequest = processAttrExtensions(attrQueryRequestAux + .getExtensions()); + + try { + attrQueryRequest.setTokenSaml(super.signAndMarshall(attrQueryRequestAux)); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + + attrQueryRequest.setSamlId(attrQueryRequestAux.getID()); + attrQueryRequest.setDestination(attrQueryRequestAux.getDestination()); + + attrQueryRequest.setIssuer(attrQueryRequestAux.getIssuer().getValue()); + + return attrQueryRequest; + } + + /** + * Generate stork attribute query response. + * + * @param request the request + * @param responseAttrQueryReq the response authentication request + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse generateSTORKAttrQueryResponse( + final STORKAttrQueryRequest request, + final STORKAttrQueryResponse responseAttrQueryReq, final String ipAddress, + final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException { + LOG.info("generateSTORKAttrQueryResponse"); + + // Validate parameters + validateParamAttrQueryResponse(request, responseAttrQueryReq); + + // Mandatory SAML + LOG.debug("Generate StatusCode"); + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(StatusCode.SUCCESS_URI); + + LOG.debug("Generate Status"); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + LOG.debug("Generate StatusMessage"); + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(StatusCode.SUCCESS_URI); + + status.setStatusMessage(statusMessage); + + LOG.debug("Generate Response"); + + // RESPONSE + final Response response = genAuthnRespBase(status, destinationUrl, + request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, "" + ,request.getSamlId(), request.getIssuer(), notOnOrAfter); + + final AttributeStatement attrStatement = this + .generateAttributeStatement(responseAttrQueryReq + .getPersonalAttributeList(), isHashing); + + assertion.getAttributeStatements().add(attrStatement); + + // Add assertions + response.getAssertions().add(assertion); + + final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); + + try { + attrQueryResponse.setTokenSaml(super.signAndMarshall(response)); + attrQueryResponse.setSamlId(response.getID()); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + return attrQueryResponse; + } + + /** + * Generate stork attribute query response fail. + * + * @param request the request + * @param response the response + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the STORK attribute query response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse generateSTORKAttrQueryResponseFail( + final STORKAttrQueryRequest request, final STORKAttrQueryResponse response, + final String ipAddress, final String destinationUrl, final boolean isHashing) + throws STORKSAMLEngineException { + LOG.info("generateSTORKAttrQueryResponseFail"); + + validateParamAttrQueryResponseFail(request, response); + + // Mandatory + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(response.getStatusCode()); + + // Mandatory SAML + LOG.debug("Generate StatusCode."); + // Subordinate code it's optional in case not covered into next codes: + // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed + // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue + // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy + // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied + // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported + + if (StringUtils.isNotBlank(response.getSubStatusCode())) { + final StatusCode newStatusCode = SAMLEngineUtils + .generateStatusCode(response.getSubStatusCode()); + statusCode.setStatusCode(newStatusCode); + } + + LOG.debug("Generate Status."); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + if (StringUtils.isNotBlank(response.getMessage())) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(response.getMessage()); + + status.setStatusMessage(statusMessage); + } + + LOG.debug("Generate Response."); + // RESPONSE + final Response responseFail = genAuthnRespBase(status, destinationUrl, + request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, "", + request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + responseFail.getAssertions().add(assertion); + + LOG.debug("Sign and Marshall ResponseFail."); + + final STORKAttrQueryResponse storkResponse = new STORKAttrQueryResponse(); + + try { + storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); + storkResponse.setSamlId(responseFail.getID()); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException.", e); + throw new STORKSAMLEngineException(e); + } + return storkResponse; + } + + /** + * Generate stork authentication statement for the authentication statement. + * + * @param ipAddress the IP address + * + * @return the authentication statement + */ + private AuthnStatement generateStorkAuthStatement(final String ipAddress) { + LOG.debug("Generate stork authenticate statement."); + final SubjectLocality subjectLocality = SAMLEngineUtils + .generateSubjectLocality(ipAddress); + + final AuthnContext authnContext = (AuthnContext) SAMLEngineUtils + .createSamlObject(AuthnContext.DEFAULT_ELEMENT_NAME); + + final AuthnContextDecl authnContextDecl = (AuthnContextDecl) SAMLEngineUtils + .createSamlObject(AuthnContextDecl.DEFAULT_ELEMENT_NAME); + + authnContext.setAuthnContextDecl(authnContextDecl); + + final AuthnStatement authnStatement = SAMLEngineUtils + .generateAthnStatement(new DateTime(), authnContext); + + // Optional STORK + authnStatement.setSessionIndex(null); + authnStatement.setSubjectLocality(subjectLocality); + + return authnStatement; + } + + /** + * Generate stork extensions. + * + * @param request the request + * + * @return the extensions + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Extensions generateSTORKExtensions(final STORKAuthnRequest request) + throws STORKSAMLEngineException { + LOG.debug("Generate STORKExtensions"); + + final Extensions extensions = SAMLEngineUtils.generateExtension(); + + LOG.debug("Generate QAAAttribute"); + final QAAAttribute qaaAttribute = SAMLEngineUtils + .generateQAAAttribute(request.getQaa()); + extensions.getUnknownXMLObjects().add(qaaAttribute); + + + if (StringUtils.isNotEmpty(request + .getSpSector())) { + // Add information about service provider. + LOG.debug("Generate SPSector"); + final SPSector sector = SAMLEngineUtils.generateSPSector(request + .getSpSector()); + extensions.getUnknownXMLObjects().add(sector); + } + + //Delete from specification. Kept for compatibility with Provider Name value + LOG.debug("Generate SPInstitution"); + final SPInstitution institution = SAMLEngineUtils + .generateSPInstitution(request.getProviderName()); + extensions.getUnknownXMLObjects().add(institution); + + + if (StringUtils.isNotEmpty(request.getSpApplication())) { + LOG.debug("Generate SPApplication"); + final SPApplication application = SAMLEngineUtils + .generateSPApplication(request.getSpApplication()); + extensions.getUnknownXMLObjects().add(application); + } + + if (StringUtils.isNotEmpty(request.getSpCountry())) { + LOG.debug("Generate SPCountry"); + final SPCountry country = SAMLEngineUtils.generateSPCountry(request + .getSpCountry()); + extensions.getUnknownXMLObjects().add(country); + } + + //eIDSectorShare: optional; default value: false. + String valueSectorShare = super.getSamlCoreProperties() + .iseIDSectorShare(); + + if (StringUtils.isNotEmpty(valueSectorShare)) { + // Add information about the use of the SAML message. + LOG.debug("Generate EIDSectorShare"); + final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils + .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); + + eIdSectorShare.setEIDSectorShare(String.valueOf(Boolean.valueOf(valueSectorShare))); + + extensions.getUnknownXMLObjects().add(eIdSectorShare); + } + + String valueCrossSectorShare = super.getSamlCoreProperties() + .iseIDCrossSectorShare(); + + if (StringUtils.isNotEmpty(valueCrossSectorShare)) { + LOG.debug("Generate EIDCrossSectorShare"); + final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils + .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); + eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(Boolean.valueOf(valueCrossSectorShare))); + extensions.getUnknownXMLObjects().add(eIdCrossSecShare); + } + + + String valueCrossBorderShare = super.getSamlCoreProperties() + .iseIDCrossBorderShare(); + + if (StringUtils.isNotEmpty(valueCrossBorderShare)) { + LOG.debug("Generate EIDCrossBorderShare"); + final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils + .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); + eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(Boolean.valueOf(valueCrossBorderShare))); + extensions.getUnknownXMLObjects().add(eIdCrossBordShare); + } + + + // Add information about requested attributes. + LOG.debug("Generate RequestedAttributes."); + final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils + .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); + + LOG.debug("SAML Engine configuration properties load."); + final Iterator iterator = request + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + if (attribute == null || StringUtils.isBlank(attribute.getName())) { + LOG.error(ATTRIBUTE_EMPTY_LITERAL); + throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); + } + + // Verified if exits the attribute name. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.debug("Attribute name: {} was not found.", attribute + .getName()); + throw new STORKSAMLEngineException("Attribute name: " + + attribute.getName() + " was not found."); + } + + // Friendly name it's an optional attribute. + String friendlyName = null; + + if (super.getSamlCoreProperties().isFriendlyName()) { + friendlyName = attribute.getName(); + } + + + String isRequired = null; + if (super.getSamlCoreProperties().isRequired()) { + isRequired = String.valueOf(attribute.isRequired()); + } + + + LOG.debug("Generate requested attribute: " + attributeName); + final RequestedAttribute requestedAttr = SAMLEngineUtils + .generateReqAuthnAttributeSimple(attributeName, + friendlyName, isRequired, attribute + .getValue()); + + // Add requested attribute. + reqAttributes.getAttributes().add(requestedAttr); + } + + // Add requested attributes. + extensions.getUnknownXMLObjects().add(reqAttributes); + + CitizenCountryCode citizenCountryCode = null; + if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ + LOG.debug("Generate CitizenCountryCode"); + citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils + .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); + + citizenCountryCode.setCitizenCountryCode(request + .getCitizenCountryCode().toUpperCase()); + } + + SPID spid = null; + if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { + LOG.debug("Generate SPID"); + spid = (SPID) SAMLEngineUtils + .createSamlObject(SPID.DEF_ELEMENT_NAME); + + spid.setSPID(request.getSPID().toUpperCase()); + } + + AuthenticationAttributes authenticationAttr = (AuthenticationAttributes) SAMLEngineUtils + .createSamlObject(AuthenticationAttributes.DEF_ELEMENT_NAME); + + final VIDPAuthenticationAttributes vIDPauthenticationAttr = (VIDPAuthenticationAttributes) SAMLEngineUtils + .createSamlObject(VIDPAuthenticationAttributes.DEF_ELEMENT_NAME); + + final SPInformation spInformation = (SPInformation) SAMLEngineUtils + .createSamlObject(SPInformation.DEF_ELEMENT_NAME); + + if(citizenCountryCode!=null){ + vIDPauthenticationAttr.setCitizenCountryCode(citizenCountryCode); + } + + if(spid!=null){ + spInformation.setSPID(spid); + } + + vIDPauthenticationAttr.setSPInformation(spInformation); + + authenticationAttr + .setVIDPAuthenticationAttributes(vIDPauthenticationAttr); + extensions.getUnknownXMLObjects().add(authenticationAttr); + + + return extensions; + + } + + /** + * Generate stork extensions. + * + * @param request the attribute query request + * + * @return the extensions + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Extensions generateSTORKAttrExtensions(final STORKAttrQueryRequest request) + throws STORKSAMLEngineException { + LOG.debug("Generate STORKExtensions"); + + final Extensions extensions = SAMLEngineUtils.generateExtension(); + + LOG.debug("Generate QAAAttribute"); + final QAAAttribute qaaAttribute = SAMLEngineUtils + .generateQAAAttribute(request.getQaa()); + extensions.getUnknownXMLObjects().add(qaaAttribute); + + + if (StringUtils.isNotEmpty(request + .getSpSector())) { + // Add information about service provider. + LOG.debug("Generate SPSector"); + final SPSector sector = SAMLEngineUtils.generateSPSector(request + .getSpSector()); + extensions.getUnknownXMLObjects().add(sector); + } + + + if (StringUtils.isNotEmpty(request.getSpApplication())) { + LOG.debug("Generate SPApplication"); + final SPApplication application = SAMLEngineUtils + .generateSPApplication(request.getSpApplication()); + extensions.getUnknownXMLObjects().add(application); + } + + if (StringUtils.isNotEmpty(request.getSpCountry())) { + LOG.debug("Generate SPCountry"); + final SPCountry country = SAMLEngineUtils.generateSPCountry(request + .getSpCountry()); + extensions.getUnknownXMLObjects().add(country); + } + + final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils + .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); + + eIdSectorShare.setEIDSectorShare(String.valueOf(request.isEIDSectorShare())); + + extensions.getUnknownXMLObjects().add(eIdSectorShare); + + final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils + .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); + eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(request.isEIDCrossSectorShare())); + extensions.getUnknownXMLObjects().add(eIdCrossSecShare); + + final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils + .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); + eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(request.isEIDCrossBorderShare())); + extensions.getUnknownXMLObjects().add(eIdCrossBordShare); + + + // Add information about requested attributes. + LOG.debug("Generate RequestedAttributes."); + final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils + .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); + + LOG.debug("SAML Engine configuration properties load."); + final Iterator iterator = request + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + if (attribute == null || StringUtils.isBlank(attribute.getName())) { + LOG.error(ATTRIBUTE_EMPTY_LITERAL); + throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); + } + + // Verified if exits the attribute name. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.debug("Attribute name: {} was not found.", attribute + .getName()); + throw new STORKSAMLEngineException("Attribute name: " + + attribute.getName() + " was not found."); + } + + // Friendly name it's an optional attribute. + String friendlyName = null; + + if (super.getSamlCoreProperties().isFriendlyName()) { + friendlyName = attribute.getName(); + } + + + String isRequired = null; + if (super.getSamlCoreProperties().isRequired()) { + isRequired = String.valueOf(attribute.isRequired()); + } + + + LOG.debug("Generate requested attribute: " + attributeName); + final RequestedAttribute requestedAttr = SAMLEngineUtils + .generateReqAuthnAttributeSimple(attributeName, + friendlyName, isRequired, attribute + .getValue()); + + // Add requested attribute. + reqAttributes.getAttributes().add(requestedAttr); + } + + // Add requested attributes. + extensions.getUnknownXMLObjects().add(reqAttributes); + + CitizenCountryCode citizenCountryCode = null; + if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ + LOG.debug("Generate CitizenCountryCode"); + citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils + .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); + + citizenCountryCode.setCitizenCountryCode(request + .getCitizenCountryCode().toUpperCase()); + } + + SPID spid = null; + if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { + LOG.debug("Generate SPID"); + spid = (SPID) SAMLEngineUtils + .createSamlObject(SPID.DEF_ELEMENT_NAME); + + spid.setSPID(request.getSPID().toUpperCase()); + } + + + return extensions; + + } + + /** + * Gets the alias from X.509 Certificate at keystore. + * + * @param keyInfo the key info + * @param storkOwnKeyStore + * @param storkOwnKeyStore + * + * @return the alias + */ + private String getAlias(final KeyInfo keyInfo, KeyStore storkOwnKeyStore) { + + LOG.debug("Recover alias information"); + + String alias = null; + try { + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + // Transform the KeyInfo to X509Certificate. + CertificateFactory certFact; + certFact = CertificateFactory.getInstance("X.509"); + + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + final String tokenSerialNumber = cert.getSerialNumber().toString(16); + final X509Principal tokenIssuerDN = new X509Principal(cert.getIssuerDN().getName()); + + + String aliasCert; + X509Certificate certificate; + boolean find = false; + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements() + && !find; ) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + + final String serialNum = certificate.getSerialNumber() + .toString(16); + + X509Principal issuerDN = new X509Principal(certificate + .getIssuerDN().getName()); + + if(serialNum.equalsIgnoreCase(tokenSerialNumber) + && X509PrincipalUtil.equals2(issuerDN, tokenIssuerDN)){ + alias = aliasCert; + find = true; + } + + } + + } catch (KeyStoreException e) { + LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); + } catch (CertificateException e) { + LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); + } catch (RuntimeException e) { + LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); + } + return alias; + } + + /** + * Gets the country from X.509 Certificate. + * + * @param keyInfo the key info + * + * @return the country + */ + private String getCountry(final KeyInfo keyInfo) { + LOG.debug("Recover country information."); + + String result = ""; + try { + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + // Transform the KeyInfo to X509Certificate. + CertificateFactory certFact; + certFact = CertificateFactory.getInstance("X.509"); + + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + String distName = cert.getSubjectDN().toString(); + + distName = StringUtils.deleteWhitespace(StringUtils + .upperCase(distName)); + + final String countryCode = "C="; + final int init = distName.indexOf(countryCode); + + if (init > StringUtils.INDEX_NOT_FOUND) { // Exist country code. + int end = distName.indexOf(',', init); + + if (end <= StringUtils.INDEX_NOT_FOUND) { + end = distName.length(); + } + + if (init < end && end > StringUtils.INDEX_NOT_FOUND) { + result = distName.substring(init + countryCode.length(), + end); + //It must be a two characters value + if(result.length()>2){ + result = result.substring(0, 2); + } + } + } + + } catch (CertificateException e) { + LOG.error("Procces getCountry from certificate."); + } + return result.trim(); + } + + /** + * Process all elements XMLObjects from the extensions. + * + * @param extensions the extensions from the authentication request. + * + * @return the STORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private STORKAuthnRequest processExtensions(final Extensions extensions) + throws STORKSAMLEngineException { + LOG.debug("Procces the extensions."); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + final QAAAttribute qaa = (QAAAttribute) extensions + .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); + request.setQaa(Integer.parseInt(qaa.getQaaLevel())); + + List optionalElements = extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME).get(0); + request.setSpSector(sector.getSPSector()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPApplication application = (SPApplication) extensions + .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); + request.setSpApplication(application.getSPApplication()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPCountry application = (SPCountry) extensions + .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); + request.setSpCountry(application.getSPCountry()); + } + + + List listCrossBorderShare = extensions + .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); + + if (!listCrossBorderShare .isEmpty()) { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); + request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare + .getEIDCrossBorderShare())); + } + + + List listCrosSectorShare = extensions + .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); + + if (!listCrosSectorShare.isEmpty()) { + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); + request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare + .getEIDCrossSectorShare())); + } + + List listSectorShareExtension = extensions + .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); + if (!listSectorShareExtension.isEmpty()) { + final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); + request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); + } + + + + List authAttrs = extensions + .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); + + if (authAttrs != null && !authAttrs.isEmpty()) { + + final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs + .get(0); + + VIDPAuthenticationAttributes vidpAuthnAttr = null; + if (authnAttr != null && !authAttrs.isEmpty()){ + vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); + } + + CitizenCountryCode citizenCountryCodeElement = null; + SPInformation spInformation = null; + if (vidpAuthnAttr != null){ + citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); + spInformation = vidpAuthnAttr.getSPInformation(); + } + + String citizenCountryCode = null; + if(citizenCountryCodeElement!=null){ + citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); + } + + if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ + request.setCitizenCountryCode(citizenCountryCode); + } + + SPID spidElement = null; + if (spInformation != null){ + spidElement = spInformation.getSPID(); + } + + String spid = null; + if(spidElement!=null){ + spid = spidElement.getSPID(); + } + + if (spid != null && StringUtils.isNotBlank(spid)) { + request.setSPID(spid); + } + } + + if (extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { + LOG.error("Extensions not contains any requested attribute."); + throw new STORKSAMLEngineException( + "Extensions not contains any requested attribute."); + } + + final RequestedAttributes requestedAttr = (RequestedAttributes) extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) + .get(0); + + final List reqAttrs = requestedAttr.getAttributes(); + + final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); + + String attributeName; + for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { + final RequestedAttribute attribute = reqAttrs.get(nextAttribute); + final PersonalAttribute personalAttribute = new PersonalAttribute(); + personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); + personalAttribute.setFriendlyName(attribute.getFriendlyName()); + attributeName = attribute.getName(); + + // recover the last name from the string. + personalAttribute.setName(attributeName.substring(attributeName + .lastIndexOf('/') + 1)); + + final ArrayList valores = new ArrayList(); + final List values = attribute.getOrderedChildren(); + + for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { + + // Process attributes simples. An AuthenticationRequest only + // must contains simple values. + + final XMLObject xmlObject = values.get(nextSimpleValue); + + if(xmlObject instanceof XSStringImpl){ + + final XSStringImpl xmlString = (XSStringImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getValue()); + + }else{ + + if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + + TransformerFactory transFactory = TransformerFactory.newInstance(); + Transformer transformer = null; + try { + transformer = transFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + } catch (TransformerConfigurationException e) { + LOG.error("Error transformer configuration exception", e); + } + StringWriter buffer = new StringWriter(); + try { + if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ + transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), + new StreamResult(buffer)); + } + } catch (TransformerException e) { + LOG.error("Error transformer exception", e); + } + String str = buffer.toString(); + + valores.add(str); + + }else{ + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getTextContent()); + } + + + + } + } + personalAttribute.setValue(valores); + personalAttrList.add(personalAttribute); + } + + request.setPersonalAttributeList(personalAttrList); + + return request; + } + + + /** + * Process all elements XMLObjects from the extensions. + * + * @param extensions the extensions from the authentication request. + * + * @return the STORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private STORKAttrQueryRequest processAttrExtensions(final Extensions extensions) + throws STORKSAMLEngineException { + LOG.debug("Procces the atribute query extensions."); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + final QAAAttribute qaa = (QAAAttribute) extensions + .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); + request.setQaa(Integer.parseInt(qaa.getQaaLevel())); + + List optionalElements = extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME).get(0); + request.setSpSector(sector.getSPSector()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPApplication application = (SPApplication) extensions + .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); + request.setSpApplication(application.getSPApplication()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPCountry application = (SPCountry) extensions + .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); + request.setSpCountry(application.getSPCountry()); + } + + + List listCrossBorderShare = extensions + .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); + + if (!listCrossBorderShare .isEmpty()) { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); + request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare + .getEIDCrossBorderShare())); + } + + + List listCrosSectorShare = extensions + .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); + + if (!listCrosSectorShare.isEmpty()) { + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); + request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare + .getEIDCrossSectorShare())); + } + + List listSectorShareExtension = extensions + .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); + if (!listSectorShareExtension.isEmpty()) { + final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); + request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); + } + + + + List authAttrs = extensions + .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); + + if (authAttrs != null && !authAttrs.isEmpty()) { + + final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs + .get(0); + + VIDPAuthenticationAttributes vidpAuthnAttr = null; + if (authnAttr != null && !authAttrs.isEmpty()){ + vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); + } + + CitizenCountryCode citizenCountryCodeElement = null; + SPInformation spInformation = null; + if (vidpAuthnAttr != null){ + citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); + spInformation = vidpAuthnAttr.getSPInformation(); + } + + String citizenCountryCode = null; + if(citizenCountryCodeElement!=null){ + citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); + } + + if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ + request.setCitizenCountryCode(citizenCountryCode); + } + + SPID spidElement = null; + if (spInformation != null){ + spidElement = spInformation.getSPID(); + } + + String spid = null; + if(spidElement!=null){ + spid = spidElement.getSPID(); + } + + if (spid != null && StringUtils.isNotBlank(spid)) { + request.setSPID(spid); + } + } + + if (extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { + LOG.error("Extensions not contains any requested attribute."); + throw new STORKSAMLEngineException( + "Extensions not contains any requested attribute."); + } + + final RequestedAttributes requestedAttr = (RequestedAttributes) extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) + .get(0); + + final List reqAttrs = requestedAttr.getAttributes(); + + final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); + + String attributeName; + for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { + final RequestedAttribute attribute = reqAttrs.get(nextAttribute); + final PersonalAttribute personalAttribute = new PersonalAttribute(); + personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); + personalAttribute.setFriendlyName(attribute.getFriendlyName()); + attributeName = attribute.getName(); + + // recover the last name from the string. + personalAttribute.setName(attributeName.substring(attributeName + .lastIndexOf('/') + 1)); + + final ArrayList valores = new ArrayList(); + final List values = attribute.getOrderedChildren(); + + for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { + + // Process attributes simples. An AuthenticationRequest only + // must contains simple values. + + final XMLObject xmlObject = values.get(nextSimpleValue); + + if(xmlObject instanceof XSStringImpl){ + + final XSStringImpl xmlString = (XSStringImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getValue()); + + }else{ + + if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + + TransformerFactory transFactory = TransformerFactory.newInstance(); + Transformer transformer = null; + try { + transformer = transFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + } catch (TransformerConfigurationException e) { + LOG.error("Error transformer configuration exception", e); + } + StringWriter buffer = new StringWriter(); + try { + if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ + transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), + new StreamResult(buffer)); + } + } catch (TransformerException e) { + LOG.error("Error transformer exception", e); + } + String str = buffer.toString(); + + valores.add(str); + + }else{ + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getTextContent()); + } + + + + } + } + personalAttribute.setValue(valores); + personalAttrList.add(personalAttribute); + } + + request.setPersonalAttributeList(personalAttrList); + + return request; + } + + /** + * Sets the name spaces. + * + * @param tokenSaml the new name spaces + */ + private void setNameSpaces(final XMLObject tokenSaml) { + LOG.debug("Set namespaces."); + + final Namespace saml2 = new Namespace(SAMLConstants.SAML20_NS, + SAMLConstants.SAML20_PREFIX); + tokenSaml.addNamespace(saml2); + + final Namespace digSig = new Namespace( + "http://www.w3.org/2000/09/xmldsig#", "ds"); + tokenSaml.addNamespace(digSig); + + final Namespace storkp = new Namespace(SAMLCore.STORK10P_NS.getValue(), + SAMLCore.STORK10P_PREFIX.getValue()); + tokenSaml.addNamespace(storkp); + + final Namespace stork = new Namespace(SAMLCore.STORK10_NS.getValue(), + SAMLCore.STORK10_PREFIX.getValue()); + + tokenSaml.addNamespace(stork); + } + + /** + * Validate parameters from authentication request. + * + * @param request the request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAuthnReq(final STORKAuthnRequest request) + throws STORKSAMLEngineException { + LOG.info("Validate parameters from authentication request."); + + // URL to which Authentication Response must be sent. + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); + } + + // the name of the original service provider requesting the + // authentication. + if (StringUtils.isBlank(request.getProviderName())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Service Provider it's mandatory."); + } + + // object that contain all attributes requesting. + if (request.getPersonalAttributeList() == null + || request.getPersonalAttributeList().isEmpty()) { + throw new STORKSAMLEngineException( + "attributeQueries is null or empty."); + } + + // Quality authentication assurance level. + if ((request.getQaa() < QAAAttribute.MIN_VALUE) + || (request.getQaa() > QAAAttribute.MAX_VALUE)) { + throw new STORKSAMLEngineException("Qaal: " + request.getQaa() + + ", is invalid."); + } + + } + + /** + * Validate parameters from authentication request. + * + * @param request the request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAttrQueryReq(final STORKAttrQueryRequest request) + throws STORKSAMLEngineException { + LOG.info("Validate parameters from attribute query request."); + + // URL to which Authentication Response must be sent. + /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); + }*/ + + // the name of the original service provider requesting the + // authentication. + /*if (StringUtils.isBlank(request.getProviderName())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Service Provider it's mandatory."); + }*/ + + // object that contain all attributes requesting. + if (request.getPersonalAttributeList() == null + || request.getPersonalAttributeList().isEmpty()) { + throw new STORKSAMLEngineException( + "attributeQueries is null or empty."); + } + + // Quality authentication assurance level. + if ((request.getQaa() < QAAAttribute.MIN_VALUE) + || (request.getQaa() > QAAAttribute.MAX_VALUE)) { + throw new STORKSAMLEngineException("Qaal: " + request.getQaa() + + ", is invalid."); + } + + } + + + /** + * Validate parameters from response. + * + * @param request the request + * @param responseAuthReq the response authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamResponse(final STORKAuthnRequest request, + final STORKAuthnResponse responseAuthReq) + throws STORKSAMLEngineException { + LOG.info("Validate parameters response."); + if (StringUtils.isBlank(request.getIssuer())) { + throw new STORKSAMLEngineException( + "Issuer must be not empty or null."); + } + + if (responseAuthReq.getPersonalAttributeList() == null + || responseAuthReq.getPersonalAttributeList().isEmpty()) { + LOG.error("PersonalAttributeList is null or empty."); + throw new STORKSAMLEngineException( + "PersonalAttributeList is null or empty."); + } + + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "assertionConsumerServiceURL is null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate parameters from response. + * + * @param request the request + * @param responseAttrQueryReq the response authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAttrQueryResponse(final STORKAttrQueryRequest request, + final STORKAttrQueryResponse responseAttrQueryReq) + throws STORKSAMLEngineException { + LOG.info("Validate attribute querey parameters response."); + if (StringUtils.isBlank(request.getIssuer())) { + throw new STORKSAMLEngineException( + "Issuer must be not empty or null."); + } + + if (responseAttrQueryReq.getPersonalAttributeList() == null + || responseAttrQueryReq.getPersonalAttributeList().isEmpty()) { + LOG.error("PersonalAttributeList is null or empty."); + throw new STORKSAMLEngineException( + "PersonalAttributeList is null or empty."); + } + + /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "assertionConsumerServiceURL is null or empty."); + }*/ + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate parameter from response fail. + * + * @param request the request + * @param response the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamResponseFail(final STORKAuthnRequest request, + final STORKAuthnResponse response) throws STORKSAMLEngineException { + LOG.info("Validate parameters response fail."); + if (StringUtils.isBlank(response.getStatusCode())) { + throw new STORKSAMLEngineException("Code error it's null or empty."); + } + + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "assertionConsumerServiceURL is null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate parameter from response fail. + * + * @param request the request + * @param response the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAttrQueryResponseFail(final STORKAttrQueryRequest request, + final STORKAttrQueryResponse response) throws STORKSAMLEngineException { + LOG.info("Validate parameters response fail."); + if (StringUtils.isBlank(response.getStatusCode())) { + throw new STORKSAMLEngineException("Code error it's null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate stork authentication request. + * + * @param tokenSaml the token SAML + * + * @return the sTORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnRequest validateSTORKAuthnRequest(final byte[] tokenSaml) + throws STORKSAMLEngineException { + LOG.info("validateSTORKAuthnRequest"); + + final AuthnRequest samlRequest = (AuthnRequest) validateStorkSaml(tokenSaml); + + LOG.debug("Validate Extensions."); + final Validator validatorExt = new ExtensionsSchemaValidator(); + try { + validatorExt.validate(samlRequest.getExtensions()); + } catch (ValidationException e) { + LOG.error("ValidationException: validate Extensions.", e); + throw new STORKSAMLEngineException(e); + } + + LOG.debug("Generate STORKAuthnRequest."); + final STORKAuthnRequest authnRequest = processExtensions(samlRequest + .getExtensions()); + + authnRequest.setCountry(this.getCountry(samlRequest.getSignature() + .getKeyInfo())); + + authnRequest.setAlias(this.getAlias(samlRequest.getSignature() + .getKeyInfo(), super.getSigner().getTrustStore())); + + authnRequest.setSamlId(samlRequest.getID()); + authnRequest.setDestination(samlRequest.getDestination()); + authnRequest.setAssertionConsumerServiceURL(samlRequest + .getAssertionConsumerServiceURL()); + + authnRequest.setProviderName(samlRequest.getProviderName()); + authnRequest.setIssuer(samlRequest.getIssuer().getValue()); + + //Delete unknown elements from requested ones + final Iterator iterator = authnRequest.getPersonalAttributeList().iterator(); + IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) authnRequest.getPersonalAttributeList(); + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + // Verify if the attribute name exits. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); + cleanPerAttrList.remove(attribute.getName()); + } + + } + authnRequest.setPersonalAttributeList(cleanPerAttrList); + + return authnRequest; + + } + + /** + * Validate stork authentication request. + * + * @param tokenSaml the token SAML + * + * @return the sTORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryRequest validateSTORKAttrQueryRequest(final byte[] tokenSaml) + throws STORKSAMLEngineException { + LOG.info("validateSTORKAttrQueryRequest"); + + final AttributeQuery samlRequest = (AttributeQuery) validateStorkSaml(tokenSaml); + + LOG.debug("Validate Extensions."); + final Validator validatorExt = new ExtensionsSchemaValidator(); + try { + validatorExt.validate(samlRequest.getExtensions()); + } catch (ValidationException e) { + LOG.error("ValidationException: validate Extensions.", e); + throw new STORKSAMLEngineException(e); + } + + LOG.debug("Generate STORKAttrQueryRequest."); + final STORKAttrQueryRequest attrRequest = processAttrExtensions(samlRequest + .getExtensions()); + + attrRequest.setCountry(this.getCountry(samlRequest.getSignature() + .getKeyInfo())); + + attrRequest.setAlias(this.getAlias(samlRequest.getSignature() + .getKeyInfo(), super.getSigner().getTrustStore())); + + attrRequest.setSamlId(samlRequest.getID()); + attrRequest.setDestination(samlRequest.getDestination()); + /*attrRequest.setAssertionConsumerServiceURL(samlRequest + .getAssertionConsumerServiceURL()); + + authnRequest.setProviderName(samlRequest.getProviderName());*/ + attrRequest.setIssuer(samlRequest.getIssuer().getValue()); + + //Delete unknown elements from requested ones + final Iterator iterator = attrRequest.getPersonalAttributeList().iterator(); + IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) attrRequest.getPersonalAttributeList(); + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + // Verify if the attribute name exits. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); + cleanPerAttrList.remove(attribute.getName()); + } + + } + attrRequest.setPersonalAttributeList(cleanPerAttrList); + + return attrRequest; + + } + + /** + * Validate stork authentication response. + * + * @param tokenSaml the token SAML + * @param userIP the user IP + * + * @return the Stork authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse validateSTORKAuthnResponse( + final byte[] tokenSaml, final String userIP) + throws STORKSAMLEngineException { + + LOG.info("validateSTORKAuthnResponse"); + final Response samlResponse = (Response) validateStorkSaml(tokenSaml); + + LOG.debug("Create StorkAuthResponse."); + final STORKAuthnResponse authnResponse = new STORKAuthnResponse(); + + authnResponse.setCountry(this.getCountry(samlResponse.getSignature() + .getKeyInfo())); + + LOG.debug("Set ID."); + authnResponse.setSamlId(samlResponse.getID()); + LOG.debug("Set InResponseTo."); + authnResponse.setInResponseTo(samlResponse.getInResponseTo()); + LOG.debug("Set statusCode."); + authnResponse.setStatusCode(samlResponse.getStatus().getStatusCode() + .getValue()); + + // Subordinate code. + if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { + authnResponse.setSubStatusCode(samlResponse.getStatus() + .getStatusCode().getStatusCode().getValue()); + } + + if (samlResponse.getStatus().getStatusMessage() != null) { + LOG.debug("Set statusMessage."); + authnResponse.setMessage(samlResponse.getStatus() + .getStatusMessage().getMessage()); + } + + LOG.debug("validateStorkResponse"); + final Assertion assertion = (Assertion) validateStorkResponse( + samlResponse, userIP); + + if(assertion!=null){ + final DateTime serverDate = new DateTime(); + + if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { + LOG.error("Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + ", server_date: " + serverDate + ")"); + throw new STORKSAMLEngineException( + "Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + " ), server_date: " + serverDate); + } + + LOG.debug("Set notOnOrAfter."); + authnResponse.setNotOnOrAfter(assertion.getConditions() + .getNotOnOrAfter()); + + LOG.debug("Set notBefore."); + authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + authnResponse.setAudienceRestriction(((AudienceRestriction) assertion + .getConditions().getAudienceRestrictions().get(0)) + .getAudiences().get(0).getAudienceURI()); + } + + // Case no error. + if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(authnResponse + .getStatusCode())) { + LOG.debug("Status Success. Set PersonalAttributeList."); + authnResponse + .setPersonalAttributeList(generatePersonalAttributeList(assertion)); + authnResponse.setFail(false); + } else { + LOG.debug("Status Fail."); + authnResponse.setFail(true); + } + LOG.debug("Return result."); + return authnResponse; + + } + + /** + * Validate stork attribute query response. + * + * @param tokenSaml the token SAML + * @param userIP the user IP + * + * @return the Stork attribute query response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse validateSTORKAttrQueryResponse( + final byte[] tokenSaml, final String userIP) + throws STORKSAMLEngineException { + + LOG.info("validateSTORKAttrQueryResponse"); + final Response samlResponse = (Response) validateStorkSaml(tokenSaml); + + LOG.debug("Create StorkAttrQueryResponse."); + final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); + + attrQueryResponse.setCountry(this.getCountry(samlResponse.getSignature() + .getKeyInfo())); + + LOG.debug("Set ID."); + attrQueryResponse.setSamlId(samlResponse.getID()); + LOG.debug("Set InResponseTo."); + attrQueryResponse.setInResponseTo(samlResponse.getInResponseTo()); + LOG.debug("Set statusCode."); + attrQueryResponse.setStatusCode(samlResponse.getStatus().getStatusCode() + .getValue()); + + // Subordinate code. + if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { + attrQueryResponse.setSubStatusCode(samlResponse.getStatus() + .getStatusCode().getStatusCode().getValue()); + } + + if (samlResponse.getStatus().getStatusMessage() != null) { + LOG.debug("Set statusMessage."); + attrQueryResponse.setMessage(samlResponse.getStatus() + .getStatusMessage().getMessage()); + } + + LOG.debug("validateStorkResponse"); + final Assertion assertion = (Assertion) validateStorkResponse( + samlResponse, userIP); + + if(assertion!=null){ + final DateTime serverDate = new DateTime(); + + if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { + LOG.error("Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + ", server_date: " + serverDate + ")"); + throw new STORKSAMLEngineException( + "Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + " ), server_date: " + serverDate); + } + + LOG.debug("Set notOnOrAfter."); + attrQueryResponse.setNotOnOrAfter(assertion.getConditions() + .getNotOnOrAfter()); + + LOG.debug("Set notBefore."); + attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + attrQueryResponse.setAudienceRestriction(((AudienceRestriction) assertion + .getConditions().getAudienceRestrictions().get(0)) + .getAudiences().get(0).getAudienceURI()); + } + + // Case no error. + if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(attrQueryResponse + .getStatusCode())) { + LOG.debug("Status Success. Set PersonalAttributeList."); + attrQueryResponse + .setPersonalAttributeList(generatePersonalAttributeList(assertion)); + attrQueryResponse.setFail(false); + } else { + LOG.debug("Status Fail."); + attrQueryResponse.setFail(true); + } + LOG.debug("Return result."); + return attrQueryResponse; + + } + + /** + * Validate stork response. + * + * @param samlResponse the SAML response + * @param userIP the user IP + * + * @return the assertion + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Assertion validateStorkResponse(final Response samlResponse, + final String userIP) throws STORKSAMLEngineException { + // Exist only one Assertion + + if (samlResponse.getAssertions() == null + || samlResponse.getAssertions().isEmpty()) { + LOG.info("Assertion is null or empty."); //in replace of throw new STORKSAMLEngineException("Assertion is null or empty.") + return null; + } + + final Assertion assertion = (Assertion) samlResponse.getAssertions() + .get(0); + + LOG.debug("Verified method Bearer"); + for (final Iterator iter = assertion.getSubject() + .getSubjectConfirmations().iterator(); iter.hasNext();) { + final SubjectConfirmation element = iter.next(); + final boolean isBearer = SubjectConfirmation.METHOD_BEARER + .equals(element.getMethod()); + + final boolean ipValidate = super.getSamlCoreProperties() + .isIpValidation(); + + if (ipValidate) { + if (isBearer) { + if (StringUtils.isBlank(userIP)) { + LOG.error("browser_ip is null or empty."); + throw new STORKSAMLEngineException( + "browser_ip is null or empty."); + } else if (StringUtils.isBlank(element + .getSubjectConfirmationData().getAddress())) { + LOG.error("token_ip attribute is null or empty."); + throw new STORKSAMLEngineException( + "token_ip attribute is null or empty."); + } + } + + final boolean ipEqual = element.getSubjectConfirmationData() + .getAddress().equals(userIP); + + // Validation ipUser + if (!ipEqual && ipValidate) { + LOG.error("SubjectConfirmation BEARER: "); + throw new STORKSAMLEngineException( + "IPs doesn't match : token_ip (" + + element.getSubjectConfirmationData() + .getAddress() + ") browser_ip (" + + userIP + ")"); + } + } + + } + return assertion; + } + + /** + * Validate stork SAML. + * + * @param tokenSaml the token SAML + * + * @return the signable SAML object + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private SignableSAMLObject validateStorkSaml(final byte[] tokenSaml) + throws STORKSAMLEngineException { + + LOG.info("Validate StorkSaml message."); + + if (tokenSaml == null) { + LOG.error("Saml authentication request is null."); + throw new STORKSAMLEngineException( + "Saml authentication request is null."); + } + + LOG.debug("Generate AuthnRequest from request."); + SignableSAMLObject samlObject; + + try { + samlObject = (SignableSAMLObject) super.unmarshall(tokenSaml); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException unmarshall.", e); + throw new STORKSAMLEngineException(e); + } + + boolean validateSign = true; + + if (StringUtils.isNotBlank(super.getSamlCoreProperties().getProperty( + "validateSignature"))) { + validateSign = Boolean.valueOf(super.getSamlCoreProperties() + .getProperty("validateSignature")); + } + + if (validateSign) { + LOG.debug("Validate Signature."); + try { + super.validateSignature(samlObject); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException validateSignature.", e); + throw new STORKSAMLEngineException(e); + } + } + + LOG.debug("Validate Schema."); + final ValidatorSuite validatorSuite = Configuration + .getValidatorSuite("saml2-core-schema-validator"); + try { + validatorSuite.validate(samlObject); + } catch (ValidationException e) { + LOG.error("ValidationException.", e); + throw new STORKSAMLEngineException(e); + } + + return samlObject; + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base new file mode 100644 index 000000000..e38cc5f0b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base @@ -0,0 +1,69 @@ +package eu.stork.peps.auth.engine; + +import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.jce.X509Principal; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Utility class used to decrease complexity of comparison of 2 X509principal + * + * @author vanegdi + * @version $Revision: 1.00 $, $Date: 2013-05-24 20:53:51 $ + */ +public final class X509PrincipalUtil{ + + private static final DERObjectIdentifier[] DER_OBJECT_IDENTIFIERS_ARRAY= { + X509Principal.CN, + X509Principal.OU, + X509Principal.O, + X509Principal.L, + X509Principal.ST, + X509Principal.C, + X509Principal.E + }; + + private static final Logger LOG = LoggerFactory.getLogger(eu.stork.peps.auth.engine.X509PrincipalUtil.class); + + /** + * Compares 2 X509Principals to detect if they equals + * @param principal1 + * @param principal2 + * @return true if arguments are not null and equals + */ + public static boolean equals(X509Principal principal1, X509Principal principal2) { + boolean continueProcess = true; + if (principal1 == null || principal2 == null){ + return false; + } + + int cpt = 0; + while(continueProcess && cpt < DER_OBJECT_IDENTIFIERS_ARRAY.length){ + continueProcess = continueProcess && x509ValuesByIdentifierEquals(principal1, principal2, DER_OBJECT_IDENTIFIERS_ARRAY[cpt]); + cpt++; + } + return continueProcess; + } + + public static boolean equals2(X509Principal principal1, X509Principal principal2) { + + if (principal1 == null || principal2 == null){ + return false; + } + + if (principal1.getName().equals(principal2.getName())) + return true; + else + return false; + + } + + private static boolean x509ValuesByIdentifierEquals(X509Principal principal1, X509Principal principal2, DERObjectIdentifier identifier){ + return principal1.getValues(identifier).equals(principal2.getValues(identifier)); + } + + private X509PrincipalUtil(){ + // default contructor + LOG.error("Fake X509PrincipalUtil : never be called"); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..d3e353e51 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes necessary to create a SAML message. + */ +package eu.stork.peps.auth.engine; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java new file mode 100644 index 000000000..f8f50fc74 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java @@ -0,0 +1,409 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine; + +import java.io.ByteArrayInputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import javax.xml.XMLConstants; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.opensaml.Configuration; +import org.opensaml.DefaultBootstrap; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.xml.ConfigurationException; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.Marshaller; +import org.opensaml.xml.io.MarshallerFactory; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.io.Unmarshaller; +import org.opensaml.xml.io.UnmarshallerFactory; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.parse.BasicParserPool; +import org.opensaml.xml.parse.XMLParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.auth.engine.core.STORKSAMLCore; +import eu.stork.peps.auth.engine.core.impl.SignModuleFactory; +import eu.stork.peps.configuration.ConfigurationCreator; +import eu.stork.peps.configuration.ConfigurationReader; +import eu.stork.peps.configuration.InstanceEngine; +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * Class that wraps the operations over SAML tokens, both generation and + * validation of SAML requests and SAML responses. Compliant with "OASIS Secure + * Assertion Markup Language (SAML) 2.0, May 2005", but taking into account + * STORK specific requirements. + * + * @author fjquevedo + * @author iinigo + */ + +public class SAMLEngine { + + /** The Document Builder Factory. */ + private static javax.xml.parsers.DocumentBuilderFactory dbf = null; + + /** The instance of every engine SAML. */ + private static Map instanceConfigs; + + /** The instances of SAML engine. */ + private static Map> instances; + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SAMLEngine.class + .getName()); + + /** The Constant MODULE_SIGN_CONF. */ + private static final String MODULE_SIGN_CONF = "SignatureConf"; + + /** The Constant SAML_ENGINE_SIGN_CLASS. */ + private static final String SAML_ENGINE_SIGN_CLASS = "class"; + + /** The Constant SAML_ENGINE_CONF. */ + private static final String SAML_ENGINE_CONF = "SamlEngineConf"; + + /** The Constant SAML_ENGINE_FILE_CONF. */ + private static final String SAML_ENGINE_FILE_CONF = "fileConfiguration"; + + /** The codification of characters. */ + private static final String CHARACTER_ENCODING = "UTF-8"; + + /** The SAML core. */ + private STORKSAMLCore samlCore; + + /** The Module of Signature. */ + private SAMLEngineSignI signer; + + + /** Initializes the SAML engine. */ + /** Configure Document Builder Factory. */ + + static { + startUp(); + loadDocumentFactory(); + } + + /** + * Load document factory. + */ + private static void loadDocumentFactory() { + + try { + dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance(); + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setNamespaceAware(true); + dbf.setIgnoringComments(true); + } catch (ParserConfigurationException e) { + LOG.error("Error parser configuration."); + throw new STORKSAMLEngineRuntimeException(e); + } + + } + + /** + * Method that initializes the basic services for the SAML Engine, like the + * OpenSAML library and the BouncyCastle provider. + */ + private static void startUp() { + + LOG.info("SAMLEngine: Initialize OpenSAML"); + + try { + DefaultBootstrap.bootstrap(); + } catch (ConfigurationException e) { + LOG.error("Problem initializing the OpenSAML library."); + throw new STORKSAMLEngineRuntimeException(e); + } + + LOG.debug("Read all file configurations. (instances of SAMLEngine)"); + try { + instanceConfigs = ConfigurationReader.readConfiguration(); + } catch (SAMLEngineException e) { + LOG.error("Error read configuration file."); + throw new STORKSAMLEngineRuntimeException(e); + } + + LOG.debug("Create all instaces of saml engine. (instances of SAMLEngine)"); + try { + instances = ConfigurationCreator + .createConfiguration(instanceConfigs); + } catch (STORKSAMLEngineException e) { + LOG.error("Error initializing instances from Stork SAML engine."); + throw new STORKSAMLEngineRuntimeException(e); + } + } + + /** + * Instantiates a new SAML engine. + */ + private SAMLEngine() { + + } + + /** + * Instantiates a new SAML engine. + * + * @param nameInstance the name instance + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + protected SAMLEngine(final String nameInstance) + throws STORKSAMLEngineException { + LOG.info("Loading Specific Configuration."); + + LOG.debug("Create intance of saml messages."); + + Map instance = instances.get(nameInstance); + + if (instance == null || instance.isEmpty()) { + LOG.error("Instance: " + nameInstance + " not exist."); + throw new STORKSAMLEngineException("Instance: " + nameInstance + + " not exist."); + } + + Properties properties = (Properties) instance.get(SAML_ENGINE_CONF); + + if (properties == null) { + LOG.error("SamlEngine.xml: not exist."); + throw new STORKSAMLEngineException("SamlEngine.xml: not exist."); + } + + samlCore = new STORKSAMLCore(properties); + + final HashMap propertiesSign = (HashMap) instance + .get(MODULE_SIGN_CONF); + + LOG.debug("Loading Module of sign."); + signer = SignModuleFactory.getInstance(propertiesSign + .get(SAML_ENGINE_SIGN_CLASS)); + + try { + LOG.info("Initialize module of sign."); + signer.init(propertiesSign.get(SAML_ENGINE_FILE_CONF)); + LOG.info("Load cryptographic service provider of module of sign."); + signer.loadCryptServiceProvider(); + } catch (SAMLEngineException e) { + LOG.error("Error create signature module: " + + propertiesSign.get(SAML_ENGINE_FILE_CONF)); + LOG.info("Exception" + e); + throw new STORKSAMLEngineException(e); + } + } + + /** + * Gets the Signer properties. + * + * @return the SAML Sign properties + */ + protected SAMLEngineSignI getSigner() { + return signer; + } + + /** + * Gets the SAML core properties. + * + * @return the SAML core properties + */ + protected final STORKSAMLCore getSamlCoreProperties() { + return samlCore; + } + + /** + * Method that transform the received SAML object into a byte array + * representation. + * + * @param samlToken the SAML token. + * + * @return the byte[] of the SAML token. + * + * @throws SAMLEngineException the SAML engine exception + */ + private byte[] marshall(final XMLObject samlToken) + throws SAMLEngineException { + + try { + javax.xml.parsers.DocumentBuilder docBuilder = null; + + final MarshallerFactory marshallerFactory = Configuration + .getMarshallerFactory(); + + final Marshaller marshaller = marshallerFactory + .getMarshaller(samlToken); + + docBuilder = dbf.newDocumentBuilder(); + + final Document doc = docBuilder.newDocument(); + + marshaller.marshall(samlToken, doc); + + // Obtain a byte array representation of the marshalled SAML object + final DOMSource domSource = new DOMSource(doc); + final StringWriter writer = new StringWriter(); + final StreamResult result = new StreamResult(writer); + final TransformerFactory transFactory = TransformerFactory + .newInstance(); + Transformer transformer; + + transformer = transFactory.newTransformer(); + transformer.transform(domSource, result); + LOG.debug("SAML request \n"+ writer.toString()); + return writer.toString().getBytes(CHARACTER_ENCODING); + + } catch (ParserConfigurationException e) { + LOG.error("ParserConfigurationException."); + throw new SAMLEngineException(e); + } catch (MarshallingException e) { + LOG.error("MarshallingException."); + throw new SAMLEngineException(e); + } catch (TransformerConfigurationException e) { + LOG.error("TransformerConfigurationException."); + throw new SAMLEngineException(e); + } catch (TransformerException e) { + LOG.error("TransformerException."); + throw new SAMLEngineException(e); + } catch (UnsupportedEncodingException e) { + LOG.error("UnsupportedEncodingException: " + CHARACTER_ENCODING); + throw new SAMLEngineException(e); + } + } + + /** + * Method that signs a SAML Token. + * + * @param tokenSaml the token SAML + * + * @return the SAML object sign + * + * @throws SAMLEngineException the SAML engine exception + */ + private SignableSAMLObject sign(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.debug("Sign SamlToken."); + signer.sign(tokenSaml); + return tokenSaml; + } + + /** + * Sign and transform to byte array. + * + * @param samlToken the SAML token + * + * @return the byte[] of the SAML token + * + * @throws SAMLEngineException the SAML engine exception + */ + protected final byte[] signAndMarshall(final SignableSAMLObject samlToken) + throws SAMLEngineException { + LOG.debug("Marshall Saml Token."); + SignableSAMLObject signElement = sign(samlToken); + return marshall(signElement); + } + + /** + * Method that unmarshalls a SAML Object from a byte array representation to + * an XML Object. + * + * @param samlToken Byte array representation of a SAML Object + * + * @return XML Object (superclass of SAMLObject) + * + * @throws SAMLEngineException the SAML engine exception + */ + protected final XMLObject unmarshall(final byte[] samlToken) + throws SAMLEngineException { + try { + // Get parser pool manager + final BasicParserPool ppMgr = new BasicParserPool(); + // Note: this is necessary due to an unresolved Xerces deferred DOM + // issue/bug + final HashMap features = new HashMap(); + features.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); + ppMgr.setBuilderFeatures(features); + + ppMgr.setNamespaceAware(true); + + // Parse SAMLToken + Document document = ppMgr.parse(new ByteArrayInputStream(samlToken)); + if (document != null){ + final Element root = document.getDocumentElement(); + // Get appropriate unmarshaller + final UnmarshallerFactory unmarshallerFact = Configuration.getUnmarshallerFactory(); + // Unmarshall using the SAML Token root element + if (unmarshallerFact != null && root != null){ + final Unmarshaller unmarshaller = unmarshallerFact.getUnmarshaller(root); + try { + return unmarshaller.unmarshall(root); + } catch (NullPointerException e){ + LOG.error("Error element tag incomplet or null."); + throw new SAMLEngineException("NullPointerException", e); + } + } else { + LOG.error("Error element tag incomplet or null."); + throw new SAMLEngineException("NullPointerException : unmarshallerFact or root is null"); + } + } else { + LOG.error("Error element tag incomplet or null."); + throw new SAMLEngineException("NullPointerException : document is null"); + } + } catch (XMLParserException e) { + LOG.error("XML Parsing Error.", e); + throw new SAMLEngineException(e); + } catch (UnmarshallingException e) { + LOG.error("TransformerException.", e); + throw new SAMLEngineException(e); + } catch (NullPointerException e) { + LOG.error("Error element tag incomplet or null.", e); + throw new SAMLEngineException(e); + } + } + + /** + * Method that validates an XML Signature contained in a SAML Token. + * + * @param samlToken the SAML token + * + * @return the SAML object + * + * @throws SAMLEngineException the SAML engine exception + */ + protected final SAMLObject validateSignature( + final SignableSAMLObject samlToken) throws SAMLEngineException { + + LOG.info("Validate Signature"); + signer.validateSignature(samlToken); + + return samlToken; + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java new file mode 100644 index 000000000..60f7c3091 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java @@ -0,0 +1,833 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.commons.lang.StringUtils; +import org.joda.time.DateTime; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLVersion; +import org.opensaml.common.impl.SecureRandomIdentifierGenerator; +import org.opensaml.saml2.common.Extensions; +import org.opensaml.saml2.common.impl.ExtensionsBuilder; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.AttributeQuery; +import org.opensaml.saml2.core.AttributeValue; +import org.opensaml.saml2.core.AuthnContext; +import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.core.AuthnStatement; +import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.NameID; +import org.opensaml.saml2.core.Response; +import org.opensaml.saml2.core.Status; +import org.opensaml.saml2.core.StatusCode; +import org.opensaml.saml2.core.StatusMessage; +import org.opensaml.saml2.core.Subject; +import org.opensaml.saml2.core.SubjectConfirmation; +import org.opensaml.saml2.core.SubjectConfirmationData; +import org.opensaml.saml2.core.SubjectLocality; +import org.opensaml.saml2.core.impl.AssertionBuilder; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSAny; +import org.opensaml.xml.schema.XSString; +import org.opensaml.xml.signature.KeyInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import eu.stork.peps.auth.engine.core.QAAAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.SPApplication; +import eu.stork.peps.auth.engine.core.SPCountry; +import eu.stork.peps.auth.engine.core.SPInstitution; +import eu.stork.peps.auth.engine.core.SPSector; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class SAMLEngineUtils. + * + * @author fjquevedo + * @author iinigo + */ +public final class SAMLEngineUtils { + + /** The Constant UTF_8. */ + public static final String UTF_8 = "UTF-8"; + + /** The Constant SHA_512. */ + public static final String SHA_512 = "SHA-512"; + + + /** The generator. */ + private static SecureRandomIdentifierGenerator generator; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(SAMLEngineUtils.class.getName()); + + /** + * Method that generates a random value according to NCName grammar. + * + * NCName ::= NCNameStartChar NCNameChar* NCNameChar ::= NameChar - ':' + * NCNameStartChar ::= Letter | '_' NameStartChar ::= ":" | [A-Z] | "_" | + * [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | + * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | + * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] + * NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | + * [#x203F-#x2040] Name ::= NameStartChar (NameChar)* Letter ::= BaseChar | + * Ideographic BaseChar ::= [#x0041-#x005A] | [#x0061-#x007A] | + * [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | + * [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | + * [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | + * [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | + * [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | + * [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | + * [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | + * [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | + * #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | + * [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | + * [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | + * [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | + * [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | + * [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | + * [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | + * [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | + * #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | + * [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | + * #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | + * [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | + * [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | + * [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | + * [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | + * [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | + * [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | + * [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | + * [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | + * [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | + * [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | + * [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | + * [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | + * #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | + * [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | + * [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | + * [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | + * [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | + * #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | + * #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | + * #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | + * [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | + * [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | + * [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | + * [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | + * [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | + * [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | + * [#xAC00-#xD7A3] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | + * [#x3021-#x3029] + * + * @return Random ID value + */ + + //Initialization of a generator of identifiers for all token SAML. + + static { + loadRandomIdentifierGenerator(); + } + + + /** + * Load random identifier generator. + * + *@throws STORKSAMLEngineRuntimeException the STORKSAML engine runtime exception + */ + private static void loadRandomIdentifierGenerator() { + + try { + generator = new SecureRandomIdentifierGenerator(); + } catch (NoSuchAlgorithmException ex) { + LOG.error("Error init SecureRandomIdentifierGenerator", ex); + throw new STORKSAMLEngineRuntimeException(ex); + } + + } + + /** + * Creates the SAML object. + * + * @param qname the QName + * + * @return the XML object + */ + public static XMLObject createSamlObject(final QName qname) { + return Configuration.getBuilderFactory().getBuilder(qname).buildObject( + qname); + } + + /** + * Creates the SAML object. + * + * @param qname the quality name + * @param qname1 the qname1 + * + * @return the xML object + */ + public static XMLObject createSamlObject(final QName qname, + final QName qname1) { + return Configuration.getBuilderFactory().getBuilder(qname1) + .buildObject(qname, qname1); + } + + /** + * Encode value with an specific algorithm. + * + * @param value the value + * @param alg the algorithm + * + * @return the string + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static String encode(final String value, final String alg) + throws STORKSAMLEngineException { + LOG.debug("Encode value with " + alg + " algorithm."); + byte[] buffer; + + final StringBuffer hash = new StringBuffer(""); + try { + buffer = value.getBytes(UTF_8); + MessageDigest msgDig; + msgDig = MessageDigest.getInstance(alg); + + + msgDig.update(buffer); + final byte[] digest = msgDig.digest(); + + final int signedByte = 0xff; + for (byte aux : digest) { + final int byt = aux & signedByte; + if (Integer.toHexString(byt).length() == 1) { + hash.append('0'); + } + hash.append(Integer.toHexString(byt)); + } + + } catch (UnsupportedEncodingException e1) { + LOG.error("UnsupportedEncodingException: " + UTF_8); + throw new STORKSAMLEngineException(e1); + } catch (NoSuchAlgorithmException e) { + LOG.error("NoSuchAlgorithmException: " + alg); + throw new STORKSAMLEngineException(e); + } + + return hash.toString(); + } + + /** + * Generate assertion. + * + * @param version the version + * @param identifier the identifier + * @param issueInstant the issue instant + * @param issuer the issuer + * + * @return the assertion + */ + public static Assertion generateAssertion(final SAMLVersion version, + final String identifier, final DateTime issueInstant, + final Issuer issuer) { + final AssertionBuilder assertionBuilder = new AssertionBuilder(); + final Assertion assertion = assertionBuilder.buildObject(); + assertion.setVersion(version); + assertion.setID(identifier); + assertion.setIssueInstant(issueInstant); + + // + assertion.setIssuer(issuer); + return assertion; + } + + /** + * Generate authentication statement. + * + * @param authnInstant the authentication instant + * @param authnContext the authentication context + * + * @return the authentication statement + */ + public static AuthnStatement generateAthnStatement(final DateTime authnInstant, + final AuthnContext authnContext) { + // + final AuthnStatement authnStatement = (AuthnStatement) SAMLEngineUtils + .createSamlObject(AuthnStatement.DEFAULT_ELEMENT_NAME); + + authnStatement.setAuthnInstant(authnInstant); + authnStatement.setAuthnContext(authnContext); + + return authnStatement; + } + + + + + + /** + * Generate attribute from a list of values. + * + * @param name the name of the attribute. + * @param status the status of the parameter: "Available", "NotAvailable" or + * "Withheld". + * @param values the value of the attribute. + * @param isHashing the is hashing with "SHA-512" algorithm. + * @return the attribute + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static Attribute generateAttrComplex(final String name, + final String status, final Map values, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.debug("Generate attribute complex: " + name); + final Attribute attribute = (Attribute) SAMLEngineUtils + .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); + + attribute.setName(name); + attribute.setNameFormat(Attribute.URI_REFERENCE); + + attribute.getUnknownAttributes().put( + new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", + SAMLCore.STORK10_PREFIX.getValue()), status); + + if (!values.isEmpty()) { + LOG.debug("Add attribute values."); + + // Create an attribute that contains all XSAny elements. + final XSAny attrValue = (XSAny) SAMLEngineUtils.createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, XSAny.TYPE_NAME); + + final Iterator> iterator = values.entrySet() + .iterator(); + while (iterator.hasNext()) { + final Map.Entry pairs = iterator.next(); + + final String value = pairs.getValue(); + + if (StringUtils.isNotBlank(value)) { + // Create the attribute statement + final XSAny attrValueSimple = (XSAny) SAMLEngineUtils + .createSamlObject(new QName(SAMLCore.STORK10_NS.getValue(), + pairs.getKey().toString(), + SAMLCore.STORK10_PREFIX.getValue()), XSAny.TYPE_NAME); + + // if it's necessary encode the information. + if (isHashing) { + attrValueSimple + .setTextContent(encode(value, SHA_512)); + } else { + attrValueSimple.setTextContent(value); + } + + attrValue.getUnknownXMLObjects().add(attrValueSimple); + attribute.getAttributeValues().add(attrValue); + } + } + + } + return attribute; + } + + /** + * Generate extension. + * + * @return the extensions + */ + public static Extensions generateExtension() { + final ExtensionsBuilder extensionsBuilder = new ExtensionsBuilder(); + return extensionsBuilder.buildObject( + "urn:oasis:names:tc:SAML:2.0:protocol", "Extensions", "saml2p"); + } + + + + + /** + * Generate issuer. + * + * @return the issuer + */ + public static Issuer generateIssuer() { + return (Issuer) SAMLEngineUtils + .createSamlObject(Issuer.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate key info. + * + * @return the key info + */ + public static KeyInfo generateKeyInfo() { + return (KeyInfo) SAMLEngineUtils + .createSamlObject(KeyInfo.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate name id. + * + * @return the name id + */ + public static NameID generateNameID() { + return (NameID) SAMLEngineUtils + .createSamlObject(NameID.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate name id. + * + * @param nameQualifier the name qualifier + * @param format the format + * @param spNameQualifier the sP name qualifier + * + * @return the name id + */ + public static NameID generateNameID(final String nameQualifier, + final String format, final String spNameQualifier) { + // + final NameID nameId = (NameID) Configuration.getBuilderFactory() + .getBuilder(NameID.DEFAULT_ELEMENT_NAME).buildObject( + NameID.DEFAULT_ELEMENT_NAME); + + // optional + nameId.setNameQualifier(nameQualifier); + + // optional + nameId.setFormat(format); + + // optional + nameId.setSPNameQualifier(spNameQualifier); + + return nameId; + } + + /** + * Generate NCName. + * + * @return the string + */ + public static String generateNCName() { + return generator.generateIdentifier(); + } + + + /** + * Generate the quality authentication assurance level. + * + * @param qaal the level of quality authentication assurance. + * + * @return the quality authentication assurance attribute + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static QAAAttribute generateQAAAttribute(final int qaal) + throws STORKSAMLEngineException { + LOG.debug("Generate QAAAttribute."); + + final QAAAttribute qaaAttribute = (QAAAttribute) SAMLEngineUtils + .createSamlObject(QAAAttribute.DEF_ELEMENT_NAME); + qaaAttribute.setQaaLevel(String.valueOf(qaal)); + return qaaAttribute; + } + + /** + * Generate requested attribute. + * + * @param name the name + * @param friendlyName the friendly name + * @param isRequired the is required + * @param value the value + * + * @return the requested attribute + */ + public static RequestedAttribute generateReqAuthnAttributeSimple( + final String name, final String friendlyName, + final String isRequired, final List value) { + LOG.debug("Generate the requested attribute."); + + final RequestedAttribute requested = (RequestedAttribute) SAMLEngineUtils + .createSamlObject(RequestedAttribute.DEF_ELEMENT_NAME); + requested.setName(name); + requested.setNameFormat(RequestedAttribute.URI_REFERENCE); + + requested.setFriendlyName(friendlyName); + + requested.setIsRequired(isRequired); + + // The value is optional in an authentication request. + if (!value.isEmpty()) { + for (int nextValue = 0; nextValue < value.size(); nextValue++) { + final String valor = value.get(nextValue); + if (StringUtils.isNotBlank(valor)) { + + if(!name.equals("http://www.stork.gov.eu/1.0/signedDoc")){ + + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + new QName(SAMLCore.STORK10_NS.getValue(), + "AttributeValue", + SAMLCore.STORK10_PREFIX.getValue()), + XSAny.TYPE_NAME); + + attrValue.setTextContent(valor.trim()); + requested.getAttributeValues().add(attrValue); + + }else{ + + DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + domFactory.setNamespaceAware(true); + Document document = null; + DocumentBuilder builder; + + // Parse the signedDoc value into an XML DOM Document + try { + builder = domFactory.newDocumentBuilder(); + InputStream is; + is = new ByteArrayInputStream(valor.trim().getBytes("UTF-8")); + document = builder.parse(is); + is.close(); + } catch (SAXException e1) { + LOG.error("SAX Error while parsing signModule attribute", e1); + throw new STORKSAMLEngineRuntimeException(e1); + } catch (ParserConfigurationException e2) { + LOG.error("Parser Configuration Error while parsing signModule attribute", e2); + throw new STORKSAMLEngineRuntimeException(e2); + } catch (UnsupportedEncodingException e3) { + LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); + throw new STORKSAMLEngineRuntimeException(e3); + } catch (IOException e4) { + LOG.error("IO Error while parsing signModule attribute", e4); + throw new STORKSAMLEngineRuntimeException(e4); + } + + // Create the XML statement(this will be overwritten with the previous DOM structure) + final XSAny xmlValue = (XSAny) SAMLEngineUtils + .createSamlObject( + new QName(SAMLCore.STORK10_NS.getValue(), + "XMLValue", + SAMLCore.STORK10_PREFIX.getValue()), + XSAny.TYPE_NAME); + + //Set the signedDoc XML content to this element + xmlValue.setDOM(document.getDocumentElement()); + + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + new QName(SAMLCore.STORK10_NS.getValue(), + "AttributeValue", + SAMLCore.STORK10_PREFIX.getValue()), + XSAny.TYPE_NAME); + + //Add previous signedDocXML to the AttributeValue Element + attrValue.getUnknownXMLObjects().add(xmlValue); + + requested.getAttributeValues().add(attrValue); + } + + + } + } + } + + return requested; + } + + /** + * Generate response. + * + * @param version the version + * @param identifier the identifier + * @param issueInstant the issue instant + * @param status the status + * + * @return the response + */ + public static Response generateResponse(final SAMLVersion version, + final String identifier, final DateTime issueInstant, + final Status status) { + final Response response = (Response) SAMLEngineUtils + .createSamlObject(Response.DEFAULT_ELEMENT_NAME); + response.setID(identifier); + response.setIssueInstant(issueInstant); + response.setStatus(status); + return response; + } + + /** + * Method that generates a SAML Authentication Request basing on the + * provided information. + * + * @param identifier the identifier + * @param version the version + * @param issueInstant the issue instant + * + * @return the authentication request + */ + public static AuthnRequest generateSAMLAuthnRequest(final String identifier, + final SAMLVersion version, final DateTime issueInstant) { + LOG.debug("Generate basic authentication request."); + final AuthnRequest authnRequest = (AuthnRequest) SAMLEngineUtils + .createSamlObject(AuthnRequest.DEFAULT_ELEMENT_NAME); + + authnRequest.setID(identifier); + authnRequest.setVersion(version); + authnRequest.setIssueInstant(issueInstant); + return authnRequest; + } + + public static AttributeQuery generateSAMLAttrQueryRequest(final String identifier, + final SAMLVersion version, final DateTime issueInstant) { + LOG.debug("Generate attribute query request."); + final AttributeQuery attrQueryRequest = (AttributeQuery) SAMLEngineUtils + .createSamlObject(AttributeQuery.DEFAULT_ELEMENT_NAME); + + attrQueryRequest.setID(identifier); + attrQueryRequest.setVersion(version); + attrQueryRequest.setIssueInstant(issueInstant); + return attrQueryRequest; + } + + /** + * Generate service provider application. + * + * @param spApplication the service provider application + * + * @return the sP application + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPApplication generateSPApplication(final String spApplication) + throws STORKSAMLEngineException { + LOG.debug("Generate SPApplication."); + + final SPApplication applicationAttr = (SPApplication) SAMLEngineUtils + .createSamlObject(SPApplication.DEF_ELEMENT_NAME); + applicationAttr.setSPApplication(spApplication); + return applicationAttr; + } + + /** + * Generate service provider country. + * + * @param spCountry the service provider country + * + * @return the service provider country + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPCountry generateSPCountry(final String spCountry) + throws STORKSAMLEngineException { + LOG.debug("Generate SPApplication."); + + final SPCountry countryAttribute = (SPCountry) SAMLEngineUtils + .createSamlObject(SPCountry.DEF_ELEMENT_NAME); + countryAttribute.setSPCountry(spCountry); + return countryAttribute; + } + + /** + * Generate service provider institution. + * + * @param spInstitution the service provider institution + * + * @return the service provider institution + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPInstitution generateSPInstitution(final String spInstitution) + throws STORKSAMLEngineException { + LOG.debug("Generate SPInstitution."); + + final SPInstitution institutionAttr = (SPInstitution) SAMLEngineUtils + .createSamlObject(SPInstitution.DEF_ELEMENT_NAME); + institutionAttr.setSPInstitution(spInstitution); + return institutionAttr; + } + + /** + * Generate service provider sector. + * + * @param spSector the service provider sector + * + * @return the service provider sector + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SPSector generateSPSector(final String spSector) + throws STORKSAMLEngineException { + LOG.debug("Generate SPSector."); + + final SPSector sectorAttribute = (SPSector) SAMLEngineUtils + .createSamlObject(SPSector.DEF_ELEMENT_NAME); + sectorAttribute.setSPSector(spSector); + return sectorAttribute; + } + + /** + * Generate status. + * + * @param statusCode the status code + * + * @return the status + */ + public static Status generateStatus(final StatusCode statusCode) { + final Status status = (Status) SAMLEngineUtils + .createSamlObject(Status.DEFAULT_ELEMENT_NAME); + status.setStatusCode(statusCode); + return status; + } + + /** + * Generate status code. + * + * @param value the value + * + * @return the status code + */ + public static StatusCode generateStatusCode(final String value) { + final StatusCode statusCode = (StatusCode) SAMLEngineUtils + .createSamlObject(StatusCode.DEFAULT_ELEMENT_NAME); + statusCode.setValue(value); + return statusCode; + } + + + /** + * Generate status message. + * + * @param message the message + * + * @return the status message + */ + public static StatusMessage generateStatusMessage(final String message) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .createSamlObject(StatusMessage.DEFAULT_ELEMENT_NAME); + statusMessage.setMessage(message); + return statusMessage; + } + + /** + * Generate subject. + * + * @return the subject + */ + public static Subject generateSubject() { + return (Subject) SAMLEngineUtils + .createSamlObject(Subject.DEFAULT_ELEMENT_NAME); + } + + /** + * Generate subject confirmation. + * + * @param method the method + * @param data the data + * + * @return the subject confirmation + */ + public static SubjectConfirmation generateSubjectConfirmation( + final String method, final SubjectConfirmationData data) { + final SubjectConfirmation subjectConf = (SubjectConfirmation) Configuration + .getBuilderFactory().getBuilder( + SubjectConfirmation.DEFAULT_ELEMENT_NAME).buildObject( + SubjectConfirmation.DEFAULT_ELEMENT_NAME); + + subjectConf.setMethod(method); + + subjectConf.setSubjectConfirmationData(data); + + return subjectConf; + } + + + /** + * Generate subject confirmation data. + * + * @param notOnOrAfter the not on or after + * @param recipient the recipient + * @param inResponseTo the in response to + * + * @return the subject confirmation data + */ + public static SubjectConfirmationData generateSubjectConfirmationData( + final DateTime notOnOrAfter, final String recipient, + final String inResponseTo) { + final SubjectConfirmationData subjectConfData = (SubjectConfirmationData) SAMLEngineUtils + .createSamlObject(SubjectConfirmationData.DEFAULT_ELEMENT_NAME); + subjectConfData.setNotOnOrAfter(notOnOrAfter); + subjectConfData.setRecipient(recipient); + subjectConfData.setInResponseTo(inResponseTo); + return subjectConfData; + } + + + /** + * Generate subject locality. + * + * @param address the address + * + * @return the subject locality + */ + public static SubjectLocality generateSubjectLocality(final String address) { + final SubjectLocality subjectLocality = (SubjectLocality) SAMLEngineUtils + .createSamlObject(SubjectLocality.DEFAULT_ELEMENT_NAME); + subjectLocality.setAddress(address); + return subjectLocality; + } + + + + + /** + * Method that returns the current time. + * + * @return the current time + */ + public static DateTime getCurrentTime() { + return new DateTime(); + } + + + /** + * Instantiates a new SAML engine utilities. + */ + private SAMLEngineUtils() { + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java new file mode 100644 index 000000000..3cac2f637 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java @@ -0,0 +1,2983 @@ +/* + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.commons.lang.StringUtils; +import org.bouncycastle.jce.X509Principal; +import org.joda.time.DateTime; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLVersion; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.common.Extensions; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.AttributeQuery; +import org.opensaml.saml2.core.AttributeStatement; +import org.opensaml.saml2.core.AttributeValue; +import org.opensaml.saml2.core.Audience; +import org.opensaml.saml2.core.AudienceRestriction; +import org.opensaml.saml2.core.AuthnContext; +import org.opensaml.saml2.core.AuthnContextDecl; +import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.core.AuthnStatement; +import org.opensaml.saml2.core.Conditions; +import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.NameID; +import org.opensaml.saml2.core.OneTimeUse; +import org.opensaml.saml2.core.Response; +import org.opensaml.saml2.core.Status; +import org.opensaml.saml2.core.StatusCode; +import org.opensaml.saml2.core.StatusMessage; +import org.opensaml.saml2.core.Subject; +import org.opensaml.saml2.core.SubjectConfirmation; +import org.opensaml.saml2.core.SubjectConfirmationData; +import org.opensaml.saml2.core.SubjectLocality; +import org.opensaml.saml2.core.impl.SubjectConfirmationBuilder; +import org.opensaml.xml.Namespace; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSAny; +import org.opensaml.xml.schema.impl.XSAnyBuilder; +import org.opensaml.xml.schema.impl.XSAnyImpl; +import org.opensaml.xml.schema.impl.XSAnyMarshaller; +import org.opensaml.xml.schema.impl.XSAnyUnmarshaller; +import org.opensaml.xml.schema.impl.XSStringImpl; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.util.Base64; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; +import org.opensaml.xml.validation.ValidatorSuite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAttrQueryRequest; +import eu.stork.peps.auth.commons.STORKAttrQueryResponse; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; +import eu.stork.peps.auth.engine.core.EIDSectorShare; +import eu.stork.peps.auth.engine.core.QAAAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.SPApplication; +import eu.stork.peps.auth.engine.core.SPCountry; +import eu.stork.peps.auth.engine.core.SPID; +import eu.stork.peps.auth.engine.core.SPInformation; +import eu.stork.peps.auth.engine.core.SPInstitution; +import eu.stork.peps.auth.engine.core.SPSector; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; +import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesBuilder; +import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesMarshaller; +import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeBuilder; +import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeMarshaller; +import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareBuilder; +import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareMarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareBuilder; +import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareMarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDSectorShareBuilder; +import eu.stork.peps.auth.engine.core.impl.EIDSectorShareMarshaller; +import eu.stork.peps.auth.engine.core.impl.EIDSectorShareUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeBuilder; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeMarshaller; +import eu.stork.peps.auth.engine.core.impl.QAAAttributeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeBuilder; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeMarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesBuilder; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesMarshaller; +import eu.stork.peps.auth.engine.core.impl.RequestedAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPApplicationBuilder; +import eu.stork.peps.auth.engine.core.impl.SPApplicationMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPApplicationUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPCountryBuilder; +import eu.stork.peps.auth.engine.core.impl.SPCountryMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPCountryUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPIDBuilder; +import eu.stork.peps.auth.engine.core.impl.SPIDMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPIDUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInformationBuilder; +import eu.stork.peps.auth.engine.core.impl.SPInformationMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInformationUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInstitutionBuilder; +import eu.stork.peps.auth.engine.core.impl.SPInstitutionMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPInstitutionUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.SPSectorBuilder; +import eu.stork.peps.auth.engine.core.impl.SPSectorMarshaller; +import eu.stork.peps.auth.engine.core.impl.SPSectorUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesBuilder; +import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesMarshaller; +import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.validator.ExtensionsSchemaValidator; +import eu.stork.peps.auth.engine.core.validator.QAAAttributeSchemaValidator; +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * Class that wraps the operations over SAML tokens, both generation and + * validation of SAML STORK requests and SAML STORK responses. Complaint with + * "OASIS Secure Assertion Markup Language (SAML) 2.0, May 2005", but taking + * into account STORK specific requirements. + * + * @author fjquevedo + * @author iinigo + */ +public final class STORKSAMLEngine extends SAMLEngine { + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(STORKSAMLEngine.class.getName()); + + private static final String ATTRIBUTE_EMPTY_LITERAL = "Attribute name is null or empty."; + /** + * Gets the single instance of STORKSAMLEngine. + * + * @param nameInstance the name instance + * + * @return single instance of STORKSAMLEngine + */ + public static synchronized STORKSAMLEngine getInstance( + final String nameInstance) { + STORKSAMLEngine engine = null; + LOG.info("Get instance: " + nameInstance); + try { + engine = new STORKSAMLEngine(nameInstance.trim()); + } catch (Exception e) { + LOG.error("Error get instance: " + nameInstance); + } + return engine; + } + + /** + * Instantiate a new STORKSAML engine. + * + * @param nameInstance the name instance + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private STORKSAMLEngine(final String nameInstance) + throws STORKSAMLEngineException { + // Initialization OpenSAML. + super(nameInstance); + LOG.info("Register STORK objects provider."); + Configuration.registerObjectProvider(QAAAttribute.DEF_ELEMENT_NAME, + new QAAAttributeBuilder(), new QAAAttributeMarshaller(), + new QAAAttributeUnmarshaller()); + + Configuration.registerObjectProvider(EIDSectorShare.DEF_ELEMENT_NAME, + new EIDSectorShareBuilder(), new EIDSectorShareMarshaller(), + new EIDSectorShareUnmarshaller()); + + Configuration.registerObjectProvider( + EIDCrossSectorShare.DEF_ELEMENT_NAME, + new EIDCrossSectorShareBuilder(), + new EIDCrossSectorShareMarshaller(), + new EIDCrossSectorShareUnmarshaller()); + + Configuration.registerObjectProvider( + EIDCrossBorderShare.DEF_ELEMENT_NAME, + new EIDCrossBorderShareBuilder(), + new EIDCrossBorderShareMarshaller(), + new EIDCrossBorderShareUnmarshaller()); + + Configuration.registerObjectProvider(SPSector.DEF_ELEMENT_NAME, + new SPSectorBuilder(), new SPSectorMarshaller(), + new SPSectorUnmarshaller()); + + Configuration.registerObjectProvider(SPInstitution.DEF_ELEMENT_NAME, + new SPInstitutionBuilder(), new SPInstitutionMarshaller(), + new SPInstitutionUnmarshaller()); + + Configuration.registerObjectProvider(SPApplication.DEF_ELEMENT_NAME, + new SPApplicationBuilder(), new SPApplicationMarshaller(), + new SPApplicationUnmarshaller()); + + Configuration.registerObjectProvider(SPCountry.DEF_ELEMENT_NAME, + new SPCountryBuilder(), new SPCountryMarshaller(), + new SPCountryUnmarshaller()); + + Configuration.registerObjectProvider(XSAny.TYPE_NAME, + new XSAnyBuilder(), new XSAnyMarshaller(), + new XSAnyUnmarshaller()); + + Configuration.registerObjectProvider( + RequestedAttribute.DEF_ELEMENT_NAME, + new RequestedAttributeBuilder(), + new RequestedAttributeMarshaller(), + new RequestedAttributeUnmarshaller()); + + Configuration.registerObjectProvider( + RequestedAttributes.DEF_ELEMENT_NAME, + new RequestedAttributesBuilder(), + new RequestedAttributesMarshaller(), + new RequestedAttributesUnmarshaller()); + + Configuration.registerObjectProvider( + AuthenticationAttributes.DEF_ELEMENT_NAME, + new AuthenticationAttributesBuilder(), + new AuthenticationAttributesMarshaller(), + new AuthenticationAttributesUnmarshaller()); + + Configuration.registerObjectProvider( + VIDPAuthenticationAttributes.DEF_ELEMENT_NAME, + new VIDPAuthenticationAttributesBuilder(), + new VIDPAuthenticationAttributesMarshaller(), + new VIDPAuthenticationAttributesUnmarshaller()); + + Configuration.registerObjectProvider( + CitizenCountryCode.DEF_ELEMENT_NAME, + new CitizenCountryCodeBuilder(), + new CitizenCountryCodeMarshaller(), + new CitizenCountryCodeUnmarshaller()); + + Configuration.registerObjectProvider( + SPID.DEF_ELEMENT_NAME, + new SPIDBuilder(), + new SPIDMarshaller(), + new SPIDUnmarshaller()); + + Configuration.registerObjectProvider( + SPInformation.DEF_ELEMENT_NAME, + new SPInformationBuilder(), + new SPInformationMarshaller(), + new SPInformationUnmarshaller()); + + LOG.info("Register STORK object validators."); + final ValidatorSuite validatorSuite = new ValidatorSuite( + QAAAttribute.DEF_LOCAL_NAME); + + validatorSuite.registerValidator(QAAAttribute.DEF_ELEMENT_NAME, + new QAAAttributeSchemaValidator()); + final Extensions extensions = SAMLEngineUtils.generateExtension(); + validatorSuite.registerValidator(extensions.getElementQName(), + new ExtensionsSchemaValidator()); + + Configuration.registerValidatorSuite( + "stork:QualityAuthenticationAssuranceLevel", validatorSuite); + + } + + /** + * Generate authentication response base. + * + * @param status the status + * @param assertConsumerURL the assert consumer URL. + * @param inResponseTo the in response to + * + * @return the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Response genAuthnRespBase(final Status status, + final String assertConsumerURL, final String inResponseTo) + throws STORKSAMLEngineException { + LOG.debug("Generate Authentication Response base."); + final Response response = SAMLEngineUtils.generateResponse( + SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), + SAMLEngineUtils.getCurrentTime(), status); + + // Set name Spaces + this.setNameSpaces(response); + + // Mandatory STORK + LOG.debug("Generate Issuer"); + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + issuer.setValue(super.getSamlCoreProperties().getResponder()); + + // Format Entity Optional STORK + issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); + + response.setIssuer(issuer); + + // destination Mandatory Stork + response.setDestination(assertConsumerURL.trim()); + + // inResponseTo Mandatory Stork + response.setInResponseTo(inResponseTo.trim()); + + // Optional STORK + response.setConsent(super.getSamlCoreProperties() + .getConsentAuthnResponse()); + + return response; + } + + /** + * Generate attribute query response base. + * + * @param status the status + * @param destinationURL the assert consumer URL. + * @param inResponseTo the in response to + * + * @return the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Response genAttrQueryRespBase(final Status status, + final String destinationURL, final String inResponseTo) + throws STORKSAMLEngineException { + LOG.debug("Generate Attribute query Response base."); + final Response response = SAMLEngineUtils.generateResponse( + SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), + SAMLEngineUtils.getCurrentTime(), status); + + // Set name Spaces + this.setNameSpaces(response); + + // Mandatory STORK + LOG.debug("Generate Issuer"); + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + issuer.setValue(super.getSamlCoreProperties().getResponder()); + + // Format Entity Optional STORK + issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); + + response.setIssuer(issuer); + + // destination Mandatory Stork + response.setDestination(destinationURL.trim()); + + // inResponseTo Mandatory Stork + response.setInResponseTo(inResponseTo.trim()); + + // Optional STORK + response.setConsent(super.getSamlCoreProperties() + .getConsentAuthnResponse()); + + return response; + } + + /** + * Generate assertion. + * + * @param ipAddress the IP address. + * @param assertConsumerURL the assert consumer URL. + * @param inResponseTo the in response to + * @param issuer the issuer + * @param notOnOrAfter the not on or after + * + * @return the assertion + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Assertion generateAssertion(final String ipAddress, + final String assertConsumerURL, final String inResponseTo, + final String issuer, final DateTime notOnOrAfter) + throws STORKSAMLEngineException { + LOG.info("Generate Assertion."); + + // Mandatory STORK + LOG.debug("Generate Issuer to Assertion"); + final Issuer issuerAssertion = SAMLEngineUtils.generateIssuer(); + issuerAssertion.setValue(super.getSamlCoreProperties().getResponder()); + + // Format Entity Optional STORK + issuerAssertion.setFormat(super.getSamlCoreProperties() + .getFormatEntity()); + + final Assertion assertion = SAMLEngineUtils.generateAssertion( + SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), + SAMLEngineUtils.getCurrentTime(), issuerAssertion); + + final Subject subject = SAMLEngineUtils.generateSubject(); + + // Mandatory STORK verified + // String format = NameID.UNSPECIFIED + // specification: 'SAML:2.0' exist + // opensaml: "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" + // opensaml "urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified" + final String format = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"; + + final String nameQualifier = ""; + + LOG.debug("Generate NameID"); + final NameID nameId = SAMLEngineUtils.generateNameID(super + .getSamlCoreProperties().getResponder(), format, nameQualifier); + nameId.setValue(format); + subject.setNameID(nameId); + + // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. + // Optional in other case. + LOG.debug("Generate SubjectConfirmationData."); + final SubjectConfirmationData dataBearer = SAMLEngineUtils + .generateSubjectConfirmationData(SAMLEngineUtils + .getCurrentTime(), assertConsumerURL, inResponseTo); + + // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. + // Optional in other case. + LOG.debug("Generate SubjectConfirmation"); + final SubjectConfirmation subjectConf = SAMLEngineUtils + .generateSubjectConfirmation(SubjectConfirmation.METHOD_BEARER, + dataBearer); + + final ArrayList listSubjectConf = new ArrayList(); + listSubjectConf.add(subjectConf); + + for (final Iterator iter = listSubjectConf + .iterator(); iter.hasNext();) { + final SubjectConfirmation element = iter.next(); + + if (SubjectConfirmation.METHOD_BEARER.equals(element.getMethod())) { + // ipAddress Mandatory if method is Bearer. + + if (StringUtils.isBlank(ipAddress)) { + throw new STORKSAMLEngineException( + "ipAddress is null or empty"); + } + element.getSubjectConfirmationData().setAddress( + ipAddress.trim()); + } + + element.getSubjectConfirmationData() + .setRecipient(assertConsumerURL); + element.getSubjectConfirmationData().setNotOnOrAfter(notOnOrAfter); + } + + // The SAML 2.0 specification allows multiple SubjectConfirmations + subject.getSubjectConfirmations().addAll(listSubjectConf); + + // Mandatory Stork + assertion.setSubject(subject); + + // Conditions that MUST be evaluated when assessing the validity of + // and/or when using the assertion. + final Conditions conditions = this.generateConditions(SAMLEngineUtils + .getCurrentTime(), notOnOrAfter, issuer); + + assertion.setConditions(conditions); + + LOG.debug("Generate stork Authentication Statement."); + final AuthnStatement storkAuthnStat = this + .generateStorkAuthStatement(ipAddress); + assertion.getAuthnStatements().add(storkAuthnStat); + + return assertion; + } + + private String getAttributeName(final PersonalAttribute attribute) throws STORKSAMLEngineException { + if (StringUtils.isBlank(attribute.getName())) { + LOG.error(ATTRIBUTE_EMPTY_LITERAL); + throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); + } + + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.error("Attribute name: {} it is not known.", attribute + .getName()); + throw new STORKSAMLEngineException("Attribute name: " + + attribute.getName() + " it is not known."); + } + return attributeName; + } + /** + * Generate attribute statement. + * + * @param personalAttrList the personal attribute list + * @param isHashing the is hashing + * + * @return the attribute statement + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + * @throws IOException + */ + private AttributeStatement generateAttributeStatement( + final IPersonalAttributeList personalAttrList, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.debug("Generate attribute statement"); + + final AttributeStatement attrStatement = (AttributeStatement) SAMLEngineUtils + .createSamlObject(AttributeStatement.DEFAULT_ELEMENT_NAME); + + for (PersonalAttribute attribute : personalAttrList) { + + String attributeName = getAttributeName(attribute); + + // Verification that only one value it's permitted, simple or + // complex, not both. + + final boolean simpleNull = (attribute.getValue() == null); + final boolean simpleEmpty = (simpleNull || (!simpleNull && attribute + .getValue().isEmpty())); + + final boolean complexNull = (attribute.getComplexValue() == null); + final boolean complexEmpty = (complexNull || (!complexNull && attribute + .getComplexValue().isEmpty())); + + if ((!simpleEmpty && !complexEmpty)) { + throw new STORKSAMLEngineException( + "Attribute name: " + + attribute.getName() + + " must be contain one value, simple or complex value."); + } else { + + if (!simpleEmpty) { + attrStatement.getAttributes().add( + this.generateAttrSimple(attributeName, attribute + .getStatus(), attribute.getValue(), + isHashing)); + } else if (!complexEmpty) { + attrStatement.getAttributes().add( + SAMLEngineUtils.generateAttrComplex(attributeName, + attribute.getStatus(), attribute + .getComplexValue(), isHashing)); + } else if (!simpleNull) { + attrStatement.getAttributes().add( + this.generateAttrSimple(attributeName, attribute + .getStatus(), new ArrayList(), + isHashing)); + } else { + // Add attribute complex. + attrStatement.getAttributes().add( + SAMLEngineUtils.generateAttrComplex(attributeName, + attribute.getStatus(), + new HashMap(), isHashing)); + } + } + } + return attrStatement; + } + private XSAny createAttributeValueForSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { + DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + domFactory.setNamespaceAware(true); + Document document = null; + DocumentBuilder builder; + + // Parse the signedDoc value into an XML DOM Document + try { + builder = domFactory.newDocumentBuilder(); + InputStream is; + is = new ByteArrayInputStream(value.trim().getBytes("UTF-8")); + document = builder.parse(is); + is.close(); + } catch (SAXException e1) { + LOG.error("SAX Error while parsing signModule attribute", e1); + throw new STORKSAMLEngineRuntimeException(e1); + } catch (ParserConfigurationException e2) { + LOG.error("Parser Configuration Error while parsing signModule attribute", e2); + throw new STORKSAMLEngineRuntimeException(e2); + } catch (UnsupportedEncodingException e3) { + LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); + throw new STORKSAMLEngineRuntimeException(e3); + } catch (IOException e4) { + LOG.error("IO Error while parsing signModule attribute", e4); + throw new STORKSAMLEngineRuntimeException(e4); + } + + // Create the attribute statement + final XSAny xmlValue = (XSAny) SAMLEngineUtils + .createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, + XSAny.TYPE_NAME); + + //Set the signedDoc XML content to this element + xmlValue.setDOM(document.getDocumentElement()); + + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, + XSAny.TYPE_NAME); + + //Add previous signedDocXML to the AttributeValue Element + + // if it's necessary encode the information. + if (!isHashing) { + attrValue.getUnknownXMLObjects().add(xmlValue); + } + return attrValue; + } + + private XSAny createAttributeValueForNonSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { + // Create the attribute statement + final XSAny attrValue = (XSAny) SAMLEngineUtils + .createSamlObject( + AttributeValue.DEFAULT_ELEMENT_NAME, + XSAny.TYPE_NAME); + // if it's necessary encode the information. + if (isHashing) { + attrValue.setTextContent(SAMLEngineUtils.encode(value, SAMLEngineUtils.SHA_512)); + } else { + attrValue.setTextContent(value); + } + return attrValue; + } + + /** + * Generate attribute from a list of values. + * + * @param name the name of the attribute. + * @param values the value of the attribute. + * @param isHashing the is hashing with "SHA-512" algorithm. + * @param status the status of the parameter: "Available", "NotAvailable" or + * "Withheld". + * + * @return the attribute + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Attribute generateAttrSimple(final String name, + final String status, final List values, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.debug("Generate attribute simple: " + name); + final Attribute attribute = (Attribute) SAMLEngineUtils + .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); + + attribute.setName(name); + attribute.setNameFormat(Attribute.URI_REFERENCE); + + attribute.getUnknownAttributes().put( + new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", + SAMLCore.STORK10_PREFIX.getValue()), status); + + if (values != null) { + LOG.debug("Add attribute values."); + for (int i = 0; i < values.size(); i++) { + final String value = values.get(i); + if (StringUtils.isNotBlank(value)) { + XSAny attrValue = null; + if (!name.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + // Create the attribute statement + attrValue = createAttributeValueForNonSignedDoc(value, isHashing); + + } else { + attrValue = createAttributeValueForSignedDoc(value, isHashing); + attribute.getAttributeValues().add(attrValue); + } + attribute.getAttributeValues().add(attrValue); + } + } + } + return attribute; + } + + /** + * Generate conditions that MUST be evaluated when assessing the validity of + * and/or when using the assertion. + * + * @param notBefore the not before + * @param notOnOrAfter the not on or after + * @param audienceURI the audience URI. + * + * @return the conditions + */ + private Conditions generateConditions(final DateTime notBefore, + final DateTime notOnOrAfter, final String audienceURI) { + LOG.debug("Generate conditions."); + final Conditions conditions = (Conditions) SAMLEngineUtils + .createSamlObject(Conditions.DEFAULT_ELEMENT_NAME); + conditions.setNotBefore(notBefore); + conditions.setNotOnOrAfter(notOnOrAfter); + + final AudienceRestriction restrictions = (AudienceRestriction) SAMLEngineUtils + .createSamlObject(AudienceRestriction.DEFAULT_ELEMENT_NAME); + + final Audience audience = (Audience) SAMLEngineUtils + .createSamlObject(Audience.DEFAULT_ELEMENT_NAME); + audience.setAudienceURI(audienceURI); + + restrictions.getAudiences().add(audience); + conditions.getAudienceRestrictions().add(restrictions); + + if (super.getSamlCoreProperties().isOneTimeUse()) { + final OneTimeUse oneTimeUse = (OneTimeUse) SAMLEngineUtils + .createSamlObject(OneTimeUse.DEFAULT_ELEMENT_NAME); + conditions.getConditions().add(oneTimeUse); + } + return conditions; + } + + /** + * Generate personal attribute list. + * + * @param assertion the assertion + * + * @return the personal attribute list + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private IPersonalAttributeList generatePersonalAttributeList( + final Assertion assertion) throws STORKSAMLEngineException { + LOG.debug("Generate personal attribute list from XMLObject."); + final List listExtensions = assertion.getOrderedChildren(); + + boolean find = false; + AttributeStatement requestedAttr = null; + + // Search the attribute statement. + for (int i = 0; i < listExtensions.size() && !find; i++) { + final XMLObject xml = listExtensions.get(i); + if (xml instanceof AttributeStatement) { + requestedAttr = (AttributeStatement) xml; + find = true; + } + } + + if (!find) { + LOG.error("Error: AttributeStatement it's not present."); + throw new STORKSAMLEngineException( + "AttributeStatement it's not present."); + } + + final List reqAttrs = requestedAttr.getAttributes(); + + final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); + String attributeName; + + // Process the attributes. + for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { + final Attribute attribute = reqAttrs.get(nextAttribute); + + final PersonalAttribute personalAttribute = new PersonalAttribute(); + + attributeName = attribute.getName(); + personalAttribute.setName(attributeName.substring(attributeName + .lastIndexOf('/') + 1)); + + personalAttribute.setStatus(attribute.getUnknownAttributes().get( + new QName(SAMLCore.STORK10_NS.getValue(), + "AttributeStatus", SAMLCore.STORK10_PREFIX + .getValue()))); + + final ArrayList simpleValues = new ArrayList(); + final HashMap multiValues = new HashMap(); + + final List values = attribute.getOrderedChildren(); + + + // Process the values. + for (int nextValue = 0; nextValue < values.size(); nextValue++) { + + final XMLObject xmlObject = values.get(nextValue); + + if (xmlObject instanceof XSStringImpl) { + + // Process simple value. + simpleValues.add(((XSStringImpl) xmlObject).getValue()); + + } else if (xmlObject instanceof XSAnyImpl) { + + if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextValue); + + TransformerFactory transFactory = TransformerFactory + .newInstance(); + Transformer transformer = null; + try { + transformer = transFactory.newTransformer(); + transformer.setOutputProperty( + OutputKeys.OMIT_XML_DECLARATION, "yes"); + } catch (TransformerConfigurationException e) { + LOG.error("Error transformer configuration exception", e); + } + StringWriter buffer = new StringWriter(); + try { + if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ + transformer.transform(new DOMSource(xmlString + .getUnknownXMLObjects().get(0).getDOM()), + new StreamResult(buffer)); + } + } catch (TransformerException e) { + LOG.error("Error transformer exception", e); + } + String str = buffer.toString(); + + simpleValues.add(str); + + } else if (attributeName + .equals("http://www.stork.gov.eu/1.0/canonicalResidenceAddress")) + { + LOG.info("canonicalResidenceAddress found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + + } + else if (attributeName + .equals("http://www.stork.gov.eu/1.0/newAttribute2")) + { + LOG.info("newAttribute2 found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + } + else if (attributeName + .equals("http://www.stork.gov.eu/1.0/hasDegree")) + { + LOG.info("hasDegree found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + } + else if(attributeName + .equals("http://www.stork.gov.eu/1.0/mandateContent")) + { + LOG.info("mandateContent found"); + // Process complex value. + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + multiValues.put(simple.getElementQName() + .getLocalPart(), simple.getTextContent()); + } + } + else { + // Process simple value. + simpleValues.add(((XSAnyImpl) xmlObject) + .getTextContent()); + } + + } else { + LOG.error("Error: attribute value it's unknown."); + throw new STORKSAMLEngineException( + "Attribute value it's unknown."); + } + } + + personalAttribute.setValue(simpleValues); + personalAttribute.setComplexValue(multiValues); + personalAttrList.add(personalAttribute); + } + + return personalAttrList; + } + + /** + * Generate stork authentication request. + * + * @param request the request that contain all parameters for generate an + * authentication request. + * + * @return the STORK authentication request that has been processed. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnRequest generateSTORKAuthnRequest( + final STORKAuthnRequest request) throws STORKSAMLEngineException { + LOG.info("Generate SAMLAuthnRequest."); + + // Validate Parameters mandatories + validateParamAuthnReq(request); + + final AuthnRequest authnRequestAux = SAMLEngineUtils + .generateSAMLAuthnRequest(SAMLEngineUtils.generateNCName(), + SAMLVersion.VERSION_20, SAMLEngineUtils + .getCurrentTime()); + + // Set name spaces. + setNameSpaces(authnRequestAux); + + // Add parameter Mandatory STORK + authnRequestAux.setForceAuthn(Boolean.TRUE); + + // Add parameter Mandatory STORK + authnRequestAux.setIsPassive(Boolean.FALSE); + + authnRequestAux.setAssertionConsumerServiceURL(request + .getAssertionConsumerServiceURL()); + + authnRequestAux.setProviderName(request.getProviderName()); + + // Add protocol binding + authnRequestAux.setProtocolBinding(super.getSamlCoreProperties() + .getProtocolBinding()); + + // Add parameter optional STORK + // Destination is mandatory if the destination is a C-PEPS + // The application must to know if the destination is a C-PEPS. + if (StringUtils.isNotBlank(request.getDestination())) { + authnRequestAux.setDestination(request.getDestination()); + } + + // Consent is optional. Set from SAMLEngine.xml - consent. + authnRequestAux.setConsent(super.getSamlCoreProperties() + .getConsentAuthnRequest()); + + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + + if(request.getIssuer()!=null){ + issuer.setValue(request.getIssuer()); + } else { + issuer.setValue(super.getSamlCoreProperties().getRequester()); + } + + // Optional STORK + final String formatEntity = super.getSamlCoreProperties() + .getFormatEntity(); + if (StringUtils.isNotBlank(formatEntity)) { + issuer.setFormat(formatEntity); + } + + authnRequestAux.setIssuer(issuer); + + // Generate stork extensions. + final Extensions storkExtensions = this + .generateSTORKExtensions(request); + // add the extensions to the SAMLAuthnRequest + authnRequestAux.setExtensions(storkExtensions); + + // the result contains an authentication request token (byte[]), + // identifier of the token, and all parameters from the request. + final STORKAuthnRequest authRequest = processExtensions(authnRequestAux + .getExtensions()); + + try { + authRequest.setTokenSaml(super.signAndMarshall(authnRequestAux)); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + + authRequest.setSamlId(authnRequestAux.getID()); + authRequest.setDestination(authnRequestAux.getDestination()); + authRequest.setAssertionConsumerServiceURL(authnRequestAux + .getAssertionConsumerServiceURL()); + + authRequest.setProviderName(authnRequestAux.getProviderName()); + authRequest.setIssuer(authnRequestAux.getIssuer().getValue()); + + return authRequest; + } + + /** + * Generate stork authentication response. + * + * @param request the request + * @param responseAuthReq the response authentication request + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse generateSTORKAuthnResponse( + final STORKAuthnRequest request, + final STORKAuthnResponse responseAuthReq, final String ipAddress, + final boolean isHashing) throws STORKSAMLEngineException { + LOG.info("generateSTORKAuthnResponse"); + + // Validate parameters + validateParamResponse(request, responseAuthReq); + + // Mandatory SAML + LOG.debug("Generate StatusCode"); + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(StatusCode.SUCCESS_URI); + + LOG.debug("Generate Status"); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + LOG.debug("Generate StatusMessage"); + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(StatusCode.SUCCESS_URI); + + status.setStatusMessage(statusMessage); + + LOG.debug("Generate Response"); + + // RESPONSE + final Response response = genAuthnRespBase(status, request + .getAssertionConsumerServiceURL(), request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, request + .getAssertionConsumerServiceURL(), request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + final AttributeStatement attrStatement = this + .generateAttributeStatement(responseAuthReq + .getPersonalAttributeList(), isHashing); + + assertion.getAttributeStatements().add(attrStatement); + + // Add assertions + response.getAssertions().add(assertion); + + final STORKAuthnResponse authresponse = new STORKAuthnResponse(); + + try { + authresponse.setTokenSaml(super.signAndMarshall(response)); + authresponse.setSamlId(response.getID()); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + return authresponse; + } + + /** + * Generate stork authentication response fail. + * + * @param request the request + * @param response the response + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse generateSTORKAuthnResponseFail( + final STORKAuthnRequest request, final STORKAuthnResponse response, + final String ipAddress, final boolean isHashing) + throws STORKSAMLEngineException { + LOG.info("generateSTORKAuthnResponseFail"); + + validateParamResponseFail(request, response); + + // Mandatory + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(response.getStatusCode()); + + // Mandatory SAML + LOG.debug("Generate StatusCode."); + // Subordinate code it's optional in case not covered into next codes: + // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed + // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue + // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy + // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied + // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported + + if (StringUtils.isNotBlank(response.getSubStatusCode())) { + final StatusCode newStatusCode = SAMLEngineUtils + .generateStatusCode(response.getSubStatusCode()); + statusCode.setStatusCode(newStatusCode); + } + + LOG.debug("Generate Status."); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + if (StringUtils.isNotBlank(response.getMessage())) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(response.getMessage()); + + status.setStatusMessage(statusMessage); + } + + LOG.debug("Generate Response."); + // RESPONSE + final Response responseFail = genAuthnRespBase(status, request + .getAssertionConsumerServiceURL(), request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, request + .getAssertionConsumerServiceURL(), request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + responseFail.getAssertions().add(assertion); + + LOG.debug("Sign and Marshall ResponseFail."); + + final STORKAuthnResponse storkResponse = new STORKAuthnResponse(); + + try { + storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); + storkResponse.setSamlId(responseFail.getID()); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException.", e); + throw new STORKSAMLEngineException(e); + } + return storkResponse; + } + + /** + * Generate stork attribute query request. + * + * @param request the request that contain all parameters for generate an + * attribute query request. + * + * @return the STORK attribute query request that has been processed. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryRequest generateSTORKAttrQueryRequest( + final STORKAttrQueryRequest request) throws STORKSAMLEngineException { + LOG.info("Generate STORKAttrQueryRequest."); + + // Validate Parameters mandatories + validateParamAttrQueryReq(request); + + final AttributeQuery attrQueryRequestAux = SAMLEngineUtils + .generateSAMLAttrQueryRequest(SAMLEngineUtils.generateNCName(), + SAMLVersion.VERSION_20, SAMLEngineUtils + .getCurrentTime()); + + // Set name spaces. + setNameSpaces(attrQueryRequestAux); + + + // Add parameter optional STORK + // Destination is mandatory if the destination is a C-PEPS + // The application must to know if the destination is a C-PEPS. + if (StringUtils.isNotBlank(request.getDestination())) { + attrQueryRequestAux.setDestination(request.getDestination()); + } + + // Consent is optional. Set from SAMLEngine.xml - consent. + attrQueryRequestAux.setConsent(super.getSamlCoreProperties() + .getConsentAuthnRequest()); + + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + + //Set the subject - needed for attribute query validation + Subject subject = SAMLEngineUtils.generateSubject(); + SubjectConfirmationBuilder builder = new SubjectConfirmationBuilder(); + SubjectConfirmation subjectConfirmation = builder.buildObject(); + subjectConfirmation.setMethod("urn:oasis:names:tc:SAML:2.0:cm:bearer"); + subject.getSubjectConfirmations().add(subjectConfirmation); + attrQueryRequestAux.setSubject(subject); + + if(request.getIssuer()!=null){ + issuer.setValue(request.getIssuer()); + } else { + issuer.setValue(super.getSamlCoreProperties().getRequester()); + } + + // Optional STORK + final String formatEntity = super.getSamlCoreProperties() + .getFormatEntity(); + if (StringUtils.isNotBlank(formatEntity)) { + issuer.setFormat(formatEntity); + } + + attrQueryRequestAux.setIssuer(issuer); + + // Generate stork extensions. + final Extensions storkExtensions = this + .generateSTORKAttrExtensions(request); + // add the extensions to the SAMLAuthnRequest + attrQueryRequestAux.setExtensions(storkExtensions); + + // the result contains an authentication request token (byte[]), + // identifier of the token, and all parameters from the request. + final STORKAttrQueryRequest attrQueryRequest = processAttrExtensions(attrQueryRequestAux + .getExtensions()); + + try { + attrQueryRequest.setTokenSaml(super.signAndMarshall(attrQueryRequestAux)); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + + attrQueryRequest.setSamlId(attrQueryRequestAux.getID()); + attrQueryRequest.setDestination(attrQueryRequestAux.getDestination()); + + attrQueryRequest.setIssuer(attrQueryRequestAux.getIssuer().getValue()); + + return attrQueryRequest; + } + + /** + * Generate stork attribute query response. + * + * @param request the request + * @param responseAttrQueryReq the response authentication request + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse generateSTORKAttrQueryResponse( + final STORKAttrQueryRequest request, + final STORKAttrQueryResponse responseAttrQueryReq, final String ipAddress, + final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException { + LOG.info("generateSTORKAttrQueryResponse"); + + // Validate parameters + validateParamAttrQueryResponse(request, responseAttrQueryReq); + + // Mandatory SAML + LOG.debug("Generate StatusCode"); + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(StatusCode.SUCCESS_URI); + + LOG.debug("Generate Status"); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + LOG.debug("Generate StatusMessage"); + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(StatusCode.SUCCESS_URI); + + status.setStatusMessage(statusMessage); + + LOG.debug("Generate Response"); + + // RESPONSE + final Response response = genAuthnRespBase(status, destinationUrl, + request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, "" + ,request.getSamlId(), request.getIssuer(), notOnOrAfter); + + final AttributeStatement attrStatement = this + .generateAttributeStatement(responseAttrQueryReq + .getPersonalAttributeList(), isHashing); + + assertion.getAttributeStatements().add(attrStatement); + + // Add assertions + response.getAssertions().add(assertion); + + final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); + + try { + attrQueryResponse.setTokenSaml(super.signAndMarshall(response)); + attrQueryResponse.setSamlId(response.getID()); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + return attrQueryResponse; + } + + /** + * Generate stork attribute query response fail. + * + * @param request the request + * @param response the response + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the STORK attribute query response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse generateSTORKAttrQueryResponseFail( + final STORKAttrQueryRequest request, final STORKAttrQueryResponse response, + final String ipAddress, final String destinationUrl, final boolean isHashing) + throws STORKSAMLEngineException { + LOG.info("generateSTORKAttrQueryResponseFail"); + + validateParamAttrQueryResponseFail(request, response); + + // Mandatory + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(response.getStatusCode()); + + // Mandatory SAML + LOG.debug("Generate StatusCode."); + // Subordinate code it's optional in case not covered into next codes: + // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed + // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue + // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy + // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied + // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported + + if (StringUtils.isNotBlank(response.getSubStatusCode())) { + final StatusCode newStatusCode = SAMLEngineUtils + .generateStatusCode(response.getSubStatusCode()); + statusCode.setStatusCode(newStatusCode); + } + + LOG.debug("Generate Status."); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + if (StringUtils.isNotBlank(response.getMessage())) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(response.getMessage()); + + status.setStatusMessage(statusMessage); + } + + LOG.debug("Generate Response."); + // RESPONSE + final Response responseFail = genAuthnRespBase(status, destinationUrl, + request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, "", + request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + responseFail.getAssertions().add(assertion); + + LOG.debug("Sign and Marshall ResponseFail."); + + final STORKAttrQueryResponse storkResponse = new STORKAttrQueryResponse(); + + try { + storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); + storkResponse.setSamlId(responseFail.getID()); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException.", e); + throw new STORKSAMLEngineException(e); + } + return storkResponse; + } + + /** + * Generate stork authentication statement for the authentication statement. + * + * @param ipAddress the IP address + * + * @return the authentication statement + */ + private AuthnStatement generateStorkAuthStatement(final String ipAddress) { + LOG.debug("Generate stork authenticate statement."); + final SubjectLocality subjectLocality = SAMLEngineUtils + .generateSubjectLocality(ipAddress); + + final AuthnContext authnContext = (AuthnContext) SAMLEngineUtils + .createSamlObject(AuthnContext.DEFAULT_ELEMENT_NAME); + + final AuthnContextDecl authnContextDecl = (AuthnContextDecl) SAMLEngineUtils + .createSamlObject(AuthnContextDecl.DEFAULT_ELEMENT_NAME); + + authnContext.setAuthnContextDecl(authnContextDecl); + + final AuthnStatement authnStatement = SAMLEngineUtils + .generateAthnStatement(new DateTime(), authnContext); + + // Optional STORK + authnStatement.setSessionIndex(null); + authnStatement.setSubjectLocality(subjectLocality); + + return authnStatement; + } + + /** + * Generate stork extensions. + * + * @param request the request + * + * @return the extensions + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Extensions generateSTORKExtensions(final STORKAuthnRequest request) + throws STORKSAMLEngineException { + LOG.debug("Generate STORKExtensions"); + + final Extensions extensions = SAMLEngineUtils.generateExtension(); + + LOG.debug("Generate QAAAttribute"); + final QAAAttribute qaaAttribute = SAMLEngineUtils + .generateQAAAttribute(request.getQaa()); + extensions.getUnknownXMLObjects().add(qaaAttribute); + + + if (StringUtils.isNotEmpty(request + .getSpSector())) { + // Add information about service provider. + LOG.debug("Generate SPSector"); + final SPSector sector = SAMLEngineUtils.generateSPSector(request + .getSpSector()); + extensions.getUnknownXMLObjects().add(sector); + } + + //Delete from specification. Kept for compatibility with Provider Name value + LOG.debug("Generate SPInstitution"); + final SPInstitution institution = SAMLEngineUtils + .generateSPInstitution(request.getProviderName()); + extensions.getUnknownXMLObjects().add(institution); + + + if (StringUtils.isNotEmpty(request.getSpApplication())) { + LOG.debug("Generate SPApplication"); + final SPApplication application = SAMLEngineUtils + .generateSPApplication(request.getSpApplication()); + extensions.getUnknownXMLObjects().add(application); + } + + if (StringUtils.isNotEmpty(request.getSpCountry())) { + LOG.debug("Generate SPCountry"); + final SPCountry country = SAMLEngineUtils.generateSPCountry(request + .getSpCountry()); + extensions.getUnknownXMLObjects().add(country); + } + + //eIDSectorShare: optional; default value: false. + String valueSectorShare = super.getSamlCoreProperties() + .iseIDSectorShare(); + + if (StringUtils.isNotEmpty(valueSectorShare)) { + // Add information about the use of the SAML message. + LOG.debug("Generate EIDSectorShare"); + final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils + .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); + + eIdSectorShare.setEIDSectorShare(String.valueOf(Boolean.valueOf(valueSectorShare))); + + extensions.getUnknownXMLObjects().add(eIdSectorShare); + } + + String valueCrossSectorShare = super.getSamlCoreProperties() + .iseIDCrossSectorShare(); + + if (StringUtils.isNotEmpty(valueCrossSectorShare)) { + LOG.debug("Generate EIDCrossSectorShare"); + final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils + .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); + eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(Boolean.valueOf(valueCrossSectorShare))); + extensions.getUnknownXMLObjects().add(eIdCrossSecShare); + } + + + String valueCrossBorderShare = super.getSamlCoreProperties() + .iseIDCrossBorderShare(); + + if (StringUtils.isNotEmpty(valueCrossBorderShare)) { + LOG.debug("Generate EIDCrossBorderShare"); + final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils + .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); + eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(Boolean.valueOf(valueCrossBorderShare))); + extensions.getUnknownXMLObjects().add(eIdCrossBordShare); + } + + + // Add information about requested attributes. + LOG.debug("Generate RequestedAttributes."); + final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils + .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); + + LOG.debug("SAML Engine configuration properties load."); + final Iterator iterator = request + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + if (attribute == null || StringUtils.isBlank(attribute.getName())) { + LOG.error(ATTRIBUTE_EMPTY_LITERAL); + throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); + } + + // Verified if exits the attribute name. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.debug("Attribute name: {} was not found.", attribute + .getName()); + throw new STORKSAMLEngineException("Attribute name: " + + attribute.getName() + " was not found."); + } + + // Friendly name it's an optional attribute. + String friendlyName = null; + + if (super.getSamlCoreProperties().isFriendlyName()) { + friendlyName = attribute.getName(); + } + + + String isRequired = null; + if (super.getSamlCoreProperties().isRequired()) { + isRequired = String.valueOf(attribute.isRequired()); + } + + + LOG.debug("Generate requested attribute: " + attributeName); + final RequestedAttribute requestedAttr = SAMLEngineUtils + .generateReqAuthnAttributeSimple(attributeName, + friendlyName, isRequired, attribute + .getValue()); + + // Add requested attribute. + reqAttributes.getAttributes().add(requestedAttr); + } + + // Add requested attributes. + extensions.getUnknownXMLObjects().add(reqAttributes); + + CitizenCountryCode citizenCountryCode = null; + if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ + LOG.debug("Generate CitizenCountryCode"); + citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils + .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); + + citizenCountryCode.setCitizenCountryCode(request + .getCitizenCountryCode().toUpperCase()); + } + + SPID spid = null; + if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { + LOG.debug("Generate SPID"); + spid = (SPID) SAMLEngineUtils + .createSamlObject(SPID.DEF_ELEMENT_NAME); + + spid.setSPID(request.getSPID().toUpperCase()); + } + + AuthenticationAttributes authenticationAttr = (AuthenticationAttributes) SAMLEngineUtils + .createSamlObject(AuthenticationAttributes.DEF_ELEMENT_NAME); + + final VIDPAuthenticationAttributes vIDPauthenticationAttr = (VIDPAuthenticationAttributes) SAMLEngineUtils + .createSamlObject(VIDPAuthenticationAttributes.DEF_ELEMENT_NAME); + + final SPInformation spInformation = (SPInformation) SAMLEngineUtils + .createSamlObject(SPInformation.DEF_ELEMENT_NAME); + + if(citizenCountryCode!=null){ + vIDPauthenticationAttr.setCitizenCountryCode(citizenCountryCode); + } + + if(spid!=null){ + spInformation.setSPID(spid); + } + + vIDPauthenticationAttr.setSPInformation(spInformation); + + authenticationAttr + .setVIDPAuthenticationAttributes(vIDPauthenticationAttr); + extensions.getUnknownXMLObjects().add(authenticationAttr); + + + return extensions; + + } + + /** + * Generate stork extensions. + * + * @param request the attribute query request + * + * @return the extensions + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Extensions generateSTORKAttrExtensions(final STORKAttrQueryRequest request) + throws STORKSAMLEngineException { + LOG.debug("Generate STORKExtensions"); + + final Extensions extensions = SAMLEngineUtils.generateExtension(); + + LOG.debug("Generate QAAAttribute"); + final QAAAttribute qaaAttribute = SAMLEngineUtils + .generateQAAAttribute(request.getQaa()); + extensions.getUnknownXMLObjects().add(qaaAttribute); + + + if (StringUtils.isNotEmpty(request + .getSpSector())) { + // Add information about service provider. + LOG.debug("Generate SPSector"); + final SPSector sector = SAMLEngineUtils.generateSPSector(request + .getSpSector()); + extensions.getUnknownXMLObjects().add(sector); + } + + + if (StringUtils.isNotEmpty(request.getSpApplication())) { + LOG.debug("Generate SPApplication"); + final SPApplication application = SAMLEngineUtils + .generateSPApplication(request.getSpApplication()); + extensions.getUnknownXMLObjects().add(application); + } + + if (StringUtils.isNotEmpty(request.getSpCountry())) { + LOG.debug("Generate SPCountry"); + final SPCountry country = SAMLEngineUtils.generateSPCountry(request + .getSpCountry()); + extensions.getUnknownXMLObjects().add(country); + } + + final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils + .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); + + eIdSectorShare.setEIDSectorShare(String.valueOf(request.isEIDSectorShare())); + + extensions.getUnknownXMLObjects().add(eIdSectorShare); + + final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils + .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); + eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(request.isEIDCrossSectorShare())); + extensions.getUnknownXMLObjects().add(eIdCrossSecShare); + + final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils + .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); + eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(request.isEIDCrossBorderShare())); + extensions.getUnknownXMLObjects().add(eIdCrossBordShare); + + + // Add information about requested attributes. + LOG.debug("Generate RequestedAttributes."); + final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils + .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); + + LOG.debug("SAML Engine configuration properties load."); + final Iterator iterator = request + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + if (attribute == null || StringUtils.isBlank(attribute.getName())) { + LOG.error(ATTRIBUTE_EMPTY_LITERAL); + throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); + } + + // Verified if exits the attribute name. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.debug("Attribute name: {} was not found.", attribute + .getName()); + throw new STORKSAMLEngineException("Attribute name: " + + attribute.getName() + " was not found."); + } + + // Friendly name it's an optional attribute. + String friendlyName = null; + + if (super.getSamlCoreProperties().isFriendlyName()) { + friendlyName = attribute.getName(); + } + + + String isRequired = null; + if (super.getSamlCoreProperties().isRequired()) { + isRequired = String.valueOf(attribute.isRequired()); + } + + + LOG.debug("Generate requested attribute: " + attributeName); + final RequestedAttribute requestedAttr = SAMLEngineUtils + .generateReqAuthnAttributeSimple(attributeName, + friendlyName, isRequired, attribute + .getValue()); + + // Add requested attribute. + reqAttributes.getAttributes().add(requestedAttr); + } + + // Add requested attributes. + extensions.getUnknownXMLObjects().add(reqAttributes); + + CitizenCountryCode citizenCountryCode = null; + if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ + LOG.debug("Generate CitizenCountryCode"); + citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils + .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); + + citizenCountryCode.setCitizenCountryCode(request + .getCitizenCountryCode().toUpperCase()); + } + + SPID spid = null; + if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { + LOG.debug("Generate SPID"); + spid = (SPID) SAMLEngineUtils + .createSamlObject(SPID.DEF_ELEMENT_NAME); + + spid.setSPID(request.getSPID().toUpperCase()); + } + + + return extensions; + + } + + /** + * Gets the alias from X.509 Certificate at keystore. + * + * @param keyInfo the key info + * @param storkOwnKeyStore + * @param storkOwnKeyStore + * + * @return the alias + */ + private String getAlias(final KeyInfo keyInfo, KeyStore storkOwnKeyStore) { + + LOG.debug("Recover alias information"); + + String alias = null; + try { + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + // Transform the KeyInfo to X509Certificate. + CertificateFactory certFact; + certFact = CertificateFactory.getInstance("X.509"); + + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + final String tokenSerialNumber = cert.getSerialNumber().toString(16); + final X509Principal tokenIssuerDN = new X509Principal(cert.getIssuerDN().getName()); + + + String aliasCert; + X509Certificate certificate; + boolean find = false; + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements() + && !find; ) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + + final String serialNum = certificate.getSerialNumber() + .toString(16); + + X509Principal issuerDN = new X509Principal(certificate + .getIssuerDN().getName()); + + if(serialNum.equalsIgnoreCase(tokenSerialNumber) + && X509PrincipalUtil.equals2(issuerDN, tokenIssuerDN)){ + alias = aliasCert; + find = true; + } + + } + + } catch (KeyStoreException e) { + LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); + } catch (CertificateException e) { + LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); + } catch (RuntimeException e) { + LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); + } + return alias; + } + + /** + * Gets the country from X.509 Certificate. + * + * @param keyInfo the key info + * + * @return the country + */ + private String getCountry(final KeyInfo keyInfo) { + LOG.debug("Recover country information."); + + String result = ""; + try { + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + // Transform the KeyInfo to X509Certificate. + CertificateFactory certFact; + certFact = CertificateFactory.getInstance("X.509"); + + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + String distName = cert.getSubjectDN().toString(); + + distName = StringUtils.deleteWhitespace(StringUtils + .upperCase(distName)); + + final String countryCode = "C="; + final int init = distName.indexOf(countryCode); + + if (init > StringUtils.INDEX_NOT_FOUND) { // Exist country code. + int end = distName.indexOf(',', init); + + if (end <= StringUtils.INDEX_NOT_FOUND) { + end = distName.length(); + } + + if (init < end && end > StringUtils.INDEX_NOT_FOUND) { + result = distName.substring(init + countryCode.length(), + end); + //It must be a two characters value + if(result.length()>2){ + result = result.substring(0, 2); + } + } + } + + } catch (CertificateException e) { + LOG.error("Procces getCountry from certificate."); + } + return result.trim(); + } + + /** + * Process all elements XMLObjects from the extensions. + * + * @param extensions the extensions from the authentication request. + * + * @return the STORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private STORKAuthnRequest processExtensions(final Extensions extensions) + throws STORKSAMLEngineException { + LOG.debug("Procces the extensions."); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + final QAAAttribute qaa = (QAAAttribute) extensions + .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); + request.setQaa(Integer.parseInt(qaa.getQaaLevel())); + + List optionalElements = extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME).get(0); + request.setSpSector(sector.getSPSector()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPApplication application = (SPApplication) extensions + .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); + request.setSpApplication(application.getSPApplication()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPCountry application = (SPCountry) extensions + .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); + request.setSpCountry(application.getSPCountry()); + } + + + List listCrossBorderShare = extensions + .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); + + if (!listCrossBorderShare .isEmpty()) { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); + request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare + .getEIDCrossBorderShare())); + } + + + List listCrosSectorShare = extensions + .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); + + if (!listCrosSectorShare.isEmpty()) { + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); + request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare + .getEIDCrossSectorShare())); + } + + List listSectorShareExtension = extensions + .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); + if (!listSectorShareExtension.isEmpty()) { + final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); + request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); + } + + + + List authAttrs = extensions + .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); + + if (authAttrs != null && !authAttrs.isEmpty()) { + + final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs + .get(0); + + VIDPAuthenticationAttributes vidpAuthnAttr = null; + if (authnAttr != null && !authAttrs.isEmpty()){ + vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); + } + + CitizenCountryCode citizenCountryCodeElement = null; + SPInformation spInformation = null; + if (vidpAuthnAttr != null){ + citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); + spInformation = vidpAuthnAttr.getSPInformation(); + } + + String citizenCountryCode = null; + if(citizenCountryCodeElement!=null){ + citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); + } + + if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ + request.setCitizenCountryCode(citizenCountryCode); + } + + SPID spidElement = null; + if (spInformation != null){ + spidElement = spInformation.getSPID(); + } + + String spid = null; + if(spidElement!=null){ + spid = spidElement.getSPID(); + } + + if (spid != null && StringUtils.isNotBlank(spid)) { + request.setSPID(spid); + } + } + + if (extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { + LOG.error("Extensions not contains any requested attribute."); + throw new STORKSAMLEngineException( + "Extensions not contains any requested attribute."); + } + + final RequestedAttributes requestedAttr = (RequestedAttributes) extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) + .get(0); + + final List reqAttrs = requestedAttr.getAttributes(); + + final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); + + String attributeName; + for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { + final RequestedAttribute attribute = reqAttrs.get(nextAttribute); + final PersonalAttribute personalAttribute = new PersonalAttribute(); + personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); + personalAttribute.setFriendlyName(attribute.getFriendlyName()); + attributeName = attribute.getName(); + + // recover the last name from the string. + personalAttribute.setName(attributeName.substring(attributeName + .lastIndexOf('/') + 1)); + + final ArrayList valores = new ArrayList(); + final List values = attribute.getOrderedChildren(); + + for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { + + // Process attributes simples. An AuthenticationRequest only + // must contains simple values. + + final XMLObject xmlObject = values.get(nextSimpleValue); + + if(xmlObject instanceof XSStringImpl){ + + final XSStringImpl xmlString = (XSStringImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getValue()); + + }else{ + + if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + + TransformerFactory transFactory = TransformerFactory.newInstance(); + Transformer transformer = null; + try { + transformer = transFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + } catch (TransformerConfigurationException e) { + LOG.error("Error transformer configuration exception", e); + } + StringWriter buffer = new StringWriter(); + try { + if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ + transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), + new StreamResult(buffer)); + } + } catch (TransformerException e) { + LOG.error("Error transformer exception", e); + } + String str = buffer.toString(); + + valores.add(str); + + }else{ + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getTextContent()); + } + + + + } + } + personalAttribute.setValue(valores); + personalAttrList.add(personalAttribute); + } + + request.setPersonalAttributeList(personalAttrList); + + return request; + } + + + /** + * Process all elements XMLObjects from the extensions. + * + * @param extensions the extensions from the authentication request. + * + * @return the STORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private STORKAttrQueryRequest processAttrExtensions(final Extensions extensions) + throws STORKSAMLEngineException { + LOG.debug("Procces the atribute query extensions."); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + final QAAAttribute qaa = (QAAAttribute) extensions + .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); + request.setQaa(Integer.parseInt(qaa.getQaaLevel())); + + List optionalElements = extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( + SPSector.DEF_ELEMENT_NAME).get(0); + request.setSpSector(sector.getSPSector()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPApplication application = (SPApplication) extensions + .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); + request.setSpApplication(application.getSPApplication()); + } + + optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); + + if (!optionalElements.isEmpty()) { + final SPCountry application = (SPCountry) extensions + .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); + request.setSpCountry(application.getSPCountry()); + } + + + List listCrossBorderShare = extensions + .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); + + if (!listCrossBorderShare .isEmpty()) { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); + request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare + .getEIDCrossBorderShare())); + } + + + List listCrosSectorShare = extensions + .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); + + if (!listCrosSectorShare.isEmpty()) { + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); + request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare + .getEIDCrossSectorShare())); + } + + List listSectorShareExtension = extensions + .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); + if (!listSectorShareExtension.isEmpty()) { + final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); + request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); + } + + + + List authAttrs = extensions + .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); + + if (authAttrs != null && !authAttrs.isEmpty()) { + + final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs + .get(0); + + VIDPAuthenticationAttributes vidpAuthnAttr = null; + if (authnAttr != null && !authAttrs.isEmpty()){ + vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); + } + + CitizenCountryCode citizenCountryCodeElement = null; + SPInformation spInformation = null; + if (vidpAuthnAttr != null){ + citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); + spInformation = vidpAuthnAttr.getSPInformation(); + } + + String citizenCountryCode = null; + if(citizenCountryCodeElement!=null){ + citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); + } + + if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ + request.setCitizenCountryCode(citizenCountryCode); + } + + SPID spidElement = null; + if (spInformation != null){ + spidElement = spInformation.getSPID(); + } + + String spid = null; + if(spidElement!=null){ + spid = spidElement.getSPID(); + } + + if (spid != null && StringUtils.isNotBlank(spid)) { + request.setSPID(spid); + } + } + + if (extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { + LOG.error("Extensions not contains any requested attribute."); + throw new STORKSAMLEngineException( + "Extensions not contains any requested attribute."); + } + + final RequestedAttributes requestedAttr = (RequestedAttributes) extensions + .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) + .get(0); + + final List reqAttrs = requestedAttr.getAttributes(); + + final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); + + String attributeName; + for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { + final RequestedAttribute attribute = reqAttrs.get(nextAttribute); + final PersonalAttribute personalAttribute = new PersonalAttribute(); + personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); + personalAttribute.setFriendlyName(attribute.getFriendlyName()); + attributeName = attribute.getName(); + + // recover the last name from the string. + personalAttribute.setName(attributeName.substring(attributeName + .lastIndexOf('/') + 1)); + + final ArrayList valores = new ArrayList(); + final List values = attribute.getOrderedChildren(); + + for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { + + // Process attributes simples. An AuthenticationRequest only + // must contains simple values. + + final XMLObject xmlObject = values.get(nextSimpleValue); + + if(xmlObject instanceof XSStringImpl){ + + final XSStringImpl xmlString = (XSStringImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getValue()); + + }else{ + + if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + + TransformerFactory transFactory = TransformerFactory.newInstance(); + Transformer transformer = null; + try { + transformer = transFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + } catch (TransformerConfigurationException e) { + LOG.error("Error transformer configuration exception", e); + } + StringWriter buffer = new StringWriter(); + try { + if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ + transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), + new StreamResult(buffer)); + } + } catch (TransformerException e) { + LOG.error("Error transformer exception", e); + } + String str = buffer.toString(); + + valores.add(str); + + }else{ + + final XSAnyImpl xmlString = (XSAnyImpl) values + .get(nextSimpleValue); + valores.add(xmlString.getTextContent()); + } + + + + } + } + personalAttribute.setValue(valores); + personalAttrList.add(personalAttribute); + } + + request.setPersonalAttributeList(personalAttrList); + + return request; + } + + /** + * Sets the name spaces. + * + * @param tokenSaml the new name spaces + */ + private void setNameSpaces(final XMLObject tokenSaml) { + LOG.debug("Set namespaces."); + + final Namespace saml2 = new Namespace(SAMLConstants.SAML20_NS, + SAMLConstants.SAML20_PREFIX); + tokenSaml.addNamespace(saml2); + + final Namespace digSig = new Namespace( + "http://www.w3.org/2000/09/xmldsig#", "ds"); + tokenSaml.addNamespace(digSig); + + final Namespace storkp = new Namespace(SAMLCore.STORK10P_NS.getValue(), + SAMLCore.STORK10P_PREFIX.getValue()); + tokenSaml.addNamespace(storkp); + + final Namespace stork = new Namespace(SAMLCore.STORK10_NS.getValue(), + SAMLCore.STORK10_PREFIX.getValue()); + + tokenSaml.addNamespace(stork); + } + + /** + * Validate parameters from authentication request. + * + * @param request the request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAuthnReq(final STORKAuthnRequest request) + throws STORKSAMLEngineException { + LOG.info("Validate parameters from authentication request."); + + // URL to which Authentication Response must be sent. + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); + } + + // the name of the original service provider requesting the + // authentication. + if (StringUtils.isBlank(request.getProviderName())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Service Provider it's mandatory."); + } + + // object that contain all attributes requesting. + if (request.getPersonalAttributeList() == null + || request.getPersonalAttributeList().isEmpty()) { + throw new STORKSAMLEngineException( + "attributeQueries is null or empty."); + } + + // Quality authentication assurance level. + if ((request.getQaa() < QAAAttribute.MIN_VALUE) + || (request.getQaa() > QAAAttribute.MAX_VALUE)) { + throw new STORKSAMLEngineException("Qaal: " + request.getQaa() + + ", is invalid."); + } + + } + + /** + * Validate parameters from authentication request. + * + * @param request the request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAttrQueryReq(final STORKAttrQueryRequest request) + throws STORKSAMLEngineException { + LOG.info("Validate parameters from attribute query request."); + + // URL to which Authentication Response must be sent. + /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); + }*/ + + // the name of the original service provider requesting the + // authentication. + /*if (StringUtils.isBlank(request.getProviderName())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Service Provider it's mandatory."); + }*/ + + // object that contain all attributes requesting. + if (request.getPersonalAttributeList() == null + || request.getPersonalAttributeList().isEmpty()) { + throw new STORKSAMLEngineException( + "attributeQueries is null or empty."); + } + + // Quality authentication assurance level. + if ((request.getQaa() < QAAAttribute.MIN_VALUE) + || (request.getQaa() > QAAAttribute.MAX_VALUE)) { + throw new STORKSAMLEngineException("Qaal: " + request.getQaa() + + ", is invalid."); + } + + } + + + /** + * Validate parameters from response. + * + * @param request the request + * @param responseAuthReq the response authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamResponse(final STORKAuthnRequest request, + final STORKAuthnResponse responseAuthReq) + throws STORKSAMLEngineException { + LOG.info("Validate parameters response."); + if (StringUtils.isBlank(request.getIssuer())) { + throw new STORKSAMLEngineException( + "Issuer must be not empty or null."); + } + + if (responseAuthReq.getPersonalAttributeList() == null + || responseAuthReq.getPersonalAttributeList().isEmpty()) { + LOG.error("PersonalAttributeList is null or empty."); + throw new STORKSAMLEngineException( + "PersonalAttributeList is null or empty."); + } + + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "assertionConsumerServiceURL is null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate parameters from response. + * + * @param request the request + * @param responseAttrQueryReq the response authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAttrQueryResponse(final STORKAttrQueryRequest request, + final STORKAttrQueryResponse responseAttrQueryReq) + throws STORKSAMLEngineException { + LOG.info("Validate attribute querey parameters response."); + if (StringUtils.isBlank(request.getIssuer())) { + throw new STORKSAMLEngineException( + "Issuer must be not empty or null."); + } + + if (responseAttrQueryReq.getPersonalAttributeList() == null + || responseAttrQueryReq.getPersonalAttributeList().isEmpty()) { + LOG.error("PersonalAttributeList is null or empty."); + throw new STORKSAMLEngineException( + "PersonalAttributeList is null or empty."); + } + + /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "assertionConsumerServiceURL is null or empty."); + }*/ + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate parameter from response fail. + * + * @param request the request + * @param response the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamResponseFail(final STORKAuthnRequest request, + final STORKAuthnResponse response) throws STORKSAMLEngineException { + LOG.info("Validate parameters response fail."); + if (StringUtils.isBlank(response.getStatusCode())) { + throw new STORKSAMLEngineException("Code error it's null or empty."); + } + + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + throw new STORKSAMLEngineException( + "assertionConsumerServiceURL is null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate parameter from response fail. + * + * @param request the request + * @param response the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamAttrQueryResponseFail(final STORKAttrQueryRequest request, + final STORKAttrQueryResponse response) throws STORKSAMLEngineException { + LOG.info("Validate parameters response fail."); + if (StringUtils.isBlank(response.getStatusCode())) { + throw new STORKSAMLEngineException("Code error it's null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } + + /** + * Validate stork authentication request. + * + * @param tokenSaml the token SAML + * + * @return the sTORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnRequest validateSTORKAuthnRequest(final byte[] tokenSaml) + throws STORKSAMLEngineException { + LOG.info("validateSTORKAuthnRequest"); + + final AuthnRequest samlRequest = (AuthnRequest) validateStorkSaml(tokenSaml); + + LOG.debug("Validate Extensions."); + final Validator validatorExt = new ExtensionsSchemaValidator(); + try { + validatorExt.validate(samlRequest.getExtensions()); + } catch (ValidationException e) { + LOG.error("ValidationException: validate Extensions.", e); + throw new STORKSAMLEngineException(e); + } + + LOG.debug("Generate STORKAuthnRequest."); + final STORKAuthnRequest authnRequest = processExtensions(samlRequest + .getExtensions()); + + authnRequest.setCountry(this.getCountry(samlRequest.getSignature() + .getKeyInfo())); + + authnRequest.setAlias(this.getAlias(samlRequest.getSignature() + .getKeyInfo(), super.getSigner().getTrustStore())); + + authnRequest.setSamlId(samlRequest.getID()); + authnRequest.setDestination(samlRequest.getDestination()); + authnRequest.setAssertionConsumerServiceURL(samlRequest + .getAssertionConsumerServiceURL()); + + authnRequest.setProviderName(samlRequest.getProviderName()); + authnRequest.setIssuer(samlRequest.getIssuer().getValue()); + + //Delete unknown elements from requested ones + final Iterator iterator = authnRequest.getPersonalAttributeList().iterator(); + IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) authnRequest.getPersonalAttributeList(); + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + // Verify if the attribute name exits. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); + cleanPerAttrList.remove(attribute.getName()); + } + + } + authnRequest.setPersonalAttributeList(cleanPerAttrList); + + return authnRequest; + + } + + /** + * Validate stork authentication request. + * + * @param tokenSaml the token SAML + * + * @return the sTORK authentication request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryRequest validateSTORKAttrQueryRequest(final byte[] tokenSaml) + throws STORKSAMLEngineException { + LOG.info("validateSTORKAttrQueryRequest"); + + final AttributeQuery samlRequest = (AttributeQuery) validateStorkSaml(tokenSaml); + + LOG.debug("Validate Extensions."); + final Validator validatorExt = new ExtensionsSchemaValidator(); + try { + validatorExt.validate(samlRequest.getExtensions()); + } catch (ValidationException e) { + LOG.error("ValidationException: validate Extensions.", e); + throw new STORKSAMLEngineException(e); + } + + LOG.debug("Generate STORKAttrQueryRequest."); + final STORKAttrQueryRequest attrRequest = processAttrExtensions(samlRequest + .getExtensions()); + + attrRequest.setCountry(this.getCountry(samlRequest.getSignature() + .getKeyInfo())); + + attrRequest.setAlias(this.getAlias(samlRequest.getSignature() + .getKeyInfo(), super.getSigner().getTrustStore())); + + attrRequest.setSamlId(samlRequest.getID()); + attrRequest.setDestination(samlRequest.getDestination()); + /*attrRequest.setAssertionConsumerServiceURL(samlRequest + .getAssertionConsumerServiceURL()); + + authnRequest.setProviderName(samlRequest.getProviderName());*/ + attrRequest.setIssuer(samlRequest.getIssuer().getValue()); + + //Delete unknown elements from requested ones + final Iterator iterator = attrRequest.getPersonalAttributeList().iterator(); + IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) attrRequest.getPersonalAttributeList(); + while (iterator.hasNext()) { + + final PersonalAttribute attribute = iterator.next(); + + // Verify if the attribute name exits. + final String attributeName = super.getSamlCoreProperties() + .getProperty(attribute.getName()); + + if (StringUtils.isBlank(attributeName)) { + LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); + cleanPerAttrList.remove(attribute.getName()); + } + + } + attrRequest.setPersonalAttributeList(cleanPerAttrList); + + return attrRequest; + + } + + /** + * Validate stork authentication response. + * + * @param tokenSaml the token SAML + * @param userIP the user IP + * + * @return the Stork authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse validateSTORKAuthnResponse( + final byte[] tokenSaml, final String userIP) + throws STORKSAMLEngineException { + + LOG.info("validateSTORKAuthnResponse"); + final Response samlResponse = (Response) validateStorkSaml(tokenSaml); + + LOG.debug("Create StorkAuthResponse."); + final STORKAuthnResponse authnResponse = new STORKAuthnResponse(); + + authnResponse.setCountry(this.getCountry(samlResponse.getSignature() + .getKeyInfo())); + + LOG.debug("Set ID."); + authnResponse.setSamlId(samlResponse.getID()); + LOG.debug("Set InResponseTo."); + authnResponse.setInResponseTo(samlResponse.getInResponseTo()); + LOG.debug("Set statusCode."); + authnResponse.setStatusCode(samlResponse.getStatus().getStatusCode() + .getValue()); + + // Subordinate code. + if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { + authnResponse.setSubStatusCode(samlResponse.getStatus() + .getStatusCode().getStatusCode().getValue()); + } + + if (samlResponse.getStatus().getStatusMessage() != null) { + LOG.debug("Set statusMessage."); + authnResponse.setMessage(samlResponse.getStatus() + .getStatusMessage().getMessage()); + } + + LOG.debug("validateStorkResponse"); + final Assertion assertion = (Assertion) validateStorkResponse( + samlResponse, userIP); + + if(assertion!=null){ + final DateTime serverDate = new DateTime(); + + if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { + LOG.error("Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + ", server_date: " + serverDate + ")"); + throw new STORKSAMLEngineException( + "Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + " ), server_date: " + serverDate); + } + + LOG.debug("Set notOnOrAfter."); + authnResponse.setNotOnOrAfter(assertion.getConditions() + .getNotOnOrAfter()); + + LOG.debug("Set notBefore."); + authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + authnResponse.setAudienceRestriction(((AudienceRestriction) assertion + .getConditions().getAudienceRestrictions().get(0)) + .getAudiences().get(0).getAudienceURI()); + } + + // Case no error. + if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(authnResponse + .getStatusCode())) { + LOG.debug("Status Success. Set PersonalAttributeList."); + authnResponse + .setPersonalAttributeList(generatePersonalAttributeList(assertion)); + authnResponse.setFail(false); + } else { + LOG.debug("Status Fail."); + authnResponse.setFail(true); + } + LOG.debug("Return result."); + return authnResponse; + + } + + /** + * Validate stork attribute query response. + * + * @param tokenSaml the token SAML + * @param userIP the user IP + * + * @return the Stork attribute query response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse validateSTORKAttrQueryResponse( + final byte[] tokenSaml, final String userIP) + throws STORKSAMLEngineException { + + LOG.info("validateSTORKAttrQueryResponse"); + final Response samlResponse = (Response) validateStorkSaml(tokenSaml); + + LOG.debug("Create StorkAttrQueryResponse."); + final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); + + attrQueryResponse.setCountry(this.getCountry(samlResponse.getSignature() + .getKeyInfo())); + + LOG.debug("Set ID."); + attrQueryResponse.setSamlId(samlResponse.getID()); + LOG.debug("Set InResponseTo."); + attrQueryResponse.setInResponseTo(samlResponse.getInResponseTo()); + LOG.debug("Set statusCode."); + attrQueryResponse.setStatusCode(samlResponse.getStatus().getStatusCode() + .getValue()); + + // Subordinate code. + if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { + attrQueryResponse.setSubStatusCode(samlResponse.getStatus() + .getStatusCode().getStatusCode().getValue()); + } + + if (samlResponse.getStatus().getStatusMessage() != null) { + LOG.debug("Set statusMessage."); + attrQueryResponse.setMessage(samlResponse.getStatus() + .getStatusMessage().getMessage()); + } + + LOG.debug("validateStorkResponse"); + final Assertion assertion = (Assertion) validateStorkResponse( + samlResponse, userIP); + + if(assertion!=null){ + final DateTime serverDate = new DateTime(); + + if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { + LOG.error("Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + ", server_date: " + serverDate + ")"); + throw new STORKSAMLEngineException( + "Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + " ), server_date: " + serverDate); + } + + LOG.debug("Set notOnOrAfter."); + attrQueryResponse.setNotOnOrAfter(assertion.getConditions() + .getNotOnOrAfter()); + + LOG.debug("Set notBefore."); + attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + attrQueryResponse.setAudienceRestriction(((AudienceRestriction) assertion + .getConditions().getAudienceRestrictions().get(0)) + .getAudiences().get(0).getAudienceURI()); + } + + // Case no error. + if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(attrQueryResponse + .getStatusCode())) { + LOG.debug("Status Success. Set PersonalAttributeList."); + attrQueryResponse + .setPersonalAttributeList(generatePersonalAttributeList(assertion)); + attrQueryResponse.setFail(false); + } else { + LOG.debug("Status Fail."); + attrQueryResponse.setFail(true); + } + LOG.debug("Return result."); + return attrQueryResponse; + + } + + /** + * Validate stork response. + * + * @param samlResponse the SAML response + * @param userIP the user IP + * + * @return the assertion + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private Assertion validateStorkResponse(final Response samlResponse, + final String userIP) throws STORKSAMLEngineException { + // Exist only one Assertion + + if (samlResponse.getAssertions() == null + || samlResponse.getAssertions().isEmpty()) { + LOG.info("Assertion is null or empty."); //in replace of throw new STORKSAMLEngineException("Assertion is null or empty.") + return null; + } + + final Assertion assertion = (Assertion) samlResponse.getAssertions() + .get(0); + + LOG.debug("Verified method Bearer"); + for (final Iterator iter = assertion.getSubject() + .getSubjectConfirmations().iterator(); iter.hasNext();) { + final SubjectConfirmation element = iter.next(); + final boolean isBearer = SubjectConfirmation.METHOD_BEARER + .equals(element.getMethod()); + + final boolean ipValidate = super.getSamlCoreProperties() + .isIpValidation(); + + if (ipValidate) { + if (isBearer) { + if (StringUtils.isBlank(userIP)) { + LOG.error("browser_ip is null or empty."); + throw new STORKSAMLEngineException( + "browser_ip is null or empty."); + } else if (StringUtils.isBlank(element + .getSubjectConfirmationData().getAddress())) { + LOG.error("token_ip attribute is null or empty."); + throw new STORKSAMLEngineException( + "token_ip attribute is null or empty."); + } + } + + final boolean ipEqual = element.getSubjectConfirmationData() + .getAddress().equals(userIP); + + // Validation ipUser + if (!ipEqual && ipValidate) { + LOG.error("SubjectConfirmation BEARER: "); + throw new STORKSAMLEngineException( + "IPs doesn't match : token_ip (" + + element.getSubjectConfirmationData() + .getAddress() + ") browser_ip (" + + userIP + ")"); + } + } + + } + return assertion; + } + + /** + * Validate stork SAML. + * + * @param tokenSaml the token SAML + * + * @return the signable SAML object + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private SignableSAMLObject validateStorkSaml(final byte[] tokenSaml) + throws STORKSAMLEngineException { + + LOG.info("Validate StorkSaml message."); + + if (tokenSaml == null) { + LOG.error("Saml authentication request is null."); + throw new STORKSAMLEngineException( + "Saml authentication request is null."); + } + + LOG.debug("Generate AuthnRequest from request."); + SignableSAMLObject samlObject; + + try { + samlObject = (SignableSAMLObject) super.unmarshall(tokenSaml); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException unmarshall.", e); + throw new STORKSAMLEngineException(e); + } + + boolean validateSign = true; + + if (StringUtils.isNotBlank(super.getSamlCoreProperties().getProperty( + "validateSignature"))) { + validateSign = Boolean.valueOf(super.getSamlCoreProperties() + .getProperty("validateSignature")); + } + + if (validateSign) { + LOG.debug("Validate Signature."); + try { + super.validateSignature(samlObject); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException validateSignature.", e); + throw new STORKSAMLEngineException(e); + } + } + + LOG.debug("Validate Schema."); + final ValidatorSuite validatorSuite = Configuration + .getValidatorSuite("saml2-core-schema-validator"); + try { + validatorSuite.validate(samlObject); + } catch (ValidationException e) { + LOG.error("ValidationException.", e); + throw new STORKSAMLEngineException(e); + } + + return samlObject; + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java new file mode 100644 index 000000000..e38cc5f0b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java @@ -0,0 +1,69 @@ +package eu.stork.peps.auth.engine; + +import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.jce.X509Principal; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Utility class used to decrease complexity of comparison of 2 X509principal + * + * @author vanegdi + * @version $Revision: 1.00 $, $Date: 2013-05-24 20:53:51 $ + */ +public final class X509PrincipalUtil{ + + private static final DERObjectIdentifier[] DER_OBJECT_IDENTIFIERS_ARRAY= { + X509Principal.CN, + X509Principal.OU, + X509Principal.O, + X509Principal.L, + X509Principal.ST, + X509Principal.C, + X509Principal.E + }; + + private static final Logger LOG = LoggerFactory.getLogger(eu.stork.peps.auth.engine.X509PrincipalUtil.class); + + /** + * Compares 2 X509Principals to detect if they equals + * @param principal1 + * @param principal2 + * @return true if arguments are not null and equals + */ + public static boolean equals(X509Principal principal1, X509Principal principal2) { + boolean continueProcess = true; + if (principal1 == null || principal2 == null){ + return false; + } + + int cpt = 0; + while(continueProcess && cpt < DER_OBJECT_IDENTIFIERS_ARRAY.length){ + continueProcess = continueProcess && x509ValuesByIdentifierEquals(principal1, principal2, DER_OBJECT_IDENTIFIERS_ARRAY[cpt]); + cpt++; + } + return continueProcess; + } + + public static boolean equals2(X509Principal principal1, X509Principal principal2) { + + if (principal1 == null || principal2 == null){ + return false; + } + + if (principal1.getName().equals(principal2.getName())) + return true; + else + return false; + + } + + private static boolean x509ValuesByIdentifierEquals(X509Principal principal1, X509Principal principal2, DERObjectIdentifier identifier){ + return principal1.getValues(identifier).equals(principal2.getValues(identifier)); + } + + private X509PrincipalUtil(){ + // default contructor + LOG.error("Fake X509PrincipalUtil : never be called"); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops new file mode 100644 index 000000000..5bda1b07b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops @@ -0,0 +1,119 @@ +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 110 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/package-info.java +END +CitizenCountryCode.java +K 25 +svn:wc:ra_dav:version-url +V 116 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.java +END +RequestedAttribute.java +K 25 +svn:wc:ra_dav:version-url +V 116 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.java +END +AuthenticationAttributes.java +K 25 +svn:wc:ra_dav:version-url +V 122 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java +END +QAAAttribute.java +K 25 +svn:wc:ra_dav:version-url +V 110 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.java +END +STORKSAMLCore.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.java +END +SPInformation.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPInformation.java +END +SPInstitution.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPInstitution.java +END +EIDCrossBorderShare.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java +END +SPID.java +K 25 +svn:wc:ra_dav:version-url +V 102 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPID.java +END +SPSector.java +K 25 +svn:wc:ra_dav:version-url +V 106 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPSector.java +END +EIDSectorShare.java +K 25 +svn:wc:ra_dav:version-url +V 112 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.java +END +SAMLCore.java +K 25 +svn:wc:ra_dav:version-url +V 106 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SAMLCore.java +END +SPApplication.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPApplication.java +END +SPCountry.java +K 25 +svn:wc:ra_dav:version-url +V 107 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPCountry.java +END +RequestedAttributes.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.java +END +VIDPAuthenticationAttributes.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.java +END +SAMLEngineSignI.java +K 25 +svn:wc:ra_dav:version-url +V 113 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.java +END +EIDCrossSectorShare.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.java +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/entries new file mode 100644 index 000000000..72f16fa28 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/entries @@ -0,0 +1,680 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +SPID.java +file + + + + +2013-12-20T12:27:57.446475Z +5befd7eed677372d2acb48b3f66e9f02 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1679 + +SPSector.java +file + + + + +2013-12-20T12:27:57.442475Z +00956c4124a9c9062fd408ab886d0a29 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1767 + +EIDSectorShare.java +file + + + + +2013-12-20T12:27:57.442475Z +4277603e70eeeea24e59449136fee007 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1788 + +SAMLCore.java +file + + + + +2013-12-20T12:27:57.442475Z +3ef05a16db7f280124687fbebbd0ca37 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2633 + +validator +dir + +SPApplication.java +file + + + + +2013-12-20T12:27:57.442475Z +97dc9337dfb28ca32ffb50a3b5329651 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1827 + +SPCountry.java +file + + + + +2013-12-20T12:27:57.442475Z +e955976114b4fa9dba61ebc3fdf3c267 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1779 + +RequestedAttributes.java +file + + + + +2013-12-20T12:27:57.442475Z +d93c2c38f6dec952d22f60827b24ee9e +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1652 + +VIDPAuthenticationAttributes.java +file + + + + +2013-12-20T12:27:57.442475Z +b3a8f3746ce11111d80d9e942339a54e +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2224 + +SAMLEngineSignI.java +file + + + + +2013-12-20T12:27:57.442475Z +fb834797256e1ed6873be19ebe860092 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2429 + +EIDCrossSectorShare.java +file + + + + +2013-12-20T12:27:57.442475Z +a693707c2bb3a43e62d8e3ed20e8844d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1856 + +impl +dir + +package-info.java +file + + + + +2013-12-20T12:27:57.446475Z +34cf10993955447fa31dd616aa4978c9 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +808 + +CitizenCountryCode.java +file + + + + +2013-12-20T12:27:57.442475Z +a741f6d7c36860e65f64186ef5cd8610 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1817 + +RequestedAttribute.java +file + + + + +2013-12-20T12:27:57.446475Z +9707a0f5bdad6888a2e021182f80b245 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3828 + +QAAAttribute.java +file + + + + +2013-12-20T12:27:57.446475Z +f0d7a0516989582d342d5ce2a3f08c9d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1917 + +AuthenticationAttributes.java +file + + + + +2013-12-20T12:27:57.446475Z +86b9b4aebe1ca7ca90ce818785374ea7 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1948 + +SPInformation.java +file + + + + +2013-12-20T12:27:57.446475Z +0159e00cdec105564bb6ac394355533b +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1705 + +STORKSAMLCore.java +file + + + + +2013-12-20T12:27:57.446475Z +0e02e7a4c0f208fd5f05191fca5ba91a +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +14229 + +SPInstitution.java +file + + + + +2013-12-20T12:27:57.446475Z +21eda2ef1cb604ce4f952fc608e7772f +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1833 + +EIDCrossBorderShare.java +file + + + + +2013-12-20T12:27:57.446475Z +17d390896e4f96f24df0da4ec83321ec +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1861 + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base new file mode 100644 index 000000000..07157073c --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base @@ -0,0 +1,57 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface AuthenticationAttributes. + * @author fjquevedo + */ +public interface AuthenticationAttributes extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "AuthenticationAttributes"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "AuthenticationAttributesType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the citizen country code. + * + * @return the citizen country code + */ + VIDPAuthenticationAttributes getVIDPAuthenticationAttributes(); + + + /** + * Sets the vIDP authentication attributes. + * + * @param newVIDPAuthenticationAttr the new vIDP authentication attributes + */ + void setVIDPAuthenticationAttributes(VIDPAuthenticationAttributes newVIDPAuthenticationAttr); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base new file mode 100644 index 000000000..859d37feb --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author fjquevedo + */ +public interface CitizenCountryCode extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "CitizenCountryCode"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "CitizenCountryCodeType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the SP country. + * + * @return the sP country + */ + String getCitizenCountryCode(); + + + /** + * Sets the citizen country code. + * + * @param citizenCountryCode the new citizen country code + */ + void setCitizenCountryCode(String citizenCountryCode); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base new file mode 100644 index 000000000..c892eae78 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base @@ -0,0 +1,58 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author fjquevedo + */ +public interface EIDCrossBorderShare extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "eIDCrossBorderShare"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "eIDCrossBorderShareType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the eID cross border share. + * + * @return the eID cross border share + */ + String getEIDCrossBorderShare(); + + + /** + * Sets the eID cross border share. + * + * @param eIDCrossBorderShare the new eID cross border share + */ + void setEIDCrossBorderShare(String eIDCrossBorderShare); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base new file mode 100644 index 000000000..f879914f9 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossSectorShare. + * @author fjquevedo + */ +public interface EIDCrossSectorShare extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String ELEM_LOCAL_NAME = "eIDCrossSectorShare"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), ELEM_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "eIDCrossSectorShareType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the eID cross sector share. + * + * @return the eID cross sector share + */ + String getEIDCrossSectorShare(); + + /** + * Sets the eID cross sector share. + * + * @param eIDCrossSectorShare the new eID cross sector share + */ + void setEIDCrossSectorShare(String eIDCrossSectorShare); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base new file mode 100644 index 000000000..dc88f3318 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base @@ -0,0 +1,57 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDSectorShare. + * @author fjquevedo + */ +public interface EIDSectorShare extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "eIDSectorShare"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "eIDSectorShare"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the eID sector share. + * + * @return the eID sector share + */ + String getEIDSectorShare(); + + /** + * Sets the eID sector share. + * + * @param eIDSectorShare the new eID sector share + */ + void setEIDSectorShare(String eIDSectorShare); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base new file mode 100644 index 000000000..2c09cf85b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base @@ -0,0 +1,63 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * STORK Quality Authentication Assurance Level Attribute Interface. + * + * @author fjquevedo + */ +public interface QAAAttribute extends SAMLObject { + + /** Element local name. */ + String DEF_LOCAL_NAME = "QualityAuthenticationAssuranceLevel"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "QualityAuthenticationAssuranceLevelAbstractType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The minimum value allowed. */ + int MIN_VALUE = 1; + + /** The Max value allowed. */ + int MAX_VALUE = 4; + + /** + * Gets the qAA level. + * + * @return the qAA level + */ + String getQaaLevel(); + + /** + * Sets the qAA level. + * + * @param qaaLevel the new qAA level + * + */ + void setQaaLevel(String qaaLevel); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base new file mode 100644 index 000000000..02be9e104 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base @@ -0,0 +1,140 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; +import org.opensaml.xml.AttributeExtensibleXMLObject; +import org.opensaml.xml.schema.XSBooleanValue; +import org.opensaml.xml.XMLObject; + +/** + * The Interface RequestedAttribute. + * + * @author fjquevedo + */ +public interface RequestedAttribute extends SAMLObject, + AttributeExtensibleXMLObject { + + /** Element local name. */ + String DEF_LOCAL_NAME = "RequestedAttribute"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "RequestedAttributeAbstractType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** NAME_ATTRIB_NAME attribute name. */ + String NAME_ATTRIB_NAME = "Name"; + + /** NAME_FORMAT_ATTRIB_NAME attribute name. */ + String NAME_FORMAT_ATTR = "NameFormat"; + + /** IS_REQUIRED_ATTRIB_NAME attribute name. */ + String IS_REQUIRED_ATTR = "isRequired"; + + /** FRIENDLY_NAME_ATTRIB_NAME attribute name. */ + String FRIENDLY_NAME_ATT = "FriendlyName"; + + /** Unspecified attribute format ID. */ + String UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"; + + /** URI reference attribute format ID. */ + String URI_REFERENCE = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"; + + /** Basic attribute format ID. */ + String BASIC = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"; + + /** + * Gets the name. + * + * @return the name + */ + String getName(); + + /** + * Sets the name. + * + * @param name the new name + */ + void setName(String name); + + /** + * Gets the name format. + * + * @return the name format + */ + String getNameFormat(); + + /** + * Sets the name format. + * + * @param nameFormat the new name format + */ + void setNameFormat(String nameFormat); + + /** + * Gets the friendly name. + * + * @return the friendly name + */ + String getFriendlyName(); + + /** + * Sets the friendly name. + * + * @param friendlyName the new friendly name + */ + void setFriendlyName(String friendlyName); + + /** + * Gets the checks if is required. + * + * @return the checks if is required + */ + String isRequired(); + + /** + * Gets the checks if is required xs boolean. + * + * @return the checks if is required xs boolean + */ + String getIsRequiredXSBoolean(); + + /** + * Sets the checks if is required. + * + * @param newIsRequired the new checks if is required + */ + void setIsRequired(String newIsRequired); + + /** + * Gets the attribute values. + * + * @return the attribute values + */ + List getAttributeValues(); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base new file mode 100644 index 000000000..9004b10f4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface RequestedAttributes. + * + * @author fjquevedo + */ +public interface RequestedAttributes extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "RequestedAttributes"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "RequestedAttributesType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the attributes. + * + * @return the attributes + */ + List getAttributes(); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base new file mode 100644 index 000000000..e511bbaeb --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base @@ -0,0 +1,98 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +/** + * The Enumeration SAMLCore. + * + * @author fjquevedo + */ + +public enum SAMLCore { + + /** The consent authentication request. */ + CONSENT_AUTHN_REQ("consentAuthnRequest"), + + /** The consent authentication response. */ + CONSENT_AUTHN_RES("consentAuthnResponse"), + + /** The FORC e_ auth n_ tag. */ + FORCE_AUTHN_TAG("forceAuthN"), + + /** The I s_ passiv e_ tag. */ + IS_PASSIVE_TAG("isPassive"), + + /** The FORMA t_ entity. */ + FORMAT_ENTITY("formatEntity"), + + /** The FRIENDLY name. */ + FRIENDLY_NAME("friendlyName"), + + /** The IS_REQUIRED AN ATTRIBUTE */ + IS_REQUIRED("isRequired"), + + /** The PRO t_ bindin g_ tag. */ + PROT_BINDING_TAG("protocolBinding"), + + /** The ASSER t_ con s_ tag. */ + ASSERT_CONS_TAG("assertionConsumerServiceURL"), + + /** The REQUESTE r_ tag. */ + REQUESTER_TAG("requester"), + + /** The RESPONDE r_ tag. */ + RESPONDER_TAG("responder"), + + /** The STOR k10_ ns. */ + STORK10_NS("urn:eu:stork:names:tc:STORK:1.0:assertion"), + + /** The STOR k10 p_ ns. */ + STORK10P_NS("urn:eu:stork:names:tc:STORK:1.0:protocol"), + + /** The STOR k10_ prefix. */ + STORK10_PREFIX("stork"), + + /** The STOR k10 p_ prefix. */ + STORK10P_PREFIX("storkp"), + + /** The STOR k10_ bas e_ uri. */ + STORK10_BASE_URI("http://www.stork.gov.eu/1.0/"), + + /** The ON e_ tim e_ use. */ + ONE_TIME_USE("oneTimeUse"); + + /** The value. */ + private String value; + + /** + * Instantiates a new sAML core. + * + * @param fullName the full name + */ + private SAMLCore(final String fullName) { + this.value = fullName; + } + + /** + * Gets the value. + * + * @return the value + */ + public String getValue() { + return value; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base new file mode 100644 index 000000000..b382646be --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base @@ -0,0 +1,88 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.security.KeyStore; +import java.security.cert.X509Certificate; + +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; + +import eu.stork.peps.exceptions.SAMLEngineException; + +/** + * The Interface SAMLEngineSignI. + * + * @author fjquevedo + */ +public interface SAMLEngineSignI { + + /** + * Sign. + * + * @param tokenSaml the token SAML + * + * @return the sAML object + * + * @throws SAMLEngineException the SAML engine exception + */ + SAMLObject sign(SignableSAMLObject tokenSaml) throws SAMLEngineException; + + /** + * Gets the certificate. + * + * @return the certificate + */ + X509Certificate getCertificate(); + + /** + * Gets the trustStore used when validating SAMLTokens + * + * @return the trustStore + * + */ + KeyStore getTrustStore(); + + /** + * Validate signature. + * + * @param tokenSaml the token SAML + * + * @return the sAML object + * + * @throws SAMLEngineException the SAML engine exception + */ + SAMLObject validateSignature(SignableSAMLObject tokenSaml) + throws SAMLEngineException; + + /** + * Initialize the signature module. + * + * @param fileConf the configuration file. + * + * @throws SAMLEngineException the STORKSAML engine runtime + * exception + */ + void init(String fileConf) throws SAMLEngineException; + + /** + * Load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + */ + void loadCryptServiceProvider() throws SAMLEngineException; + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base new file mode 100644 index 000000000..9ace6d37c --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface SPApplication. + * + * @author fjquevedo + */ +public interface SPApplication extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spApplication"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spApplicationType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider application. + * + * @return the service provider application + */ + String getSPApplication(); + + /** + * Sets the service provider application. + * + * @param spApplication the new service provider application + */ + void setSPApplication(String spApplication); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base new file mode 100644 index 000000000..569ea48c2 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface SPCountry. + * + * @author fjquevedo + */ +public interface SPCountry extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spCountry"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spCountryType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider country. + * + * @return the service provider country + */ + String getSPCountry(); + + /** + * Sets the service provider country. + * + * @param spCountry the new service provider country + */ + void setSPCountry(String spCountry); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base new file mode 100644 index 000000000..c0cf02ad0 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author iinigo + */ +public interface SPID extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "SPID"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "SPIDType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the SP ID. + * + * @return the SP ID + */ + String getSPID(); + + + /** + * Sets the SP ID. + * + * @param SPID the new SP ID + */ + void setSPID(String newSPID); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base new file mode 100644 index 000000000..34ba9c9c5 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author iinigo + */ +public interface SPInformation extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "SPInformation"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "SPInformationType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the SP Id. + * + * @return the SP Id + */ + SPID getSPID(); + + + /** + * Sets the SP Id. + * + * @param newSPId the new SP Id + */ + void setSPID(SPID newSPID); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base new file mode 100644 index 000000000..33dad474b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * + * @author fjquevedo + */ +public interface SPInstitution extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spInstitution"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spInstitutionType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider institution. + * + * @return the service provider institution + */ + String getSPInstitution(); + + /** + * Sets the service provider institution. + * + * @param spInstitution the new service provider institution + */ + void setSPInstitution(String spInstitution); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base new file mode 100644 index 000000000..1f49a4015 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface SPSector. + * + * @author fjquevedo + */ +public interface SPSector extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spSector"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spSectorType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider sector. + * + * @return the service provider sector + */ + String getSPSector(); + + /** + * Sets the service provider sector. + * + * @param spSector the new service provider sector + */ + void setSPSector(String spSector); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base new file mode 100644 index 000000000..19c71dd74 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base @@ -0,0 +1,508 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.NameIDType; +import org.opensaml.saml2.core.RequestAbstractType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class SAMLCore. + * + * @author fjquevedo + */ +public final class STORKSAMLCore { + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(STORKSAMLCore.class.getName()); + + /** The consent authentication request. */ + private String consentAuthnReq = null; + + /** The consent authentication response. */ + private String consentAuthnResp = null; + + /** The id cross border share. */ + private String eIDCrossBordShare = null; + + /** The e id cross sect share. */ + private String eIDCrossSectShare = null; + + /** The e id sector share. */ + private String eIDSectorShare = null; + + /** The format entity. */ + private String formatEntity = null; + + /** The friendly name. */ + private boolean friendlyName = false; + + /** The IP validation. */ + private boolean ipValidation = false; + + /** The one time use. */ + private boolean oneTimeUse = true; + + /** The protocol binding. */ + private String protocolBinding = null; + + /** The requester. */ + private String requester = null; + + + /** The responder. */ + private String responder = null; + + /** The SAML core properties. */ + private Properties samlCoreProp = null; + + /** The time not on or after. */ + private Integer timeNotOnOrAfter = null; + + /** The is required parameter. */ + private boolean isRequired = true; + + private static final String SAML_ENGINE_LITERAL = "SamlEngine.xml: "; + + /** + * Gets the isRequired. + * + * @return the isRequired + */ + public boolean isRequired() { + return isRequired; + } + + /** + * Sets the isRequired. + * + * @param isRequired the required. + */ + public void setRequired(boolean isRequired) { + this.isRequired = isRequired; + } + + /** + * Instantiates a new sAML core. + * + * @param instance the instance + */ + public STORKSAMLCore(final Properties instance) { + loadConfiguration(instance); + } + + /** + * Gets the consent. + * + * @return the consent + */ + public String getConsentAuthnRequest() { + return consentAuthnReq; + } + + /** + * Gets the consent authentication response. + * + * @return the consent authentication response. + */ + public String getConsentAuthnResp() { + return consentAuthnResp; + } + + /** + * Gets the consent authentication response. + * + * @return the consent authentication response + */ + public String getConsentAuthnResponse() { + return consentAuthnResp; + } + + /** + * Gets the format entity. + * + * @return the format entity + */ + public String getFormatEntity() { + return formatEntity; + } + + /** + * Gets the property. + * + * @param key the key + * + * @return the property + */ + public String getProperty(final String key) { + return samlCoreProp.getProperty(key); + } + + /** + * Gets the protocol binding. + * + * @return the protocol binding + */ + public String getProtocolBinding() { + return protocolBinding; + } + + /** + * Gets the requester. + * + * @return the requester + */ + public String getRequester() { + return requester; + } + + /** + * Gets the responder. + * + * @return the responder + */ + public String getResponder() { + return responder; + } + + /** + * Gets the time not on or after. + * + * @return the time not on or after + */ + public Integer getTimeNotOnOrAfter() { + return timeNotOnOrAfter; + } + + /** + * Checks if is e id cross border share. + * + * @return true, if is e id cross border share + */ + public String iseIDCrossBorderShare() { + return eIDCrossBordShare; + } + + /** + * Checks if is e id cross border share. + * + * @return true, if is e id cross border share + */ + public String iseIDCrossBordShare() { + return eIDCrossBordShare; + } + + /** + * Checks if is e id cross sector share. + * + * @return true, if is e id cross sector share + */ + public String iseIDCrossSectorShare() { + return eIDCrossSectShare; + } + + /** + * Checks if is e id cross sect share. + * + * @return true, if is e id cross sect share + */ + public String iseIDCrossSectShare() { + return eIDCrossSectShare; + } + + /** + * Checks if is e id sector share. + * + * @return true, if is e id sector share + */ + public String iseIDSectorShare() { + return eIDSectorShare; + } + + /** + * Checks if is friendly name. + * + * @return true, if checks if is friendly name + */ + public boolean isFriendlyName() { + return friendlyName; + } + + /** + * Checks if is IP validation. + * + * @return true, if is IP validation + */ + public boolean isIpValidation() { + return ipValidation; + } + + /** + * Checks if is one time use. + * + * @return true, if is one time use + */ + public boolean isOneTimeUse() { + return oneTimeUse; + } + + /** + * Method that loads the configuration file for the SAML Engine. + * + * @param instance the instance of the Engine properties. + */ + private void loadConfiguration(final Properties instance) { + + try { + LOGGER.info("SAMLCore: Loading SAMLEngine properties."); + + samlCoreProp = instance; + + final String parameter = samlCoreProp + .getProperty(SAMLCore.FORMAT_ENTITY.getValue()); + + if ("entity".equalsIgnoreCase(parameter)) { + formatEntity = NameIDType.ENTITY; + } + + friendlyName = Boolean.valueOf(samlCoreProp + .getProperty(SAMLCore.FRIENDLY_NAME.getValue())); + + String isRequiredValue = samlCoreProp. + getProperty(SAMLCore.IS_REQUIRED.getValue()); + if (isRequiredValue != null) { + isRequired = Boolean.valueOf(isRequiredValue); + } + + eIDSectorShare = samlCoreProp + .getProperty("eIDSectorShare"); + eIDCrossSectShare = samlCoreProp + .getProperty("eIDCrossSectorShare"); + eIDCrossBordShare = samlCoreProp + .getProperty("eIDCrossBorderShare"); + + ipValidation = Boolean.valueOf(samlCoreProp + .getProperty("ipAddrValidation")); + + final String oneTimeUseProp = samlCoreProp + .getProperty(SAMLCore.ONE_TIME_USE.getValue()); + + if (StringUtils.isNotBlank(oneTimeUseProp)) { + oneTimeUse = Boolean.valueOf(oneTimeUseProp); + } + + // Protocol Binding + loadProtocolBiding(); + + // Consent Authentication Request + consentAuthnReq = samlCoreProp + .getProperty(SAMLCore.CONSENT_AUTHN_REQ.getValue()); + + if ("unspecified".equalsIgnoreCase(consentAuthnReq)) { + consentAuthnReq = RequestAbstractType.UNSPECIFIED_CONSENT; + } + + loadConsentAuthResp(); + + timeNotOnOrAfter = Integer.valueOf(samlCoreProp + .getProperty("timeNotOnOrAfter")); + + if (timeNotOnOrAfter.intValue() < 0) { + LOGGER.error(SAML_ENGINE_LITERAL + "timeNotOnOrAfter" + + " is negative number."); + + throw new SAMLEngineException(SAML_ENGINE_LITERAL + + "timeNotOnOrAfter" + " is negative number."); + } + + requester = samlCoreProp.getProperty(SAMLCore.REQUESTER_TAG.getValue()); + responder = samlCoreProp.getProperty(SAMLCore.RESPONDER_TAG.getValue()); + + } catch (SAMLEngineException e) { + LOGGER.error("SAMLCore: error loadConfiguration. ", e); + throw new STORKSAMLEngineRuntimeException(e); + } catch (RuntimeException e) { + LOGGER.error("SAMLCore: error loadConfiguration. ", e); + throw new STORKSAMLEngineRuntimeException(e); + } + } + + /** + * Load consent authentication response. + */ + private void loadConsentAuthResp() { + // Consent Authentication Response + consentAuthnResp = samlCoreProp + .getProperty(SAMLCore.CONSENT_AUTHN_RES.getValue()); + + if ("obtained".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = RequestAbstractType.OBTAINED_CONSENT; + } else if ("prior".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = RequestAbstractType.PRIOR_CONSENT; + } else if ("curent-implicit".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = + "urn:oasis:names:tc:SAML:2.0:consent:current-implicit"; + } else if ("curent-explicit".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = + "urn:oasis:names:tc:SAML:2.0:consent:current-explicit"; + } else if ("unspecified".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = RequestAbstractType.UNSPECIFIED_CONSENT; + } + } + + /** + * Load protocol biding. + * + * @throws SAMLEngineException the SAML engine exception + */ + private void loadProtocolBiding() throws SAMLEngineException { + // Protocol Binding + protocolBinding = samlCoreProp.getProperty(SAMLCore.PROT_BINDING_TAG.getValue()); + + if (StringUtils.isBlank(protocolBinding)) { + LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG + + " it's mandatory."); + throw new SAMLEngineException(SAML_ENGINE_LITERAL + + SAMLCore.PROT_BINDING_TAG + " it's mandatory."); + } else if (protocolBinding.equalsIgnoreCase("HTTP-POST")) { + protocolBinding = SAMLConstants.SAML2_POST_BINDING_URI; + } else { + LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG + + " it's not supporting."); + + throw new SAMLEngineException(SAML_ENGINE_LITERAL + + SAMLCore.PROT_BINDING_TAG + " it's not supporting."); + } + } + + /** + * Sets the consent authentication response. + * + * @param newConsAuthnResp the new consent authentication response + */ + public void setConsentAuthnResp(final String newConsAuthnResp) { + this.consentAuthnResp = newConsAuthnResp; + } + + /** + * Sets an eID that can be shared outside of the Service Provider’s member state. + * + * @param newEIDCrossBord the new eid cross border share + */ + public void setEIDCrossBordShare(final String newEIDCrossBord) { + this.eIDCrossBordShare = newEIDCrossBord; + } + + /** + * Sets an eID that can be shared outside of the Service Provider’s sector. + * + * @param newEIDCrossSect the new eid cross sect share + */ + public void setEIDCrossSectShare(final String newEIDCrossSect) { + this.eIDCrossSectShare = newEIDCrossSect; + } + + /** + * Sets an eID that can be shared within the Service Provider’s sector. + * + * @param newEIDSectorShare the new eid sector share + */ + public void seteIDSectorShare(final String newEIDSectorShare) { + this.eIDSectorShare = newEIDSectorShare; + } + + /** + * Sets the format entity. + * + * @param newFormatEntity the new format entity + */ + public void setFormatEntity(final String newFormatEntity) { + this.formatEntity = newFormatEntity; + } + + /** + * Sets the friendly name. + * + * @param newFriendlyName the new friendly name + */ + public void setFriendlyName(final boolean newFriendlyName) { + this.friendlyName = newFriendlyName; + } + + /** + * Sets the IP validation. + * + * @param newIpValidation the new IP validation + */ + public void setIpValidation(final boolean newIpValidation) { + this.ipValidation = newIpValidation; + } + + /** + * Sets the one time use. + * + * @param newOneTimeUse the new one time use + */ + public void setOneTimeUse(final boolean newOneTimeUse) { + this.oneTimeUse = newOneTimeUse; + } + + /** + * Sets the protocol binding. + * + * @param newProtBinding the new protocol binding + */ + public void setProtocolBinding(final String newProtBinding) { + this.protocolBinding = newProtBinding; + } + + /** + * Sets the requester. + * + * @param newRequester the new requester + */ + public void setRequester(final String newRequester) { + this.requester = newRequester; + } + + /** + * Sets the responder. + * + * @param newResponder the new responder + */ + public void setResponder(final String newResponder) { + this.responder = newResponder; + } + + /** + * Sets the time not on or after. + * + * @param newTimeNotOnOrAft the new time not on or after + */ + public void setTimeNotOnOrAfter(final Integer newTimeNotOnOrAft) { + this.timeNotOnOrAfter = newTimeNotOnOrAft; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base new file mode 100644 index 000000000..3f812393e --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base @@ -0,0 +1,72 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface VIDPAuthenticationAttributes. + * + * @author fjquevedo + */ +public interface VIDPAuthenticationAttributes extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "VIDPAuthenticationAttributes"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "VIDPAuthenticationAttributesType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the citizen country code. + * + * @return the citizen country code + */ + CitizenCountryCode getCitizenCountryCode(); + + /** + * Sets the citizen country code. + * + * @param newCitizenCountryCode the new citizen country code + */ + void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode); + + /** + * Gets the SP information + * + * @return the SP information + */ + SPInformation getSPInformation(); + + /** + * Sets the SP information + * + * @param newSPInformation the new SPInformation + */ + void setSPInformation(SPInformation newSPInformation); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..3393dcf78 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Interfaces for STORK 1.0 core specification types and elements. + */ +package eu.stork.peps.auth.engine.core; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java new file mode 100644 index 000000000..07157073c --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java @@ -0,0 +1,57 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface AuthenticationAttributes. + * @author fjquevedo + */ +public interface AuthenticationAttributes extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "AuthenticationAttributes"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "AuthenticationAttributesType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the citizen country code. + * + * @return the citizen country code + */ + VIDPAuthenticationAttributes getVIDPAuthenticationAttributes(); + + + /** + * Sets the vIDP authentication attributes. + * + * @param newVIDPAuthenticationAttr the new vIDP authentication attributes + */ + void setVIDPAuthenticationAttributes(VIDPAuthenticationAttributes newVIDPAuthenticationAttr); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.java new file mode 100644 index 000000000..859d37feb --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author fjquevedo + */ +public interface CitizenCountryCode extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "CitizenCountryCode"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "CitizenCountryCodeType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the SP country. + * + * @return the sP country + */ + String getCitizenCountryCode(); + + + /** + * Sets the citizen country code. + * + * @param citizenCountryCode the new citizen country code + */ + void setCitizenCountryCode(String citizenCountryCode); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java new file mode 100644 index 000000000..c892eae78 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java @@ -0,0 +1,58 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author fjquevedo + */ +public interface EIDCrossBorderShare extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "eIDCrossBorderShare"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "eIDCrossBorderShareType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the eID cross border share. + * + * @return the eID cross border share + */ + String getEIDCrossBorderShare(); + + + /** + * Sets the eID cross border share. + * + * @param eIDCrossBorderShare the new eID cross border share + */ + void setEIDCrossBorderShare(String eIDCrossBorderShare); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.java new file mode 100644 index 000000000..f879914f9 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossSectorShare. + * @author fjquevedo + */ +public interface EIDCrossSectorShare extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String ELEM_LOCAL_NAME = "eIDCrossSectorShare"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), ELEM_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "eIDCrossSectorShareType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the eID cross sector share. + * + * @return the eID cross sector share + */ + String getEIDCrossSectorShare(); + + /** + * Sets the eID cross sector share. + * + * @param eIDCrossSectorShare the new eID cross sector share + */ + void setEIDCrossSectorShare(String eIDCrossSectorShare); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.java new file mode 100644 index 000000000..dc88f3318 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.java @@ -0,0 +1,57 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDSectorShare. + * @author fjquevedo + */ +public interface EIDSectorShare extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "eIDSectorShare"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "eIDSectorShare"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the eID sector share. + * + * @return the eID sector share + */ + String getEIDSectorShare(); + + /** + * Sets the eID sector share. + * + * @param eIDSectorShare the new eID sector share + */ + void setEIDSectorShare(String eIDSectorShare); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.java new file mode 100644 index 000000000..2c09cf85b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.java @@ -0,0 +1,63 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * STORK Quality Authentication Assurance Level Attribute Interface. + * + * @author fjquevedo + */ +public interface QAAAttribute extends SAMLObject { + + /** Element local name. */ + String DEF_LOCAL_NAME = "QualityAuthenticationAssuranceLevel"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "QualityAuthenticationAssuranceLevelAbstractType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The minimum value allowed. */ + int MIN_VALUE = 1; + + /** The Max value allowed. */ + int MAX_VALUE = 4; + + /** + * Gets the qAA level. + * + * @return the qAA level + */ + String getQaaLevel(); + + /** + * Sets the qAA level. + * + * @param qaaLevel the new qAA level + * + */ + void setQaaLevel(String qaaLevel); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.java new file mode 100644 index 000000000..02be9e104 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.java @@ -0,0 +1,140 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; +import org.opensaml.xml.AttributeExtensibleXMLObject; +import org.opensaml.xml.schema.XSBooleanValue; +import org.opensaml.xml.XMLObject; + +/** + * The Interface RequestedAttribute. + * + * @author fjquevedo + */ +public interface RequestedAttribute extends SAMLObject, + AttributeExtensibleXMLObject { + + /** Element local name. */ + String DEF_LOCAL_NAME = "RequestedAttribute"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "RequestedAttributeAbstractType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** NAME_ATTRIB_NAME attribute name. */ + String NAME_ATTRIB_NAME = "Name"; + + /** NAME_FORMAT_ATTRIB_NAME attribute name. */ + String NAME_FORMAT_ATTR = "NameFormat"; + + /** IS_REQUIRED_ATTRIB_NAME attribute name. */ + String IS_REQUIRED_ATTR = "isRequired"; + + /** FRIENDLY_NAME_ATTRIB_NAME attribute name. */ + String FRIENDLY_NAME_ATT = "FriendlyName"; + + /** Unspecified attribute format ID. */ + String UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"; + + /** URI reference attribute format ID. */ + String URI_REFERENCE = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"; + + /** Basic attribute format ID. */ + String BASIC = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"; + + /** + * Gets the name. + * + * @return the name + */ + String getName(); + + /** + * Sets the name. + * + * @param name the new name + */ + void setName(String name); + + /** + * Gets the name format. + * + * @return the name format + */ + String getNameFormat(); + + /** + * Sets the name format. + * + * @param nameFormat the new name format + */ + void setNameFormat(String nameFormat); + + /** + * Gets the friendly name. + * + * @return the friendly name + */ + String getFriendlyName(); + + /** + * Sets the friendly name. + * + * @param friendlyName the new friendly name + */ + void setFriendlyName(String friendlyName); + + /** + * Gets the checks if is required. + * + * @return the checks if is required + */ + String isRequired(); + + /** + * Gets the checks if is required xs boolean. + * + * @return the checks if is required xs boolean + */ + String getIsRequiredXSBoolean(); + + /** + * Sets the checks if is required. + * + * @param newIsRequired the new checks if is required + */ + void setIsRequired(String newIsRequired); + + /** + * Gets the attribute values. + * + * @return the attribute values + */ + List getAttributeValues(); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.java new file mode 100644 index 000000000..9004b10f4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.java @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface RequestedAttributes. + * + * @author fjquevedo + */ +public interface RequestedAttributes extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "RequestedAttributes"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "RequestedAttributesType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the attributes. + * + * @return the attributes + */ + List getAttributes(); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLCore.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLCore.java new file mode 100644 index 000000000..e511bbaeb --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLCore.java @@ -0,0 +1,98 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +/** + * The Enumeration SAMLCore. + * + * @author fjquevedo + */ + +public enum SAMLCore { + + /** The consent authentication request. */ + CONSENT_AUTHN_REQ("consentAuthnRequest"), + + /** The consent authentication response. */ + CONSENT_AUTHN_RES("consentAuthnResponse"), + + /** The FORC e_ auth n_ tag. */ + FORCE_AUTHN_TAG("forceAuthN"), + + /** The I s_ passiv e_ tag. */ + IS_PASSIVE_TAG("isPassive"), + + /** The FORMA t_ entity. */ + FORMAT_ENTITY("formatEntity"), + + /** The FRIENDLY name. */ + FRIENDLY_NAME("friendlyName"), + + /** The IS_REQUIRED AN ATTRIBUTE */ + IS_REQUIRED("isRequired"), + + /** The PRO t_ bindin g_ tag. */ + PROT_BINDING_TAG("protocolBinding"), + + /** The ASSER t_ con s_ tag. */ + ASSERT_CONS_TAG("assertionConsumerServiceURL"), + + /** The REQUESTE r_ tag. */ + REQUESTER_TAG("requester"), + + /** The RESPONDE r_ tag. */ + RESPONDER_TAG("responder"), + + /** The STOR k10_ ns. */ + STORK10_NS("urn:eu:stork:names:tc:STORK:1.0:assertion"), + + /** The STOR k10 p_ ns. */ + STORK10P_NS("urn:eu:stork:names:tc:STORK:1.0:protocol"), + + /** The STOR k10_ prefix. */ + STORK10_PREFIX("stork"), + + /** The STOR k10 p_ prefix. */ + STORK10P_PREFIX("storkp"), + + /** The STOR k10_ bas e_ uri. */ + STORK10_BASE_URI("http://www.stork.gov.eu/1.0/"), + + /** The ON e_ tim e_ use. */ + ONE_TIME_USE("oneTimeUse"); + + /** The value. */ + private String value; + + /** + * Instantiates a new sAML core. + * + * @param fullName the full name + */ + private SAMLCore(final String fullName) { + this.value = fullName; + } + + /** + * Gets the value. + * + * @return the value + */ + public String getValue() { + return value; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.java new file mode 100644 index 000000000..b382646be --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.java @@ -0,0 +1,88 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.security.KeyStore; +import java.security.cert.X509Certificate; + +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; + +import eu.stork.peps.exceptions.SAMLEngineException; + +/** + * The Interface SAMLEngineSignI. + * + * @author fjquevedo + */ +public interface SAMLEngineSignI { + + /** + * Sign. + * + * @param tokenSaml the token SAML + * + * @return the sAML object + * + * @throws SAMLEngineException the SAML engine exception + */ + SAMLObject sign(SignableSAMLObject tokenSaml) throws SAMLEngineException; + + /** + * Gets the certificate. + * + * @return the certificate + */ + X509Certificate getCertificate(); + + /** + * Gets the trustStore used when validating SAMLTokens + * + * @return the trustStore + * + */ + KeyStore getTrustStore(); + + /** + * Validate signature. + * + * @param tokenSaml the token SAML + * + * @return the sAML object + * + * @throws SAMLEngineException the SAML engine exception + */ + SAMLObject validateSignature(SignableSAMLObject tokenSaml) + throws SAMLEngineException; + + /** + * Initialize the signature module. + * + * @param fileConf the configuration file. + * + * @throws SAMLEngineException the STORKSAML engine runtime + * exception + */ + void init(String fileConf) throws SAMLEngineException; + + /** + * Load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + */ + void loadCryptServiceProvider() throws SAMLEngineException; + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPApplication.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPApplication.java new file mode 100644 index 000000000..9ace6d37c --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPApplication.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface SPApplication. + * + * @author fjquevedo + */ +public interface SPApplication extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spApplication"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spApplicationType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider application. + * + * @return the service provider application + */ + String getSPApplication(); + + /** + * Sets the service provider application. + * + * @param spApplication the new service provider application + */ + void setSPApplication(String spApplication); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPCountry.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPCountry.java new file mode 100644 index 000000000..569ea48c2 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPCountry.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface SPCountry. + * + * @author fjquevedo + */ +public interface SPCountry extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spCountry"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spCountryType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider country. + * + * @return the service provider country + */ + String getSPCountry(); + + /** + * Sets the service provider country. + * + * @param spCountry the new service provider country + */ + void setSPCountry(String spCountry); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPID.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPID.java new file mode 100644 index 000000000..c0cf02ad0 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPID.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author iinigo + */ +public interface SPID extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "SPID"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "SPIDType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the SP ID. + * + * @return the SP ID + */ + String getSPID(); + + + /** + * Sets the SP ID. + * + * @param SPID the new SP ID + */ + void setSPID(String newSPID); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInformation.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInformation.java new file mode 100644 index 000000000..34ba9c9c5 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInformation.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * @author iinigo + */ +public interface SPInformation extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "SPInformation"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "SPInformationType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** + * Gets the SP Id. + * + * @return the SP Id + */ + SPID getSPID(); + + + /** + * Sets the SP Id. + * + * @param newSPId the new SP Id + */ + void setSPID(SPID newSPID); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInstitution.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInstitution.java new file mode 100644 index 000000000..33dad474b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInstitution.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface EIDCrossBorderShare. + * + * @author fjquevedo + */ +public interface SPInstitution extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spInstitution"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spInstitutionType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider institution. + * + * @return the service provider institution + */ + String getSPInstitution(); + + /** + * Sets the service provider institution. + * + * @param spInstitution the new service provider institution + */ + void setSPInstitution(String spInstitution); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPSector.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPSector.java new file mode 100644 index 000000000..1f49a4015 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPSector.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface SPSector. + * + * @author fjquevedo + */ +public interface SPSector extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "spSector"; + + /** The Constant DEFAULT_ELEMENT_NAME. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** The Constant TYPE_LOCAL_NAME. */ + String TYPE_LOCAL_NAME = "spSectorType"; + + /** The Constant TYPE_NAME. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10_PREFIX.getValue()); + + /** + * Gets the service provider sector. + * + * @return the service provider sector + */ + String getSPSector(); + + /** + * Sets the service provider sector. + * + * @param spSector the new service provider sector + */ + void setSPSector(String spSector); +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.java new file mode 100644 index 000000000..19c71dd74 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.java @@ -0,0 +1,508 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.NameIDType; +import org.opensaml.saml2.core.RequestAbstractType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class SAMLCore. + * + * @author fjquevedo + */ +public final class STORKSAMLCore { + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(STORKSAMLCore.class.getName()); + + /** The consent authentication request. */ + private String consentAuthnReq = null; + + /** The consent authentication response. */ + private String consentAuthnResp = null; + + /** The id cross border share. */ + private String eIDCrossBordShare = null; + + /** The e id cross sect share. */ + private String eIDCrossSectShare = null; + + /** The e id sector share. */ + private String eIDSectorShare = null; + + /** The format entity. */ + private String formatEntity = null; + + /** The friendly name. */ + private boolean friendlyName = false; + + /** The IP validation. */ + private boolean ipValidation = false; + + /** The one time use. */ + private boolean oneTimeUse = true; + + /** The protocol binding. */ + private String protocolBinding = null; + + /** The requester. */ + private String requester = null; + + + /** The responder. */ + private String responder = null; + + /** The SAML core properties. */ + private Properties samlCoreProp = null; + + /** The time not on or after. */ + private Integer timeNotOnOrAfter = null; + + /** The is required parameter. */ + private boolean isRequired = true; + + private static final String SAML_ENGINE_LITERAL = "SamlEngine.xml: "; + + /** + * Gets the isRequired. + * + * @return the isRequired + */ + public boolean isRequired() { + return isRequired; + } + + /** + * Sets the isRequired. + * + * @param isRequired the required. + */ + public void setRequired(boolean isRequired) { + this.isRequired = isRequired; + } + + /** + * Instantiates a new sAML core. + * + * @param instance the instance + */ + public STORKSAMLCore(final Properties instance) { + loadConfiguration(instance); + } + + /** + * Gets the consent. + * + * @return the consent + */ + public String getConsentAuthnRequest() { + return consentAuthnReq; + } + + /** + * Gets the consent authentication response. + * + * @return the consent authentication response. + */ + public String getConsentAuthnResp() { + return consentAuthnResp; + } + + /** + * Gets the consent authentication response. + * + * @return the consent authentication response + */ + public String getConsentAuthnResponse() { + return consentAuthnResp; + } + + /** + * Gets the format entity. + * + * @return the format entity + */ + public String getFormatEntity() { + return formatEntity; + } + + /** + * Gets the property. + * + * @param key the key + * + * @return the property + */ + public String getProperty(final String key) { + return samlCoreProp.getProperty(key); + } + + /** + * Gets the protocol binding. + * + * @return the protocol binding + */ + public String getProtocolBinding() { + return protocolBinding; + } + + /** + * Gets the requester. + * + * @return the requester + */ + public String getRequester() { + return requester; + } + + /** + * Gets the responder. + * + * @return the responder + */ + public String getResponder() { + return responder; + } + + /** + * Gets the time not on or after. + * + * @return the time not on or after + */ + public Integer getTimeNotOnOrAfter() { + return timeNotOnOrAfter; + } + + /** + * Checks if is e id cross border share. + * + * @return true, if is e id cross border share + */ + public String iseIDCrossBorderShare() { + return eIDCrossBordShare; + } + + /** + * Checks if is e id cross border share. + * + * @return true, if is e id cross border share + */ + public String iseIDCrossBordShare() { + return eIDCrossBordShare; + } + + /** + * Checks if is e id cross sector share. + * + * @return true, if is e id cross sector share + */ + public String iseIDCrossSectorShare() { + return eIDCrossSectShare; + } + + /** + * Checks if is e id cross sect share. + * + * @return true, if is e id cross sect share + */ + public String iseIDCrossSectShare() { + return eIDCrossSectShare; + } + + /** + * Checks if is e id sector share. + * + * @return true, if is e id sector share + */ + public String iseIDSectorShare() { + return eIDSectorShare; + } + + /** + * Checks if is friendly name. + * + * @return true, if checks if is friendly name + */ + public boolean isFriendlyName() { + return friendlyName; + } + + /** + * Checks if is IP validation. + * + * @return true, if is IP validation + */ + public boolean isIpValidation() { + return ipValidation; + } + + /** + * Checks if is one time use. + * + * @return true, if is one time use + */ + public boolean isOneTimeUse() { + return oneTimeUse; + } + + /** + * Method that loads the configuration file for the SAML Engine. + * + * @param instance the instance of the Engine properties. + */ + private void loadConfiguration(final Properties instance) { + + try { + LOGGER.info("SAMLCore: Loading SAMLEngine properties."); + + samlCoreProp = instance; + + final String parameter = samlCoreProp + .getProperty(SAMLCore.FORMAT_ENTITY.getValue()); + + if ("entity".equalsIgnoreCase(parameter)) { + formatEntity = NameIDType.ENTITY; + } + + friendlyName = Boolean.valueOf(samlCoreProp + .getProperty(SAMLCore.FRIENDLY_NAME.getValue())); + + String isRequiredValue = samlCoreProp. + getProperty(SAMLCore.IS_REQUIRED.getValue()); + if (isRequiredValue != null) { + isRequired = Boolean.valueOf(isRequiredValue); + } + + eIDSectorShare = samlCoreProp + .getProperty("eIDSectorShare"); + eIDCrossSectShare = samlCoreProp + .getProperty("eIDCrossSectorShare"); + eIDCrossBordShare = samlCoreProp + .getProperty("eIDCrossBorderShare"); + + ipValidation = Boolean.valueOf(samlCoreProp + .getProperty("ipAddrValidation")); + + final String oneTimeUseProp = samlCoreProp + .getProperty(SAMLCore.ONE_TIME_USE.getValue()); + + if (StringUtils.isNotBlank(oneTimeUseProp)) { + oneTimeUse = Boolean.valueOf(oneTimeUseProp); + } + + // Protocol Binding + loadProtocolBiding(); + + // Consent Authentication Request + consentAuthnReq = samlCoreProp + .getProperty(SAMLCore.CONSENT_AUTHN_REQ.getValue()); + + if ("unspecified".equalsIgnoreCase(consentAuthnReq)) { + consentAuthnReq = RequestAbstractType.UNSPECIFIED_CONSENT; + } + + loadConsentAuthResp(); + + timeNotOnOrAfter = Integer.valueOf(samlCoreProp + .getProperty("timeNotOnOrAfter")); + + if (timeNotOnOrAfter.intValue() < 0) { + LOGGER.error(SAML_ENGINE_LITERAL + "timeNotOnOrAfter" + + " is negative number."); + + throw new SAMLEngineException(SAML_ENGINE_LITERAL + + "timeNotOnOrAfter" + " is negative number."); + } + + requester = samlCoreProp.getProperty(SAMLCore.REQUESTER_TAG.getValue()); + responder = samlCoreProp.getProperty(SAMLCore.RESPONDER_TAG.getValue()); + + } catch (SAMLEngineException e) { + LOGGER.error("SAMLCore: error loadConfiguration. ", e); + throw new STORKSAMLEngineRuntimeException(e); + } catch (RuntimeException e) { + LOGGER.error("SAMLCore: error loadConfiguration. ", e); + throw new STORKSAMLEngineRuntimeException(e); + } + } + + /** + * Load consent authentication response. + */ + private void loadConsentAuthResp() { + // Consent Authentication Response + consentAuthnResp = samlCoreProp + .getProperty(SAMLCore.CONSENT_AUTHN_RES.getValue()); + + if ("obtained".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = RequestAbstractType.OBTAINED_CONSENT; + } else if ("prior".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = RequestAbstractType.PRIOR_CONSENT; + } else if ("curent-implicit".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = + "urn:oasis:names:tc:SAML:2.0:consent:current-implicit"; + } else if ("curent-explicit".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = + "urn:oasis:names:tc:SAML:2.0:consent:current-explicit"; + } else if ("unspecified".equalsIgnoreCase(consentAuthnResp)) { + consentAuthnResp = RequestAbstractType.UNSPECIFIED_CONSENT; + } + } + + /** + * Load protocol biding. + * + * @throws SAMLEngineException the SAML engine exception + */ + private void loadProtocolBiding() throws SAMLEngineException { + // Protocol Binding + protocolBinding = samlCoreProp.getProperty(SAMLCore.PROT_BINDING_TAG.getValue()); + + if (StringUtils.isBlank(protocolBinding)) { + LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG + + " it's mandatory."); + throw new SAMLEngineException(SAML_ENGINE_LITERAL + + SAMLCore.PROT_BINDING_TAG + " it's mandatory."); + } else if (protocolBinding.equalsIgnoreCase("HTTP-POST")) { + protocolBinding = SAMLConstants.SAML2_POST_BINDING_URI; + } else { + LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG + + " it's not supporting."); + + throw new SAMLEngineException(SAML_ENGINE_LITERAL + + SAMLCore.PROT_BINDING_TAG + " it's not supporting."); + } + } + + /** + * Sets the consent authentication response. + * + * @param newConsAuthnResp the new consent authentication response + */ + public void setConsentAuthnResp(final String newConsAuthnResp) { + this.consentAuthnResp = newConsAuthnResp; + } + + /** + * Sets an eID that can be shared outside of the Service Provider’s member state. + * + * @param newEIDCrossBord the new eid cross border share + */ + public void setEIDCrossBordShare(final String newEIDCrossBord) { + this.eIDCrossBordShare = newEIDCrossBord; + } + + /** + * Sets an eID that can be shared outside of the Service Provider’s sector. + * + * @param newEIDCrossSect the new eid cross sect share + */ + public void setEIDCrossSectShare(final String newEIDCrossSect) { + this.eIDCrossSectShare = newEIDCrossSect; + } + + /** + * Sets an eID that can be shared within the Service Provider’s sector. + * + * @param newEIDSectorShare the new eid sector share + */ + public void seteIDSectorShare(final String newEIDSectorShare) { + this.eIDSectorShare = newEIDSectorShare; + } + + /** + * Sets the format entity. + * + * @param newFormatEntity the new format entity + */ + public void setFormatEntity(final String newFormatEntity) { + this.formatEntity = newFormatEntity; + } + + /** + * Sets the friendly name. + * + * @param newFriendlyName the new friendly name + */ + public void setFriendlyName(final boolean newFriendlyName) { + this.friendlyName = newFriendlyName; + } + + /** + * Sets the IP validation. + * + * @param newIpValidation the new IP validation + */ + public void setIpValidation(final boolean newIpValidation) { + this.ipValidation = newIpValidation; + } + + /** + * Sets the one time use. + * + * @param newOneTimeUse the new one time use + */ + public void setOneTimeUse(final boolean newOneTimeUse) { + this.oneTimeUse = newOneTimeUse; + } + + /** + * Sets the protocol binding. + * + * @param newProtBinding the new protocol binding + */ + public void setProtocolBinding(final String newProtBinding) { + this.protocolBinding = newProtBinding; + } + + /** + * Sets the requester. + * + * @param newRequester the new requester + */ + public void setRequester(final String newRequester) { + this.requester = newRequester; + } + + /** + * Sets the responder. + * + * @param newResponder the new responder + */ + public void setResponder(final String newResponder) { + this.responder = newResponder; + } + + /** + * Sets the time not on or after. + * + * @param newTimeNotOnOrAft the new time not on or after + */ + public void setTimeNotOnOrAfter(final Integer newTimeNotOnOrAft) { + this.timeNotOnOrAfter = newTimeNotOnOrAft; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.java new file mode 100644 index 000000000..3f812393e --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.java @@ -0,0 +1,72 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.opensaml.common.SAMLObject; + +/** + * The Interface VIDPAuthenticationAttributes. + * + * @author fjquevedo + */ +public interface VIDPAuthenticationAttributes extends SAMLObject { + + /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ + String DEF_LOCAL_NAME = "VIDPAuthenticationAttributes"; + + /** Default element name. */ + QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + /** Local name of the XSI type. */ + String TYPE_LOCAL_NAME = "VIDPAuthenticationAttributesType"; + + /** QName of the XSI type. */ + QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, + SAMLCore.STORK10P_PREFIX.getValue()); + + + /** + * Gets the citizen country code. + * + * @return the citizen country code + */ + CitizenCountryCode getCitizenCountryCode(); + + /** + * Sets the citizen country code. + * + * @param newCitizenCountryCode the new citizen country code + */ + void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode); + + /** + * Gets the SP information + * + * @return the SP information + */ + SPInformation getSPInformation(); + + /** + * Sets the SP information + * + * @param newSPInformation the new SPInformation + */ + void setSPInformation(SPInformation newSPInformation); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops new file mode 100644 index 000000000..7eb0de6e7 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops @@ -0,0 +1,395 @@ +K 25 +svn:wc:ra_dav:version-url +V 97 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl +END +RequestedAttributeImpl.java +K 25 +svn:wc:ra_dav:version-url +V 125 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.java +END +EIDCrossBorderShareMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 132 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.java +END +SPIDMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.java +END +SPInformationImpl.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.java +END +SPInstitutionUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.java +END +EIDSectorShareBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 124 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.java +END +SPCountryBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.java +END +EIDCrossBorderShareImpl.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.java +END +EIDSectorShareUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.java +END +RequestedAttributesMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 132 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.java +END +RequestedAttributesImpl.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.java +END +SignHW.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java +END +QAAAttributeUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 127 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.java +END +SPInstitutionMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.java +END +SPIDUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.java +END +SPInstitutionImpl.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.java +END +EIDSectorShareMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 127 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.java +END +SPSectorUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.java +END +VIDPAuthenticationAttributesBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 138 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 115 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/package-info.java +END +VIDPAuthenticationAttributesMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 141 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.java +END +SPApplicationUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.java +END +EIDSectorShareImpl.java +K 25 +svn:wc:ra_dav:version-url +V 121 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.java +END +CitizenCountryCodeBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.java +END +EIDCrossSectorShareUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 134 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.java +END +RequestedAttributeBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.java +END +SignModuleFactory.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.java +END +RequestedAttributeMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 131 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.java +END +QAAAttributeMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 125 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.java +END +CitizenCountryCodeUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 133 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.java +END +AuthenticationAttributesUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 139 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java +END +SPIDBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.java +END +QAAAttributeImpl.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.java +END +SPSectorMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 121 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.java +END +SPApplicationMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.java +END +SPIDImpl.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.java +END +SPCountryUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 124 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.java +END +SPSectorImpl.java +K 25 +svn:wc:ra_dav:version-url +V 115 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.java +END +VIDPAuthenticationAttributesUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 143 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.java +END +SPApplicationImpl.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.java +END +EIDCrossSectorShareMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 132 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.java +END +QAAAttributeBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 122 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.java +END +CitizenCountryCodeMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 131 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.java +END +SPInformationBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.java +END +EIDCrossSectorShareImpl.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.java +END +AuthenticationAttributesMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 137 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.java +END +EIDCrossBorderShareBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java +END +RequestedAttributeUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 133 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.java +END +SPInformationUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 128 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.java +END +CitizenCountryCodeImpl.java +K 25 +svn:wc:ra_dav:version-url +V 125 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.java +END +AuthenticationAttributesImpl.java +K 25 +svn:wc:ra_dav:version-url +V 131 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.java +END +SPSectorBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 118 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.java +END +EIDCrossBorderShareUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 134 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.java +END +SignSW.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java +END +SPApplicationBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.java +END +RequestedAttributesBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.java +END +SPCountryMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 122 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.java +END +SignP12.java +K 25 +svn:wc:ra_dav:version-url +V 110 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java +END +EIDCrossSectorShareBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.java +END +RequestedAttributesUnmarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 134 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.java +END +SPCountryImpl.java +K 25 +svn:wc:ra_dav:version-url +V 116 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.java +END +VIDPAuthenticationAttributesImpl.java +K 25 +svn:wc:ra_dav:version-url +V 135 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.java +END +AuthenticationAttributesBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 134 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java +END +SPInformationMarshaller.java +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.java +END +SPInstitutionBuilder.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.java +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries new file mode 100644 index 000000000..1c6a5c2a8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries @@ -0,0 +1,2238 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +VIDPAuthenticationAttributesUnmarshaller.java +file + + + + +2013-12-20T12:27:57.414475Z +379336b4e33025428a27f1cec8b44056 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2104 + +RequestedAttributesImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +27cbdb6010cc87d0da987d980e933181 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2964 + +CitizenCountryCodeMarshaller.java +file + + + + +2013-12-20T12:27:57.418475Z +d5237a27554ddbe26fd86e0b10800274 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1655 + +SPInformationBuilder.java +file + + + + +2013-12-20T12:27:57.414475Z +225f5a1c91da42fbcd3a0cb68318b32c +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1477 + +AuthenticationAttributesMarshaller.java +file + + + + +2013-12-20T12:27:57.418475Z +7c4410da9e4b223a39e8cfe7fe8baca8 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +986 + +EIDCrossBorderShareBuilder.java +file + + + + +2013-12-20T12:27:57.418475Z +87ddac844ca24e090fd90e8cd258c462 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1682 + +RequestedAttributeUnmarshaller.java +file + + + + +2013-12-20T12:27:57.418475Z +757de668eb8faac10e3d467a6fb75d8b +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3435 + +CitizenCountryCodeImpl.java +file + + + + +2013-12-20T12:27:57.418475Z +e823785bbced34f6d08bea9998975575 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2642 + +SPInstitutionMarshaller.java +file + + + + +2013-12-20T12:27:57.418475Z +cc15a0beeb86be9ca8ee405fb46e2bdb +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1627 + +AuthenticationAttributesImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +fa84458a078738803e160f1fd3ff6210 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3348 + +SignSW.java +file + + + + +2013-12-20T12:27:57.422475Z +1f905fe296e2dfb66e02ea925d3a7761 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +14730 + +SPApplicationBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +03f6145382be5dc9dbf50a09172d40ba +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1638 + +SPInstitutionImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +debba0c2baa76483e40e62a5de0e1123 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2618 + +RequestedAttributesBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +8516fe8723cb2405475a0fca0909e338 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1729 + +VIDPAuthenticationAttributesBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +60bafffa1fb9223231f49a0c12109ccd +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1607 + +SPApplicationUnmarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +143466710186caf840584c038fc365d4 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1408 + +EIDCrossSectorShareBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +95a940a01539d754a0f2d5fbc58dced2 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1746 + +VIDPAuthenticationAttributesImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +71986c6390a88c027fb622f342dda7dd +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3928 + +CitizenCountryCodeBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +d6adb4dcf3f02a2115e03e197f71e7d0 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1661 + +EIDCrossSectorShareUnmarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +8b7d6524324bf334695470c97a5ae8e9 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1636 + +RequestedAttributeBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +8e01d40d3d5d57e76e68335c4dfa33fd +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1719 + +SignModuleFactory.java +file + + + + +2013-12-20T12:27:57.422475Z +ca27edd3b64fe3994d694668441242c0 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1904 + +SPInstitutionBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +c154c661d7cf09d5deeb12ddf66b69a1 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1652 + +SPIDBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +081af3337ceb54c3a8e8c3fdbdd07757 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1531 + +RequestedAttributeImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +2b0a40b8c2b3640929adb2c1500ecfa8 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +5576 + +SPIDMarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +1f25673e4ed1a76ed9763d06e73942bf +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1549 + +SPCountryBuilder.java +file + + + + +2013-12-20T12:27:57.422475Z +a6e6d09f79e112c96d03f1dff4506843 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1627 + +SPApplicationMarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +d3053090b75974af918b25e32b3c16cb +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1627 + +EIDSectorShareUnmarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +e003885ad4f424b731178f3de53a9934 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1596 + +SPCountryUnmarshaller.java +file + + + + +2013-12-20T12:27:57.422475Z +e01b8f80dbcec3c100d563b8da6c206d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1376 + +SPApplicationImpl.java +file + + + + +2013-12-20T12:27:57.422475Z +0df0bd3dc6acdf706be767ba9e5ca6fc +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2617 + +EIDCrossSectorShareMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +e80eee7bbdb571f5a481ea66fc6b047d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1687 + +QAAAttributeBuilder.java +file + + + + +2013-12-20T12:27:57.426475Z +965b74882dfafe06f391804601049c48 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1653 + +SignHW.java +file + + + + +2013-12-20T12:27:57.426475Z +7896afe7f189a7db5835e120aa6b6037 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +13749 + +EIDCrossSectorShareImpl.java +file + + + + +2013-12-20T12:27:57.426475Z +08ad1682d1f146a114625a1dc1626f6c +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2703 + +QAAAttributeUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +b5eede63027f8b9638f905d3e905046f +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1387 + +SPInformationUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +b504aef9588b7817e1e1d37fd157076e +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1775 + +SPSectorBuilder.java +file + + + + +2013-12-20T12:27:57.426475Z +4725ddc6ef146afbe0a3cca1a97a0102 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1606 + +EIDCrossBorderShareUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +c7cd8600b386369e011a2a7f4c5f0d9c +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1472 + +SPIDUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +7090a9ec17d610025260f1af3495044d +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +1332 + +EIDSectorShareMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +ded11a8620d93cbb7fe703385583827a +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1712 + +SPSectorUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +16ec587f7357a4896411cc80a10f6523 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1372 + +SPCountryMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +f03343df1d204b3f461c7a54a1e6ed35 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1592 + +SignP12.java +file + + + + +2013-12-20T12:27:57.426475Z +2d6ec5552f62f50e8eb579e11def48f7 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +15576 + +package-info.java +file + + + + +2013-12-20T12:27:57.426475Z +76a0f72a61ed971b95da33c1c8b8aa69 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +817 + +VIDPAuthenticationAttributesMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +c099f28cf58fbc0f1db727b22f3a0d5a +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1120 + +RequestedAttributesUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +d18788d30b80c2a020dded672c9d937d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1844 + +EIDSectorShareImpl.java +file + + + + +2013-12-20T12:27:57.426475Z +eb771b1a638ae3751a0f90b187748495 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2622 + +SPCountryImpl.java +file + + + + +2013-12-20T12:27:57.426475Z +a2ddffd67762f74d21509471a2e1663c +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2528 + +AuthenticationAttributesBuilder.java +file + + + + +2013-12-20T12:27:57.426475Z +99840afca17ae5400257a49dd15c3d4f +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1792 + +RequestedAttributeMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +f4b4ab1af9ecd9aaf7230786ab73f6d7 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2969 + +QAAAttributeMarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +9a0f0dd3957d29547adf15ae519b1ad4 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1612 + +CitizenCountryCodeUnmarshaller.java +file + + + + +2013-12-20T12:27:57.426475Z +ff6f71c1e4e7a3d58f8696ae9080588e +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1447 + +SPInformationMarshaller.java +file + + + + +2013-12-20T12:27:57.430475Z +126729a7293d478709678748ec47277f +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1055 + +AuthenticationAttributesUnmarshaller.java +file + + + + +2013-12-20T12:27:57.430475Z +4f9cbca52f62feb055986ed1d6cc45ed +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1929 + +EIDCrossBorderShareMarshaller.java +file + + + + +2013-12-20T12:27:57.410475Z +0334c19bff0e6bfd196de52e7f1d1547 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1689 + +QAAAttributeImpl.java +file + + + + +2013-12-20T12:27:57.410475Z +bee5948d710cfab6256be7f47bb70096 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2647 + +SPInformationImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +93e4dc0e3432b0a6f355b70230f59edd +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2979 + +SPInstitutionUnmarshaller.java +file + + + + +2013-12-20T12:27:57.410475Z +11e598b7cc89fdea183e3f4f7c2019b3 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1407 + +EIDSectorShareBuilder.java +file + + + + +2013-12-20T12:27:57.414475Z +eef58e0f54cd2c89b3ccb73dbbaf4b24 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1672 + +SPSectorMarshaller.java +file + + + + +2013-12-20T12:27:57.414475Z +1d5f1bf8fa1b6170804abc1a64ad52c4 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1584 + +EIDCrossBorderShareImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +9514676b0d03b2288c82db3d46ef150a +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2722 + +SPIDImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +17b9d0d330854aa4aaa855345c09e9c0 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2381 + +RequestedAttributesMarshaller.java +file + + + + +2013-12-20T12:27:57.414475Z +84d34f73f399fdecde91f58068f2fcd0 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1116 + +SPSectorImpl.java +file + + + + +2013-12-20T12:27:57.414475Z +1751902990706e32763e3e931b70622e +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2411 + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base new file mode 100644 index 000000000..74840e135 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; + +/** + * The Class AuthenticationAttributesBuilder. + * + * @author fjquevedo + */ +public class AuthenticationAttributesBuilder extends + AbstractSAMLObjectBuilder { + + + + /** + * Builds the object. + * + * @return the authentication attributes + */ + public final AuthenticationAttributes buildObject() { + return buildObject(AuthenticationAttributes.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace URI + * @param localName the local name + * @param namespacePrefix the namespace prefix + * + * @return the authentication attributes + */ + public final AuthenticationAttributes buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new AuthenticationAttributesImpl(namespaceURI, localName, + namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base new file mode 100644 index 000000000..1e43e7ec3 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base @@ -0,0 +1,109 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSignableSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class AuthenticationAttributesImpl. + * + * @author fjquevedo + */ +public final class AuthenticationAttributesImpl extends AbstractSignableSAMLObject implements +AuthenticationAttributes { + + private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticationAttributesImpl.class.getName()); + + /** The indexed children. */ + private VIDPAuthenticationAttributes vIDPAuthenAttr; + + /** + * Instantiates a new authentication attributes implementation. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected AuthenticationAttributesImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * + */ + public List getOrderedChildren() { + final ArrayList children = new ArrayList(); + + children.add(vIDPAuthenAttr); + + if (getSignature() != null) { + children.add(getSignature()); + } + + return Collections.unmodifiableList(children); + } + + /** + * Gets the signature reference id. + * + * @return the signature reference id + * + */ + public String getSignatureReferenceID() { + return null; + } + + /** + * Gets the vidp authentication attributes. + * + * @return the VIDP authentication attributes + * + */ + public VIDPAuthenticationAttributes getVIDPAuthenticationAttributes() { + return vIDPAuthenAttr; + } + + /** + * Sets the vidp authentication attributes. + * + * @param newVIDPAuthenAttr the new vidp authen attr + * + */ + public void setVIDPAuthenticationAttributes( + final VIDPAuthenticationAttributes newVIDPAuthenAttr) { + vIDPAuthenAttr = prepareForAssignment(this.vIDPAuthenAttr, newVIDPAuthenAttr); + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base new file mode 100644 index 000000000..698bf56b9 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base @@ -0,0 +1,30 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class AuthenticationAttributesMarshaller. + * + * @author fjquevedo + */ +public class AuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { + + + + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base new file mode 100644 index 000000000..af3e5c234 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base @@ -0,0 +1,54 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; + +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; + +/** + * The Class AuthenticationAttributesUnmarshaller. + * + * @author fjquevedo + */ +public class AuthenticationAttributesUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException the unmarshalling exception + * + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final AuthenticationAttributes attrStatement = (AuthenticationAttributes) parentObject; + + if (childObject instanceof VIDPAuthenticationAttributes) { + attrStatement.setVIDPAuthenticationAttributes((VIDPAuthenticationAttributes) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base new file mode 100644 index 000000000..64651691f --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base @@ -0,0 +1,50 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; + +/** + * The Class CitizenCountryCodeBuilder. + * + * @author fjquevedo + */ +public class CitizenCountryCodeBuilder extends AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the citizen country code + */ + public final CitizenCountryCode buildObject() { + return buildObject(CitizenCountryCode.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the citizen country code + */ + public final CitizenCountryCode buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new CitizenCountryCodeImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base new file mode 100644 index 000000000..4df8084a9 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base @@ -0,0 +1,82 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class CitizenCountryCodeImpl. + * + * @author fjquevedo + */ +public class CitizenCountryCodeImpl extends AbstractSAMLObject implements CitizenCountryCode { + + private static final Logger LOGGER = LoggerFactory.getLogger(CitizenCountryCodeImpl.class.getName()); + /** The citizen country code. */ + private String citizenCountryCode; + + /** + * Instantiates a new sP country impl. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected CitizenCountryCodeImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the citizen country code. + * + * @return the citizen country code + */ + public final String getCitizenCountryCode() { + return citizenCountryCode; + } + + /** + * Sets the citizen country code. + * + * @param newCitizenCountryCode the new citizen country code + */ + public final void setCitizenCountryCode(final String newCitizenCountryCode) { + this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base new file mode 100644 index 000000000..decae04c5 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; + +/** + * The Class SPCountryMarshaller. + * + * @author fjquevedo + */ +public class CitizenCountryCodeMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; + XMLHelper.appendTextContent(domElement, citizenCountryCode.getCitizenCountryCode()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base new file mode 100644 index 000000000..93132b508 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; + +/** + * The Class CitizenCountryCodeUnmarshaller. + * + * @author fjquevedo + */ +public class CitizenCountryCodeUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; + citizenCountryCode.setCitizenCountryCode(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base new file mode 100644 index 000000000..b939da776 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; + +/** + * The Class EIDCrossBorderShareBuilder. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareBuilder extends AbstractSAMLObjectBuilder { + + + /** + * Builds the object. + * + * @return the identifier cross border share + */ + public final EIDCrossBorderShare buildObject() { + return buildObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); + } + + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the eID cross border share + */ + public final EIDCrossBorderShare buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new EIDCrossBorderShareImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base new file mode 100644 index 000000000..50a997031 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base @@ -0,0 +1,87 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class EIDCrossBorderShareImpl. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareImpl extends AbstractSAMLObject implements + EIDCrossBorderShare { + + private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossBorderShareImpl.class.getName()); + /** The citizen country code. */ + private String eIDCrossBorderShare; + + /** + * Instantiates a new eID cross border share implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected EIDCrossBorderShareImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + + /** + * Gets the eID cross border share. + * + * @return the eID cross border share + */ + public final String getEIDCrossBorderShare() { + return eIDCrossBorderShare; + } + + + /** + * Sets the eID cross border share. + * + * @param newEIDCrossBorderShare the new eID cross border share + */ + public final void setEIDCrossBorderShare(String newEIDCrossBorderShare) { + this.eIDCrossBorderShare = prepareForAssignment(this.eIDCrossBorderShare, newEIDCrossBorderShare); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * {@inheritDoc} + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base new file mode 100644 index 000000000..58fa8af65 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base @@ -0,0 +1,47 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; + + +/** + * The Class EIDCrossBorderShareMarshaller. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareMarshaller extends AbstractSAMLObjectMarshaller { + + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; + XMLHelper.appendTextContent(domElement, crossBorderShare.getEIDCrossBorderShare()); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base new file mode 100644 index 000000000..457e70c23 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base @@ -0,0 +1,43 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; + +/** + * The Class EIDCrossBorderShareUnmarshaller. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; + crossBorderShare.setEIDCrossBorderShare(elementContent); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base new file mode 100644 index 000000000..9683d2ad8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; + +/** + * The Class EIDCrossSectorShareBuilder. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the eID cross sector share + */ + public final EIDCrossSectorShare buildObject() { + return buildObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the eID cross sector share implementation + */ + public final EIDCrossSectorShareImpl buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new EIDCrossSectorShareImpl(namespaceURI, localName, + namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base new file mode 100644 index 000000000..30502f429 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base @@ -0,0 +1,89 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; + +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * The Class EIDCrossSectorShareImpl. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareImpl extends AbstractSAMLObject implements + EIDCrossSectorShare { + + private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossSectorShareImpl.class.getName()); + /** The citizen country code. */ + private String eIDCrossSectorShare; + + + /** + * Instantiates a new eID cross sector share implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected EIDCrossSectorShareImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + + /** + * Gets the eID cross sector share. + * + * @return the eID cross sector share + */ + public final String getEIDCrossSectorShare() { + return eIDCrossSectorShare; + } + + + /** + * Sets the eID cross sector share. + * + * @param newEIDCrossSectorShare the new eID cross sector share + */ + public final void setEIDCrossSectorShare(String newEIDCrossSectorShare) { + this.eIDCrossSectorShare = prepareForAssignment(this.eIDCrossSectorShare, newEIDCrossSectorShare); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base new file mode 100644 index 000000000..dfd2b81dc --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; + + +/** + * The Class EIDCrossSectorShareMarshaller. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; + XMLHelper.appendTextContent(domElement, crossSectorShare.getEIDCrossSectorShare()); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base new file mode 100644 index 000000000..6a9711ca2 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base @@ -0,0 +1,47 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; + +/** + * The Class EIDCrossSectorShareUnmarshaller. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void processElementContent(final XMLObject samlObject, + final String domElement) { + + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; + crossSectorShare.setEIDCrossSectorShare(domElement); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base new file mode 100644 index 000000000..75062dc69 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; + +/** + * The Class EIDSectorShareBuilder. + * + * @author fjquevedo + */ +public class EIDSectorShareBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the eID sector share + */ + public final EIDSectorShare buildObject() { + return buildObject(EIDSectorShare.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the eID sector share + */ + public final EIDSectorShare buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new EIDSectorShareImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base new file mode 100644 index 000000000..c548841f7 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base @@ -0,0 +1,85 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +// TODO: Auto-generated Javadoc +/** + * The Class EIDSectorShareImpl. + * + * @author fjquevedo + */ +public class EIDSectorShareImpl extends AbstractSAMLObject implements + EIDSectorShare { + + private static final Logger LOGGER = LoggerFactory.getLogger(EIDSectorShareImpl.class.getName()); + + /** The e id sector share. */ + private String eIDSectorShare; + /** + * Instantiates a new eID sector share implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected EIDSectorShareImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * Gets the eID sector share. + * + * @return the eID sector share + */ + public final String getEIDSectorShare() { + return eIDSectorShare; + } + + /** + * Sets the eID sector share. + * + * @param newEIDSectorShare the new eID sector share + */ + public final void setEIDSectorShare(String newEIDSectorShare) { + this.eIDSectorShare = prepareForAssignment(this.eIDSectorShare, newEIDSectorShare); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base new file mode 100644 index 000000000..87ab23660 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.saml2.core.impl.AbstractNameIDTypeMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; + +/** + * The Class EIDSectorShareMarshaller. + * + * @author fjquevedo + */ +public class EIDSectorShareMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; + XMLHelper.appendTextContent(domElement, sectorShare.getEIDSectorShare()); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base new file mode 100644 index 000000000..9c661813f --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base @@ -0,0 +1,47 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; + + +/** + * The Class EIDSectorShareUnmarshaller. + * + * @author fjquevedo + */ +public class EIDSectorShareUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void processElementContent(final XMLObject samlObject, + final String domElement) { + final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; + sectorShare.setEIDSectorShare(domElement); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base new file mode 100644 index 000000000..41676931b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeBuilder. + * + * @author fjquevedo + */ +public class QAAAttributeBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the quality authentication assurance object + */ + public final QAAAttribute buildObject() { + return buildObject(QAAAttribute.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the quality authentication assurance object + + */ + public final QAAAttribute buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new QAAAttributeImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base new file mode 100644 index 000000000..c08986026 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.QAAAttribute; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class QAAAttributeImpl. + * + * @author fjquevedo + */ +public class QAAAttributeImpl extends AbstractSAMLObject implements + QAAAttribute { + + private static final Logger LOGGER = LoggerFactory.getLogger(QAAAttributeImpl.class.getName()); + /** The quality authentication assurance level. */ + private String qaaLevel; + + /** + * Constructor. + * + * @param namespaceURI the namespace the element is in + * @param elementLocalName the local name of the XML element this Object + * represents + * @param namespacePrefix the prefix for the given namespace + */ + protected QAAAttributeImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the quality authentication assurance level. + * + * @return the quality authentication assurance level + */ + public final String getQaaLevel() { + return qaaLevel; + } + + /** + * Sets the quality authentication assurance level. + * + * @param newQaaLevel the new quality authentication assurance level + */ + public final void setQaaLevel(final String newQaaLevel) { + this.qaaLevel = prepareForAssignment(this.qaaLevel, newQaaLevel); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base new file mode 100644 index 000000000..000879368 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeMarshaller. + * + * @author fjquevedo + */ +public class QAAAttributeMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final QAAAttribute qaaAttribute = (QAAAttribute) samlObject; + XMLHelper.appendTextContent(domElement, qaaAttribute.getQaaLevel()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base new file mode 100644 index 000000000..8445e4eeb --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeUnmarshaller. + * + * @author fjquevedo + */ +public class QAAAttributeUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final QAAAttribute qaaLevel = (QAAAttribute) samlObject; + qaaLevel.setQaaLevel(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base new file mode 100644 index 000000000..70bd6ac1f --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base @@ -0,0 +1,54 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; + +/** + * The Class RequestedAttributeBuilder. + * + * @author fjquevedo + */ +public class RequestedAttributeBuilder extends + AbstractSAMLObjectBuilder { + + + /** + * Builds the object. + * + * @return the requested attribute + */ + public final RequestedAttribute buildObject() { + return buildObject(RequestedAttribute.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the requested attribute + */ + public final RequestedAttribute buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new RequestedAttributeImpl(namespaceURI, localName, + namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base new file mode 100644 index 000000000..ad759230a --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base @@ -0,0 +1,220 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSBooleanValue; +import org.opensaml.xml.util.AttributeMap; +import org.opensaml.xml.util.XMLObjectChildrenList; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +// TODO: Auto-generated Javadoc +/** + * The Class RequestedAttributeImpl. + * + * @author fjquevedo + */ +public class RequestedAttributeImpl extends AbstractSAMLObject implements + RequestedAttribute { + + private static final Logger LOGGER = LoggerFactory.getLogger(RequestedAttributeImpl.class.getName()); + /** + * The attribute values. + */ + private final XMLObjectChildrenList attributeValues; + + /** + * The friendly name. + * + */ + private String friendlyName; + + /** + * The is required. + */ + private String isRequired; + + /** + * The name. + * + */ + private String name; + + /** + * The name format. + * + */ + private String nameFormat; + + /** + * The unknown attributes. + * + */ + private AttributeMap unknownAttributes; + + /** + * Instantiates a new requested attribute impl. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected RequestedAttributeImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + unknownAttributes = new AttributeMap(this); + attributeValues = new XMLObjectChildrenList(this); + } + + + /** + * Gets the attribute values. + * + * @return the attribute values + */ + public final List getAttributeValues() { + return attributeValues; + } + + /** + * Gets the friendly name. + * + * @return the friendly name. + */ + public final String getFriendlyName() { + return friendlyName; + } + + + /** + * Gets the checks if is required. + * + * @return the boolean if it's required. + */ + public final String isRequired() { + return isRequired; + } + + + /** + * Gets the is required xs boolean. + * + * @return the XSBoolean if it's required. + */ + public final String getIsRequiredXSBoolean() { + return isRequired; + } + + + /** + * Gets the name. + * + * @return the name + */ + public final String getName() { + return name; + } + + + /** + * Gets the name format. + * + * @return the name format. + */ + public final String getNameFormat() { + return nameFormat; + } + + /** + * Gets the ordered children. + * + * @return the list of XMLObject. + */ + public final List getOrderedChildren() { + final ArrayList children = new ArrayList(); + children.addAll(attributeValues); + return Collections.unmodifiableList(children); + } + + /** + * Gets the unknown attributes. + * + * @return the attribute map + */ + public final AttributeMap getUnknownAttributes() { + return unknownAttributes; + } + + /** + * Sets the friendly name. + * + * @param newFriendlyName the new friendly name format + */ + public final void setFriendlyName(final String newFriendlyName) { + this.friendlyName = prepareForAssignment(this.friendlyName, + newFriendlyName); + } + + /** + * Set new boolean value isRequired. + * @param newIsRequired then new value + */ + public final void setIsRequired(final String newIsRequired) { + isRequired = prepareForAssignment(this.isRequired, newIsRequired); + + } + + /** + * Sets the name. + * + * @param newName the new name + */ + public final void setName(final String newName) { + this.name = prepareForAssignment(this.name, newName); + } + + /** + * Sets the name format. + * + * @param newNameFormat the new name format + */ + public final void setNameFormat(final String newNameFormat) { + this.nameFormat = prepareForAssignment(this.nameFormat, newNameFormat); + } + + /** + * Sets the unknown attributes. + * + * @param newUnknownAttr the new unknown attributes + */ + public final void setUnknownAttributes(final AttributeMap newUnknownAttr) { + this.unknownAttributes = newUnknownAttr; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base new file mode 100644 index 000000000..6d0669241 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base @@ -0,0 +1,89 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.Map.Entry; + +import javax.xml.namespace.QName; + +import org.opensaml.Configuration; +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; + +/** + * The Class RequestedAttributeMarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributeMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall attributes. + * + * @param samlElement the SAML element + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallAttributes(final XMLObject samlElement, + final Element domElement) throws MarshallingException { + final RequestedAttribute requestedAttr = (RequestedAttribute) samlElement; + + if (requestedAttr.getName() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.NAME_ATTRIB_NAME, requestedAttr + .getName()); + } + + if (requestedAttr.getNameFormat() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.NAME_FORMAT_ATTR, requestedAttr + .getNameFormat()); + } + + if (requestedAttr.getFriendlyName() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.FRIENDLY_NAME_ATT, requestedAttr + .getFriendlyName()); + } + + if (requestedAttr.getIsRequiredXSBoolean() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.IS_REQUIRED_ATTR, requestedAttr + .getIsRequiredXSBoolean().toString()); + } + + Attr attr; + for (Entry entry : requestedAttr.getUnknownAttributes() + .entrySet()) { + attr = XMLHelper.constructAttribute(domElement.getOwnerDocument(), + entry.getKey()); + attr.setValue(entry.getValue()); + domElement.setAttributeNodeNS(attr); + if (Configuration.isIDAttribute(entry.getKey()) + || requestedAttr.getUnknownAttributes().isIDAttribute( + entry.getKey())) { + attr.getOwnerElement().setIdAttributeNode(attr, true); + } + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base new file mode 100644 index 000000000..551f4239d --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base @@ -0,0 +1,96 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import javax.xml.namespace.QName; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.schema.XSBooleanValue; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Attr; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.SAMLCore; + +/** + * The Class RequestedAttributeUnmarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributeUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentSAMLObject parent SAMLObject + * @param childSAMLObject child SAMLObject + * + * @throws UnmarshallingException error at unmarshall XML object + */ + protected final void processChildElement(final XMLObject parentSAMLObject, + final XMLObject childSAMLObject) throws UnmarshallingException { + + final RequestedAttribute requestedAttr = (RequestedAttribute) parentSAMLObject; + + final QName childQName = childSAMLObject.getElementQName(); + if (childQName.getLocalPart().equals("AttributeValue") + && childQName.getNamespaceURI().equals(SAMLCore.STORK10_NS.getValue())) { + requestedAttr.getAttributeValues().add(childSAMLObject); + } else { + super.processChildElement(parentSAMLObject, childSAMLObject); + } + } + + /** + * Process attribute. + * + * @param samlObject the SAML object + * @param attribute the attribute + * @throws UnmarshallingException the unmarshalling exception + */ + protected final void processAttribute(final XMLObject samlObject, + final Attr attribute) throws UnmarshallingException { + + final RequestedAttribute requestedAttr = (RequestedAttribute) samlObject; + + if (attribute.getLocalName() + .equals(RequestedAttribute.NAME_ATTRIB_NAME)) { + requestedAttr.setName(attribute.getValue()); + } else if (attribute.getLocalName().equals( + RequestedAttribute.NAME_FORMAT_ATTR)) { + requestedAttr.setNameFormat(attribute.getValue()); + } else if (attribute.getLocalName().equals( + RequestedAttribute.FRIENDLY_NAME_ATT)) { + requestedAttr.setFriendlyName(attribute.getValue()); + } else if (attribute.getLocalName().equals( + RequestedAttribute.IS_REQUIRED_ATTR)) { + requestedAttr.setIsRequired(attribute + .getValue()); + + } else { + final QName attribQName = XMLHelper.getNodeQName(attribute); + if (attribute.isId()) { + requestedAttr.getUnknownAttributes().registerID(attribQName); + } + requestedAttr.getUnknownAttributes().put(attribQName, + attribute.getValue()); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base new file mode 100644 index 000000000..138177995 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base @@ -0,0 +1,54 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.RequestedAttributes; + +/** + * The Class RequestedAttributesBuilder. + * + * @author fjquevedo + */ +public class RequestedAttributesBuilder extends + AbstractSAMLObjectBuilder { + + + /** + * Builds the object. + * + * @return the requested attributes + */ + public final RequestedAttributes buildObject() { + return buildObject(RequestedAttributes.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the requested attributes + */ + public final RequestedAttributes buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new RequestedAttributesImpl(namespaceURI, localName, + namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base new file mode 100644 index 000000000..a58a08a05 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base @@ -0,0 +1,95 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.util.IndexedXMLObjectChildrenList; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; + +/** + * The Class RequestedAttributesImpl. + * + * @author fjquevedo + */ +public class RequestedAttributesImpl extends AbstractSAMLObject implements + RequestedAttributes { + + /** + * Instantiates a new requested attributes implement. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected RequestedAttributesImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + indexedChildren = new IndexedXMLObjectChildrenList(this); + } + + /** The indexed children. */ + private final IndexedXMLObjectChildrenList indexedChildren; + + /** + * Gets the indexed children. + * + * @return the indexed children + */ + public final IndexedXMLObjectChildrenList getIndexedChildren() { + return indexedChildren; + } + + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + + final ArrayList children = new ArrayList(); + + children.addAll(indexedChildren); + + return Collections.unmodifiableList(children); + + } + + /** + * Gets the attributes. + * + * @return the attributes + * + * @see eu.stork.peps.auth.engine.core.RequestedAttributes#getAttributes() + */ + @SuppressWarnings("unchecked") + public final List getAttributes() { + return (List) indexedChildren + .subList(RequestedAttribute.DEF_ELEMENT_NAME); + } + + @Override + public int hashCode() { + throw new UnsupportedOperationException("hashCode method not implemented"); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base new file mode 100644 index 000000000..955fe0318 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base @@ -0,0 +1,33 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class RequestedAttributesMarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributesMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Instantiates a new requested attributes marshaller. + */ + public RequestedAttributesMarshaller() { + super(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base new file mode 100644 index 000000000..132d6cc59 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; + +/** + * The Class RequestedAttributesUnmarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributesUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException error in unmarshall + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final RequestedAttributes attrStatement = (RequestedAttributes) parentObject; + + if (childObject instanceof RequestedAttribute) { + attrStatement.getAttributes().add((RequestedAttribute) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base new file mode 100644 index 000000000..a35c77936 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPApplication; + +/** + * The Class SPApplicationBuilder. + * + * @author fjquevedo + */ +public class SPApplicationBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the service provider application + */ + public final SPApplication buildObject() { + return buildObject(SPApplication.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider application + */ + public final SPApplication buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPApplicationImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base new file mode 100644 index 000000000..6bb631a74 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPApplication; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPApplicationImpl. + * + * @author fjquevedo + */ +public class SPApplicationImpl extends AbstractSAMLObject implements + SPApplication { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPApplicationImpl.class.getName()); + /** The service provider application. */ + private String spApplication; + + /** + * Instantiates a new service provider application. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPApplicationImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the service provider application. + * + * @return the service provider application + */ + public final String getSPApplication() { + return spApplication; + } + + /** + * Sets the service provider application. + * + * @param newSpApplication the new service provider application + */ + public final void setSPApplication(final String newSpApplication) { + this.spApplication = prepareForAssignment(this.spApplication, + newSpApplication); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base new file mode 100644 index 000000000..4866c3535 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPApplication; + +/** + * The Class SPApplicationMarshaller. + * + * @author fjquevedo + */ +public class SPApplicationMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPApplication spApplication = (SPApplication) samlObject; + XMLHelper.appendTextContent(domElement, spApplication + .getSPApplication()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base new file mode 100644 index 000000000..a28432a13 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base @@ -0,0 +1,42 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPApplication; + + +/** + * The Class SPApplicationUnmarshaller. + * + * @author fjquevedo + */ +public class SPApplicationUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPApplication spApplication = (SPApplication) samlObject; + spApplication.setSPApplication(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base new file mode 100644 index 000000000..48ec92f49 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPCountry; + +/** + * The Class SPCountryBuilder. + * + * @author fjquevedo + */ +public class SPCountryBuilder extends AbstractSAMLObjectBuilder { + + + /** + * Builds the object SPCountry. + * + * @return the service provider country + */ + public final SPCountry buildObject() { + return buildObject(SPCountry.DEF_ELEMENT_NAME); + } + + + /** + * Builds the object SPCountry. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider country + */ + public final SPCountry buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPCountryImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base new file mode 100644 index 000000000..db58fb8be --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base @@ -0,0 +1,82 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPCountry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPCountryImpl. + * + * @author fjquevedo + */ +public class SPCountryImpl extends AbstractSAMLObject implements SPCountry { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPCountryImpl.class.getName()); + /** The service provider country. */ + private String spCountry; + + /** + * Instantiates a new service provider country. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPCountryImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the service provider country. + * + * @return the service provider country + */ + public final String getSPCountry() { + return spCountry; + } + + /** + * Sets the service provider country. + * + * @param newSpCountry the new service provider country + */ + public final void setSPCountry(final String newSpCountry) { + this.spCountry = prepareForAssignment(this.spCountry, newSpCountry); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base new file mode 100644 index 000000000..e82634749 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPCountry; + +/** + * The Class SPCountryMarshaller. + * + * @author fjquevedo + */ +public class SPCountryMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPCountry spCountry = (SPCountry) samlObject; + XMLHelper.appendTextContent(domElement, spCountry.getSPCountry()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base new file mode 100644 index 000000000..deb695ac6 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base @@ -0,0 +1,42 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPCountry; + + +/** + * The Class SPCountryUnmarshaller. + * + * @author fjquevedo + */ +public class SPCountryUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPCountry spCountry = (SPCountry) samlObject; + spCountry.setSPCountry(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base new file mode 100644 index 000000000..b3640947b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base @@ -0,0 +1,50 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPID; + +/** + * The Class SPIDBuilder. + * + * @author iinigo + */ +public class SPIDBuilder extends AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the SP ID + */ + public final SPID buildObject() { + return buildObject(SPID.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the citizen country code + */ + public final SPID buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPIDImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base new file mode 100644 index 000000000..0c7127273 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base @@ -0,0 +1,82 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPIDImpl. + * + * @author iinigo + */ +public class SPIDImpl extends AbstractSAMLObject implements SPID { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPIDImpl.class.getName()); + /** The citizen country code. */ + private String spId; + + /** + * Instantiates a new sP country impl. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPIDImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the SP ID. + * + * @return the SP ID + */ + public final String getSPID() { + return spId; + } + + /** + * Sets the SP ID. + * + * @param newSPID the new SP ID + */ + public final void setSPID(final String newSPID) { + this.spId = prepareForAssignment(this.spId, newSPID); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base new file mode 100644 index 000000000..24389522e --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPID; + +/** + * The Class SPIDMarshaller. + * + * @author iinigo + */ +public class SPIDMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPID spid = (SPID) samlObject; + XMLHelper.appendTextContent(domElement, spid.getSPID()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base new file mode 100644 index 000000000..e4d230b94 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPID; + +/** + * The Class SPIDUnmarshaller. + * + * @author iinigo + */ +public class SPIDUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPID spid = (SPID) samlObject; + spid.setSPID(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base new file mode 100644 index 000000000..a6e1fe686 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.SPInformation; + +/** + * The Class SPInformation. + * + * @author iinigo + */ +public final class SPInformationBuilder extends AbstractSAMLObjectBuilder { + + + /** {@inheritDoc} */ + public SPInformation buildObject() { + return buildObject(SAMLCore.STORK10P_NS.getValue(), SPInformation.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); + } + + /** {@inheritDoc} */ + public SPInformation buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { + return new SPInformationImpl(namespaceURI, localName, namespacePrefix); + } + +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base new file mode 100644 index 000000000..b5609600d --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base @@ -0,0 +1,110 @@ +/* + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSignableSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPID; +import eu.stork.peps.auth.engine.core.SPInformation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * The Class SPInformationImpl. + * + * @author iinigo + */ +public final class SPInformationImpl extends AbstractSignableSAMLObject implements +SPInformation { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPInformationImpl.class.getName()); + /** The citizen country code. */ + private SPID spId; + + + /** + * Instantiates a new requested attributes implement. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPInformationImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * getSPId. + * + * @return the SP ID + */ + public SPID getSPID() { + return spId; + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * + */ + public List getOrderedChildren() { + final ArrayList children = new ArrayList(); + + children.add(spId); + + if (getSignature() != null) { + children.add(getSignature()); + } + + return Collections.unmodifiableList(children); + + } + + /** + * Gets the signature reference id. + * + * @return the signature reference id + * + */ + public String getSignatureReferenceID() { + return null; + } + + /** + * Sets the SP Id. + * + * @param newSPId the new SP Id + * + */ + public void setSPID(SPID newSPId) { + this.spId = prepareForAssignment(this.spId, newSPId); + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base new file mode 100644 index 000000000..44845948c --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base @@ -0,0 +1,33 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class SPInformationMarshaller. + * + * @author iinigo + */ +public class SPInformationMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Instantiates a new SP Information marshaller. + */ + public SPInformationMarshaller() { + super(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base new file mode 100644 index 000000000..79b0b0f35 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.SPID; +import eu.stork.peps.auth.engine.core.SPInformation; + +/** + * The Class SPInformationUnmarshaller. + * + * @author iinigo + */ +public class SPInformationUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException the unmarshalling exception + * + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final SPInformation spInformation = (SPInformation) parentObject; + + if (childObject instanceof SPID) { + spInformation.setSPID((SPID) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base new file mode 100644 index 000000000..fe47cf99c --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPInstitution; + +/** + * The Class SPInstitutionBuilder. + * + * @author fjquevedo + */ +public class SPInstitutionBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the service provider institution + */ + public final SPInstitution buildObject() { + return buildObject(SPInstitution.DEF_ELEMENT_NAME); + } + + /** + * Builds the object SPInstitution. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider institution + */ + public final SPInstitution buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPInstitutionImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base new file mode 100644 index 000000000..cf1760446 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPInstitution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPInstitutionImpl. + * + * @author fjquevedo + */ +public class SPInstitutionImpl extends AbstractSAMLObject implements + SPInstitution { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPInstitutionImpl.class.getName()); + /** The service provider institution. */ + private String spInstitution; + + /** + * Instantiates a new service provider institution. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPInstitutionImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the service provider institution. + * + * @return the service provider institution + */ + public final String getSPInstitution() { + return spInstitution; + } + + /** + * Sets the service provider institution. + * + * @param newSpInstitution the new service provider institution + */ + public final void setSPInstitution(final String newSpInstitution) { + this.spInstitution = prepareForAssignment(this.spInstitution, + newSpInstitution); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } + } diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base new file mode 100644 index 000000000..504a1f035 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPInstitution; + +/** + * The Class SPInstitutionMarshaller. + * + * @author fjquevedo + */ +public class SPInstitutionMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPInstitution spInstitution = (SPInstitution) samlObject; + XMLHelper.appendTextContent(domElement, spInstitution + .getSPInstitution()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base new file mode 100644 index 000000000..103d5f2b2 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPInstitution; + +/** + * The Class SPInstitutionUnmarshaller. + * + * @author fjquevedo + */ +public class SPInstitutionUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPInstitution spInstitution = (SPInstitution) samlObject; + spInstitution.setSPInstitution(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base new file mode 100644 index 000000000..a691b9008 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base @@ -0,0 +1,50 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPSector; + +/** + * The Class SPSectorBuilder. + * + * @author fjquevedo + */ +public class SPSectorBuilder extends AbstractSAMLObjectBuilder { + + /** + * Builds the object SPSector. + * + * @return the service provider sector. + */ + public final SPSector buildObject() { + return buildObject(SPSector.DEF_ELEMENT_NAME); + } + + /** + * Builds the object SPSector. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider sector + */ + public final SPSector buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPSectorImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base new file mode 100644 index 000000000..a29810dd4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPSector; + + +/** + * The Class SPSectorImpl. + * + * @author fjquevedo + */ +public class SPSectorImpl extends AbstractSAMLObject implements SPSector { + + /** The service provider sector. */ + private String spSector; + + /** + * Instantiates a new Service provider sector implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPSectorImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * Gets the service provider sector. + * + * @return the SP sector + * + * @see eu.stork.peps.auth.engine.core.SPSector#getSPSector() + */ + public final String getSPSector() { + return spSector; + } + + + /** + * Sets the service provider sector. + * + * @param newSpSector the new service provider sector + */ + public final void setSPSector(final String newSpSector) { + this.spSector = prepareForAssignment(this.spSector, newSpSector); + } + + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + throw new UnsupportedOperationException("hashCode method not implemented"); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base new file mode 100644 index 000000000..c5331e8f4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPSector; + +/** + * The Class SPSectorMarshaller. + * + * @author fjquevedo + */ +public class SPSectorMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPSector spSector = (SPSector) samlObject; + XMLHelper.appendTextContent(domElement, spSector.getSPSector()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base new file mode 100644 index 000000000..cbb05c6e5 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base @@ -0,0 +1,42 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPSector; + +/** + * The Class SPSectorUnmarshaller. + * + * @author fjquevedo + */ +public class SPSectorUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPSector spSector = (SPSector) samlObject; + spSector.setSPSector(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base new file mode 100644 index 000000000..2db14f543 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base @@ -0,0 +1,399 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Properties; + +import eu.stork.peps.auth.engine.X509PrincipalUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.NotImplementedException; +import org.bouncycastle.jce.X509Principal; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.security.SecurityConfiguration; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; +import org.opensaml.xml.security.keyinfo.KeyInfoHelper; +import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; +import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.x509.BasicX509Credential; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.validation.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.SAMLEngineException; + +/** + * The Class HWSign. Module of sign. + * + * @author fjquevedo + */ +public final class SignHW implements SAMLEngineSignI { + + /** The Constant CONFIGURATION_FILE. */ + private static final String CONF_FILE = "configurationFile"; + + /** The Constant KEYSTORE_TYPE. + private static final String KEYSTORE_TYPE = "keystoreType" */ + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SignHW.class + .getName()); + + /** The stork own key store. */ + private KeyStore storkOwnKeyStore = null; + + /** + * Gets the stork own key store. + * + * @return the stork own key store + */ + public KeyStore getStorkOwnKeyStore() { + return storkOwnKeyStore; + } + + /** + * Gets the stork trustStore. + * + * @return the stork own key store + */ + public KeyStore getTrustStore() { + return storkOwnKeyStore; + } + + /** + * Sets the stork own key store. + * + * @param newkOwnKeyStore the new stork own key store + */ + public void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { + this.storkOwnKeyStore = newkOwnKeyStore; + } + + /** + * Gets the properties. + * + * @return the properties + */ + public Properties getProperties() { + return properties; + } + + /** + * Sets the properties. + * + * @param newProperties the new properties + */ + public void setProperties(final Properties newProperties) { + this.properties = newProperties; + } + + /** The HW sign prop. */ + private Properties properties = null; + + /** + * @see + * eu.stork.peps.auth.engine.core.SAMLEngineSignI#init(java.lang.String) + * @param fileConf file of configuration + * @throws SAMLEngineException error in read file + */ + public void init(final String fileConf) + throws SAMLEngineException { + InputStream inputStr = null; + try { + inputStr = SignHW.class.getResourceAsStream("/" + + fileConf); + properties = new Properties(); + + properties.loadFromXML(inputStr); + } catch (final InvalidPropertiesFormatException e) { + LOG.info("Exception: invalid properties format."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOG.info("Exception: invalid file: " + fileConf); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(inputStr); + } + } + + + /** + * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() + * @return the X509Certificate. + */ + public X509Certificate getCertificate() { + throw new NotImplementedException(); + } + + /** + * @see + * eu.stork.peps.auth.engine.core.SAMLEngineSignI#sign(SignableSAMLObject tokenSaml) + * @param tokenSaml signable SAML Object + * @return the SAMLObject signed. + * @throws SAMLEngineException error in sign token saml + */ + public SAMLObject sign(final SignableSAMLObject tokenSaml) throws SAMLEngineException { + + try { + LOG.info("Star procces of sign"); + final char[] pin = properties.getProperty("keyPassword") + .toCharArray(); + + storkOwnKeyStore.load(null, pin); + + final String serialNumber = properties.getProperty("serialNumber"); + final String issuer = properties.getProperty("issuer"); + + String alias = null; + String aliasCert; + X509Certificate certificate; + + boolean find = false; + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements() && !find;) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + // Verified serial number, issuer + + final String serialNum = certificate.getSerialNumber() + .toString(16); + X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); + X509Principal issuerDNConf = new X509Principal(issuer); + + if(serialNum.equalsIgnoreCase(serialNumber) + && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ + alias = aliasCert; + find = true; + } + + } + + if (!find) { + throw new SAMLEngineException("Certificate cannot be found in keystore "); + } + certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); + final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( + alias, pin); + + LOG.info("Recover BasicX509Credential."); + final BasicX509Credential credential = new BasicX509Credential(); + + LOG.debug("Load certificate"); + credential.setEntityCertificate(certificate); + + LOG.debug("Load privateKey"); + credential.setPrivateKey(privateKey); + + LOG.info("Star procces of sign"); + final Signature signature = (Signature) org.opensaml.xml.Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + + LOG.debug("Begin signature with openSaml"); + signature.setSigningCredential(credential); + + signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + + + + final SecurityConfiguration securityConf = + org.opensaml.xml.Configuration.getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager = securityConf + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac + .newInstance(); + + final KeyInfo keyInfo = keyInfoGenerator.generate(credential); + + signature.setKeyInfo(keyInfo); + + LOG.debug("Set Canonicalization Algorithm"); + signature.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + tokenSaml.setSignature(signature); + + LOG.debug("Marshall samlToken."); + org.opensaml.xml.Configuration.getMarshallerFactory() + .getMarshaller(tokenSaml).marshall(tokenSaml); + + LOG.info("Sign samlToken."); + Signer.signObject(signature); + + } catch (final MarshallingException e) { + LOG.error("MarshallingException"); + throw new SAMLEngineException(e); + } catch (final NoSuchAlgorithmException e) { + LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); + throw new SAMLEngineException(e); + } catch (final KeyStoreException e) { + LOG.error("Generic KeyStore exception."); + throw new SAMLEngineException(e); + } catch (final SignatureException e) { + LOG.error("Signature exception."); + throw new SAMLEngineException(e); + } catch (final SecurityException e) { + LOG.error("Security exception."); + throw new SAMLEngineException(e); + } catch (final CertificateException e) { + LOG.error("Certificate exception."); + throw new SAMLEngineException(e); + } catch (final IOException e) { + LOG.error("IO exception."); + throw new SAMLEngineException(e); + } catch (final UnrecoverableKeyException e) { + LOG.error("UnrecoverableKeyException exception."); + throw new SAMLEngineException(e); + } + + return tokenSaml; + } + + /** + * @see + * eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(SignableSAMLObject) + * @param tokenSaml the token saml + * @return the SAMLObject validated. + * @throws SAMLEngineException exception in validate signature + */ + public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start signature validation."); + try { + + // Validate structure signature + final SAMLSignatureProfileValidator signProfValidator = + new SAMLSignatureProfileValidator(); + + // Indicates signature id conform to SAML Signature profile + signProfValidator.validate(tokenSaml.getSignature()); + + String aliasCert; + X509Certificate certificate; + + final List trustedCred = new ArrayList(); + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements();) { + aliasCert = e.nextElement(); + final BasicX509Credential credential = new BasicX509Credential(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + credential.setEntityCertificate(certificate); + trustedCred.add(credential); + } + + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); + final List listCertificates = KeyInfoHelper + .getCertificates(keyInfo); + + if (listCertificates.size() != 1) { + throw new SAMLEngineException("Only must be one certificate"); + } + + // Exist only one certificate + final BasicX509Credential entityX509Cred = new BasicX509Credential(); + entityX509Cred.setEntityCertificate(listCertificates.get(0)); + + final ExplicitKeyTrustEvaluator keyTrustEvaluator = + new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustedCred)) { + throw new SAMLEngineException("Certificate it is not trusted."); + } + + final SignatureValidator sigValidator = new SignatureValidator( + entityX509Cred); + + sigValidator.validate(tokenSaml.getSignature()); + + } catch (final ValidationException e) { + LOG.error("ValidationException.", e); + throw new SAMLEngineException(e); + } catch (final KeyStoreException e) { + LOG.error("ValidationException.", e); + throw new SAMLEngineException(e); + } catch (final CertificateException e) { + LOG.error("CertificateException.", e); + throw new SAMLEngineException(e); + } + return tokenSaml; + } + + /** + * load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + * Note this class was using pkcs11Provider + * final Provider pkcs11Provider = new sun.security.pkcs11.SunPKCS11(inputStream) + * if (Security.getProperty(pkcs11Provider.getName()) == null) { + * Security.insertProviderAt(pkcs11Provider, Security .getProviders().length) + * } + * storkOwnKeyStore = KeyStore.getInstance(properties.getProperty(KEYSTORE_TYPE)) + */ + public void loadCryptServiceProvider() throws SAMLEngineException { + LOG.info("Load Cryptographic Service Provider"); + InputStream inputStream = null; + + try { + inputStream = SignHW.class.getResourceAsStream("/" + + properties.getProperty(CONF_FILE)); + + } catch (final Exception e) { + throw new SAMLEngineException( + "Error loading CryptographicServiceProvider", e); + } finally { + IOUtils.closeQuietly(inputStream); + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base new file mode 100644 index 000000000..2adefddbd --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base @@ -0,0 +1,64 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class ModuleSignFactory. + * + * @author fjquevedo + * + */ + +public final class SignModuleFactory { + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(SignModuleFactory.class.getName()); + + /** + * Instantiates a new module sign factory. + */ + private SignModuleFactory() { + + } + + /** + * Gets the single instance of SignModuleFactory. + * + * @param className the class name + * + * @return single instance of SignModuleFactory + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SAMLEngineSignI getInstance(final String className) + throws STORKSAMLEngineException { + LOG.info("[START]SignModuleFactory static"); + try { + final Class cls = Class.forName(className); + return (SAMLEngineSignI) cls.newInstance(); + } catch (Exception e) { + throw new STORKSAMLEngineException(e); + } + + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base new file mode 100644 index 000000000..33ed05515 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base @@ -0,0 +1,468 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Properties; + +import eu.stork.peps.auth.engine.X509PrincipalUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.NotImplementedException; +import org.bouncycastle.jce.X509Principal; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.security.SecurityConfiguration; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; +import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; +import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.x509.BasicX509Credential; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.util.Base64; +import org.opensaml.xml.validation.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.SAMLEngineException; + +/** + * The Class SWSign. Class responsible for signing and validating of messages + * SAML with a certificate store software. + * + * @author fjquevedo + */ +public final class SignP12 implements SAMLEngineSignI { + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SignP12.class + .getName()); + + + /** The p12 store. */ + private KeyStore p12Store = null; + + + /** The trust store. */ + private KeyStore trustStore = null; + + + /** + * Gets the trust store. + * + * @return the trust store + */ + public KeyStore getTrustStore() { + return trustStore; + } + + /** + * Sets the trust store. + * + * @param newTrustStore the new trust store + */ + public void setTrustStore(final KeyStore newTrustStore) { + this.trustStore = newTrustStore; + } + + /** + * The instance. + * + * @return the properties + */ + + public Properties getProperties() { + return properties; + } + + + + /** + * Gets the p12 store. + * + * @return the p12 store + */ + public KeyStore getP12Store() { + return p12Store; + } + + + + /** + * Sets the p12 store. + * + * @param newP12Store the new p12 store + */ + public void setP12Store(final KeyStore newP12Store) { + this.p12Store = newP12Store; + } + + + + /** + * Sets the properties. + * + * @param newProperties the new properties + */ + public void setProperties(final Properties newProperties) { + this.properties = newProperties; + } + + /** The SW sign prop. */ + private Properties properties = null; + + + /** + * Initialize the file configuration. + * + * @param fileConf name of the file configuration + * + * @throws SAMLEngineException error at the load from file configuration + */ + public void init(final String fileConf) throws SAMLEngineException { + InputStream fileProperties = null; + properties = new Properties(); + try { + try { + LOG.debug("Fichero a cargar " + fileConf); + fileProperties = new FileInputStream(fileConf); + properties.loadFromXML(fileProperties); + } catch (Exception e) { + LOG.error("Fallo al cargar el recurso externo. Se reintenta como fichero interno."); + fileProperties = SignP12.class.getResourceAsStream("/" + fileConf); + if (fileProperties == null) { + fileProperties = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileConf); + if (fileProperties == null) { + Enumeration files = ClassLoader.getSystemClassLoader().getResources(fileConf); + if (files != null && files.hasMoreElements()) { + LOG.info("Se han encontrado recurso/s. Se toma el primero."); + fileProperties = ClassLoader.getSystemClassLoader().getResourceAsStream(files.nextElement().getFile()); + } else { + throw new IOException("No se pudo recuperar el fichero: " + fileConf, e); + } + } + } + LOG.debug("Recuperados " + fileProperties.available() + " bytes"); + properties.loadFromXML(fileProperties); + } + } catch (InvalidPropertiesFormatException e) { + LOG.info("Exception: invalid properties format."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOG.info("Exception: invalid file: " + fileConf); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(fileProperties); + } + } + + /** + * Gets the certificate. + * + * @return the X509Certificate + * + */ + public X509Certificate getCertificate() { + throw new NotImplementedException(); + } + + /** + * Sign the token SAML. + * + * @param tokenSaml token SAML + * + * @return the X509Certificate signed. + * + * @throws SAMLEngineException error at sign SAML token + * + */ + public SAMLObject sign(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start Sign process"); + try { + + final String serialNumber = properties.getProperty("serialNumber"); + final String issuer = properties.getProperty("issuer"); + + String alias = null; + String aliasCert; + X509Certificate certificate; + + boolean find = false; + for (final Enumeration e = p12Store.aliases(); e + .hasMoreElements() && !find;) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) p12Store + .getCertificate(aliasCert); + + final String serialNum = certificate.getSerialNumber() + .toString(16); + + X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); + X509Principal issuerDNConf = new X509Principal(issuer); + + if(serialNum.equalsIgnoreCase(serialNumber) + && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ + alias = aliasCert; + find = true; + } + + } + + certificate = (X509Certificate) p12Store + .getCertificate(alias); + final PrivateKey privateKey = (PrivateKey) p12Store.getKey( + alias, properties.getProperty("keyPassword").toCharArray()); + + LOG.info("Recover BasicX509Credential."); + final BasicX509Credential credential = new BasicX509Credential(); + + LOG.debug("Load certificate"); + credential.setEntityCertificate(certificate); + + LOG.debug("Load privateKey"); + credential.setPrivateKey(privateKey); + + LOG.debug("Begin signature with openSaml"); + final Signature signature = (Signature) Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + + signature.setSigningCredential(credential); + + signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + + final SecurityConfiguration secConfiguration = Configuration + .getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac + .newInstance(); + + final KeyInfo keyInfo = keyInfoGenerator.generate(credential); + + signature.setKeyInfo(keyInfo); + signature.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + tokenSaml.setSignature(signature); + + LOG.info("Marshall samlToken."); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + + LOG.info("Sign samlToken."); + Signer.signObject(signature); + + } catch (MarshallingException e) { + LOG.error("MarshallingException"); + throw new SAMLEngineException(e); + } catch (NoSuchAlgorithmException e) { + LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("Generic KeyStore exception."); + throw new SAMLEngineException(e); + } catch (SignatureException e) { + LOG.error("Signature exception."); + throw new SAMLEngineException(e); + } catch (SecurityException e) { + LOG.error("Security exception."); + throw new SAMLEngineException(e); + } catch (UnrecoverableKeyException e) { + LOG.error("UnrecoverableKey exception."); + throw new SAMLEngineException(e); + } + + return tokenSaml; + } + + /** + * Validate signature. + * + * @param tokenSaml token SAML + * + * @return the SAMLObject validated. + * + * @throws SAMLEngineException error validate signature + * + */ + public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start signature validation."); + try { + + // Validate structure signature + final SAMLSignatureProfileValidator sigProfValidator = + new SAMLSignatureProfileValidator(); + try { + // Indicates signature id conform to SAML Signature profile + sigProfValidator.validate(tokenSaml.getSignature()); + } catch (ValidationException e) { + LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); + throw new SAMLEngineException(e); + } + + String aliasCert = null; + X509Certificate certificate; + + final List trustCred = new ArrayList(); + + for (final Enumeration e = trustStore.aliases(); e + .hasMoreElements();) { + aliasCert = e.nextElement(); + final BasicX509Credential credential = new BasicX509Credential(); + certificate = (X509Certificate) trustStore + .getCertificate(aliasCert); + credential.setEntityCertificate(certificate); + trustCred.add(credential); + } + + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); + + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + final CertificateFactory certFact = CertificateFactory + .getInstance("X.509"); + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + // Exist only one certificate + final BasicX509Credential entityX509Cred = new BasicX509Credential(); + entityX509Cred.setEntityCertificate(cert); + + // Validate trust certificates + final ExplicitKeyTrustEvaluator keyTrustEvaluator = + new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { + throw new SAMLEngineException("Certificate it is not trusted."); + } + + // Validate signature + final SignatureValidator sigValidator = new SignatureValidator( + entityX509Cred); + sigValidator.validate(tokenSaml.getSignature()); + + } catch (ValidationException e) { + LOG.error("ValidationException."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("KeyStoreException.", e); + throw new SAMLEngineException(e); + } catch (GeneralSecurityException e) { + LOG.error("GeneralSecurityException.", e); + throw new SAMLEngineException(e); + } + return tokenSaml; + } + + + /** + * Load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + */ + public void loadCryptServiceProvider() throws SAMLEngineException { + LOG.info("Load Cryptographic Service Provider"); + + FileInputStream fis = null; + FileInputStream fisTrustStore = null; + + try { + // Dynamically register Bouncy Castle provider. + boolean found = false; + // Check if BouncyCastle is already registered as a provider + final Provider[] providers = Security.getProviders(); + for (int i = 0; i < providers.length; i++) { + if (providers[i].getName().equals( + BouncyCastleProvider.PROVIDER_NAME)) { + found = true; + } + } + + // Register only if the provider has not been previously registered + if (!found) { + LOG.debug("SAMLCore: Register Bouncy Castle provider."); + Security.insertProviderAt(new BouncyCastleProvider(), Security + .getProviders().length); + } + + p12Store = KeyStore.getInstance(properties + .getProperty("keystoreType")); + + fis = new FileInputStream(properties + .getProperty("keystorePath")); + + p12Store.load(fis, properties.getProperty( + "keyStorePassword").toCharArray()); + + + trustStore = KeyStore.getInstance(properties + .getProperty("trustStoreType")); + + fisTrustStore = new FileInputStream(properties + .getProperty("trustStorePath")); + trustStore.load(fisTrustStore, properties.getProperty( + "trustStorePassword").toCharArray()); + + } catch (Exception e) { + throw new SAMLEngineException( + "Error loading CryptographicServiceProvider", e); + } finally { + IOUtils.closeQuietly(fis); + IOUtils.closeQuietly(fisTrustStore); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base new file mode 100644 index 000000000..4c7bb18a3 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base @@ -0,0 +1,423 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Properties; + +import eu.stork.peps.auth.engine.X509PrincipalUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.NotImplementedException; +import org.bouncycastle.jce.X509Principal; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.security.SecurityConfiguration; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; +import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; +import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.x509.BasicX509Credential; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.util.Base64; +import org.opensaml.xml.validation.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.SAMLEngineException; + + +/** + * The Class SWSign. Class responsible for signing and validating of messages + * SAML with a certificate store software. + * + * @author fjquevedo + */ +public class SignSW implements SAMLEngineSignI { + + /** The Constant KEYSTORE_TYPE. */ + private static final String KEYSTORE_TYPE = "keystoreType"; + + /** The Constant KEY_STORE_PASSWORD. */ + private static final String KEY_STORE_PASS = "keyStorePassword"; + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SignSW.class + .getName()); + + /** The stork own key store. */ + private KeyStore storkOwnKeyStore = null; + + /** + * The instance. + * + * @return the properties + */ + + public final Properties getProperties() { + return properties; + } + + /** + * Gets the stork own key store. + * + * @return the stork own key store + */ + public final KeyStore getStorkOwnKeyStore() { + return storkOwnKeyStore; + } + + /** + * Gets the stork trustStore. + * + * @return the stork own key store + */ + public KeyStore getTrustStore() { + return storkOwnKeyStore; + } + + /** + * Sets the stork own key store. + * + * @param newkOwnKeyStore the new stork own key store + */ + public final void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { + this.storkOwnKeyStore = newkOwnKeyStore; + } + + /** + * Sets the properties. + * + * @param newProperties the new properties + */ + public final void setProperties(final Properties newProperties) { + this.properties = newProperties; + } + + /** The SW sign prop. */ + private Properties properties = null; + + + /** + * Inits the file configuration. + * + * @param fileConf name of the file configuration + * + * @throws SAMLEngineException error at the load from file configuration + */ + public final void init(final String fileConf) + throws SAMLEngineException { + InputStream fileProperties = null; + try { + fileProperties = SignSW.class.getResourceAsStream("/" + + fileConf); + properties = new Properties(); + + properties.loadFromXML(fileProperties); + fileProperties.close(); + } catch (InvalidPropertiesFormatException e) { + LOG.info("Exception: invalid properties format."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOG.info("Exception: invalid file: " + fileConf); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(fileProperties); + } + } + + /** + * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() + * @return the X509Certificate + */ + public final X509Certificate getCertificate() { + throw new NotImplementedException(); + } + + + /** + * Sign the token SAML. + * + * @param tokenSaml the token SAML. + * + * @return the SAML object + * + * @throws SAMLEngineException the SAML engine exception + * + */ + public final SAMLObject sign(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start Sign process."); + try { + final String serialNumber = properties.getProperty("serialNumber"); + final String issuer = properties.getProperty("issuer"); + + String alias = null; + String aliasCert; + X509Certificate certificate; + boolean find = false; + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements() && !find; ) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + + final String serialNum = certificate.getSerialNumber() + .toString(16); + + X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); + X509Principal issuerDNConf = new X509Principal(issuer); + + if(serialNum.equalsIgnoreCase(serialNumber) + && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ + alias = aliasCert; + find = true; + } + } + if (!find) { + throw new SAMLEngineException("Certificate cannot be found in keystore "); + } + certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); + final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( + alias, properties.getProperty("keyPassword").toCharArray()); + + LOG.info("Recover BasicX509Credential."); + final BasicX509Credential credential = new BasicX509Credential(); + + LOG.debug("Load certificate"); + credential.setEntityCertificate(certificate); + + LOG.debug("Load privateKey"); + credential.setPrivateKey(privateKey); + + LOG.debug("Begin signature with openSaml"); + final Signature signature = (Signature) Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + + signature.setSigningCredential(credential); + + signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + + + final SecurityConfiguration secConfiguration = Configuration + .getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac + .newInstance(); + + KeyInfo keyInfo = keyInfoGenerator.generate(credential); + + signature.setKeyInfo(keyInfo); + signature.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + tokenSaml.setSignature(signature); + + LOG.info("Marshall samlToken."); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + + LOG.info("Sign samlToken."); + Signer.signObject(signature); + + } catch (MarshallingException e) { + LOG.error("MarshallingException"); + throw new SAMLEngineException(e); + } catch (NoSuchAlgorithmException e) { + LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("Generic KeyStore exception."); + throw new SAMLEngineException(e); + } catch (SignatureException e) { + LOG.error("Signature exception."); + throw new SAMLEngineException(e); + } catch (SecurityException e) { + LOG.error("Security exception."); + throw new SAMLEngineException(e); + } catch (UnrecoverableKeyException e) { + LOG.error("UnrecoverableKey exception."); + throw new SAMLEngineException(e); + } + + return tokenSaml; + } + + /** + * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(org.opensaml.common.SignableSAMLObject) + * @param tokenSaml token SAML + * @return the SAMLObject validated. + * @throws SAMLEngineException error validate signature + */ + public final SAMLObject validateSignature(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start signature validation."); + try { + + // Validate structure signature + final SAMLSignatureProfileValidator sigProfValidator = + new SAMLSignatureProfileValidator(); + try { + // Indicates signature id conform to SAML Signature profile + sigProfValidator.validate(tokenSaml.getSignature()); + } catch (ValidationException e) { + LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); + throw new SAMLEngineException(e); + } + + String aliasCert = null; + X509Certificate certificate; + + final List trustCred = new ArrayList(); + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements();) { + aliasCert = e.nextElement(); + final BasicX509Credential credential = new BasicX509Credential(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + credential.setEntityCertificate(certificate); + trustCred.add(credential); + } + + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); + + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + final CertificateFactory certFact = CertificateFactory + .getInstance("X.509"); + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + // Exist only one certificate + final BasicX509Credential entityX509Cred = new BasicX509Credential(); + entityX509Cred.setEntityCertificate(cert); + + // Validate trust certificates + final ExplicitKeyTrustEvaluator keyTrustEvaluator = + new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { + throw new SAMLEngineException("Certificate is not trusted."); + } + + // Validate signature + final SignatureValidator sigValidator = new SignatureValidator( + entityX509Cred); + sigValidator.validate(tokenSaml.getSignature()); + + } catch (ValidationException e) { + LOG.error("ValidationException."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("KeyStoreException.", e); + throw new SAMLEngineException(e); + } catch (GeneralSecurityException e) { + LOG.error("GeneralSecurityException.", e); + throw new SAMLEngineException(e); + } + LOG.info(tokenSaml.getSignatureReferenceID()); + LOG.info("Start signature validation - END." ); + return tokenSaml; + } + + + /** + * Load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + */ + public final void loadCryptServiceProvider() throws SAMLEngineException { + LOG.info("Load Cryptographic Service Provider"); + FileInputStream fis = null; + try { + // Dynamically register Bouncy Castle provider. + boolean found = false; + // Check if BouncyCastle is already registered as a provider + final Provider[] providers = Security.getProviders(); + for (int i = 0; i < providers.length; i++) { + if (providers[i].getName().equals( + BouncyCastleProvider.PROVIDER_NAME)) { + found = true; + } + } + + // Register only if the provider has not been previously registered + if (!found) { + LOG.info("SAMLCore: Register Bouncy Castle provider."); + Security.insertProviderAt(new BouncyCastleProvider(), Security + .getProviders().length); + } + + storkOwnKeyStore = KeyStore.getInstance(properties + .getProperty(KEYSTORE_TYPE)); + + LOG.info("Loading KeyInfo from keystore file " + properties.getProperty("keystorePath")); + fis = new FileInputStream(properties + .getProperty("keystorePath")); + + storkOwnKeyStore.load(fis, properties.getProperty( + KEY_STORE_PASS).toCharArray()); + + } catch (Exception e) { + LOG.error("Error loading CryptographicServiceProvider", e); + throw new SAMLEngineException( + "Error loading CryptographicServiceProvider", e); + } finally { + IOUtils.closeQuietly(fis); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base new file mode 100644 index 000000000..a60515593 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; + +/** + * The Class VIDPAuthenticationAttributesBuilder. + * + * @author fjquevedo + */ +public final class VIDPAuthenticationAttributesBuilder extends AbstractSAMLObjectBuilder { + + + /** {@inheritDoc} */ + public VIDPAuthenticationAttributes buildObject() { + return buildObject(SAMLCore.STORK10P_NS.getValue(), VIDPAuthenticationAttributes.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); + } + + /** {@inheritDoc} */ + public VIDPAuthenticationAttributes buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { + return new VIDPAuthenticationAttributesImpl(namespaceURI, localName, namespacePrefix); + } + +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base new file mode 100644 index 000000000..a6e7e7f60 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base @@ -0,0 +1,132 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSignableSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.SPInformation; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class VIDPAuthenticationAttributesImpl. + * + * @author fjquevedo + */ +public final class VIDPAuthenticationAttributesImpl extends AbstractSignableSAMLObject implements +VIDPAuthenticationAttributes { + + private static final Logger LOGGER = LoggerFactory.getLogger(VIDPAuthenticationAttributesImpl.class.getName()); + /** The citizen country code. */ + private CitizenCountryCode citizenCountryCode; + + /** The SP information. */ + private SPInformation spInformation; + + /** + * Instantiates a new requested attributes implement. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected VIDPAuthenticationAttributesImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * getCitizenCountryCode. + * + * @return the citizen country code + */ + public CitizenCountryCode getCitizenCountryCode() { + return citizenCountryCode; + } + + /** + * getSPInformation + * + * @return the SP information + */ + public SPInformation getSPInformation() { + return spInformation; + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * + */ + public List getOrderedChildren() { + final ArrayList children = new ArrayList(); + + children.add(citizenCountryCode); + children.add(spInformation); + + if (getSignature() != null) { + children.add(getSignature()); + } + + return Collections.unmodifiableList(children); + + } + + /** + * Gets the signature reference id. + * + * @return the signature reference id + * + */ + public String getSignatureReferenceID() { + return null; + } + + /** + * Sets the citizen country code. + * + * @param newCitizenCountryCode the new citizen country code + * + */ + public void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode) { + this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); + } + + /** + * Sets the SP information. + * + * @param newSPInformation the new SP information + * + */ + public void setSPInformation(SPInformation newSPInformation) { + this.spInformation = prepareForAssignment(this.spInformation, newSPInformation); + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base new file mode 100644 index 000000000..5635ddd6b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base @@ -0,0 +1,33 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class VIDPAuthenticationAttributesMarshaller. + * + * @author fjquevedo + */ +public class VIDPAuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Instantiates a new vIDP authentication attributes marshaller. + */ + public VIDPAuthenticationAttributesMarshaller() { + super(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base new file mode 100644 index 000000000..1de300c03 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base @@ -0,0 +1,55 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.SPInformation; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; + +/** + * The Class VIDPAuthenticationAttributesUnmarshaller. + * + * @author fjquevedo + */ +public class VIDPAuthenticationAttributesUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException the unmarshalling exception + * + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final VIDPAuthenticationAttributes vIDPAuthenticationAttr = (VIDPAuthenticationAttributes) parentObject; + + if (childObject instanceof CitizenCountryCode) { + vIDPAuthenticationAttr.setCitizenCountryCode((CitizenCountryCode) childObject); + } else if (childObject instanceof SPInformation) { + vIDPAuthenticationAttr.setSPInformation((SPInformation) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..e26da6d04 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Implementations of STORK 1.0 core specification types and elements. + */ +package eu.stork.peps.auth.engine.core.impl; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java new file mode 100644 index 000000000..74840e135 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; + +/** + * The Class AuthenticationAttributesBuilder. + * + * @author fjquevedo + */ +public class AuthenticationAttributesBuilder extends + AbstractSAMLObjectBuilder { + + + + /** + * Builds the object. + * + * @return the authentication attributes + */ + public final AuthenticationAttributes buildObject() { + return buildObject(AuthenticationAttributes.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace URI + * @param localName the local name + * @param namespacePrefix the namespace prefix + * + * @return the authentication attributes + */ + public final AuthenticationAttributes buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new AuthenticationAttributesImpl(namespaceURI, localName, + namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.java new file mode 100644 index 000000000..1e43e7ec3 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.java @@ -0,0 +1,109 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSignableSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class AuthenticationAttributesImpl. + * + * @author fjquevedo + */ +public final class AuthenticationAttributesImpl extends AbstractSignableSAMLObject implements +AuthenticationAttributes { + + private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticationAttributesImpl.class.getName()); + + /** The indexed children. */ + private VIDPAuthenticationAttributes vIDPAuthenAttr; + + /** + * Instantiates a new authentication attributes implementation. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected AuthenticationAttributesImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * + */ + public List getOrderedChildren() { + final ArrayList children = new ArrayList(); + + children.add(vIDPAuthenAttr); + + if (getSignature() != null) { + children.add(getSignature()); + } + + return Collections.unmodifiableList(children); + } + + /** + * Gets the signature reference id. + * + * @return the signature reference id + * + */ + public String getSignatureReferenceID() { + return null; + } + + /** + * Gets the vidp authentication attributes. + * + * @return the VIDP authentication attributes + * + */ + public VIDPAuthenticationAttributes getVIDPAuthenticationAttributes() { + return vIDPAuthenAttr; + } + + /** + * Sets the vidp authentication attributes. + * + * @param newVIDPAuthenAttr the new vidp authen attr + * + */ + public void setVIDPAuthenticationAttributes( + final VIDPAuthenticationAttributes newVIDPAuthenAttr) { + vIDPAuthenAttr = prepareForAssignment(this.vIDPAuthenAttr, newVIDPAuthenAttr); + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.java new file mode 100644 index 000000000..698bf56b9 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.java @@ -0,0 +1,30 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class AuthenticationAttributesMarshaller. + * + * @author fjquevedo + */ +public class AuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { + + + + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java new file mode 100644 index 000000000..af3e5c234 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java @@ -0,0 +1,54 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; + +import eu.stork.peps.auth.engine.core.AuthenticationAttributes; + +/** + * The Class AuthenticationAttributesUnmarshaller. + * + * @author fjquevedo + */ +public class AuthenticationAttributesUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException the unmarshalling exception + * + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final AuthenticationAttributes attrStatement = (AuthenticationAttributes) parentObject; + + if (childObject instanceof VIDPAuthenticationAttributes) { + attrStatement.setVIDPAuthenticationAttributes((VIDPAuthenticationAttributes) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.java new file mode 100644 index 000000000..64651691f --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.java @@ -0,0 +1,50 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; + +/** + * The Class CitizenCountryCodeBuilder. + * + * @author fjquevedo + */ +public class CitizenCountryCodeBuilder extends AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the citizen country code + */ + public final CitizenCountryCode buildObject() { + return buildObject(CitizenCountryCode.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the citizen country code + */ + public final CitizenCountryCode buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new CitizenCountryCodeImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.java new file mode 100644 index 000000000..4df8084a9 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.java @@ -0,0 +1,82 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class CitizenCountryCodeImpl. + * + * @author fjquevedo + */ +public class CitizenCountryCodeImpl extends AbstractSAMLObject implements CitizenCountryCode { + + private static final Logger LOGGER = LoggerFactory.getLogger(CitizenCountryCodeImpl.class.getName()); + /** The citizen country code. */ + private String citizenCountryCode; + + /** + * Instantiates a new sP country impl. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected CitizenCountryCodeImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the citizen country code. + * + * @return the citizen country code + */ + public final String getCitizenCountryCode() { + return citizenCountryCode; + } + + /** + * Sets the citizen country code. + * + * @param newCitizenCountryCode the new citizen country code + */ + public final void setCitizenCountryCode(final String newCitizenCountryCode) { + this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.java new file mode 100644 index 000000000..decae04c5 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.java @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; + +/** + * The Class SPCountryMarshaller. + * + * @author fjquevedo + */ +public class CitizenCountryCodeMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; + XMLHelper.appendTextContent(domElement, citizenCountryCode.getCitizenCountryCode()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.java new file mode 100644 index 000000000..93132b508 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.java @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; + +/** + * The Class CitizenCountryCodeUnmarshaller. + * + * @author fjquevedo + */ +public class CitizenCountryCodeUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; + citizenCountryCode.setCitizenCountryCode(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java new file mode 100644 index 000000000..b939da776 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; + +/** + * The Class EIDCrossBorderShareBuilder. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareBuilder extends AbstractSAMLObjectBuilder { + + + /** + * Builds the object. + * + * @return the identifier cross border share + */ + public final EIDCrossBorderShare buildObject() { + return buildObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); + } + + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the eID cross border share + */ + public final EIDCrossBorderShare buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new EIDCrossBorderShareImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.java new file mode 100644 index 000000000..50a997031 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.java @@ -0,0 +1,87 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class EIDCrossBorderShareImpl. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareImpl extends AbstractSAMLObject implements + EIDCrossBorderShare { + + private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossBorderShareImpl.class.getName()); + /** The citizen country code. */ + private String eIDCrossBorderShare; + + /** + * Instantiates a new eID cross border share implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected EIDCrossBorderShareImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + + /** + * Gets the eID cross border share. + * + * @return the eID cross border share + */ + public final String getEIDCrossBorderShare() { + return eIDCrossBorderShare; + } + + + /** + * Sets the eID cross border share. + * + * @param newEIDCrossBorderShare the new eID cross border share + */ + public final void setEIDCrossBorderShare(String newEIDCrossBorderShare) { + this.eIDCrossBorderShare = prepareForAssignment(this.eIDCrossBorderShare, newEIDCrossBorderShare); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * {@inheritDoc} + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.java new file mode 100644 index 000000000..58fa8af65 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.java @@ -0,0 +1,47 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; + + +/** + * The Class EIDCrossBorderShareMarshaller. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareMarshaller extends AbstractSAMLObjectMarshaller { + + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; + XMLHelper.appendTextContent(domElement, crossBorderShare.getEIDCrossBorderShare()); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.java new file mode 100644 index 000000000..457e70c23 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.java @@ -0,0 +1,43 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; + +/** + * The Class EIDCrossBorderShareUnmarshaller. + * + * @author fjquevedo + */ +public class EIDCrossBorderShareUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; + crossBorderShare.setEIDCrossBorderShare(elementContent); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.java new file mode 100644 index 000000000..9683d2ad8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.java @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; + +/** + * The Class EIDCrossSectorShareBuilder. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the eID cross sector share + */ + public final EIDCrossSectorShare buildObject() { + return buildObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the eID cross sector share implementation + */ + public final EIDCrossSectorShareImpl buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new EIDCrossSectorShareImpl(namespaceURI, localName, + namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.java new file mode 100644 index 000000000..30502f429 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.java @@ -0,0 +1,89 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; + +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * The Class EIDCrossSectorShareImpl. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareImpl extends AbstractSAMLObject implements + EIDCrossSectorShare { + + private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossSectorShareImpl.class.getName()); + /** The citizen country code. */ + private String eIDCrossSectorShare; + + + /** + * Instantiates a new eID cross sector share implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected EIDCrossSectorShareImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + + /** + * Gets the eID cross sector share. + * + * @return the eID cross sector share + */ + public final String getEIDCrossSectorShare() { + return eIDCrossSectorShare; + } + + + /** + * Sets the eID cross sector share. + * + * @param newEIDCrossSectorShare the new eID cross sector share + */ + public final void setEIDCrossSectorShare(String newEIDCrossSectorShare) { + this.eIDCrossSectorShare = prepareForAssignment(this.eIDCrossSectorShare, newEIDCrossSectorShare); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.java new file mode 100644 index 000000000..dfd2b81dc --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.java @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; + + +/** + * The Class EIDCrossSectorShareMarshaller. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; + XMLHelper.appendTextContent(domElement, crossSectorShare.getEIDCrossSectorShare()); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.java new file mode 100644 index 000000000..6a9711ca2 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.java @@ -0,0 +1,47 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; + +/** + * The Class EIDCrossSectorShareUnmarshaller. + * + * @author fjquevedo + */ +public class EIDCrossSectorShareUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void processElementContent(final XMLObject samlObject, + final String domElement) { + + final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; + crossSectorShare.setEIDCrossSectorShare(domElement); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.java new file mode 100644 index 000000000..75062dc69 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.java @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; + +/** + * The Class EIDSectorShareBuilder. + * + * @author fjquevedo + */ +public class EIDSectorShareBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the eID sector share + */ + public final EIDSectorShare buildObject() { + return buildObject(EIDSectorShare.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the eID sector share + */ + public final EIDSectorShare buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new EIDSectorShareImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.java new file mode 100644 index 000000000..c548841f7 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.java @@ -0,0 +1,85 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +// TODO: Auto-generated Javadoc +/** + * The Class EIDSectorShareImpl. + * + * @author fjquevedo + */ +public class EIDSectorShareImpl extends AbstractSAMLObject implements + EIDSectorShare { + + private static final Logger LOGGER = LoggerFactory.getLogger(EIDSectorShareImpl.class.getName()); + + /** The e id sector share. */ + private String eIDSectorShare; + /** + * Instantiates a new eID sector share implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected EIDSectorShareImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * Gets the eID sector share. + * + * @return the eID sector share + */ + public final String getEIDSectorShare() { + return eIDSectorShare; + } + + /** + * Sets the eID sector share. + * + * @param newEIDSectorShare the new eID sector share + */ + public final void setEIDSectorShare(String newEIDSectorShare) { + this.eIDSectorShare = prepareForAssignment(this.eIDSectorShare, newEIDSectorShare); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.java new file mode 100644 index 000000000..87ab23660 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.java @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.saml2.core.impl.AbstractNameIDTypeMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; + +/** + * The Class EIDSectorShareMarshaller. + * + * @author fjquevedo + */ +public class EIDSectorShareMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; + XMLHelper.appendTextContent(domElement, sectorShare.getEIDSectorShare()); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.java new file mode 100644 index 000000000..9c661813f --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.java @@ -0,0 +1,47 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.EIDSectorShare; + + +/** + * The Class EIDSectorShareUnmarshaller. + * + * @author fjquevedo + */ +public class EIDSectorShareUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void processElementContent(final XMLObject samlObject, + final String domElement) { + final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; + sectorShare.setEIDSectorShare(domElement); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.java new file mode 100644 index 000000000..41676931b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.java @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeBuilder. + * + * @author fjquevedo + */ +public class QAAAttributeBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the quality authentication assurance object + */ + public final QAAAttribute buildObject() { + return buildObject(QAAAttribute.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the quality authentication assurance object + + */ + public final QAAAttribute buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new QAAAttributeImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.java new file mode 100644 index 000000000..c08986026 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.java @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.QAAAttribute; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class QAAAttributeImpl. + * + * @author fjquevedo + */ +public class QAAAttributeImpl extends AbstractSAMLObject implements + QAAAttribute { + + private static final Logger LOGGER = LoggerFactory.getLogger(QAAAttributeImpl.class.getName()); + /** The quality authentication assurance level. */ + private String qaaLevel; + + /** + * Constructor. + * + * @param namespaceURI the namespace the element is in + * @param elementLocalName the local name of the XML element this Object + * represents + * @param namespacePrefix the prefix for the given namespace + */ + protected QAAAttributeImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the quality authentication assurance level. + * + * @return the quality authentication assurance level + */ + public final String getQaaLevel() { + return qaaLevel; + } + + /** + * Sets the quality authentication assurance level. + * + * @param newQaaLevel the new quality authentication assurance level + */ + public final void setQaaLevel(final String newQaaLevel) { + this.qaaLevel = prepareForAssignment(this.qaaLevel, newQaaLevel); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.java new file mode 100644 index 000000000..000879368 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.java @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeMarshaller. + * + * @author fjquevedo + */ +public class QAAAttributeMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final QAAAttribute qaaAttribute = (QAAAttribute) samlObject; + XMLHelper.appendTextContent(domElement, qaaAttribute.getQaaLevel()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.java new file mode 100644 index 000000000..8445e4eeb --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.java @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeUnmarshaller. + * + * @author fjquevedo + */ +public class QAAAttributeUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final QAAAttribute qaaLevel = (QAAAttribute) samlObject; + qaaLevel.setQaaLevel(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.java new file mode 100644 index 000000000..70bd6ac1f --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.java @@ -0,0 +1,54 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; + +/** + * The Class RequestedAttributeBuilder. + * + * @author fjquevedo + */ +public class RequestedAttributeBuilder extends + AbstractSAMLObjectBuilder { + + + /** + * Builds the object. + * + * @return the requested attribute + */ + public final RequestedAttribute buildObject() { + return buildObject(RequestedAttribute.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the requested attribute + */ + public final RequestedAttribute buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new RequestedAttributeImpl(namespaceURI, localName, + namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.java new file mode 100644 index 000000000..ad759230a --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.java @@ -0,0 +1,220 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSBooleanValue; +import org.opensaml.xml.util.AttributeMap; +import org.opensaml.xml.util.XMLObjectChildrenList; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +// TODO: Auto-generated Javadoc +/** + * The Class RequestedAttributeImpl. + * + * @author fjquevedo + */ +public class RequestedAttributeImpl extends AbstractSAMLObject implements + RequestedAttribute { + + private static final Logger LOGGER = LoggerFactory.getLogger(RequestedAttributeImpl.class.getName()); + /** + * The attribute values. + */ + private final XMLObjectChildrenList attributeValues; + + /** + * The friendly name. + * + */ + private String friendlyName; + + /** + * The is required. + */ + private String isRequired; + + /** + * The name. + * + */ + private String name; + + /** + * The name format. + * + */ + private String nameFormat; + + /** + * The unknown attributes. + * + */ + private AttributeMap unknownAttributes; + + /** + * Instantiates a new requested attribute impl. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected RequestedAttributeImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + unknownAttributes = new AttributeMap(this); + attributeValues = new XMLObjectChildrenList(this); + } + + + /** + * Gets the attribute values. + * + * @return the attribute values + */ + public final List getAttributeValues() { + return attributeValues; + } + + /** + * Gets the friendly name. + * + * @return the friendly name. + */ + public final String getFriendlyName() { + return friendlyName; + } + + + /** + * Gets the checks if is required. + * + * @return the boolean if it's required. + */ + public final String isRequired() { + return isRequired; + } + + + /** + * Gets the is required xs boolean. + * + * @return the XSBoolean if it's required. + */ + public final String getIsRequiredXSBoolean() { + return isRequired; + } + + + /** + * Gets the name. + * + * @return the name + */ + public final String getName() { + return name; + } + + + /** + * Gets the name format. + * + * @return the name format. + */ + public final String getNameFormat() { + return nameFormat; + } + + /** + * Gets the ordered children. + * + * @return the list of XMLObject. + */ + public final List getOrderedChildren() { + final ArrayList children = new ArrayList(); + children.addAll(attributeValues); + return Collections.unmodifiableList(children); + } + + /** + * Gets the unknown attributes. + * + * @return the attribute map + */ + public final AttributeMap getUnknownAttributes() { + return unknownAttributes; + } + + /** + * Sets the friendly name. + * + * @param newFriendlyName the new friendly name format + */ + public final void setFriendlyName(final String newFriendlyName) { + this.friendlyName = prepareForAssignment(this.friendlyName, + newFriendlyName); + } + + /** + * Set new boolean value isRequired. + * @param newIsRequired then new value + */ + public final void setIsRequired(final String newIsRequired) { + isRequired = prepareForAssignment(this.isRequired, newIsRequired); + + } + + /** + * Sets the name. + * + * @param newName the new name + */ + public final void setName(final String newName) { + this.name = prepareForAssignment(this.name, newName); + } + + /** + * Sets the name format. + * + * @param newNameFormat the new name format + */ + public final void setNameFormat(final String newNameFormat) { + this.nameFormat = prepareForAssignment(this.nameFormat, newNameFormat); + } + + /** + * Sets the unknown attributes. + * + * @param newUnknownAttr the new unknown attributes + */ + public final void setUnknownAttributes(final AttributeMap newUnknownAttr) { + this.unknownAttributes = newUnknownAttr; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.java new file mode 100644 index 000000000..6d0669241 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.java @@ -0,0 +1,89 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.Map.Entry; + +import javax.xml.namespace.QName; + +import org.opensaml.Configuration; +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; + +/** + * The Class RequestedAttributeMarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributeMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall attributes. + * + * @param samlElement the SAML element + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallAttributes(final XMLObject samlElement, + final Element domElement) throws MarshallingException { + final RequestedAttribute requestedAttr = (RequestedAttribute) samlElement; + + if (requestedAttr.getName() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.NAME_ATTRIB_NAME, requestedAttr + .getName()); + } + + if (requestedAttr.getNameFormat() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.NAME_FORMAT_ATTR, requestedAttr + .getNameFormat()); + } + + if (requestedAttr.getFriendlyName() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.FRIENDLY_NAME_ATT, requestedAttr + .getFriendlyName()); + } + + if (requestedAttr.getIsRequiredXSBoolean() != null) { + domElement.setAttributeNS(null, + RequestedAttribute.IS_REQUIRED_ATTR, requestedAttr + .getIsRequiredXSBoolean().toString()); + } + + Attr attr; + for (Entry entry : requestedAttr.getUnknownAttributes() + .entrySet()) { + attr = XMLHelper.constructAttribute(domElement.getOwnerDocument(), + entry.getKey()); + attr.setValue(entry.getValue()); + domElement.setAttributeNodeNS(attr); + if (Configuration.isIDAttribute(entry.getKey()) + || requestedAttr.getUnknownAttributes().isIDAttribute( + entry.getKey())) { + attr.getOwnerElement().setIdAttributeNode(attr, true); + } + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.java new file mode 100644 index 000000000..551f4239d --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.java @@ -0,0 +1,96 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import javax.xml.namespace.QName; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.schema.XSBooleanValue; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Attr; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.SAMLCore; + +/** + * The Class RequestedAttributeUnmarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributeUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentSAMLObject parent SAMLObject + * @param childSAMLObject child SAMLObject + * + * @throws UnmarshallingException error at unmarshall XML object + */ + protected final void processChildElement(final XMLObject parentSAMLObject, + final XMLObject childSAMLObject) throws UnmarshallingException { + + final RequestedAttribute requestedAttr = (RequestedAttribute) parentSAMLObject; + + final QName childQName = childSAMLObject.getElementQName(); + if (childQName.getLocalPart().equals("AttributeValue") + && childQName.getNamespaceURI().equals(SAMLCore.STORK10_NS.getValue())) { + requestedAttr.getAttributeValues().add(childSAMLObject); + } else { + super.processChildElement(parentSAMLObject, childSAMLObject); + } + } + + /** + * Process attribute. + * + * @param samlObject the SAML object + * @param attribute the attribute + * @throws UnmarshallingException the unmarshalling exception + */ + protected final void processAttribute(final XMLObject samlObject, + final Attr attribute) throws UnmarshallingException { + + final RequestedAttribute requestedAttr = (RequestedAttribute) samlObject; + + if (attribute.getLocalName() + .equals(RequestedAttribute.NAME_ATTRIB_NAME)) { + requestedAttr.setName(attribute.getValue()); + } else if (attribute.getLocalName().equals( + RequestedAttribute.NAME_FORMAT_ATTR)) { + requestedAttr.setNameFormat(attribute.getValue()); + } else if (attribute.getLocalName().equals( + RequestedAttribute.FRIENDLY_NAME_ATT)) { + requestedAttr.setFriendlyName(attribute.getValue()); + } else if (attribute.getLocalName().equals( + RequestedAttribute.IS_REQUIRED_ATTR)) { + requestedAttr.setIsRequired(attribute + .getValue()); + + } else { + final QName attribQName = XMLHelper.getNodeQName(attribute); + if (attribute.isId()) { + requestedAttr.getUnknownAttributes().registerID(attribQName); + } + requestedAttr.getUnknownAttributes().put(attribQName, + attribute.getValue()); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.java new file mode 100644 index 000000000..138177995 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.java @@ -0,0 +1,54 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.RequestedAttributes; + +/** + * The Class RequestedAttributesBuilder. + * + * @author fjquevedo + */ +public class RequestedAttributesBuilder extends + AbstractSAMLObjectBuilder { + + + /** + * Builds the object. + * + * @return the requested attributes + */ + public final RequestedAttributes buildObject() { + return buildObject(RequestedAttributes.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the requested attributes + */ + public final RequestedAttributes buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new RequestedAttributesImpl(namespaceURI, localName, + namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.java new file mode 100644 index 000000000..a58a08a05 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.java @@ -0,0 +1,95 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.util.IndexedXMLObjectChildrenList; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; + +/** + * The Class RequestedAttributesImpl. + * + * @author fjquevedo + */ +public class RequestedAttributesImpl extends AbstractSAMLObject implements + RequestedAttributes { + + /** + * Instantiates a new requested attributes implement. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected RequestedAttributesImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + indexedChildren = new IndexedXMLObjectChildrenList(this); + } + + /** The indexed children. */ + private final IndexedXMLObjectChildrenList indexedChildren; + + /** + * Gets the indexed children. + * + * @return the indexed children + */ + public final IndexedXMLObjectChildrenList getIndexedChildren() { + return indexedChildren; + } + + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + + final ArrayList children = new ArrayList(); + + children.addAll(indexedChildren); + + return Collections.unmodifiableList(children); + + } + + /** + * Gets the attributes. + * + * @return the attributes + * + * @see eu.stork.peps.auth.engine.core.RequestedAttributes#getAttributes() + */ + @SuppressWarnings("unchecked") + public final List getAttributes() { + return (List) indexedChildren + .subList(RequestedAttribute.DEF_ELEMENT_NAME); + } + + @Override + public int hashCode() { + throw new UnsupportedOperationException("hashCode method not implemented"); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.java new file mode 100644 index 000000000..955fe0318 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.java @@ -0,0 +1,33 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class RequestedAttributesMarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributesMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Instantiates a new requested attributes marshaller. + */ + public RequestedAttributesMarshaller() { + super(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.java new file mode 100644 index 000000000..132d6cc59 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.java @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.RequestedAttribute; +import eu.stork.peps.auth.engine.core.RequestedAttributes; + +/** + * The Class RequestedAttributesUnmarshaller. + * + * @author fjquevedo + */ +public class RequestedAttributesUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException error in unmarshall + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final RequestedAttributes attrStatement = (RequestedAttributes) parentObject; + + if (childObject instanceof RequestedAttribute) { + attrStatement.getAttributes().add((RequestedAttribute) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.java new file mode 100644 index 000000000..a35c77936 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.java @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPApplication; + +/** + * The Class SPApplicationBuilder. + * + * @author fjquevedo + */ +public class SPApplicationBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the service provider application + */ + public final SPApplication buildObject() { + return buildObject(SPApplication.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider application + */ + public final SPApplication buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPApplicationImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.java new file mode 100644 index 000000000..6bb631a74 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.java @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPApplication; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPApplicationImpl. + * + * @author fjquevedo + */ +public class SPApplicationImpl extends AbstractSAMLObject implements + SPApplication { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPApplicationImpl.class.getName()); + /** The service provider application. */ + private String spApplication; + + /** + * Instantiates a new service provider application. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPApplicationImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the service provider application. + * + * @return the service provider application + */ + public final String getSPApplication() { + return spApplication; + } + + /** + * Sets the service provider application. + * + * @param newSpApplication the new service provider application + */ + public final void setSPApplication(final String newSpApplication) { + this.spApplication = prepareForAssignment(this.spApplication, + newSpApplication); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.java new file mode 100644 index 000000000..4866c3535 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.java @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPApplication; + +/** + * The Class SPApplicationMarshaller. + * + * @author fjquevedo + */ +public class SPApplicationMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPApplication spApplication = (SPApplication) samlObject; + XMLHelper.appendTextContent(domElement, spApplication + .getSPApplication()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.java new file mode 100644 index 000000000..a28432a13 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.java @@ -0,0 +1,42 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPApplication; + + +/** + * The Class SPApplicationUnmarshaller. + * + * @author fjquevedo + */ +public class SPApplicationUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPApplication spApplication = (SPApplication) samlObject; + spApplication.setSPApplication(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.java new file mode 100644 index 000000000..48ec92f49 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.java @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPCountry; + +/** + * The Class SPCountryBuilder. + * + * @author fjquevedo + */ +public class SPCountryBuilder extends AbstractSAMLObjectBuilder { + + + /** + * Builds the object SPCountry. + * + * @return the service provider country + */ + public final SPCountry buildObject() { + return buildObject(SPCountry.DEF_ELEMENT_NAME); + } + + + /** + * Builds the object SPCountry. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider country + */ + public final SPCountry buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPCountryImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.java new file mode 100644 index 000000000..db58fb8be --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.java @@ -0,0 +1,82 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPCountry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPCountryImpl. + * + * @author fjquevedo + */ +public class SPCountryImpl extends AbstractSAMLObject implements SPCountry { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPCountryImpl.class.getName()); + /** The service provider country. */ + private String spCountry; + + /** + * Instantiates a new service provider country. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPCountryImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the service provider country. + * + * @return the service provider country + */ + public final String getSPCountry() { + return spCountry; + } + + /** + * Sets the service provider country. + * + * @param newSpCountry the new service provider country + */ + public final void setSPCountry(final String newSpCountry) { + this.spCountry = prepareForAssignment(this.spCountry, newSpCountry); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.java new file mode 100644 index 000000000..e82634749 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.java @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPCountry; + +/** + * The Class SPCountryMarshaller. + * + * @author fjquevedo + */ +public class SPCountryMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPCountry spCountry = (SPCountry) samlObject; + XMLHelper.appendTextContent(domElement, spCountry.getSPCountry()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.java new file mode 100644 index 000000000..deb695ac6 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.java @@ -0,0 +1,42 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPCountry; + + +/** + * The Class SPCountryUnmarshaller. + * + * @author fjquevedo + */ +public class SPCountryUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPCountry spCountry = (SPCountry) samlObject; + spCountry.setSPCountry(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.java new file mode 100644 index 000000000..b3640947b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.java @@ -0,0 +1,50 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPID; + +/** + * The Class SPIDBuilder. + * + * @author iinigo + */ +public class SPIDBuilder extends AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the SP ID + */ + public final SPID buildObject() { + return buildObject(SPID.DEF_ELEMENT_NAME); + } + + /** + * Builds the object. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the citizen country code + */ + public final SPID buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPIDImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.java new file mode 100644 index 000000000..0c7127273 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.java @@ -0,0 +1,82 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPIDImpl. + * + * @author iinigo + */ +public class SPIDImpl extends AbstractSAMLObject implements SPID { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPIDImpl.class.getName()); + /** The citizen country code. */ + private String spId; + + /** + * Instantiates a new sP country impl. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPIDImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the SP ID. + * + * @return the SP ID + */ + public final String getSPID() { + return spId; + } + + /** + * Sets the SP ID. + * + * @param newSPID the new SP ID + */ + public final void setSPID(final String newSPID) { + this.spId = prepareForAssignment(this.spId, newSPID); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.java new file mode 100644 index 000000000..24389522e --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.java @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPID; + +/** + * The Class SPIDMarshaller. + * + * @author iinigo + */ +public class SPIDMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPID spid = (SPID) samlObject; + XMLHelper.appendTextContent(domElement, spid.getSPID()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.java new file mode 100644 index 000000000..e4d230b94 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.java @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPID; + +/** + * The Class SPIDUnmarshaller. + * + * @author iinigo + */ +public class SPIDUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPID spid = (SPID) samlObject; + spid.setSPID(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.java new file mode 100644 index 000000000..a6e1fe686 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.java @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.SPInformation; + +/** + * The Class SPInformation. + * + * @author iinigo + */ +public final class SPInformationBuilder extends AbstractSAMLObjectBuilder { + + + /** {@inheritDoc} */ + public SPInformation buildObject() { + return buildObject(SAMLCore.STORK10P_NS.getValue(), SPInformation.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); + } + + /** {@inheritDoc} */ + public SPInformation buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { + return new SPInformationImpl(namespaceURI, localName, namespacePrefix); + } + +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.java new file mode 100644 index 000000000..b5609600d --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.java @@ -0,0 +1,110 @@ +/* + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSignableSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPID; +import eu.stork.peps.auth.engine.core.SPInformation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * The Class SPInformationImpl. + * + * @author iinigo + */ +public final class SPInformationImpl extends AbstractSignableSAMLObject implements +SPInformation { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPInformationImpl.class.getName()); + /** The citizen country code. */ + private SPID spId; + + + /** + * Instantiates a new requested attributes implement. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPInformationImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * getSPId. + * + * @return the SP ID + */ + public SPID getSPID() { + return spId; + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * + */ + public List getOrderedChildren() { + final ArrayList children = new ArrayList(); + + children.add(spId); + + if (getSignature() != null) { + children.add(getSignature()); + } + + return Collections.unmodifiableList(children); + + } + + /** + * Gets the signature reference id. + * + * @return the signature reference id + * + */ + public String getSignatureReferenceID() { + return null; + } + + /** + * Sets the SP Id. + * + * @param newSPId the new SP Id + * + */ + public void setSPID(SPID newSPId) { + this.spId = prepareForAssignment(this.spId, newSPId); + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.java new file mode 100644 index 000000000..44845948c --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.java @@ -0,0 +1,33 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class SPInformationMarshaller. + * + * @author iinigo + */ +public class SPInformationMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Instantiates a new SP Information marshaller. + */ + public SPInformationMarshaller() { + super(); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.java new file mode 100644 index 000000000..79b0b0f35 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.java @@ -0,0 +1,52 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.SPID; +import eu.stork.peps.auth.engine.core.SPInformation; + +/** + * The Class SPInformationUnmarshaller. + * + * @author iinigo + */ +public class SPInformationUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException the unmarshalling exception + * + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final SPInformation spInformation = (SPInformation) parentObject; + + if (childObject instanceof SPID) { + spInformation.setSPID((SPID) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.java new file mode 100644 index 000000000..fe47cf99c --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.java @@ -0,0 +1,51 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPInstitution; + +/** + * The Class SPInstitutionBuilder. + * + * @author fjquevedo + */ +public class SPInstitutionBuilder extends + AbstractSAMLObjectBuilder { + + /** + * Builds the object. + * + * @return the service provider institution + */ + public final SPInstitution buildObject() { + return buildObject(SPInstitution.DEF_ELEMENT_NAME); + } + + /** + * Builds the object SPInstitution. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider institution + */ + public final SPInstitution buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPInstitutionImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.java new file mode 100644 index 000000000..cf1760446 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.java @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPInstitution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class SPInstitutionImpl. + * + * @author fjquevedo + */ +public class SPInstitutionImpl extends AbstractSAMLObject implements + SPInstitution { + + private static final Logger LOGGER = LoggerFactory.getLogger(SPInstitutionImpl.class.getName()); + /** The service provider institution. */ + private String spInstitution; + + /** + * Instantiates a new service provider institution. + * + * @param namespaceURI the namespace uri + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPInstitutionImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** + * Gets the service provider institution. + * + * @return the service provider institution + */ + public final String getSPInstitution() { + return spInstitution; + } + + /** + * Sets the service provider institution. + * + * @param newSpInstitution the new service provider institution + */ + public final void setSPInstitution(final String newSpInstitution) { + this.spInstitution = prepareForAssignment(this.spInstitution, + newSpInstitution); + } + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } + } diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.java new file mode 100644 index 000000000..504a1f035 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.java @@ -0,0 +1,46 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPInstitution; + +/** + * The Class SPInstitutionMarshaller. + * + * @author fjquevedo + */ +public class SPInstitutionMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPInstitution spInstitution = (SPInstitution) samlObject; + XMLHelper.appendTextContent(domElement, spInstitution + .getSPInstitution()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.java new file mode 100644 index 000000000..103d5f2b2 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.java @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPInstitution; + +/** + * The Class SPInstitutionUnmarshaller. + * + * @author fjquevedo + */ +public class SPInstitutionUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPInstitution spInstitution = (SPInstitution) samlObject; + spInstitution.setSPInstitution(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.java new file mode 100644 index 000000000..a691b9008 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.java @@ -0,0 +1,50 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SPSector; + +/** + * The Class SPSectorBuilder. + * + * @author fjquevedo + */ +public class SPSectorBuilder extends AbstractSAMLObjectBuilder { + + /** + * Builds the object SPSector. + * + * @return the service provider sector. + */ + public final SPSector buildObject() { + return buildObject(SPSector.DEF_ELEMENT_NAME); + } + + /** + * Builds the object SPSector. + * + * @param namespaceURI the namespace uri + * @param localName the local name + * @param namespacePrefix the namespace prefix + * @return the service provider sector + */ + public final SPSector buildObject(final String namespaceURI, + final String localName, final String namespacePrefix) { + return new SPSectorImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.java new file mode 100644 index 000000000..a29810dd4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.java @@ -0,0 +1,84 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.List; + +import org.opensaml.common.impl.AbstractSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPSector; + + +/** + * The Class SPSectorImpl. + * + * @author fjquevedo + */ +public class SPSectorImpl extends AbstractSAMLObject implements SPSector { + + /** The service provider sector. */ + private String spSector; + + /** + * Instantiates a new Service provider sector implementation. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected SPSectorImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * Gets the service provider sector. + * + * @return the SP sector + * + * @see eu.stork.peps.auth.engine.core.SPSector#getSPSector() + */ + public final String getSPSector() { + return spSector; + } + + + /** + * Sets the service provider sector. + * + * @param newSpSector the new service provider sector + */ + public final void setSPSector(final String newSpSector) { + this.spSector = prepareForAssignment(this.spSector, newSpSector); + } + + + /** + * Gets the ordered children. + * + * @return the ordered children + */ + public final List getOrderedChildren() { + return null; + } + + @Override + public int hashCode() { + throw new UnsupportedOperationException("hashCode method not implemented"); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.java new file mode 100644 index 000000000..c5331e8f4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.java @@ -0,0 +1,45 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.SPSector; + +/** + * The Class SPSectorMarshaller. + * + * @author fjquevedo + */ +public class SPSectorMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Marshall element content. + * + * @param samlObject the SAML object + * @param domElement the DOM element + * @throws MarshallingException the marshalling exception + */ + protected final void marshallElementContent(final XMLObject samlObject, + final Element domElement) throws MarshallingException { + final SPSector spSector = (SPSector) samlObject; + XMLHelper.appendTextContent(domElement, spSector.getSPSector()); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.java new file mode 100644 index 000000000..cbb05c6e5 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.java @@ -0,0 +1,42 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.SPSector; + +/** + * The Class SPSectorUnmarshaller. + * + * @author fjquevedo + */ +public class SPSectorUnmarshaller extends AbstractSAMLObjectUnmarshaller { + + + /** + * Process element content. + * + * @param samlObject the SAML object + * @param elementContent the element content + */ + protected final void processElementContent(final XMLObject samlObject, + final String elementContent) { + final SPSector spSector = (SPSector) samlObject; + spSector.setSPSector(elementContent); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java new file mode 100644 index 000000000..2db14f543 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java @@ -0,0 +1,399 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Properties; + +import eu.stork.peps.auth.engine.X509PrincipalUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.NotImplementedException; +import org.bouncycastle.jce.X509Principal; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.security.SecurityConfiguration; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; +import org.opensaml.xml.security.keyinfo.KeyInfoHelper; +import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; +import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.x509.BasicX509Credential; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.validation.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.SAMLEngineException; + +/** + * The Class HWSign. Module of sign. + * + * @author fjquevedo + */ +public final class SignHW implements SAMLEngineSignI { + + /** The Constant CONFIGURATION_FILE. */ + private static final String CONF_FILE = "configurationFile"; + + /** The Constant KEYSTORE_TYPE. + private static final String KEYSTORE_TYPE = "keystoreType" */ + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SignHW.class + .getName()); + + /** The stork own key store. */ + private KeyStore storkOwnKeyStore = null; + + /** + * Gets the stork own key store. + * + * @return the stork own key store + */ + public KeyStore getStorkOwnKeyStore() { + return storkOwnKeyStore; + } + + /** + * Gets the stork trustStore. + * + * @return the stork own key store + */ + public KeyStore getTrustStore() { + return storkOwnKeyStore; + } + + /** + * Sets the stork own key store. + * + * @param newkOwnKeyStore the new stork own key store + */ + public void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { + this.storkOwnKeyStore = newkOwnKeyStore; + } + + /** + * Gets the properties. + * + * @return the properties + */ + public Properties getProperties() { + return properties; + } + + /** + * Sets the properties. + * + * @param newProperties the new properties + */ + public void setProperties(final Properties newProperties) { + this.properties = newProperties; + } + + /** The HW sign prop. */ + private Properties properties = null; + + /** + * @see + * eu.stork.peps.auth.engine.core.SAMLEngineSignI#init(java.lang.String) + * @param fileConf file of configuration + * @throws SAMLEngineException error in read file + */ + public void init(final String fileConf) + throws SAMLEngineException { + InputStream inputStr = null; + try { + inputStr = SignHW.class.getResourceAsStream("/" + + fileConf); + properties = new Properties(); + + properties.loadFromXML(inputStr); + } catch (final InvalidPropertiesFormatException e) { + LOG.info("Exception: invalid properties format."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOG.info("Exception: invalid file: " + fileConf); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(inputStr); + } + } + + + /** + * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() + * @return the X509Certificate. + */ + public X509Certificate getCertificate() { + throw new NotImplementedException(); + } + + /** + * @see + * eu.stork.peps.auth.engine.core.SAMLEngineSignI#sign(SignableSAMLObject tokenSaml) + * @param tokenSaml signable SAML Object + * @return the SAMLObject signed. + * @throws SAMLEngineException error in sign token saml + */ + public SAMLObject sign(final SignableSAMLObject tokenSaml) throws SAMLEngineException { + + try { + LOG.info("Star procces of sign"); + final char[] pin = properties.getProperty("keyPassword") + .toCharArray(); + + storkOwnKeyStore.load(null, pin); + + final String serialNumber = properties.getProperty("serialNumber"); + final String issuer = properties.getProperty("issuer"); + + String alias = null; + String aliasCert; + X509Certificate certificate; + + boolean find = false; + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements() && !find;) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + // Verified serial number, issuer + + final String serialNum = certificate.getSerialNumber() + .toString(16); + X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); + X509Principal issuerDNConf = new X509Principal(issuer); + + if(serialNum.equalsIgnoreCase(serialNumber) + && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ + alias = aliasCert; + find = true; + } + + } + + if (!find) { + throw new SAMLEngineException("Certificate cannot be found in keystore "); + } + certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); + final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( + alias, pin); + + LOG.info("Recover BasicX509Credential."); + final BasicX509Credential credential = new BasicX509Credential(); + + LOG.debug("Load certificate"); + credential.setEntityCertificate(certificate); + + LOG.debug("Load privateKey"); + credential.setPrivateKey(privateKey); + + LOG.info("Star procces of sign"); + final Signature signature = (Signature) org.opensaml.xml.Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + + LOG.debug("Begin signature with openSaml"); + signature.setSigningCredential(credential); + + signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + + + + final SecurityConfiguration securityConf = + org.opensaml.xml.Configuration.getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager = securityConf + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac + .newInstance(); + + final KeyInfo keyInfo = keyInfoGenerator.generate(credential); + + signature.setKeyInfo(keyInfo); + + LOG.debug("Set Canonicalization Algorithm"); + signature.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + tokenSaml.setSignature(signature); + + LOG.debug("Marshall samlToken."); + org.opensaml.xml.Configuration.getMarshallerFactory() + .getMarshaller(tokenSaml).marshall(tokenSaml); + + LOG.info("Sign samlToken."); + Signer.signObject(signature); + + } catch (final MarshallingException e) { + LOG.error("MarshallingException"); + throw new SAMLEngineException(e); + } catch (final NoSuchAlgorithmException e) { + LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); + throw new SAMLEngineException(e); + } catch (final KeyStoreException e) { + LOG.error("Generic KeyStore exception."); + throw new SAMLEngineException(e); + } catch (final SignatureException e) { + LOG.error("Signature exception."); + throw new SAMLEngineException(e); + } catch (final SecurityException e) { + LOG.error("Security exception."); + throw new SAMLEngineException(e); + } catch (final CertificateException e) { + LOG.error("Certificate exception."); + throw new SAMLEngineException(e); + } catch (final IOException e) { + LOG.error("IO exception."); + throw new SAMLEngineException(e); + } catch (final UnrecoverableKeyException e) { + LOG.error("UnrecoverableKeyException exception."); + throw new SAMLEngineException(e); + } + + return tokenSaml; + } + + /** + * @see + * eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(SignableSAMLObject) + * @param tokenSaml the token saml + * @return the SAMLObject validated. + * @throws SAMLEngineException exception in validate signature + */ + public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start signature validation."); + try { + + // Validate structure signature + final SAMLSignatureProfileValidator signProfValidator = + new SAMLSignatureProfileValidator(); + + // Indicates signature id conform to SAML Signature profile + signProfValidator.validate(tokenSaml.getSignature()); + + String aliasCert; + X509Certificate certificate; + + final List trustedCred = new ArrayList(); + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements();) { + aliasCert = e.nextElement(); + final BasicX509Credential credential = new BasicX509Credential(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + credential.setEntityCertificate(certificate); + trustedCred.add(credential); + } + + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); + final List listCertificates = KeyInfoHelper + .getCertificates(keyInfo); + + if (listCertificates.size() != 1) { + throw new SAMLEngineException("Only must be one certificate"); + } + + // Exist only one certificate + final BasicX509Credential entityX509Cred = new BasicX509Credential(); + entityX509Cred.setEntityCertificate(listCertificates.get(0)); + + final ExplicitKeyTrustEvaluator keyTrustEvaluator = + new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustedCred)) { + throw new SAMLEngineException("Certificate it is not trusted."); + } + + final SignatureValidator sigValidator = new SignatureValidator( + entityX509Cred); + + sigValidator.validate(tokenSaml.getSignature()); + + } catch (final ValidationException e) { + LOG.error("ValidationException.", e); + throw new SAMLEngineException(e); + } catch (final KeyStoreException e) { + LOG.error("ValidationException.", e); + throw new SAMLEngineException(e); + } catch (final CertificateException e) { + LOG.error("CertificateException.", e); + throw new SAMLEngineException(e); + } + return tokenSaml; + } + + /** + * load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + * Note this class was using pkcs11Provider + * final Provider pkcs11Provider = new sun.security.pkcs11.SunPKCS11(inputStream) + * if (Security.getProperty(pkcs11Provider.getName()) == null) { + * Security.insertProviderAt(pkcs11Provider, Security .getProviders().length) + * } + * storkOwnKeyStore = KeyStore.getInstance(properties.getProperty(KEYSTORE_TYPE)) + */ + public void loadCryptServiceProvider() throws SAMLEngineException { + LOG.info("Load Cryptographic Service Provider"); + InputStream inputStream = null; + + try { + inputStream = SignHW.class.getResourceAsStream("/" + + properties.getProperty(CONF_FILE)); + + } catch (final Exception e) { + throw new SAMLEngineException( + "Error loading CryptographicServiceProvider", e); + } finally { + IOUtils.closeQuietly(inputStream); + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.java new file mode 100644 index 000000000..2adefddbd --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.java @@ -0,0 +1,64 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class ModuleSignFactory. + * + * @author fjquevedo + * + */ + +public final class SignModuleFactory { + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(SignModuleFactory.class.getName()); + + /** + * Instantiates a new module sign factory. + */ + private SignModuleFactory() { + + } + + /** + * Gets the single instance of SignModuleFactory. + * + * @param className the class name + * + * @return single instance of SignModuleFactory + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static SAMLEngineSignI getInstance(final String className) + throws STORKSAMLEngineException { + LOG.info("[START]SignModuleFactory static"); + try { + final Class cls = Class.forName(className); + return (SAMLEngineSignI) cls.newInstance(); + } catch (Exception e) { + throw new STORKSAMLEngineException(e); + } + + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java new file mode 100644 index 000000000..33ed05515 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java @@ -0,0 +1,468 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Properties; + +import eu.stork.peps.auth.engine.X509PrincipalUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.NotImplementedException; +import org.bouncycastle.jce.X509Principal; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.security.SecurityConfiguration; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; +import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; +import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.x509.BasicX509Credential; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.util.Base64; +import org.opensaml.xml.validation.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.SAMLEngineException; + +/** + * The Class SWSign. Class responsible for signing and validating of messages + * SAML with a certificate store software. + * + * @author fjquevedo + */ +public final class SignP12 implements SAMLEngineSignI { + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SignP12.class + .getName()); + + + /** The p12 store. */ + private KeyStore p12Store = null; + + + /** The trust store. */ + private KeyStore trustStore = null; + + + /** + * Gets the trust store. + * + * @return the trust store + */ + public KeyStore getTrustStore() { + return trustStore; + } + + /** + * Sets the trust store. + * + * @param newTrustStore the new trust store + */ + public void setTrustStore(final KeyStore newTrustStore) { + this.trustStore = newTrustStore; + } + + /** + * The instance. + * + * @return the properties + */ + + public Properties getProperties() { + return properties; + } + + + + /** + * Gets the p12 store. + * + * @return the p12 store + */ + public KeyStore getP12Store() { + return p12Store; + } + + + + /** + * Sets the p12 store. + * + * @param newP12Store the new p12 store + */ + public void setP12Store(final KeyStore newP12Store) { + this.p12Store = newP12Store; + } + + + + /** + * Sets the properties. + * + * @param newProperties the new properties + */ + public void setProperties(final Properties newProperties) { + this.properties = newProperties; + } + + /** The SW sign prop. */ + private Properties properties = null; + + + /** + * Initialize the file configuration. + * + * @param fileConf name of the file configuration + * + * @throws SAMLEngineException error at the load from file configuration + */ + public void init(final String fileConf) throws SAMLEngineException { + InputStream fileProperties = null; + properties = new Properties(); + try { + try { + LOG.debug("Fichero a cargar " + fileConf); + fileProperties = new FileInputStream(fileConf); + properties.loadFromXML(fileProperties); + } catch (Exception e) { + LOG.error("Fallo al cargar el recurso externo. Se reintenta como fichero interno."); + fileProperties = SignP12.class.getResourceAsStream("/" + fileConf); + if (fileProperties == null) { + fileProperties = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileConf); + if (fileProperties == null) { + Enumeration files = ClassLoader.getSystemClassLoader().getResources(fileConf); + if (files != null && files.hasMoreElements()) { + LOG.info("Se han encontrado recurso/s. Se toma el primero."); + fileProperties = ClassLoader.getSystemClassLoader().getResourceAsStream(files.nextElement().getFile()); + } else { + throw new IOException("No se pudo recuperar el fichero: " + fileConf, e); + } + } + } + LOG.debug("Recuperados " + fileProperties.available() + " bytes"); + properties.loadFromXML(fileProperties); + } + } catch (InvalidPropertiesFormatException e) { + LOG.info("Exception: invalid properties format."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOG.info("Exception: invalid file: " + fileConf); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(fileProperties); + } + } + + /** + * Gets the certificate. + * + * @return the X509Certificate + * + */ + public X509Certificate getCertificate() { + throw new NotImplementedException(); + } + + /** + * Sign the token SAML. + * + * @param tokenSaml token SAML + * + * @return the X509Certificate signed. + * + * @throws SAMLEngineException error at sign SAML token + * + */ + public SAMLObject sign(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start Sign process"); + try { + + final String serialNumber = properties.getProperty("serialNumber"); + final String issuer = properties.getProperty("issuer"); + + String alias = null; + String aliasCert; + X509Certificate certificate; + + boolean find = false; + for (final Enumeration e = p12Store.aliases(); e + .hasMoreElements() && !find;) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) p12Store + .getCertificate(aliasCert); + + final String serialNum = certificate.getSerialNumber() + .toString(16); + + X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); + X509Principal issuerDNConf = new X509Principal(issuer); + + if(serialNum.equalsIgnoreCase(serialNumber) + && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ + alias = aliasCert; + find = true; + } + + } + + certificate = (X509Certificate) p12Store + .getCertificate(alias); + final PrivateKey privateKey = (PrivateKey) p12Store.getKey( + alias, properties.getProperty("keyPassword").toCharArray()); + + LOG.info("Recover BasicX509Credential."); + final BasicX509Credential credential = new BasicX509Credential(); + + LOG.debug("Load certificate"); + credential.setEntityCertificate(certificate); + + LOG.debug("Load privateKey"); + credential.setPrivateKey(privateKey); + + LOG.debug("Begin signature with openSaml"); + final Signature signature = (Signature) Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + + signature.setSigningCredential(credential); + + signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + + final SecurityConfiguration secConfiguration = Configuration + .getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac + .newInstance(); + + final KeyInfo keyInfo = keyInfoGenerator.generate(credential); + + signature.setKeyInfo(keyInfo); + signature.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + tokenSaml.setSignature(signature); + + LOG.info("Marshall samlToken."); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + + LOG.info("Sign samlToken."); + Signer.signObject(signature); + + } catch (MarshallingException e) { + LOG.error("MarshallingException"); + throw new SAMLEngineException(e); + } catch (NoSuchAlgorithmException e) { + LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("Generic KeyStore exception."); + throw new SAMLEngineException(e); + } catch (SignatureException e) { + LOG.error("Signature exception."); + throw new SAMLEngineException(e); + } catch (SecurityException e) { + LOG.error("Security exception."); + throw new SAMLEngineException(e); + } catch (UnrecoverableKeyException e) { + LOG.error("UnrecoverableKey exception."); + throw new SAMLEngineException(e); + } + + return tokenSaml; + } + + /** + * Validate signature. + * + * @param tokenSaml token SAML + * + * @return the SAMLObject validated. + * + * @throws SAMLEngineException error validate signature + * + */ + public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start signature validation."); + try { + + // Validate structure signature + final SAMLSignatureProfileValidator sigProfValidator = + new SAMLSignatureProfileValidator(); + try { + // Indicates signature id conform to SAML Signature profile + sigProfValidator.validate(tokenSaml.getSignature()); + } catch (ValidationException e) { + LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); + throw new SAMLEngineException(e); + } + + String aliasCert = null; + X509Certificate certificate; + + final List trustCred = new ArrayList(); + + for (final Enumeration e = trustStore.aliases(); e + .hasMoreElements();) { + aliasCert = e.nextElement(); + final BasicX509Credential credential = new BasicX509Credential(); + certificate = (X509Certificate) trustStore + .getCertificate(aliasCert); + credential.setEntityCertificate(certificate); + trustCred.add(credential); + } + + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); + + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + final CertificateFactory certFact = CertificateFactory + .getInstance("X.509"); + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + // Exist only one certificate + final BasicX509Credential entityX509Cred = new BasicX509Credential(); + entityX509Cred.setEntityCertificate(cert); + + // Validate trust certificates + final ExplicitKeyTrustEvaluator keyTrustEvaluator = + new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { + throw new SAMLEngineException("Certificate it is not trusted."); + } + + // Validate signature + final SignatureValidator sigValidator = new SignatureValidator( + entityX509Cred); + sigValidator.validate(tokenSaml.getSignature()); + + } catch (ValidationException e) { + LOG.error("ValidationException."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("KeyStoreException.", e); + throw new SAMLEngineException(e); + } catch (GeneralSecurityException e) { + LOG.error("GeneralSecurityException.", e); + throw new SAMLEngineException(e); + } + return tokenSaml; + } + + + /** + * Load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + */ + public void loadCryptServiceProvider() throws SAMLEngineException { + LOG.info("Load Cryptographic Service Provider"); + + FileInputStream fis = null; + FileInputStream fisTrustStore = null; + + try { + // Dynamically register Bouncy Castle provider. + boolean found = false; + // Check if BouncyCastle is already registered as a provider + final Provider[] providers = Security.getProviders(); + for (int i = 0; i < providers.length; i++) { + if (providers[i].getName().equals( + BouncyCastleProvider.PROVIDER_NAME)) { + found = true; + } + } + + // Register only if the provider has not been previously registered + if (!found) { + LOG.debug("SAMLCore: Register Bouncy Castle provider."); + Security.insertProviderAt(new BouncyCastleProvider(), Security + .getProviders().length); + } + + p12Store = KeyStore.getInstance(properties + .getProperty("keystoreType")); + + fis = new FileInputStream(properties + .getProperty("keystorePath")); + + p12Store.load(fis, properties.getProperty( + "keyStorePassword").toCharArray()); + + + trustStore = KeyStore.getInstance(properties + .getProperty("trustStoreType")); + + fisTrustStore = new FileInputStream(properties + .getProperty("trustStorePath")); + trustStore.load(fisTrustStore, properties.getProperty( + "trustStorePassword").toCharArray()); + + } catch (Exception e) { + throw new SAMLEngineException( + "Error loading CryptographicServiceProvider", e); + } finally { + IOUtils.closeQuietly(fis); + IOUtils.closeQuietly(fisTrustStore); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java new file mode 100644 index 000000000..4c7bb18a3 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java @@ -0,0 +1,423 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Properties; + +import eu.stork.peps.auth.engine.X509PrincipalUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.NotImplementedException; +import org.bouncycastle.jce.X509Principal; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.opensaml.Configuration; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.security.SecurityConfiguration; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; +import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; +import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; +import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.x509.BasicX509Credential; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.util.Base64; +import org.opensaml.xml.validation.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.exceptions.SAMLEngineException; + + +/** + * The Class SWSign. Class responsible for signing and validating of messages + * SAML with a certificate store software. + * + * @author fjquevedo + */ +public class SignSW implements SAMLEngineSignI { + + /** The Constant KEYSTORE_TYPE. */ + private static final String KEYSTORE_TYPE = "keystoreType"; + + /** The Constant KEY_STORE_PASSWORD. */ + private static final String KEY_STORE_PASS = "keyStorePassword"; + + /** The logger. */ + private static final Logger LOG = LoggerFactory.getLogger(SignSW.class + .getName()); + + /** The stork own key store. */ + private KeyStore storkOwnKeyStore = null; + + /** + * The instance. + * + * @return the properties + */ + + public final Properties getProperties() { + return properties; + } + + /** + * Gets the stork own key store. + * + * @return the stork own key store + */ + public final KeyStore getStorkOwnKeyStore() { + return storkOwnKeyStore; + } + + /** + * Gets the stork trustStore. + * + * @return the stork own key store + */ + public KeyStore getTrustStore() { + return storkOwnKeyStore; + } + + /** + * Sets the stork own key store. + * + * @param newkOwnKeyStore the new stork own key store + */ + public final void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { + this.storkOwnKeyStore = newkOwnKeyStore; + } + + /** + * Sets the properties. + * + * @param newProperties the new properties + */ + public final void setProperties(final Properties newProperties) { + this.properties = newProperties; + } + + /** The SW sign prop. */ + private Properties properties = null; + + + /** + * Inits the file configuration. + * + * @param fileConf name of the file configuration + * + * @throws SAMLEngineException error at the load from file configuration + */ + public final void init(final String fileConf) + throws SAMLEngineException { + InputStream fileProperties = null; + try { + fileProperties = SignSW.class.getResourceAsStream("/" + + fileConf); + properties = new Properties(); + + properties.loadFromXML(fileProperties); + fileProperties.close(); + } catch (InvalidPropertiesFormatException e) { + LOG.info("Exception: invalid properties format."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOG.info("Exception: invalid file: " + fileConf); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(fileProperties); + } + } + + /** + * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() + * @return the X509Certificate + */ + public final X509Certificate getCertificate() { + throw new NotImplementedException(); + } + + + /** + * Sign the token SAML. + * + * @param tokenSaml the token SAML. + * + * @return the SAML object + * + * @throws SAMLEngineException the SAML engine exception + * + */ + public final SAMLObject sign(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start Sign process."); + try { + final String serialNumber = properties.getProperty("serialNumber"); + final String issuer = properties.getProperty("issuer"); + + String alias = null; + String aliasCert; + X509Certificate certificate; + boolean find = false; + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements() && !find; ) { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + + final String serialNum = certificate.getSerialNumber() + .toString(16); + + X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); + X509Principal issuerDNConf = new X509Principal(issuer); + + if(serialNum.equalsIgnoreCase(serialNumber) + && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ + alias = aliasCert; + find = true; + } + } + if (!find) { + throw new SAMLEngineException("Certificate cannot be found in keystore "); + } + certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); + final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( + alias, properties.getProperty("keyPassword").toCharArray()); + + LOG.info("Recover BasicX509Credential."); + final BasicX509Credential credential = new BasicX509Credential(); + + LOG.debug("Load certificate"); + credential.setEntityCertificate(certificate); + + LOG.debug("Load privateKey"); + credential.setPrivateKey(privateKey); + + LOG.debug("Begin signature with openSaml"); + final Signature signature = (Signature) Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + + signature.setSigningCredential(credential); + + signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + + + final SecurityConfiguration secConfiguration = Configuration + .getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac + .newInstance(); + + KeyInfo keyInfo = keyInfoGenerator.generate(credential); + + signature.setKeyInfo(keyInfo); + signature.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + tokenSaml.setSignature(signature); + + LOG.info("Marshall samlToken."); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + + LOG.info("Sign samlToken."); + Signer.signObject(signature); + + } catch (MarshallingException e) { + LOG.error("MarshallingException"); + throw new SAMLEngineException(e); + } catch (NoSuchAlgorithmException e) { + LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("Generic KeyStore exception."); + throw new SAMLEngineException(e); + } catch (SignatureException e) { + LOG.error("Signature exception."); + throw new SAMLEngineException(e); + } catch (SecurityException e) { + LOG.error("Security exception."); + throw new SAMLEngineException(e); + } catch (UnrecoverableKeyException e) { + LOG.error("UnrecoverableKey exception."); + throw new SAMLEngineException(e); + } + + return tokenSaml; + } + + /** + * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(org.opensaml.common.SignableSAMLObject) + * @param tokenSaml token SAML + * @return the SAMLObject validated. + * @throws SAMLEngineException error validate signature + */ + public final SAMLObject validateSignature(final SignableSAMLObject tokenSaml) + throws SAMLEngineException { + LOG.info("Start signature validation."); + try { + + // Validate structure signature + final SAMLSignatureProfileValidator sigProfValidator = + new SAMLSignatureProfileValidator(); + try { + // Indicates signature id conform to SAML Signature profile + sigProfValidator.validate(tokenSaml.getSignature()); + } catch (ValidationException e) { + LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); + throw new SAMLEngineException(e); + } + + String aliasCert = null; + X509Certificate certificate; + + final List trustCred = new ArrayList(); + + for (final Enumeration e = storkOwnKeyStore.aliases(); e + .hasMoreElements();) { + aliasCert = e.nextElement(); + final BasicX509Credential credential = new BasicX509Credential(); + certificate = (X509Certificate) storkOwnKeyStore + .getCertificate(aliasCert); + credential.setEntityCertificate(certificate); + trustCred.add(credential); + } + + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); + + final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo + .getX509Datas().get(0).getX509Certificates().get(0); + + final CertificateFactory certFact = CertificateFactory + .getInstance("X.509"); + final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 + .decode(xmlCert.getValue())); + final X509Certificate cert = (X509Certificate) certFact + .generateCertificate(bis); + + // Exist only one certificate + final BasicX509Credential entityX509Cred = new BasicX509Credential(); + entityX509Cred.setEntityCertificate(cert); + + // Validate trust certificates + final ExplicitKeyTrustEvaluator keyTrustEvaluator = + new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { + throw new SAMLEngineException("Certificate is not trusted."); + } + + // Validate signature + final SignatureValidator sigValidator = new SignatureValidator( + entityX509Cred); + sigValidator.validate(tokenSaml.getSignature()); + + } catch (ValidationException e) { + LOG.error("ValidationException."); + throw new SAMLEngineException(e); + } catch (KeyStoreException e) { + LOG.error("KeyStoreException.", e); + throw new SAMLEngineException(e); + } catch (GeneralSecurityException e) { + LOG.error("GeneralSecurityException.", e); + throw new SAMLEngineException(e); + } + LOG.info(tokenSaml.getSignatureReferenceID()); + LOG.info("Start signature validation - END." ); + return tokenSaml; + } + + + /** + * Load cryptographic service provider. + * + * @throws SAMLEngineException the SAML engine exception + */ + public final void loadCryptServiceProvider() throws SAMLEngineException { + LOG.info("Load Cryptographic Service Provider"); + FileInputStream fis = null; + try { + // Dynamically register Bouncy Castle provider. + boolean found = false; + // Check if BouncyCastle is already registered as a provider + final Provider[] providers = Security.getProviders(); + for (int i = 0; i < providers.length; i++) { + if (providers[i].getName().equals( + BouncyCastleProvider.PROVIDER_NAME)) { + found = true; + } + } + + // Register only if the provider has not been previously registered + if (!found) { + LOG.info("SAMLCore: Register Bouncy Castle provider."); + Security.insertProviderAt(new BouncyCastleProvider(), Security + .getProviders().length); + } + + storkOwnKeyStore = KeyStore.getInstance(properties + .getProperty(KEYSTORE_TYPE)); + + LOG.info("Loading KeyInfo from keystore file " + properties.getProperty("keystorePath")); + fis = new FileInputStream(properties + .getProperty("keystorePath")); + + storkOwnKeyStore.load(fis, properties.getProperty( + KEY_STORE_PASS).toCharArray()); + + } catch (Exception e) { + LOG.error("Error loading CryptographicServiceProvider", e); + throw new SAMLEngineException( + "Error loading CryptographicServiceProvider", e); + } finally { + IOUtils.closeQuietly(fis); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.java new file mode 100644 index 000000000..a60515593 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.java @@ -0,0 +1,41 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; + +import eu.stork.peps.auth.engine.core.SAMLCore; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; + +/** + * The Class VIDPAuthenticationAttributesBuilder. + * + * @author fjquevedo + */ +public final class VIDPAuthenticationAttributesBuilder extends AbstractSAMLObjectBuilder { + + + /** {@inheritDoc} */ + public VIDPAuthenticationAttributes buildObject() { + return buildObject(SAMLCore.STORK10P_NS.getValue(), VIDPAuthenticationAttributes.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); + } + + /** {@inheritDoc} */ + public VIDPAuthenticationAttributes buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { + return new VIDPAuthenticationAttributesImpl(namespaceURI, localName, namespacePrefix); + } + +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.java new file mode 100644 index 000000000..a6e7e7f60 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.java @@ -0,0 +1,132 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.common.impl.AbstractSignableSAMLObject; +import org.opensaml.xml.XMLObject; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.SPInformation; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class VIDPAuthenticationAttributesImpl. + * + * @author fjquevedo + */ +public final class VIDPAuthenticationAttributesImpl extends AbstractSignableSAMLObject implements +VIDPAuthenticationAttributes { + + private static final Logger LOGGER = LoggerFactory.getLogger(VIDPAuthenticationAttributesImpl.class.getName()); + /** The citizen country code. */ + private CitizenCountryCode citizenCountryCode; + + /** The SP information. */ + private SPInformation spInformation; + + /** + * Instantiates a new requested attributes implement. + * + * @param namespaceURI the namespace URI + * @param elementLocalName the element local name + * @param namespacePrefix the namespace prefix + */ + protected VIDPAuthenticationAttributesImpl(final String namespaceURI, + final String elementLocalName, final String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + /** + * getCitizenCountryCode. + * + * @return the citizen country code + */ + public CitizenCountryCode getCitizenCountryCode() { + return citizenCountryCode; + } + + /** + * getSPInformation + * + * @return the SP information + */ + public SPInformation getSPInformation() { + return spInformation; + } + + /** + * Gets the ordered children. + * + * @return the ordered children + * + */ + public List getOrderedChildren() { + final ArrayList children = new ArrayList(); + + children.add(citizenCountryCode); + children.add(spInformation); + + if (getSignature() != null) { + children.add(getSignature()); + } + + return Collections.unmodifiableList(children); + + } + + /** + * Gets the signature reference id. + * + * @return the signature reference id + * + */ + public String getSignatureReferenceID() { + return null; + } + + /** + * Sets the citizen country code. + * + * @param newCitizenCountryCode the new citizen country code + * + */ + public void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode) { + this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); + } + + /** + * Sets the SP information. + * + * @param newSPInformation the new SP information + * + */ + public void setSPInformation(SPInformation newSPInformation) { + this.spInformation = prepareForAssignment(this.spInformation, newSPInformation); + } + + @Override + public int hashCode() { + LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); + return super.hashCode(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.java new file mode 100644 index 000000000..5635ddd6b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.java @@ -0,0 +1,33 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; + +/** + * The Class VIDPAuthenticationAttributesMarshaller. + * + * @author fjquevedo + */ +public class VIDPAuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { + + /** + * Instantiates a new vIDP authentication attributes marshaller. + */ + public VIDPAuthenticationAttributesMarshaller() { + super(); + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.java new file mode 100644 index 000000000..1de300c03 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.java @@ -0,0 +1,55 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.SPInformation; +import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; + +/** + * The Class VIDPAuthenticationAttributesUnmarshaller. + * + * @author fjquevedo + */ +public class VIDPAuthenticationAttributesUnmarshaller extends + AbstractSAMLObjectUnmarshaller { + + /** + * Process child element. + * + * @param parentObject the parent object + * @param childObject the child object + * + * @throws UnmarshallingException the unmarshalling exception + * + */ + protected final void processChildElement(final XMLObject parentObject, + final XMLObject childObject) throws UnmarshallingException { + final VIDPAuthenticationAttributes vIDPAuthenticationAttr = (VIDPAuthenticationAttributes) parentObject; + + if (childObject instanceof CitizenCountryCode) { + vIDPAuthenticationAttr.setCitizenCountryCode((CitizenCountryCode) childObject); + } else if (childObject instanceof SPInformation) { + vIDPAuthenticationAttr.setSPInformation((SPInformation) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/package-info.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/package-info.java new file mode 100644 index 000000000..e26da6d04 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/package-info.java @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Implementations of STORK 1.0 core specification types and elements. + */ +package eu.stork.peps.auth.engine.core.impl; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/package-info.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/package-info.java new file mode 100644 index 000000000..3393dcf78 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/package-info.java @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Interfaces for STORK 1.0 core specification types and elements. + */ +package eu.stork.peps.auth.engine.core; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops new file mode 100644 index 000000000..d5bd68d13 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops @@ -0,0 +1,23 @@ +K 25 +svn:wc:ra_dav:version-url +V 102 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 120 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/package-info.java +END +ExtensionsSchemaValidator.java +K 25 +svn:wc:ra_dav:version-url +V 133 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.java +END +QAAAttributeSchemaValidator.java +K 25 +svn:wc:ra_dav:version-url +V 135 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.java +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries new file mode 100644 index 000000000..abba3b480 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +package-info.java +file + + + + +2013-12-20T12:27:57.310475Z +cf18b043ca5fc2869360c23c2f78c37c +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +810 + +ExtensionsSchemaValidator.java +file + + + + +2013-12-20T12:27:57.310475Z +88793567b50e1817e8b534b99b7fd40e +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2003 + +QAAAttributeSchemaValidator.java +file + + + + +2013-12-20T12:27:57.310475Z +126bf77d5e22d5609d042e0445160382 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2061 + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base new file mode 100644 index 000000000..760d9c188 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base @@ -0,0 +1,61 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.validator; + +import java.util.List; + +import org.opensaml.saml2.common.Extensions; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class ExtensionsSchemaValidator. + * + * @author fjquevedo + */ +public class ExtensionsSchemaValidator implements Validator { + + + /** + * validate the extensions. + * + * @param extensions the extensions + * + * @throws ValidationException the validation exception + */ + public final void validate(final Extensions extensions) + throws ValidationException { + if (extensions.getUnknownXMLObjects() == null + || extensions.getUnknownXMLObjects().size() <= 0) { + throw new ValidationException("Extension element is empty or not exist."); + } + + List qaa = extensions.getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME); + + if (qaa.size() == 1) { + final Validator validatorQaa = new QAAAttributeSchemaValidator(); + validatorQaa.validate((QAAAttribute) qaa.get(0)); + } else { + throw new ValidationException( + "Extensions must contain only one element QAALevel."); + } + + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base new file mode 100644 index 000000000..be5dc8c34 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base @@ -0,0 +1,65 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.validator; + +import org.opensaml.xml.util.DatatypeHelper; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeSchemaValidator. + * + * @author fjquevedo + */ +public class QAAAttributeSchemaValidator implements Validator { + + + /** + * Validate action. + * + * @param qaa the quality authentication assurance level attribute + * + * @throws ValidationException the validation exception + */ + public final void validate(final QAAAttribute qaa) throws ValidationException { + validateAction(qaa); + } + + + /** + * Validate action. + * + * @param qaaAttribute the quality authentication assurance level attribute. + * + * @throws ValidationException the validation exception + */ + protected final void validateAction(final QAAAttribute qaaAttribute) + throws ValidationException { + if (DatatypeHelper.isEmpty(qaaAttribute.getQaaLevel())) { + throw new ValidationException("QAALevel label must be specified."); + } + + final int qaa = Integer.valueOf(qaaAttribute.getQaaLevel()); + + if (qaa < QAAAttribute.MIN_VALUE || qaa > QAAAttribute.MAX_VALUE) { + throw new ValidationException( + "QAALevel label must be greater than 0."); + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..b98cf7157 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Validation rules for STORK 1.0 core types and elements. + */ +package eu.stork.peps.auth.engine.core.validator; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.java new file mode 100644 index 000000000..760d9c188 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.java @@ -0,0 +1,61 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.validator; + +import java.util.List; + +import org.opensaml.saml2.common.Extensions; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class ExtensionsSchemaValidator. + * + * @author fjquevedo + */ +public class ExtensionsSchemaValidator implements Validator { + + + /** + * validate the extensions. + * + * @param extensions the extensions + * + * @throws ValidationException the validation exception + */ + public final void validate(final Extensions extensions) + throws ValidationException { + if (extensions.getUnknownXMLObjects() == null + || extensions.getUnknownXMLObjects().size() <= 0) { + throw new ValidationException("Extension element is empty or not exist."); + } + + List qaa = extensions.getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME); + + if (qaa.size() == 1) { + final Validator validatorQaa = new QAAAttributeSchemaValidator(); + validatorQaa.validate((QAAAttribute) qaa.get(0)); + } else { + throw new ValidationException( + "Extensions must contain only one element QAALevel."); + } + + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.java new file mode 100644 index 000000000..be5dc8c34 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.java @@ -0,0 +1,65 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.auth.engine.core.validator; + +import org.opensaml.xml.util.DatatypeHelper; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.peps.auth.engine.core.QAAAttribute; + +/** + * The Class QAAAttributeSchemaValidator. + * + * @author fjquevedo + */ +public class QAAAttributeSchemaValidator implements Validator { + + + /** + * Validate action. + * + * @param qaa the quality authentication assurance level attribute + * + * @throws ValidationException the validation exception + */ + public final void validate(final QAAAttribute qaa) throws ValidationException { + validateAction(qaa); + } + + + /** + * Validate action. + * + * @param qaaAttribute the quality authentication assurance level attribute. + * + * @throws ValidationException the validation exception + */ + protected final void validateAction(final QAAAttribute qaaAttribute) + throws ValidationException { + if (DatatypeHelper.isEmpty(qaaAttribute.getQaaLevel())) { + throw new ValidationException("QAALevel label must be specified."); + } + + final int qaa = Integer.valueOf(qaaAttribute.getQaaLevel()); + + if (qaa < QAAAttribute.MIN_VALUE || qaa > QAAAttribute.MAX_VALUE) { + throw new ValidationException( + "QAALevel label must be greater than 0."); + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/package-info.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/package-info.java new file mode 100644 index 000000000..b98cf7157 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/package-info.java @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Validation rules for STORK 1.0 core types and elements. + */ +package eu.stork.peps.auth.engine.core.validator; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/package-info.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/package-info.java new file mode 100644 index 000000000..d3e353e51 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/package-info.java @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes necessary to create a SAML message. + */ +package eu.stork.peps.auth.engine; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/all-wcprops new file mode 100644 index 000000000..96b3f2328 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/all-wcprops @@ -0,0 +1,41 @@ +K 25 +svn:wc:ra_dav:version-url +V 89 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 107 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/package-info.java +END +ConfigurationCreator.java +K 25 +svn:wc:ra_dav:version-url +V 115 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java +END +ConfigurationReader.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java +END +ConfigurationSingleton.java +K 25 +svn:wc:ra_dav:version-url +V 117 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationSingleton.java +END +InstanceEngine.java +K 25 +svn:wc:ra_dav:version-url +V 109 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/InstanceEngine.java +END +ConfigurationEngine.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationEngine.java +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/entries new file mode 100644 index 000000000..b811dc64b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +ConfigurationReader.java +file + + + + +2013-12-20T12:27:57.462475Z +31bb8b4c7e74e039c561bf974dea7c33 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +6979 + +ConfigurationSingleton.java +file + + + + +2013-12-20T12:27:57.466475Z +4350e34e9ec48ce7ad03db6a130559f2 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2367 + +InstanceEngine.java +file + + + + +2013-12-20T12:27:57.466475Z +36fb20db43ded05922bf0bbf785e5d48 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1820 + +ConfigurationEngine.java +file + + + + +2013-12-20T12:27:57.466475Z +99eae7ae70fa5bf4667edfb7912696c2 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1726 + +package-info.java +file + + + + +2013-12-20T12:27:57.462475Z +36f3c0e11d20c8f980d3115b21a23df0 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +806 + +ConfigurationCreator.java +file + + + + +2013-12-20T12:27:57.462475Z +4c130e8c9749dd63e58d57d4d699b7ee +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +4114 + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base new file mode 100644 index 000000000..2fabff7d6 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base @@ -0,0 +1,127 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.InvalidPropertiesFormatException; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class InstanceCreator. + * + * @author fjquevedo + */ +public final class ConfigurationCreator { + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(ConfigurationCreator.class.getName()); + + /** + * Creates the configuration. + * + * @param instanceConfs the instance configuration + * + * @return the map< string, map< string, object>> + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static Map> createConfiguration( + final Map instanceConfs) throws STORKSAMLEngineException { + + final HashMap> instances = + new HashMap>(); + + LOGGER.info("Create configuration."); + try { + // Only create instances for SAMLEngine configuration. + // INSTANCE + for (Map.Entry entry : instanceConfs + .entrySet()) { + final InstanceEngine iEngine = entry.getValue(); + + final Map intance = new HashMap(); + + // CONFIGURATION + for (ConfigurationEngine configuration : iEngine + .getConfiguration()) { + // Properties only for configuration SamlEngine. + if (configuration.getName().equalsIgnoreCase( + "SamlEngineConf")) { + intance.put(configuration.getName(), + getNewInstance(configuration.getParameters() + .get("fileConfiguration"))); + } else { + intance.put(configuration.getName(), configuration + .getParameters()); + } + } + instances.put(entry.getKey(), intance); + } + } catch (STORKSAMLEngineException ex) { + LOGGER.error("Can not create instance from file configuration."); + throw new STORKSAMLEngineException(ex); + } + return instances; + } + + + /** + * Gets the new instance. + * + * @param fileName the file name + * + * @return the properties from the new instance + * + * @throws STORKSAMLEngineException the STORKSAML engine + * runtime exception + */ + private static Properties getNewInstance(final String fileName) + throws STORKSAMLEngineException { + LOGGER.info("Create file configuration properties to Stork Saml Engine."); + InputStream fileEngineProp = null; + try { + fileEngineProp = ConfigurationCreator.class + .getResourceAsStream("/" + fileName); + final Properties configuration = new Properties(); + configuration.loadFromXML(fileEngineProp); + return configuration; + } catch (InvalidPropertiesFormatException e) { + LOGGER.error("Invalid properties format."); + throw new STORKSAMLEngineException(e); + } catch (IOException e) { + LOGGER.error("Error read file: " + fileName); + throw new STORKSAMLEngineException(e); + } finally { + IOUtils.closeQuietly(fileEngineProp); + } + } + + /** + * Instantiates a new instance creator. + */ + private ConfigurationCreator() { + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base new file mode 100644 index 000000000..910f4398e --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base @@ -0,0 +1,69 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.util.Map; + +/** + * The Class ConfigurationEngine. + * + * @author fjquevedo + */ +public class ConfigurationEngine { + + /** The name of the configuration file. */ + private String name; + + /** The parameters. */ + private Map parameters; + + /** + * Gets the name. + * + * @return the name + */ + public final String getName() { + return name; + } + + /** + * Gets the parameters. + * + * @return the parameters + */ + public final Map getParameters() { + return parameters; + } + + /** + * Sets the name. + * + * @param newName the new name + */ + public final void setName(final String newName) { + this.name = newName; + } + + /** + * Sets the parameters. + * + * @param newParameters the parameters + */ + public final void setParameters(final Map newParameters) { + this.parameters = newParameters; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base new file mode 100644 index 000000000..374cf3fc3 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base @@ -0,0 +1,224 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class ConfigurationReader. + * + * @author fjquevedo + */ +public final class ConfigurationReader { + + /** The Constant SAML_ENGINE_CONFIGURATION_FILE. */ + private static final String ENGINE_CONF_FILE = "SamlEngine.xml"; + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(ConfigurationReader.class.getName()); + + /** The Constant NODE_CONFIGURATION. */ + private static final String NODE_CONF = "configuration"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_CONF_NAME = "name"; + + /** The Constant NODE_INSTANCE_NAME. */ + private static final String NODE_INST_NAME = "name"; + + /** The Constant NODE_INSTANCE. */ + private static final String NODE_INSTANCE = "instance"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_PARAM_NAME = "name"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_PARAM_VALUE = "value"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_PARAMETER = "parameter"; + + /** + * Generate parameters. + * + * @param configurationNode the configuration node + * + * @return the map< string, string> + */ + private static Map generateParam( + final Element configurationNode) { + + final HashMap parameters = new HashMap(); + + final NodeList parameterNodes = configurationNode + .getElementsByTagName(NODE_PARAMETER); + + String parameterName; + String parameterValue; + + for (int k = 0; k < parameterNodes.getLength(); ++k) { + // for every parameter find, process. + final Element parameterNode = (Element) parameterNodes.item(k); + parameterName = parameterNode.getAttribute(NODE_PARAM_NAME); + parameterValue = parameterNode.getAttribute(NODE_PARAM_VALUE); + + // verified the content. + if (StringUtils.isBlank(parameterName) + || StringUtils.isBlank(parameterValue)) { + throw new STORKSAMLEngineRuntimeException( + "Error reader parameters (name - value)."); + } else { + parameters.put(parameterName.trim(), parameterValue.trim()); + } + } + return parameters; + } + + /** + * Read configuration. + * + * @return the map< string, instance engine> + * + * @throws SAMLEngineException the STORKSAML engine runtime + * exception + */ + public static Map readConfiguration() + throws SAMLEngineException { + + LOGGER.info("Init reader: " + ENGINE_CONF_FILE); + final Map instanceConfs = + new HashMap(); + + Document document = null; + // Load configuration file + final DocumentBuilderFactory factory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder builder; + + InputStream engineConf = null; + try { + + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + + builder = factory.newDocumentBuilder(); + + engineConf = ConfigurationReader.class + .getResourceAsStream("/" + ENGINE_CONF_FILE); + + document = builder.parse(engineConf); + + // Read instance + final NodeList list = document.getElementsByTagName(NODE_INSTANCE); + + for (int indexElem = 0; indexElem < list.getLength(); ++indexElem) { + final Element element = (Element) list.item(indexElem); + + final InstanceEngine instanceConf = new InstanceEngine(); + + // read every configuration. + final String instanceName = element + .getAttribute(NODE_INST_NAME); + + if (StringUtils.isBlank(instanceName)) { + throw new STORKSAMLEngineRuntimeException( + "Error reader instance name."); + } + instanceConf.setName(instanceName.trim()); + + final NodeList confNodes = element + .getElementsByTagName(NODE_CONF); + + for (int indexNode = 0; indexNode < confNodes.getLength(); ++indexNode) { + + final Element configurationNode = (Element) confNodes + .item(indexNode); + + final String configurationName = configurationNode + .getAttribute(NODE_CONF_NAME); + + if (StringUtils.isBlank(configurationName)) { + throw new STORKSAMLEngineRuntimeException( + "Error reader configuration name."); + } + + final ConfigurationEngine confSamlEngine = + new ConfigurationEngine(); + + // Set configuration name. + confSamlEngine.setName(configurationName.trim()); + + // Read every parameter for this configuration. + final Map parameters = + generateParam(configurationNode); + + // Set parameters + confSamlEngine.setParameters(parameters); + + // Add parameters to the configuration. + instanceConf.getConfiguration().add(confSamlEngine); + } + + // Add to the list of configurations. + instanceConfs.put(element.getAttribute(NODE_INST_NAME), + instanceConf); + } + + } catch (SAXException e) { + LOGGER.error("Error: init library parser."); + throw new SAMLEngineException(e); + } catch (ParserConfigurationException e) { + LOGGER.error("Error: parser configuration file xml."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOGGER.error("Error: read configuration file."); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(engineConf); + } + + return instanceConfs; + } + + /** + * Instantiates a new configuration reader. + */ + private ConfigurationReader() { + + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base new file mode 100644 index 000000000..53cea621d --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base @@ -0,0 +1,74 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class InstanceCreator. + * + * @author fjquevedo + */ +public final class ConfigurationSingleton { + + /** The instance of every engine SAML. */ + private static Map instanceConfigs; + + /** The instances of SAML engine. */ + private static Map> instances; + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(ConfigurationSingleton.class.getName()); + + static { + LOGGER.debug("Read all file configurations. (instances of SAMLEngine)"); + try { + instanceConfigs = ConfigurationReader.readConfiguration(); + } catch (SAMLEngineException e) { + LOGGER.error("Error read configuration file."); + throw new STORKSAMLEngineRuntimeException(e); + } + } + + /** + * Gets the new instance. + * + * @param fileName the file name + * + * @return the properties from the new instance + * + * @throws STORKSAMLEngineException the STORKSAML engine runtime exception + */ + private static Map> getInstance( + final String fileName) throws STORKSAMLEngineException { + return ConfigurationCreator.createConfiguration(instanceConfigs); + } + + /** + * Instantiates a new instance creator. + */ + private ConfigurationSingleton() { + } + +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base new file mode 100644 index 000000000..e0e2d1965 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base @@ -0,0 +1,70 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.util.ArrayList; +import java.util.List; + +/** + * The Class InstanceConfiguration. + * + * @author fjquevedo + */ +public class InstanceEngine { + + /** The configuration. */ + private List configuration = new ArrayList(); + + /** The name. */ + private String name; + + /** + * Gets the parameters. + * + * @return the parameters + */ + public final List getConfiguration() { + return this.configuration; + } + + /** + * Gets the name. + * + * @return the name + */ + public final String getName() { + return name; + } + + /** + * Sets the parameters. + * + * @param newConfiguration the new parameters + */ + public final void setConfiguration(final List newConfiguration) { + this.configuration = newConfiguration; + } + + /** + * Sets the name. + * + * @param newName the new name + */ + public final void setName(final String newName) { + this.name = newName; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..6d0b54297 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes necessary to create a SAML message instance. + */ +package eu.stork.peps.configuration; diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java new file mode 100644 index 000000000..2fabff7d6 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java @@ -0,0 +1,127 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.InvalidPropertiesFormatException; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class InstanceCreator. + * + * @author fjquevedo + */ +public final class ConfigurationCreator { + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(ConfigurationCreator.class.getName()); + + /** + * Creates the configuration. + * + * @param instanceConfs the instance configuration + * + * @return the map< string, map< string, object>> + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public static Map> createConfiguration( + final Map instanceConfs) throws STORKSAMLEngineException { + + final HashMap> instances = + new HashMap>(); + + LOGGER.info("Create configuration."); + try { + // Only create instances for SAMLEngine configuration. + // INSTANCE + for (Map.Entry entry : instanceConfs + .entrySet()) { + final InstanceEngine iEngine = entry.getValue(); + + final Map intance = new HashMap(); + + // CONFIGURATION + for (ConfigurationEngine configuration : iEngine + .getConfiguration()) { + // Properties only for configuration SamlEngine. + if (configuration.getName().equalsIgnoreCase( + "SamlEngineConf")) { + intance.put(configuration.getName(), + getNewInstance(configuration.getParameters() + .get("fileConfiguration"))); + } else { + intance.put(configuration.getName(), configuration + .getParameters()); + } + } + instances.put(entry.getKey(), intance); + } + } catch (STORKSAMLEngineException ex) { + LOGGER.error("Can not create instance from file configuration."); + throw new STORKSAMLEngineException(ex); + } + return instances; + } + + + /** + * Gets the new instance. + * + * @param fileName the file name + * + * @return the properties from the new instance + * + * @throws STORKSAMLEngineException the STORKSAML engine + * runtime exception + */ + private static Properties getNewInstance(final String fileName) + throws STORKSAMLEngineException { + LOGGER.info("Create file configuration properties to Stork Saml Engine."); + InputStream fileEngineProp = null; + try { + fileEngineProp = ConfigurationCreator.class + .getResourceAsStream("/" + fileName); + final Properties configuration = new Properties(); + configuration.loadFromXML(fileEngineProp); + return configuration; + } catch (InvalidPropertiesFormatException e) { + LOGGER.error("Invalid properties format."); + throw new STORKSAMLEngineException(e); + } catch (IOException e) { + LOGGER.error("Error read file: " + fileName); + throw new STORKSAMLEngineException(e); + } finally { + IOUtils.closeQuietly(fileEngineProp); + } + } + + /** + * Instantiates a new instance creator. + */ + private ConfigurationCreator() { + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationEngine.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationEngine.java new file mode 100644 index 000000000..910f4398e --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationEngine.java @@ -0,0 +1,69 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.util.Map; + +/** + * The Class ConfigurationEngine. + * + * @author fjquevedo + */ +public class ConfigurationEngine { + + /** The name of the configuration file. */ + private String name; + + /** The parameters. */ + private Map parameters; + + /** + * Gets the name. + * + * @return the name + */ + public final String getName() { + return name; + } + + /** + * Gets the parameters. + * + * @return the parameters + */ + public final Map getParameters() { + return parameters; + } + + /** + * Sets the name. + * + * @param newName the new name + */ + public final void setName(final String newName) { + this.name = newName; + } + + /** + * Sets the parameters. + * + * @param newParameters the parameters + */ + public final void setParameters(final Map newParameters) { + this.parameters = newParameters; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java new file mode 100644 index 000000000..9ae8bb669 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java @@ -0,0 +1,225 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class ConfigurationReader. + * + * @author fjquevedo + */ +public final class ConfigurationReader { + + /** The Constant SAML_ENGINE_CONFIGURATION_FILE. */ + private static final String ENGINE_CONF_FILE = "SamlEngine.xml"; + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(ConfigurationReader.class.getName()); + + /** The Constant NODE_CONFIGURATION. */ + private static final String NODE_CONF = "configuration"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_CONF_NAME = "name"; + + /** The Constant NODE_INSTANCE_NAME. */ + private static final String NODE_INST_NAME = "name"; + + /** The Constant NODE_INSTANCE. */ + private static final String NODE_INSTANCE = "instance"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_PARAM_NAME = "name"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_PARAM_VALUE = "value"; + + /** The Constant NODE_CONFIGURATION_NAME. */ + private static final String NODE_PARAMETER = "parameter"; + + /** + * Generate parameters. + * + * @param configurationNode the configuration node + * + * @return the map< string, string> + */ + private static Map generateParam( + final Element configurationNode) { + + final HashMap parameters = new HashMap(); + + final NodeList parameterNodes = configurationNode + .getElementsByTagName(NODE_PARAMETER); + + String parameterName; + String parameterValue; + + for (int k = 0; k < parameterNodes.getLength(); ++k) { + // for every parameter find, process. + final Element parameterNode = (Element) parameterNodes.item(k); + parameterName = parameterNode.getAttribute(NODE_PARAM_NAME); + parameterValue = parameterNode.getAttribute(NODE_PARAM_VALUE); + + // verified the content. + if (StringUtils.isBlank(parameterName) + || StringUtils.isBlank(parameterValue)) { + throw new STORKSAMLEngineRuntimeException( + "Error reader parameters (name - value)."); + } else { + parameters.put(parameterName.trim(), parameterValue.trim()); + } + } + return parameters; + } + + /** + * Read configuration. + * + * @return the map< string, instance engine> + * + * @throws SAMLEngineException the STORKSAML engine runtime + * exception + */ + public static Map readConfiguration() + throws SAMLEngineException { + + LOGGER.info("Init reader: " + ENGINE_CONF_FILE); + final Map instanceConfs = + new HashMap(); + + Document document = null; + // Load configuration file + final DocumentBuilderFactory factory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder builder; + + InputStream engineConf = null; + try { + + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + + builder = factory.newDocumentBuilder(); + + engineConf = ConfigurationReader.class + .getResourceAsStream("/" + ENGINE_CONF_FILE); + + + document = builder.parse(engineConf); + + // Read instance + final NodeList list = document.getElementsByTagName(NODE_INSTANCE); + + for (int indexElem = 0; indexElem < list.getLength(); ++indexElem) { + final Element element = (Element) list.item(indexElem); + + final InstanceEngine instanceConf = new InstanceEngine(); + + // read every configuration. + final String instanceName = element + .getAttribute(NODE_INST_NAME); + + if (StringUtils.isBlank(instanceName)) { + throw new STORKSAMLEngineRuntimeException( + "Error reader instance name."); + } + instanceConf.setName(instanceName.trim()); + + final NodeList confNodes = element + .getElementsByTagName(NODE_CONF); + + for (int indexNode = 0; indexNode < confNodes.getLength(); ++indexNode) { + + final Element configurationNode = (Element) confNodes + .item(indexNode); + + final String configurationName = configurationNode + .getAttribute(NODE_CONF_NAME); + + if (StringUtils.isBlank(configurationName)) { + throw new STORKSAMLEngineRuntimeException( + "Error reader configuration name."); + } + + final ConfigurationEngine confSamlEngine = + new ConfigurationEngine(); + + // Set configuration name. + confSamlEngine.setName(configurationName.trim()); + + // Read every parameter for this configuration. + final Map parameters = + generateParam(configurationNode); + + // Set parameters + confSamlEngine.setParameters(parameters); + + // Add parameters to the configuration. + instanceConf.getConfiguration().add(confSamlEngine); + } + + // Add to the list of configurations. + instanceConfs.put(element.getAttribute(NODE_INST_NAME), + instanceConf); + } + + } catch (SAXException e) { + LOGGER.error("Error: init library parser."); + throw new SAMLEngineException(e); + } catch (ParserConfigurationException e) { + LOGGER.error("Error: parser configuration file xml."); + throw new SAMLEngineException(e); + } catch (IOException e) { + LOGGER.error("Error: read configuration file."); + throw new SAMLEngineException(e); + } finally { + IOUtils.closeQuietly(engineConf); + } + + return instanceConfs; + } + + /** + * Instantiates a new configuration reader. + */ + private ConfigurationReader() { + + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationSingleton.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationSingleton.java new file mode 100644 index 000000000..53cea621d --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationSingleton.java @@ -0,0 +1,74 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.exceptions.SAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineException; +import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; + +/** + * The Class InstanceCreator. + * + * @author fjquevedo + */ +public final class ConfigurationSingleton { + + /** The instance of every engine SAML. */ + private static Map instanceConfigs; + + /** The instances of SAML engine. */ + private static Map> instances; + + /** The Constant LOGGER. */ + private static final Logger LOGGER = LoggerFactory + .getLogger(ConfigurationSingleton.class.getName()); + + static { + LOGGER.debug("Read all file configurations. (instances of SAMLEngine)"); + try { + instanceConfigs = ConfigurationReader.readConfiguration(); + } catch (SAMLEngineException e) { + LOGGER.error("Error read configuration file."); + throw new STORKSAMLEngineRuntimeException(e); + } + } + + /** + * Gets the new instance. + * + * @param fileName the file name + * + * @return the properties from the new instance + * + * @throws STORKSAMLEngineException the STORKSAML engine runtime exception + */ + private static Map> getInstance( + final String fileName) throws STORKSAMLEngineException { + return ConfigurationCreator.createConfiguration(instanceConfigs); + } + + /** + * Instantiates a new instance creator. + */ + private ConfigurationSingleton() { + } + +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/InstanceEngine.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/InstanceEngine.java new file mode 100644 index 000000000..e0e2d1965 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/InstanceEngine.java @@ -0,0 +1,70 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.configuration; + +import java.util.ArrayList; +import java.util.List; + +/** + * The Class InstanceConfiguration. + * + * @author fjquevedo + */ +public class InstanceEngine { + + /** The configuration. */ + private List configuration = new ArrayList(); + + /** The name. */ + private String name; + + /** + * Gets the parameters. + * + * @return the parameters + */ + public final List getConfiguration() { + return this.configuration; + } + + /** + * Gets the name. + * + * @return the name + */ + public final String getName() { + return name; + } + + /** + * Sets the parameters. + * + * @param newConfiguration the new parameters + */ + public final void setConfiguration(final List newConfiguration) { + this.configuration = newConfiguration; + } + + /** + * Sets the name. + * + * @param newName the new name + */ + public final void setName(final String newName) { + this.name = newName; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/package-info.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/package-info.java new file mode 100644 index 000000000..6d0b54297 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/package-info.java @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes necessary to create a SAML message instance. + */ +package eu.stork.peps.configuration; diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/all-wcprops new file mode 100644 index 000000000..d4b9b9008 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25 +svn:wc:ra_dav:version-url +V 86 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions +END +SAMLEngineException.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java +END +STORKSAMLEngineException.java +K 25 +svn:wc:ra_dav:version-url +V 116 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 104 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/package-info.java +END +STORKSAMLEngineRuntimeException.java +K 25 +svn:wc:ra_dav:version-url +V 123 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.java +END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/entries new file mode 100644 index 000000000..6493ed6e8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +STORKSAMLEngineRuntimeException.java +file + + + + +2013-12-20T12:27:57.454475Z +aebe4e4afb2f11cf42448486970a5d85 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1812 + +SAMLEngineException.java +file + + + + +2013-12-20T12:27:57.454475Z +38d2d1ec4d590abab4bb36d845d9f86b +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1710 + +STORKSAMLEngineException.java +file + + + + +2013-12-20T12:27:57.454475Z +622c95d2e770b38dafe815bcfaae8994 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3460 + +package-info.java +file + + + + +2013-12-20T12:27:57.454475Z +56145f85c2084454a3c223dd9e103846 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +792 + diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base new file mode 100644 index 000000000..366379ad0 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base @@ -0,0 +1,57 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.exceptions; + +/** + * The Class SAMLEngineException. + * + * @author fjquevedo + */ +public class SAMLEngineException extends Exception { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 2611361164977849837L; + + /** + * Instantiates a new SAMLEngine exception. + * + * @param wrappedException the wrapped exception + */ + public SAMLEngineException(final Exception wrappedException) { + super(wrappedException); + } + + /** + * Instantiates a new SAMLEngine exception. + * + * @param message the message + */ + public SAMLEngineException(final String message) { + super(message); + } + + /** + * Instantiates a new SAMLEngine exception. + * + * @param message the message + * @param wrappedException the wrapped exception + */ + public SAMLEngineException(final String message, + final Exception wrappedException) { + super(message, wrappedException); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base new file mode 100644 index 000000000..bddcbd1b3 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base @@ -0,0 +1,135 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.exceptions; + +/** + * The Class STORKSAMLEngineException. + * + * @author fjquevedo + */ +public class STORKSAMLEngineException extends Exception { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = -8319723167019122930L; + + /** The error code. */ + private String errorCode; + + /** The error detail. */ + private String errorDetail; + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineException(final Exception wrappedException) { + super(wrappedException); + } + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param errorMessage the error message + */ + public STORKSAMLEngineException(final String errorMessage) { + super(errorMessage); + } + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param message the message + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineException(final String message, + final Exception wrappedException) { + super(message, wrappedException); + } + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param newErrorCode the error code + * @param errorMessage the error message + * @param newErrorDetail the error detail + */ + public STORKSAMLEngineException(final String newErrorCode, + final String errorMessage, final String newErrorDetail) { + super(errorMessage); + this.errorCode = newErrorCode; + this.errorDetail = newErrorDetail; + } + + /** + * Gets the error code. + * + * @return the error code + */ + public final String getErrorCode() { + return this.errorCode; + } + + /** + * Gets the error detail. + * + * @return the error detail + */ + public final String getErrorDetail() { + return errorDetail; + } + + /** + * Gets the error message. + * + * @return the error message + */ + public final String getErrorMessage() { + return super.getMessage(); + } + + + /** + * Gets the message. + * + * @return the message of the exception. + * + * @see java.lang.Throwable#getMessage() + */ + public final String getMessage() { + return "Error (no. " + errorCode + ") processing request : " + + super.getMessage(); + } + + /** + * Sets the error code. + * + * @param newErrorCode the new error code + */ + public final void setErrorCode(final String newErrorCode) { + this.errorCode = newErrorCode; + } + + /** + * Sets the error detail. + * + * @param newErrorDetail the new error detail + */ + public final void setErrorDetail(final String newErrorDetail) { + this.errorDetail = newErrorDetail; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base new file mode 100644 index 000000000..30b9b49b4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.exceptions; + +/** + * The Class STORKSAMLEngineRuntimeException. + * + * @author fjquevedo + */ +public class STORKSAMLEngineRuntimeException extends RuntimeException { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 5829810358581493517L; + + /** + * Instantiates a new sTORKSAML engine runtime exception. + * + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineRuntimeException(final Exception wrappedException) { + super(wrappedException); + } + + /** + * Creates a new instance of application exception. + * + * @param cause the exception cause. + */ + public STORKSAMLEngineRuntimeException(final String cause) { + super(cause); + } + + /** + * Instantiates a new sTORKSAML engine runtime exception. + * + * @param message the message + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineRuntimeException(final String message, + final Exception wrappedException) { + super(message, wrappedException); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..0c34528fc --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes for STORK exceptions management. + */ +package eu.stork.peps.exceptions; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java new file mode 100644 index 000000000..366379ad0 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java @@ -0,0 +1,57 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.exceptions; + +/** + * The Class SAMLEngineException. + * + * @author fjquevedo + */ +public class SAMLEngineException extends Exception { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 2611361164977849837L; + + /** + * Instantiates a new SAMLEngine exception. + * + * @param wrappedException the wrapped exception + */ + public SAMLEngineException(final Exception wrappedException) { + super(wrappedException); + } + + /** + * Instantiates a new SAMLEngine exception. + * + * @param message the message + */ + public SAMLEngineException(final String message) { + super(message); + } + + /** + * Instantiates a new SAMLEngine exception. + * + * @param message the message + * @param wrappedException the wrapped exception + */ + public SAMLEngineException(final String message, + final Exception wrappedException) { + super(message, wrappedException); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.java new file mode 100644 index 000000000..bddcbd1b3 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.java @@ -0,0 +1,135 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.exceptions; + +/** + * The Class STORKSAMLEngineException. + * + * @author fjquevedo + */ +public class STORKSAMLEngineException extends Exception { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = -8319723167019122930L; + + /** The error code. */ + private String errorCode; + + /** The error detail. */ + private String errorDetail; + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineException(final Exception wrappedException) { + super(wrappedException); + } + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param errorMessage the error message + */ + public STORKSAMLEngineException(final String errorMessage) { + super(errorMessage); + } + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param message the message + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineException(final String message, + final Exception wrappedException) { + super(message, wrappedException); + } + + /** + * Instantiates a new sTORKSAML engine exception. + * + * @param newErrorCode the error code + * @param errorMessage the error message + * @param newErrorDetail the error detail + */ + public STORKSAMLEngineException(final String newErrorCode, + final String errorMessage, final String newErrorDetail) { + super(errorMessage); + this.errorCode = newErrorCode; + this.errorDetail = newErrorDetail; + } + + /** + * Gets the error code. + * + * @return the error code + */ + public final String getErrorCode() { + return this.errorCode; + } + + /** + * Gets the error detail. + * + * @return the error detail + */ + public final String getErrorDetail() { + return errorDetail; + } + + /** + * Gets the error message. + * + * @return the error message + */ + public final String getErrorMessage() { + return super.getMessage(); + } + + + /** + * Gets the message. + * + * @return the message of the exception. + * + * @see java.lang.Throwable#getMessage() + */ + public final String getMessage() { + return "Error (no. " + errorCode + ") processing request : " + + super.getMessage(); + } + + /** + * Sets the error code. + * + * @param newErrorCode the new error code + */ + public final void setErrorCode(final String newErrorCode) { + this.errorCode = newErrorCode; + } + + /** + * Sets the error detail. + * + * @param newErrorDetail the new error detail + */ + public final void setErrorDetail(final String newErrorDetail) { + this.errorDetail = newErrorDetail; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.java new file mode 100644 index 000000000..30b9b49b4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.java @@ -0,0 +1,56 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.exceptions; + +/** + * The Class STORKSAMLEngineRuntimeException. + * + * @author fjquevedo + */ +public class STORKSAMLEngineRuntimeException extends RuntimeException { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 5829810358581493517L; + + /** + * Instantiates a new sTORKSAML engine runtime exception. + * + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineRuntimeException(final Exception wrappedException) { + super(wrappedException); + } + + /** + * Creates a new instance of application exception. + * + * @param cause the exception cause. + */ + public STORKSAMLEngineRuntimeException(final String cause) { + super(cause); + } + + /** + * Instantiates a new sTORKSAML engine runtime exception. + * + * @param message the message + * @param wrappedException the wrapped exception + */ + public STORKSAMLEngineRuntimeException(final String message, + final Exception wrappedException) { + super(message, wrappedException); + } +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/package-info.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/package-info.java new file mode 100644 index 000000000..0c34528fc --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/package-info.java @@ -0,0 +1,19 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes for STORK exceptions management. + */ +package eu.stork.peps.exceptions; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/.svn/all-wcprops new file mode 100644 index 000000000..ead80d4e8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 57 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test +END diff --git a/id/server/stork2-saml-engine/src/test/.svn/entries b/id/server/stork2-saml-engine/src/test/.svn/entries new file mode 100644 index 000000000..1b6d0b3e1 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +resources +dir + +java +dir + diff --git a/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops new file mode 100644 index 000000000..56c8ee113 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 62 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java +END diff --git a/id/server/stork2-saml-engine/src/test/java/.svn/entries b/id/server/stork2-saml-engine/src/test/java/.svn/entries new file mode 100644 index 000000000..ca124ed28 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +eu +dir + diff --git a/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF b/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF new file mode 100644 index 000000000..5e9495128 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops new file mode 100644 index 000000000..e00b13d5a --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 65 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu +END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries new file mode 100644 index 000000000..cc3e19816 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +stork +dir + diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops new file mode 100644 index 000000000..ac0852630 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 71 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork +END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries new file mode 100644 index 000000000..66d2ea82a --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +peps +dir + diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops new file mode 100644 index 000000000..5555d11e2 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 76 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps +END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries new file mode 100644 index 000000000..e20bc1c1d --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +test +dir + diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops new file mode 100644 index 000000000..ee98ec5bd --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 81 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test +END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries new file mode 100644 index 000000000..a7074362f --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +simple +dir + diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops new file mode 100644 index 000000000..063e2de18 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops @@ -0,0 +1,47 @@ +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple +END +StorkResponseTest.java +K 25 +svn:wc:ra_dav:version-url +V 111 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java +END +StorkAttrQueryResponseTest.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java +END +SimpleBaseTest.java +K 25 +svn:wc:ra_dav:version-url +V 107 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java +END +package-info.java +K 25 +svn:wc:ra_dav:version-url +V 105 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/package-info.java +END +SSETestUtils.java +K 25 +svn:wc:ra_dav:version-url +V 105 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java +END +StorkAttrQueryRequestTest.java +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java +END +StorkAuthRequestTest.java +K 25 +svn:wc:ra_dav:version-url +V 114 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java +END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries new file mode 100644 index 000000000..0fbc1b254 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +SSETestUtils.java +file + + + + +2013-12-20T12:27:57.274475Z +f9c51e04914afb9a99d52e642c8a6a42 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +5521 + +StorkAttrQueryRequestTest.java +file + + + + +2013-12-20T12:27:57.274475Z +66e336a173f22c2ba55b933157c703c8 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +25393 + +StorkAuthRequestTest.java +file + + + + +2013-12-20T12:27:57.274475Z +c1e89785bc4af791adb9760fd42b7d56 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +31301 + +StorkResponseTest.java +file + + + + +2013-12-20T12:27:57.274475Z +016c270fa1231e25cc1ccf67d0ebf6cf +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +39179 + +StorkAttrQueryResponseTest.java +file + + + + +2013-12-20T12:27:57.274475Z +44021c766949a57b10b61cd466a57b55 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +39559 + +SimpleBaseTest.java +file + + + + +2013-12-20T12:27:57.274475Z +6effea1d03de1bd17fd8d07d3778df58 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +1871 + +package-info.java +file + + + + +2013-12-20T12:27:57.274475Z +3cd87d2f80f4a5a4f42ab5bc844dd2f3 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +811 + diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base new file mode 100644 index 000000000..b1443bb0e --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base @@ -0,0 +1,173 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; + +import javax.xml.XMLConstants; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.commons.io.IOUtils; +import org.bouncycastle.util.encoders.Base64; +import org.opensaml.Configuration; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.Marshaller; +import org.opensaml.xml.io.MarshallerFactory; +import org.opensaml.xml.io.MarshallingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * The Class SSETestUtils. + */ +public final class SSETestUtils { + + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(SSETestUtils.class.getName()); + + /** + * Instantiates a new sSE test utils. + */ + private SSETestUtils() { + } + + /** + * Prints the tree DOM. + * + * @param samlToken the SAML token + * @param isIndent the is indent + * + * @return the string + * @throws TransformerException the exception + */ + public static String printTreeDOM(final Element samlToken, final boolean isIndent) throws TransformerException { + // set up a transformer + final TransformerFactory transfac = TransformerFactory.newInstance(); + final Transformer trans = transfac.newTransformer(); + trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + trans.setOutputProperty(OutputKeys.INDENT, String.valueOf(isIndent)); + + // create string from XML tree + final StringWriter stringWriter = new StringWriter(); + final StreamResult result = new StreamResult(stringWriter); + final DOMSource source = new DOMSource(samlToken); + trans.transform(source, result); + final String xmlString = stringWriter.toString(); + + return xmlString; + } + + /** + * Marshall. + * + * @param samlToken the SAML token + * + * @return the byte[] + * + * @throws MarshallingException the marshalling exception + * @throws ParserConfigurationException the parser configuration exception + * @throws TransformerException the transformer exception + */ + public static byte[] marshall(final XMLObject samlToken) + throws MarshallingException, ParserConfigurationException, + TransformerException { + + final javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory + .newInstance(); + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setNamespaceAware(true); + dbf.setIgnoringComments(true); + final javax.xml.parsers.DocumentBuilder docBuild = dbf + .newDocumentBuilder(); + + // Get the marshaller factory + final MarshallerFactory marshallerFactory = Configuration + .getMarshallerFactory(); + + // Get the Subject marshaller + final Marshaller marshaller = marshallerFactory + .getMarshaller(samlToken); + + final Document doc = docBuild.newDocument(); + + // Marshall the SAML token + marshaller.marshall(samlToken, doc); + + // Obtain a byte array representation of the marshalled SAML object + final DOMSource domSource = new DOMSource(doc); + final StringWriter writer = new StringWriter(); + final StreamResult result = new StreamResult(writer); + final TransformerFactory transFact = TransformerFactory.newInstance(); + final Transformer transformer = transFact.newTransformer(); + transformer.transform(domSource, result); + + return writer.toString().getBytes(); + } + + /** + * Encode SAML token. + * + * @param samlToken the SAML token + * + * @return the string + */ + public static String encodeSAMLToken(final byte[] samlToken) { + return new String(Base64.encode(samlToken)); + } + + /** + * Read stork SAML from file. + * + * @param resource the resource + * + * @return the byte[] + * @throws IOException the exception + * + */ + public static byte[] readStorkSamlFromFile(final String resource) + throws IOException { + InputStream inputStream = null; + byte[] bytes; + + try { + inputStream = StorkAuthRequestTest.class + .getResourceAsStream(resource); + + // Create the byte array to hold the data + bytes = new byte[(int) inputStream.available()]; + inputStream.read(bytes); + } catch (IOException e) { + LOG.error("Error read from file: " + resource); + throw e; + } finally { + IOUtils.closeQuietly(inputStream); + } + return bytes; + + } +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base new file mode 100644 index 000000000..97fa4b7cc --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base @@ -0,0 +1,62 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import org.junit.Test; + +import junit.framework.Assert; +import junit.framework.TestCase; +import eu.stork.peps.auth.engine.STORKSAMLEngine; + +/** + * The Class SimpleBaseTest. Defines a set of test the initialization of the + * SAML engine. + */ +public class SimpleBaseTest extends TestCase { + + /** + * Test SAML engine correct configuration name. + */ + @Test + public final void testSamlEngineCorrectInit() { + Assert.assertNotNull(STORKSAMLEngine.getInstance("CONF1")); + } + + /** + * Test SAML engine error configuration name. + */ + @Test + public final void testSamlEngineErrorNameConf() { + Assert.assertNull(STORKSAMLEngine.getInstance("CONF_ERROR")); + } + + /** + * Test SAML engine error name null. + */ + @Test + public final void testSamlEngineErrorNameNull() { + Assert.assertNull(STORKSAMLEngine.getInstance(null)); + } + + /** + * Test SAML engine correct name configuration with spaces. + */ + @Test + public final void testSamlEngineErrorNameSpaces() { + Assert.assertNotNull(STORKSAMLEngine.getInstance(" CONF1 ")); + } + +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base new file mode 100644 index 000000000..7fa305d3b --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base @@ -0,0 +1,790 @@ +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.Arrays; + +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAttrQueryRequest; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +public class StorkAttrQueryRequestTest { + + /** The engines. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0"); + private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); + private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); + + + /** + * Instantiates a new stork authentication request test. + */ + public StorkAttrQueryRequestTest() { + pal = new PersonalAttributeList(); + + final PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + final ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + final PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + final PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + eIDNumber.setValue(Arrays.asList("ES/IS/1234567890")); + pal.add(eIDNumber); + + final PersonalAttribute givenName = new PersonalAttribute(); + givenName.setName("givenName"); + givenName.setIsRequired(true); + givenName.setValue(Arrays.asList("Sveinbjorn")); + pal.add(givenName); + + destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest"; + //assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + + } + + /** The destination. */ + private String destination; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The service provider id. */ + private String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The List of Personal Attributes. */ + private IPersonalAttributeList pal; + + /** The attribute query request. */ + private static byte[] attrRequest; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkAttrQueryRequestTest.class.getName()); + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + } + + /** + * Test generate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryRequest() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // new parameters + request.setEIDSectorShare(false); + request.setEIDCrossSectorShare(false); + request.setEIDCrossBorderShare(false); + + STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request); + byte[] reqByte = req1.getTokenSaml(); + FileOutputStream output = null; + + try { + output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml")); + output.write(reqByte); + } catch (Exception e) { + e.printStackTrace(); + throw new STORKSAMLEngineException(e); + } finally { + try { output.close(); } catch (Exception e) { throw new STORKSAMLEngineException(e); } + } + + + + + LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); + + request.setCitizenCountryCode("IS"); + LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); + } + + /** + * Test generate authentication request error personal attribute name error. + */ + @Test + public final void testGenerateAttrQueryRequestPALsErr1() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("attrNotValid"); + worngAttr.setIsRequired(true); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + + // news parameters + request.setEIDSectorShare(false); + request.setEIDCrossSectorShare(false); + request.setEIDCrossBorderShare(false); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + /** + * Test generate authentication request error personal attribute value error. + */ + @Test + public final void testGenerateAttrQueryRequestPALsErr2() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute attrNotValid = new PersonalAttribute(); + attrNotValid.setName("attrNotValid"); + attrNotValid.setIsRequired(true); + palWrong.add(attrNotValid); + + + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request authentication assurance level + * negative value. + */ + @Test + public final void testGenerateAttrQueryRequestQaalErr1() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(-1); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request service provider sector null. + */ + @Test + public final void testGenerateAttrQueryRequestSectorErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + + } + } + + /** + * Test generate authentication request service provider institution null. + */ + @Test + public final void testGenerateAttrQueryRequestInstitutionrErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(null); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAttrQueryRequestApplicationErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(null); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider country null. + */ + @Test + public final void testGenerateAttrQueryRequestCountryErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(null); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request error with quality authentication + * assurance level wrong. + */ + @Test + public final void testGenerateAttrQueryRequestQaalErr2() { + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(0); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request personal attribute list null value. + */ + @Test + public final void testGenerateAttrQueryRequestPALErr1() { + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(null); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request null parameter. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestNullParam() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAttrQueryRequest(null); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request error bytes encode. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestErrorEncode() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAttrQueryRequest("messageError".getBytes()); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequest() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + attrRequest = engine.generateSTORKAttrQueryRequest(request).getTokenSaml(); + + final STORKAttrQueryRequest validatedRequest = engine.validateSTORKAttrQueryRequest(attrRequest); + + assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); + + } + + /** + * Test validate data authenticate request. Verified parameters after + * validation. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateDataAttrQueryRequest() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = engine.validateSTORKAttrQueryRequest(attrRequest); + + assertEquals("Sestination incorrect: ", request.getDestination(), destination); + + assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); + + assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); + assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); + assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); + assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); + assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), null); + + } + + /** + * Test validate file attribute query request. Validate from XML file. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAttrQueryRequest() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml"); + + try { + engine.validateSTORKAttrQueryRequest(bytes); + fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + } + } + + /** + * Test validate file authentication request tag delete. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAttrRequestTagDelete() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml"); + + try { + engine.validateSTORKAttrQueryRequest(bytes); + fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + + } + } + + /** + * Test validate authentication request not trusted token. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestNotTrustedErr1() + throws STORKSAMLEngineException { + + try { + final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine + .getInstance("CONF2"); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineNotTrusted + .generateSTORKAttrQueryRequest(request).getTokenSaml(); + + engine.validateSTORKAttrQueryRequest(authReqNotTrust); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("validateSTORKAttrQueryRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test validate authentication request trusted. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestTrusted() + throws STORKSAMLEngineException { + + final STORKSAMLEngine engineTrusted = STORKSAMLEngine + .getInstance("CONF3"); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest( + request).getTokenSaml(); + + // engine ("CONF1") no have trust certificate from "CONF2" + engine.validateSTORKAttrQueryRequest(authReqNotTrust); + + } + + + + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAttrQueryRequestNADA() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(null); + request.setSpApplication(null); + request.setSpCountry(null); + + try { + + engine.validateSTORKAttrQueryRequest(attrRequest); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test validate authentication request with unknown elements. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestWithUnknownElements() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute unknown = new PersonalAttribute(); + unknown.setName("unknown"); + unknown.setIsRequired(true); + pAttList.add(unknown); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + STORKAttrQueryRequest req = new STORKAttrQueryRequest(); + + req = engine3.generateSTORKAttrQueryRequest(request); + + req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); + + assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); + assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); + + } + + /** + * Test generate Request with required elements by default + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + STORKAttrQueryRequest req = new STORKAttrQueryRequest(); + STORKAttrQueryRequest reqTrue = new STORKAttrQueryRequest(); + STORKAttrQueryRequest reqFalse = new STORKAttrQueryRequest(); + + reqTrue = engine.generateSTORKAttrQueryRequest(request); + reqFalse = engine2.generateSTORKAttrQueryRequest(request); + req = engine3.generateSTORKAttrQueryRequest(request); + + + String token = new String(req.getTokenSaml()); + String reqTrueToken = new String(reqTrue.getTokenSaml()); + String reqFalseToken = new String(reqFalse.getTokenSaml()); + + assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); + assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); + assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); + + } + + /** + * Test validating attribute query and getting alias used to save + * the saml trusted certificate into trustore + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAtrrQueryRequestGettingItsAlias() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + STORKAttrQueryRequest req = new STORKAttrQueryRequest(); + + req = engine3.generateSTORKAttrQueryRequest(request); + req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + + req = engine2.generateSTORKAttrQueryRequest(request); + req = engine2.validateSTORKAttrQueryRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + } + +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base new file mode 100644 index 000000000..27c6cfe39 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base @@ -0,0 +1,920 @@ +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.junit.Ignore; +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAttrQueryRequest; +import eu.stork.peps.auth.commons.STORKAttrQueryResponse; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.commons.STORKStatusCode; +import eu.stork.peps.auth.commons.STORKSubStatusCode; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +public class StorkAttrQueryResponseTest { + + /** The engine. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + + /** + * Gets the engine. + * + * @return the engine + */ + public static STORKSAMLEngine getEngine() { + return engine; + } + + /** + * Sets the engine. + * + * @param newEngine the new engine + */ + public static void setEngine(final STORKSAMLEngine newEngine) { + StorkAttrQueryResponseTest.engine = newEngine; + } + + /** The destination. */ + private static String destination; + + /** The service provider sector. */ + private static String spSector; + + /** The service provider institution. */ + private static String spInstitution; + + /** The service provider application. */ + private static String spApplication; + + /** The service provider country. */ + private static String spCountry; + + /** The service provider id. */ + private static String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The state. */ + private static String state = "IS"; + + /** The town. */ + private static String town = "Reykjavik"; + + /** The postal code. */ + private static String postalCode = "105"; + + /** The street name. */ + private static String streetName = "Gudrunartun"; + + /** The street number. */ + private static String streetNumber = "10"; + + /** The List of Personal Attributes. */ + private static IPersonalAttributeList pal; + + /** The assertion consumer URL. */ + private static String assertConsumerUrl; + + /** The attribute query request. */ + private static byte[] attrQueryRequest; + + /** The attribute query response. */ + private static byte[] attrQueryResponse; + + /** The attribute query request. */ + private static STORKAttrQueryRequest attrQueryenRequest; + + /** The attribute query response. */ + private static STORKAttrQueryResponse attrQeuryenResponse; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkAttrQueryResponseTest.class.getName()); + + /** + * Instantiates a new stork response test. + */ + public StorkAttrQueryResponseTest() { + super(); + } + + /** The IP address. */ + private static String ipAddress; + + /** The destination URL. */ + private static String destinationUrl; + + /** The is hashing. */ + private final boolean isHashing = Boolean.TRUE; + + /** The is not hashing. */ + private final boolean isNotHashing = Boolean.FALSE; + + /** The ERROR text. */ + private static final String ERROR_TXT = "generateAttrQueryResponse(...) should've thrown an STORKSAMLEngineException!"; + + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + + pal = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + pal.add(eIDNumber); + + final PersonalAttribute givenName = new PersonalAttribute(); + givenName.setName("givenName"); + givenName.setIsRequired(true); + pal.add(givenName); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + pal.add(canRessAddress); + + PersonalAttribute newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + pal.add(newAttribute); + + destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + spSector = "EDU001"; + spInstitution = "OXF001"; + spApplication = "APP001"; + spCountry = "EN"; + + spId = "EDU001-APP001-APP001"; + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + request.setDestination(destination); + //request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + //request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(request) + .getTokenSaml(); + + attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest); + + } catch (STORKSAMLEngineException e) { + fail("Error create STORKAuthnRequest"); + } + + ipAddress = "111.222.333.444"; + + destinationUrl = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + + pal = new PersonalAttributeList(); + + isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ages = new ArrayList(); + + ages.add("16"); + ages.add("18"); + + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(isAgeOver); + + dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(dateOfBirth); + + eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789IS"); + eIDNumber.setValue(idNumber); + eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(eIDNumber); + + canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + + canRessAddress.setComplexValue(address); + pal.add(canRessAddress); + + newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap values = new HashMap(); + + values.put("value1", "value1"); + values.put("value2", "value2"); + values.put("value3", "value3"); + values.put("value4", "value4"); + + newAttribute.setComplexValue(values); + pal.add(newAttribute); + + } + + /** + * Test generate attribute query request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryResponse() throws STORKSAMLEngineException { + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + final STORKAttrQueryResponse storkResponse = getEngine() + .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, + destinationUrl, isNotHashing); + + attrQueryResponse = storkResponse.getTokenSaml(); + + FileOutputStream output = null; + + try { + output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml")); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + output.write(attrQueryResponse); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); + + + } + + /** + * Test validation id parameter mandatory. + */ + @Test + public final void testResponseMandatoryId() { + final String identifier = attrQueryenRequest.getSamlId(); + attrQueryenRequest.setSamlId(null); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, destinationUrl, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setSamlId(identifier); + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response in response to err1. + */ + @Test + public final void testResponseMandatoryIssuer() { + + final String issuer = attrQueryenRequest.getIssuer(); + attrQueryenRequest.setIssuer(null); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, destinationUrl, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setIssuer(issuer); + LOG.error("Error"); + } + } + + + /** + * Test generate attribute query response assertion consumer null. + */ + /*@Test + public final void testResponseMandatoryAssertionConsumerServiceURL() { + final String asserConsumerUrl = attrQueryenRequest + .getAssertionConsumerServiceURL(); + attrQueryenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response IP address null. + */ + @Test + public final void testResponseValidationIP() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, null, + destinationUrl, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response with personal attribute list null. + */ + @Test + public final void testResponseMandatoryPersonalAttributeList() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(null); + + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, destinationUrl, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate attribute query response token null. + */ + @Test + public final void testResponseInvalidParametersToken() { + try { + getEngine().validateSTORKAttrQueryResponse(null, ipAddress); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate attribute query response IP null. + */ + @Test + public final void STORKAttrQueryResponse() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response parameter name wrong. + */ + @Test + public final void testResponseInvalidParametersAttr() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("AttrWrong"); + wrongList.add(worngAttr); + + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrSimpleValue() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoValue() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoName() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null complex value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrComplexValue() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setComplexValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test validate attribute query response IP distinct and disabled validation + * IP. + */ + @Test + public final void testResponseInvalidParametersIPDistinct() { + try { + // ipAddress origin "111.222.333.444" + // ipAddrValidation = false + // Subject Confirmation Bearer. + + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, "127.0.0.1"); + } catch (STORKSAMLEngineException e) { + fail("validateAttributeQueryResponse(...) should've thrown an STORKSAMLEngineException!"); + LOG.error("Error"); + } + } + + /** + * Test response invalid parameters invalid token. + */ + @Test + public final void testResponseInvalidParametersTokenMsg() { + try { + // ipAddress origin "111.222.333.444" + // Subject Confirmation Bearer. + getEngine().validateSTORKAttrQueryResponse("errorMessage".getBytes(), + ipAddress); + fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate attribute query response is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + /*@Test + public final void testValidateAuthenticationResponseIsFail() + throws STORKSAMLEngineException { + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertFalse("Generate incorrect response: ", attrQeuryenResponse.isFail()); + } + + /** + * Test validate attribute query response destination. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseDestination() + throws STORKSAMLEngineException { + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertEquals("Destination incorrect: ", + attrQeuryenResponse.getInResponseTo(), attrQueryenRequest.getSamlId()); + } + + /** + * Test validate attribute query response values. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseValuesComplex() + throws STORKSAMLEngineException { + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertEquals("Country incorrect:", attrQeuryenResponse.getCountry(), "ES"); + + final Iterator iterator = attrQeuryenResponse + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + final PersonalAttribute attribute = iterator.next(); + if (attribute.getName().equalsIgnoreCase( + "canonicalResidenceAddress")) { + assertEquals("State incorrect: ", state, attribute + .getComplexValue().get("state")); + assertEquals("Town incorrect: ", town, attribute + .getComplexValue().get("town")); + assertEquals("Postal code incorrect: ", postalCode, attribute + .getComplexValue().get("postalCode")); + assertEquals("Street name incorrect: ", streetName, attribute + .getComplexValue().get("streetName")); + assertEquals("Street number incorrect: ", streetNumber, + attribute.getComplexValue().get("streetNumber")); + } + } + } + + /** + * Test generate attribute query response fail in response to it's null. + * @throws STORKSAMLEngineException + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test //( expected=STORKSAMLEngineException.class) + public final void testGenerateAttrQueryResponseFailInResponseToNull() throws STORKSAMLEngineException { + final String identifier = attrQueryenRequest.getSamlId(); + attrQueryenRequest.setSamlId(null); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setSamlId(identifier); + LOG.error("Error"); + //throw new STORKSAMLEngineException(e); + } + } + + /** + * Test generate attribute query response fail assertion consumer URL err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + /*@Test + public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() + throws STORKSAMLEngineException { + + final String assertConsumerUrl = attrQueryenRequest + .getAssertionConsumerServiceURL(); + attrQueryenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + attrQueryResponse = getEngine().generateSTORKAuthnResponseFail(attrQueryenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response fail code error err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryResponseFailCodeErrorNull() + throws STORKSAMLEngineException { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setStatusCode(null); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + fail("generateAttrQueryResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test generate attribute query request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryResponse() throws STORKSAMLEngineException { + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(dateOfBirth); + + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + complex.put("one", "two"); + + //eIDNumber.setValue(null); + //eIDNumber.setValue(idNumber); + //eIDNumber.setComplexValue(complex); + + eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); + palist.add(eIDNumber); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + + canRessAddress.setComplexValue(address); + palist.add(canRessAddress); + + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAttrQueryResponse storkResponse = getEngine() + .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, + destinationUrl, isNotHashing); + + attrQueryResponse = storkResponse.getTokenSaml(); + LOG.info("Request id: " + attrQueryenRequest.getSamlId()); + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); + + + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + LOG.info("RESPONSE ID: " + attrQeuryenResponse.getSamlId()); + LOG.info("RESPONSE IN_RESPONSE_TO: " + attrQeuryenResponse.getInResponseTo()); + LOG.info("RESPONSE COUNTRY: " + attrQeuryenResponse.getCountry()); + + } + + + + + + /** + * Test validate attribute query response fail is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryResponseFailIsFail() + throws STORKSAMLEngineException { + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage("message"); + + attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + + LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(attrQueryResponse)); + + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + LOG.info("COUNTRY: " + attrQeuryenResponse.getCountry()); + assertTrue("Generate incorrect response: ", attrQeuryenResponse.isFail()); + } + + /** + * Test generate/validate response with signedDoc + * + * @throws STORKSAMLEngineException + * the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryResponseWithSignedDoc() + throws STORKSAMLEngineException { + + String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + palist.add(isAgeOver); + + attrQueryenRequest.setPersonalAttributeList(palist); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAttrQueryResponse storkResponse = getEngine() + .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, + destinationUrl, isNotHashing); + + attrQueryResponse = storkResponse.getTokenSaml(); + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse + .getPersonalAttributeList().get("signedDoc").getValue().get(0) + .equals(signedDocResponse)); + + } +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base new file mode 100644 index 000000000..7223ab483 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base @@ -0,0 +1,966 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class StorkAuthRequestTest defines a class to . + */ +public class StorkAuthRequestTest { + + /** The engines. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); + private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); + + + /** + * Instantiates a new stork authentication request test. + */ + public StorkAuthRequestTest() { + pal = new PersonalAttributeList(); + + final PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + final ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + final PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + final PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + pal.add(eIDNumber); + + destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + + spName = "University of Oxford"; + spSector = "EDU001"; + spInstitution = "OXF001"; + spApplication = "APP001"; + spCountry = "EN"; + + spId = "EDU001-OXF001-APP001"; + + } + + /** The destination. */ + private String destination; + + /** The service provider name. */ + private String spName; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The service provider id. */ + private String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The List of Personal Attributes. */ + private IPersonalAttributeList pal; + + /** The assertion consumer URL. */ + private String assertConsumerUrl; + + /** The authentication request. */ + private static byte[] authRequest; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkAuthRequestTest.class.getName()); + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + } + + /** + * Test generate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnRequest() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + //engine.generateSTORKAuthnRequest(request); + + LOG.info("STORKAuthnRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); + request.setCitizenCountryCode("ES"); + LOG.info("STORKAuthnRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); + } + + + /** + * Test generate authentication request error personal attribute name error. + */ + @Test + public final void testGenerateAuthnRequestPALsErr1() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("attrNotValid"); + worngAttr.setIsRequired(true); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + /** + * Test generate authentication request error personal attribute value error. + */ + @Test + public final void testGenerateAuthnRequestPALsErr2() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute attrNotValid = new PersonalAttribute(); + attrNotValid.setName("attrNotValid"); + attrNotValid.setIsRequired(true); + palWrong.add(attrNotValid); + + + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request error provider name null. + */ + @Test + public final void testGenerateAuthnRequestSPNAmeErr1() { + + + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(null); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try + { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + catch (STORKSAMLEngineException e) + { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request authentication assurance level + * negative value. + */ + @Test + public final void testGenerateAuthnRequestQaalErr1() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(-1); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request service provider sector null. + */ + @Test + public final void testGenerateAuthnRequestSectorErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + + } + } + + /** + * Test generate authentication request service provider institution null. + */ + @Test + public final void testGenerateAuthnRequestInstitutionrErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(null); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAuthnRequestApplicationErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(null); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider country null. + */ + @Test + public final void testGenerateAuthnRequestCountryErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(null); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request error with quality authentication + * assurance level wrong. + */ + @Test + public final void testGenerateAuthnRequestQaalErr2() { + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(0); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request personal attribute list null value. + */ + @Test + public final void testGenerateAuthnRequestPALErr1() { + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(null); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request error with assertion consumer URL + * null. + */ + @Test + public final void testGenerateAuthnRequestAssertionConsumerErr1() { + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(null); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request null parameter. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestNullParam() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAuthnRequest(null); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request error bytes encode. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestErrorEncode() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAuthnRequest("messageError".getBytes()); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequest() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + authRequest = engine.generateSTORKAuthnRequest(request).getTokenSaml(); + + final STORKAuthnRequest validatedRequest = engine.validateSTORKAuthnRequest(authRequest); + + assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); + + } + + /** + * Test validate data authenticate request. Verified parameters after + * validation. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateDataAuthnRequest() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = engine.validateSTORKAuthnRequest(authRequest); + + assertEquals("Sestination incorrect: ", request.getDestination(), destination); + + assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); + + assertEquals("Service provider incorrect: ", request.getProviderName(), spName); + assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); + assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); + assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); + assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); + assertEquals("Asserition consumer URL incorrect: ", request.getAssertionConsumerServiceURL(), assertConsumerUrl); + + assertEquals("SP Country incorrect: ", request.getSpCountry(), spCountry); + assertEquals("SP Id incorrect: ", request.getSPID(), spId); + assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), "ES"); + + } + + /** + * Test validate file authentication request. Validate from XML file. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAuthnRequest() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml"); + + try { + engine.validateSTORKAuthnRequest(bytes); + fail("testValidateFileAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + } + } + + /** + * Test validate file authentication request tag delete. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAuthnRequestTagDelete() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml"); + + try { + engine.validateSTORKAuthnRequest(bytes); + fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + + } + } + + /** + * Test validate authentication request not trusted token. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestNotTrustedErr1() + throws STORKSAMLEngineException { + + try { + final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine + .getInstance("CONF2"); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineNotTrusted + .generateSTORKAuthnRequest(request).getTokenSaml(); + + engine.validateSTORKAuthnRequest(authReqNotTrust); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("validateSTORKAuthnRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test validate authentication request trusted. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestTrusted() + throws STORKSAMLEngineException { + + final STORKSAMLEngine engineTrusted = STORKSAMLEngine + .getInstance("CONF3"); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineTrusted.generateSTORKAuthnRequest( + request).getTokenSaml(); + + // engine ("CONF1") no have trust certificate from "CONF2" + engine.validateSTORKAuthnRequest(authReqNotTrust); + + } + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAuthnRequestNADA() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(null); + request.setSpApplication(null); + request.setSpCountry(null); + + try { + engine.validateSTORKAuthnRequest(authRequest); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error: " + e.getMessage()); + } + } + + /** + * Test validate authentication request with unknown elements. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestWithUnknownElements() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute unknown = new PersonalAttribute(); + unknown.setName("unknown"); + unknown.setIsRequired(true); + pAttList.add(unknown); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + + req = engine3.generateSTORKAuthnRequest(request); + + req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); + + assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); + assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); + + } + + /** + * Test generate Request with required elements by default + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + STORKAuthnRequest reqTrue = new STORKAuthnRequest(); + STORKAuthnRequest reqFalse = new STORKAuthnRequest(); + + reqTrue = engine.generateSTORKAuthnRequest(request); + reqFalse = engine2.generateSTORKAuthnRequest(request); + req = engine3.generateSTORKAuthnRequest(request); + + + String token = new String(req.getTokenSaml()); + String reqTrueToken = new String(reqTrue.getTokenSaml()); + String reqFalseToken = new String(reqFalse.getTokenSaml()); + + assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); + assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); + assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); + + } + + /** + * Test validating request and getting alias used to save + * the saml trusted certificate into trustore + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestGettingItsAlias() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + + req = engine3.generateSTORKAuthnRequest(request); + req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + + req = engine2.generateSTORKAuthnRequest(request); + req = engine2.validateSTORKAuthnRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + + + + } + + /** + * Test generating/validating request with signedDoc + * + * @throws STORKSAMLEngineException + * the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnRequestWithSignedDoc() + throws STORKSAMLEngineException { + + String signedDocRequest = "VGVzdCB0ZXh0"; + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + PersonalAttributeList paler = new PersonalAttributeList(); + + final PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + paler.add(eIDNumber); + + final PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + final ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + paler.add(isAgeOver); + + final PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + final ArrayList signedDocs = new ArrayList(); + signedDocs.add(signedDocRequest); + signedDoc.setValue(signedDocs); + signedDoc.setIsRequired(false); + paler.add(signedDoc); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(paler); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + + req = engine.generateSTORKAuthnRequest(request); + req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); + + assertTrue("SignedDoc request should be the same: ", req + .getPersonalAttributeList().get("signedDoc").getValue().get(0) + .equals(signedDocRequest)); + + + } + +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base new file mode 100644 index 000000000..481cbc28c --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base @@ -0,0 +1,931 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.commons.STORKStatusCode; +import eu.stork.peps.auth.commons.STORKSubStatusCode; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class AuthRequestTest. + */ +public class StorkResponseTest { + + /** The engine. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + + /** + * Gets the engine. + * + * @return the engine + */ + public static STORKSAMLEngine getEngine() { + return engine; + } + + /** + * Sets the engine. + * + * @param newEngine the new engine + */ + public static void setEngine(final STORKSAMLEngine newEngine) { + StorkResponseTest.engine = newEngine; + } + + /** The destination. */ + private static String destination; + + /** The service provider name. */ + private static String spName; + + /** The service provider sector. */ + private static String spSector; + + /** The service provider institution. */ + private static String spInstitution; + + /** The service provider application. */ + private static String spApplication; + + /** The service provider country. */ + private static String spCountry; + + /** The service provider id. */ + private static String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The state. */ + private static String state = "ES"; + + /** The town. */ + private static String town = "Madrid"; + + /** The municipality code. */ + private static String municipalityCode = "MA001"; + + /** The postal code. */ + private static String postalCode = "28038"; + + /** The street name. */ + private static String streetName = "Marchamalo"; + + /** The street number. */ + private static String streetNumber = "3"; + + /** The apartament number. */ + private static String apartamentNumber = "5º E"; + + /** The List of Personal Attributes. */ + private static IPersonalAttributeList pal; + + /** The assertion consumer URL. */ + private static String assertConsumerUrl; + + /** The authentication request. */ + private static byte[] authRequest; + + /** The authentication response. */ + private static byte[] authResponse; + + /** The authentication request. */ + private static STORKAuthnRequest authenRequest; + + /** The authentication response. */ + private static STORKAuthnResponse authnResponse; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkResponseTest.class.getName()); + + /** + * Instantiates a new stork response test. + */ + public StorkResponseTest() { + super(); + } + + /** The IP address. */ + private static String ipAddress; + + /** The is hashing. */ + private final boolean isHashing = Boolean.TRUE; + + /** The is not hashing. */ + private final boolean isNotHashing = Boolean.FALSE; + + /** The ERROR text. */ + private static final String ERROR_TXT = "generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"; + + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + + pal = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + pal.add(eIDNumber); + + final PersonalAttribute givenName = new PersonalAttribute(); + givenName.setName("givenName"); + givenName.setIsRequired(true); + pal.add(givenName); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + pal.add(canRessAddress); + + PersonalAttribute newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + pal.add(newAttribute); + + destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + spName = "University Oxford"; + + spName = "University of Oxford"; + spSector = "EDU001"; + spInstitution = "OXF001"; + spApplication = "APP001"; + spCountry = "EN"; + + spId = "EDU001-APP001-APP001"; + + final STORKAuthnRequest request = new STORKAuthnRequest(); + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + authRequest = getEngine().generateSTORKAuthnRequest(request) + .getTokenSaml(); + + authenRequest = getEngine().validateSTORKAuthnRequest(authRequest); + + } catch (STORKSAMLEngineException e) { + fail("Error create STORKAuthnRequest"); + } + + ipAddress = "111.222.333.444"; + + pal = new PersonalAttributeList(); + + isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ages = new ArrayList(); + + ages.add("16"); + ages.add("18"); + + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(isAgeOver); + + dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(dateOfBirth); + + eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + eIDNumber.setValue(idNumber); + eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(eIDNumber); + + canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("municipalityCode", municipalityCode); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + address.put("apartamentNumber", apartamentNumber); + + canRessAddress.setComplexValue(address); + pal.add(canRessAddress); + + newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap values = new HashMap(); + + values.put("value1", "value1"); + values.put("value2", "value2"); + values.put("value3", "value3"); + values.put("value4", "value4"); + + newAttribute.setComplexValue(values); + pal.add(newAttribute); + + } + + /** + * Test generate authentication request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnResponse() throws STORKSAMLEngineException { + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + final STORKAuthnResponse storkResponse = getEngine() + .generateSTORKAuthnResponse(authenRequest, response, ipAddress, + isNotHashing); + + authResponse = storkResponse.getTokenSaml(); + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); + } + + /** + * Test validation id parameter mandatory. + */ + @Test + public final void testResponseMandatoryId() { + final String identifier = authenRequest.getSamlId(); + authenRequest.setSamlId(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + authenRequest.setSamlId(identifier); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response in response to err1. + */ + @Test + public final void testResponseMandatoryIssuer() { + + final String issuer = authenRequest.getIssuer(); + authenRequest.setIssuer(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + authenRequest.setIssuer(issuer); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response assertion consumer null. + */ + @Test + public final void testResponseMandatoryAssertionConsumerServiceURL() { + final String asserConsumerUrl = authenRequest + .getAssertionConsumerServiceURL(); + authenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + authenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response IP address null. + */ + @Test + public final void testResponseValidationIP() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, null, + isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication response with personal attribute list null. + */ + @Test + public final void testResponseMandatoryPersonalAttributeList() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(null); + + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication response token null. + */ + @Test + public final void testResponseInvalidParametersToken() { + try { + getEngine().validateSTORKAuthnResponse(null, ipAddress); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication response IP null. + */ + @Test + public final void testResponseInvalidParametersIP() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response parameter name wrong. + */ + @Test + public final void testResponseInvalidParametersAttr() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("AttrWrong"); + wrongList.add(worngAttr); + + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrSimpleValue() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoValue() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoName() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null complex value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrComplexValue() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setComplexValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test validate authentication response IP distinct and disabled validation + * IP. + */ + @Test + public final void testResponseInvalidParametersIPDistinct() { + try { + // ipAddress origin "111.222.333.444" + // ipAddrValidation = false + // Subject Confirmation Bearer. + + getEngine().validateSTORKAuthnResponse(authResponse, "127.0.0.1"); + fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test response invalid parameters invalid token. + */ + @Test + public final void testResponseInvalidParametersTokenMsg() { + try { + // ipAddress origin "111.222.333.444" + // Subject Confirmation Bearer. + getEngine().validateSTORKAuthnResponse("errorMessage".getBytes(), + ipAddress); + fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication response is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseIsFail() + throws STORKSAMLEngineException { + try { + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + fail("Generate incorrect response"); + } catch (Exception e) { + LOG.error("ERROR: " + e.getMessage()); + } + } + + /** + * Test validate authentication response destination. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseDestination() + throws STORKSAMLEngineException { + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + assertEquals("Destination incorrect: ", + authnResponse.getInResponseTo(), authenRequest.getSamlId()); + } + + /** + * Test validate authentication response values. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public final void testValidateAuthenticationResponseValuesComplex() + throws STORKSAMLEngineException { + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + assertEquals("Country incorrect:", authnResponse.getCountry(), "EN"); + + final Iterator iterator = authnResponse + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + final PersonalAttribute attribute = iterator.next(); + if (attribute.getName().equalsIgnoreCase( + "canonicalResidenceAddress")) { + assertEquals("State incorrect: ", state, attribute + .getComplexValue().get("state")); + assertEquals("Municipality Code incorrect: ", municipalityCode, + attribute.getComplexValue().get("municipalityCode")); + assertEquals("Town incorrect: ", town, attribute + .getComplexValue().get("town")); + assertEquals("Postal code incorrect: ", postalCode, attribute + .getComplexValue().get("postalCode")); + assertEquals("Street name incorrect: ", streetName, attribute + .getComplexValue().get("streetName")); + assertEquals("Street number incorrect: ", streetNumber, + attribute.getComplexValue().get("streetNumber")); + assertEquals("Apartament number incorrect: ", apartamentNumber, + attribute.getComplexValue().get("apartamentNumber")); + } + } + } + + /** + * Test generate authenticate response fail in response to it's null. + * @throws STORKSAMLEngineException + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test //( expected=STORKSAMLEngineException.class) + public final void testGenerateAuthnResponseFailInResponseToNull() throws STORKSAMLEngineException { + final String identifier = authenRequest.getSamlId(); + authenRequest.setSamlId(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + authenRequest.setSamlId(identifier); + LOG.error("Error"); + //throw new STORKSAMLEngineException(e); + } + } + + /** + * Test generate authenticate response fail assertion consumer URL err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() + throws STORKSAMLEngineException { + + final String assertConsumerUrl = authenRequest + .getAssertionConsumerServiceURL(); + authenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + authenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response fail code error err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnResponseFailCodeErrorNull() + throws STORKSAMLEngineException { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(null); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test generate authentication request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnResponse() throws STORKSAMLEngineException { + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(dateOfBirth); + + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + complex.put("one", "two"); + + //eIDNumber.setValue(null); + //eIDNumber.setValue(idNumber); + //eIDNumber.setComplexValue(complex); + + eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); + palist.add(eIDNumber); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("municipalityCode", municipalityCode); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + address.put("apartamentNumber", apartamentNumber); + + canRessAddress.setComplexValue(address); + palist.add(canRessAddress); + + + final STORKAuthnResponse response = new STORKAuthnResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAuthnResponse storkResponse = getEngine() + .generateSTORKAuthnResponse(authenRequest, response, ipAddress, + isNotHashing); + + authResponse = storkResponse.getTokenSaml(); + LOG.info("Request id: " + authenRequest.getSamlId()); + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); + + + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + LOG.info("RESPONSE ID: " + authnResponse.getSamlId()); + LOG.info("RESPONSE IN_RESPONSE_TO: " + authnResponse.getInResponseTo()); + LOG.info("RESPONSE COUNTRY: " + authnResponse.getCountry()); + + } + + + + + + /** + * Test validate authentication response fail is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseFailIsFail() + throws STORKSAMLEngineException { + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage("message"); + + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + + LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(authResponse)); + + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + LOG.info("COUNTRY: " + authnResponse.getCountry()); + assertTrue("Generate incorrect response: ", authnResponse.isFail()); + } + + /** + * Test generate/validate response with signedDoc + * + * @throws STORKSAMLEngineException + * the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthenResponseWithSignedDoc() + throws STORKSAMLEngineException { + + String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + palist.add(isAgeOver); + + authenRequest.setPersonalAttributeList(palist); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAuthnResponse storkResponse = getEngine() + .generateSTORKAuthnResponse(authenRequest, response, ipAddress, + isNotHashing); + + authResponse = storkResponse.getTokenSaml(); + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + assertTrue("SignedDoc response should be the same: ", authnResponse + .getPersonalAttributeList().get("signedDoc").getValue().get(0) + .equals(signedDocResponse)); + + } + +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base new file mode 100644 index 000000000..34fed0e39 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,20 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes necessary to create a SAML message. + * @since 1.0 + */ +package eu.stork.peps.test.simple; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java new file mode 100644 index 000000000..b1443bb0e --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java @@ -0,0 +1,173 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; + +import javax.xml.XMLConstants; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.commons.io.IOUtils; +import org.bouncycastle.util.encoders.Base64; +import org.opensaml.Configuration; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.Marshaller; +import org.opensaml.xml.io.MarshallerFactory; +import org.opensaml.xml.io.MarshallingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * The Class SSETestUtils. + */ +public final class SSETestUtils { + + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(SSETestUtils.class.getName()); + + /** + * Instantiates a new sSE test utils. + */ + private SSETestUtils() { + } + + /** + * Prints the tree DOM. + * + * @param samlToken the SAML token + * @param isIndent the is indent + * + * @return the string + * @throws TransformerException the exception + */ + public static String printTreeDOM(final Element samlToken, final boolean isIndent) throws TransformerException { + // set up a transformer + final TransformerFactory transfac = TransformerFactory.newInstance(); + final Transformer trans = transfac.newTransformer(); + trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + trans.setOutputProperty(OutputKeys.INDENT, String.valueOf(isIndent)); + + // create string from XML tree + final StringWriter stringWriter = new StringWriter(); + final StreamResult result = new StreamResult(stringWriter); + final DOMSource source = new DOMSource(samlToken); + trans.transform(source, result); + final String xmlString = stringWriter.toString(); + + return xmlString; + } + + /** + * Marshall. + * + * @param samlToken the SAML token + * + * @return the byte[] + * + * @throws MarshallingException the marshalling exception + * @throws ParserConfigurationException the parser configuration exception + * @throws TransformerException the transformer exception + */ + public static byte[] marshall(final XMLObject samlToken) + throws MarshallingException, ParserConfigurationException, + TransformerException { + + final javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory + .newInstance(); + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setNamespaceAware(true); + dbf.setIgnoringComments(true); + final javax.xml.parsers.DocumentBuilder docBuild = dbf + .newDocumentBuilder(); + + // Get the marshaller factory + final MarshallerFactory marshallerFactory = Configuration + .getMarshallerFactory(); + + // Get the Subject marshaller + final Marshaller marshaller = marshallerFactory + .getMarshaller(samlToken); + + final Document doc = docBuild.newDocument(); + + // Marshall the SAML token + marshaller.marshall(samlToken, doc); + + // Obtain a byte array representation of the marshalled SAML object + final DOMSource domSource = new DOMSource(doc); + final StringWriter writer = new StringWriter(); + final StreamResult result = new StreamResult(writer); + final TransformerFactory transFact = TransformerFactory.newInstance(); + final Transformer transformer = transFact.newTransformer(); + transformer.transform(domSource, result); + + return writer.toString().getBytes(); + } + + /** + * Encode SAML token. + * + * @param samlToken the SAML token + * + * @return the string + */ + public static String encodeSAMLToken(final byte[] samlToken) { + return new String(Base64.encode(samlToken)); + } + + /** + * Read stork SAML from file. + * + * @param resource the resource + * + * @return the byte[] + * @throws IOException the exception + * + */ + public static byte[] readStorkSamlFromFile(final String resource) + throws IOException { + InputStream inputStream = null; + byte[] bytes; + + try { + inputStream = StorkAuthRequestTest.class + .getResourceAsStream(resource); + + // Create the byte array to hold the data + bytes = new byte[(int) inputStream.available()]; + inputStream.read(bytes); + } catch (IOException e) { + LOG.error("Error read from file: " + resource); + throw e; + } finally { + IOUtils.closeQuietly(inputStream); + } + return bytes; + + } +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java new file mode 100644 index 000000000..97fa4b7cc --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java @@ -0,0 +1,62 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import org.junit.Test; + +import junit.framework.Assert; +import junit.framework.TestCase; +import eu.stork.peps.auth.engine.STORKSAMLEngine; + +/** + * The Class SimpleBaseTest. Defines a set of test the initialization of the + * SAML engine. + */ +public class SimpleBaseTest extends TestCase { + + /** + * Test SAML engine correct configuration name. + */ + @Test + public final void testSamlEngineCorrectInit() { + Assert.assertNotNull(STORKSAMLEngine.getInstance("CONF1")); + } + + /** + * Test SAML engine error configuration name. + */ + @Test + public final void testSamlEngineErrorNameConf() { + Assert.assertNull(STORKSAMLEngine.getInstance("CONF_ERROR")); + } + + /** + * Test SAML engine error name null. + */ + @Test + public final void testSamlEngineErrorNameNull() { + Assert.assertNull(STORKSAMLEngine.getInstance(null)); + } + + /** + * Test SAML engine correct name configuration with spaces. + */ + @Test + public final void testSamlEngineErrorNameSpaces() { + Assert.assertNotNull(STORKSAMLEngine.getInstance(" CONF1 ")); + } + +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java new file mode 100644 index 000000000..7fa305d3b --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java @@ -0,0 +1,790 @@ +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.Arrays; + +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAttrQueryRequest; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +public class StorkAttrQueryRequestTest { + + /** The engines. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0"); + private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); + private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); + + + /** + * Instantiates a new stork authentication request test. + */ + public StorkAttrQueryRequestTest() { + pal = new PersonalAttributeList(); + + final PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + final ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + final PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + final PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + eIDNumber.setValue(Arrays.asList("ES/IS/1234567890")); + pal.add(eIDNumber); + + final PersonalAttribute givenName = new PersonalAttribute(); + givenName.setName("givenName"); + givenName.setIsRequired(true); + givenName.setValue(Arrays.asList("Sveinbjorn")); + pal.add(givenName); + + destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest"; + //assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + + } + + /** The destination. */ + private String destination; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The service provider id. */ + private String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The List of Personal Attributes. */ + private IPersonalAttributeList pal; + + /** The attribute query request. */ + private static byte[] attrRequest; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkAttrQueryRequestTest.class.getName()); + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + } + + /** + * Test generate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryRequest() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // new parameters + request.setEIDSectorShare(false); + request.setEIDCrossSectorShare(false); + request.setEIDCrossBorderShare(false); + + STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request); + byte[] reqByte = req1.getTokenSaml(); + FileOutputStream output = null; + + try { + output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml")); + output.write(reqByte); + } catch (Exception e) { + e.printStackTrace(); + throw new STORKSAMLEngineException(e); + } finally { + try { output.close(); } catch (Exception e) { throw new STORKSAMLEngineException(e); } + } + + + + + LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); + + request.setCitizenCountryCode("IS"); + LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); + } + + /** + * Test generate authentication request error personal attribute name error. + */ + @Test + public final void testGenerateAttrQueryRequestPALsErr1() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("attrNotValid"); + worngAttr.setIsRequired(true); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + + // news parameters + request.setEIDSectorShare(false); + request.setEIDCrossSectorShare(false); + request.setEIDCrossBorderShare(false); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + /** + * Test generate authentication request error personal attribute value error. + */ + @Test + public final void testGenerateAttrQueryRequestPALsErr2() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute attrNotValid = new PersonalAttribute(); + attrNotValid.setName("attrNotValid"); + attrNotValid.setIsRequired(true); + palWrong.add(attrNotValid); + + + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request authentication assurance level + * negative value. + */ + @Test + public final void testGenerateAttrQueryRequestQaalErr1() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(-1); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request service provider sector null. + */ + @Test + public final void testGenerateAttrQueryRequestSectorErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + + } + } + + /** + * Test generate authentication request service provider institution null. + */ + @Test + public final void testGenerateAttrQueryRequestInstitutionrErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(null); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAttrQueryRequestApplicationErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(null); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider country null. + */ + @Test + public final void testGenerateAttrQueryRequestCountryErr() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(null); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request error with quality authentication + * assurance level wrong. + */ + @Test + public final void testGenerateAttrQueryRequestQaalErr2() { + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(0); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request personal attribute list null value. + */ + @Test + public final void testGenerateAttrQueryRequestPALErr1() { + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(null); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + engine.generateSTORKAttrQueryRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request null parameter. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestNullParam() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAttrQueryRequest(null); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request error bytes encode. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestErrorEncode() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAttrQueryRequest("messageError".getBytes()); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequest() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + attrRequest = engine.generateSTORKAttrQueryRequest(request).getTokenSaml(); + + final STORKAttrQueryRequest validatedRequest = engine.validateSTORKAttrQueryRequest(attrRequest); + + assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); + + } + + /** + * Test validate data authenticate request. Verified parameters after + * validation. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateDataAttrQueryRequest() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = engine.validateSTORKAttrQueryRequest(attrRequest); + + assertEquals("Sestination incorrect: ", request.getDestination(), destination); + + assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); + + assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); + assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); + assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); + assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); + assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), null); + + } + + /** + * Test validate file attribute query request. Validate from XML file. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAttrQueryRequest() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml"); + + try { + engine.validateSTORKAttrQueryRequest(bytes); + fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + } + } + + /** + * Test validate file authentication request tag delete. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAttrRequestTagDelete() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml"); + + try { + engine.validateSTORKAttrQueryRequest(bytes); + fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + + } + } + + /** + * Test validate authentication request not trusted token. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestNotTrustedErr1() + throws STORKSAMLEngineException { + + try { + final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine + .getInstance("CONF2"); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineNotTrusted + .generateSTORKAttrQueryRequest(request).getTokenSaml(); + + engine.validateSTORKAttrQueryRequest(authReqNotTrust); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("validateSTORKAttrQueryRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test validate authentication request trusted. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestTrusted() + throws STORKSAMLEngineException { + + final STORKSAMLEngine engineTrusted = STORKSAMLEngine + .getInstance("CONF3"); + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest( + request).getTokenSaml(); + + // engine ("CONF1") no have trust certificate from "CONF2" + engine.validateSTORKAttrQueryRequest(authReqNotTrust); + + } + + + + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAttrQueryRequestNADA() { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(null); + request.setSpApplication(null); + request.setSpCountry(null); + + try { + + engine.validateSTORKAttrQueryRequest(attrRequest); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test validate authentication request with unknown elements. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryRequestWithUnknownElements() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute unknown = new PersonalAttribute(); + unknown.setName("unknown"); + unknown.setIsRequired(true); + pAttList.add(unknown); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + STORKAttrQueryRequest req = new STORKAttrQueryRequest(); + + req = engine3.generateSTORKAttrQueryRequest(request); + + req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); + + assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); + assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); + + } + + /** + * Test generate Request with required elements by default + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + STORKAttrQueryRequest req = new STORKAttrQueryRequest(); + STORKAttrQueryRequest reqTrue = new STORKAttrQueryRequest(); + STORKAttrQueryRequest reqFalse = new STORKAttrQueryRequest(); + + reqTrue = engine.generateSTORKAttrQueryRequest(request); + reqFalse = engine2.generateSTORKAttrQueryRequest(request); + req = engine3.generateSTORKAttrQueryRequest(request); + + + String token = new String(req.getTokenSaml()); + String reqTrueToken = new String(reqTrue.getTokenSaml()); + String reqFalseToken = new String(reqFalse.getTokenSaml()); + + assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); + assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); + assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); + + } + + /** + * Test validating attribute query and getting alias used to save + * the saml trusted certificate into trustore + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAtrrQueryRequestGettingItsAlias() throws STORKSAMLEngineException { + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + + request.setDestination(destination); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + STORKAttrQueryRequest req = new STORKAttrQueryRequest(); + + req = engine3.generateSTORKAttrQueryRequest(request); + req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + + req = engine2.generateSTORKAttrQueryRequest(request); + req = engine2.validateSTORKAttrQueryRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + } + +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java new file mode 100644 index 000000000..27c6cfe39 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java @@ -0,0 +1,920 @@ +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.junit.Ignore; +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAttrQueryRequest; +import eu.stork.peps.auth.commons.STORKAttrQueryResponse; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.commons.STORKStatusCode; +import eu.stork.peps.auth.commons.STORKSubStatusCode; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +public class StorkAttrQueryResponseTest { + + /** The engine. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + + /** + * Gets the engine. + * + * @return the engine + */ + public static STORKSAMLEngine getEngine() { + return engine; + } + + /** + * Sets the engine. + * + * @param newEngine the new engine + */ + public static void setEngine(final STORKSAMLEngine newEngine) { + StorkAttrQueryResponseTest.engine = newEngine; + } + + /** The destination. */ + private static String destination; + + /** The service provider sector. */ + private static String spSector; + + /** The service provider institution. */ + private static String spInstitution; + + /** The service provider application. */ + private static String spApplication; + + /** The service provider country. */ + private static String spCountry; + + /** The service provider id. */ + private static String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The state. */ + private static String state = "IS"; + + /** The town. */ + private static String town = "Reykjavik"; + + /** The postal code. */ + private static String postalCode = "105"; + + /** The street name. */ + private static String streetName = "Gudrunartun"; + + /** The street number. */ + private static String streetNumber = "10"; + + /** The List of Personal Attributes. */ + private static IPersonalAttributeList pal; + + /** The assertion consumer URL. */ + private static String assertConsumerUrl; + + /** The attribute query request. */ + private static byte[] attrQueryRequest; + + /** The attribute query response. */ + private static byte[] attrQueryResponse; + + /** The attribute query request. */ + private static STORKAttrQueryRequest attrQueryenRequest; + + /** The attribute query response. */ + private static STORKAttrQueryResponse attrQeuryenResponse; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkAttrQueryResponseTest.class.getName()); + + /** + * Instantiates a new stork response test. + */ + public StorkAttrQueryResponseTest() { + super(); + } + + /** The IP address. */ + private static String ipAddress; + + /** The destination URL. */ + private static String destinationUrl; + + /** The is hashing. */ + private final boolean isHashing = Boolean.TRUE; + + /** The is not hashing. */ + private final boolean isNotHashing = Boolean.FALSE; + + /** The ERROR text. */ + private static final String ERROR_TXT = "generateAttrQueryResponse(...) should've thrown an STORKSAMLEngineException!"; + + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + + pal = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + pal.add(eIDNumber); + + final PersonalAttribute givenName = new PersonalAttribute(); + givenName.setName("givenName"); + givenName.setIsRequired(true); + pal.add(givenName); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + pal.add(canRessAddress); + + PersonalAttribute newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + pal.add(newAttribute); + + destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + spSector = "EDU001"; + spInstitution = "OXF001"; + spApplication = "APP001"; + spCountry = "EN"; + + spId = "EDU001-APP001-APP001"; + + final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); + request.setDestination(destination); + //request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + //request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("IS"); + + try { + attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(request) + .getTokenSaml(); + + attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest); + + } catch (STORKSAMLEngineException e) { + fail("Error create STORKAuthnRequest"); + } + + ipAddress = "111.222.333.444"; + + destinationUrl = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + + pal = new PersonalAttributeList(); + + isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ages = new ArrayList(); + + ages.add("16"); + ages.add("18"); + + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(isAgeOver); + + dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(dateOfBirth); + + eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789IS"); + eIDNumber.setValue(idNumber); + eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(eIDNumber); + + canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + + canRessAddress.setComplexValue(address); + pal.add(canRessAddress); + + newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap values = new HashMap(); + + values.put("value1", "value1"); + values.put("value2", "value2"); + values.put("value3", "value3"); + values.put("value4", "value4"); + + newAttribute.setComplexValue(values); + pal.add(newAttribute); + + } + + /** + * Test generate attribute query request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryResponse() throws STORKSAMLEngineException { + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + final STORKAttrQueryResponse storkResponse = getEngine() + .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, + destinationUrl, isNotHashing); + + attrQueryResponse = storkResponse.getTokenSaml(); + + FileOutputStream output = null; + + try { + output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml")); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + output.write(attrQueryResponse); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); + + + } + + /** + * Test validation id parameter mandatory. + */ + @Test + public final void testResponseMandatoryId() { + final String identifier = attrQueryenRequest.getSamlId(); + attrQueryenRequest.setSamlId(null); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, destinationUrl, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setSamlId(identifier); + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response in response to err1. + */ + @Test + public final void testResponseMandatoryIssuer() { + + final String issuer = attrQueryenRequest.getIssuer(); + attrQueryenRequest.setIssuer(null); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, destinationUrl, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setIssuer(issuer); + LOG.error("Error"); + } + } + + + /** + * Test generate attribute query response assertion consumer null. + */ + /*@Test + public final void testResponseMandatoryAssertionConsumerServiceURL() { + final String asserConsumerUrl = attrQueryenRequest + .getAssertionConsumerServiceURL(); + attrQueryenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response IP address null. + */ + @Test + public final void testResponseValidationIP() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, null, + destinationUrl, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response with personal attribute list null. + */ + @Test + public final void testResponseMandatoryPersonalAttributeList() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(null); + + + try { + getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, + ipAddress, destinationUrl, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate attribute query response token null. + */ + @Test + public final void testResponseInvalidParametersToken() { + try { + getEngine().validateSTORKAttrQueryResponse(null, ipAddress); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate attribute query response IP null. + */ + @Test + public final void STORKAttrQueryResponse() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setPersonalAttributeList(pal); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response parameter name wrong. + */ + @Test + public final void testResponseInvalidParametersAttr() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("AttrWrong"); + wrongList.add(worngAttr); + + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrSimpleValue() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoValue() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoName() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate attribute query response set null complex value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrComplexValue() { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setComplexValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test validate attribute query response IP distinct and disabled validation + * IP. + */ + @Test + public final void testResponseInvalidParametersIPDistinct() { + try { + // ipAddress origin "111.222.333.444" + // ipAddrValidation = false + // Subject Confirmation Bearer. + + getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, "127.0.0.1"); + } catch (STORKSAMLEngineException e) { + fail("validateAttributeQueryResponse(...) should've thrown an STORKSAMLEngineException!"); + LOG.error("Error"); + } + } + + /** + * Test response invalid parameters invalid token. + */ + @Test + public final void testResponseInvalidParametersTokenMsg() { + try { + // ipAddress origin "111.222.333.444" + // Subject Confirmation Bearer. + getEngine().validateSTORKAttrQueryResponse("errorMessage".getBytes(), + ipAddress); + fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate attribute query response is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + /*@Test + public final void testValidateAuthenticationResponseIsFail() + throws STORKSAMLEngineException { + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertFalse("Generate incorrect response: ", attrQeuryenResponse.isFail()); + } + + /** + * Test validate attribute query response destination. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseDestination() + throws STORKSAMLEngineException { + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertEquals("Destination incorrect: ", + attrQeuryenResponse.getInResponseTo(), attrQueryenRequest.getSamlId()); + } + + /** + * Test validate attribute query response values. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseValuesComplex() + throws STORKSAMLEngineException { + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertEquals("Country incorrect:", attrQeuryenResponse.getCountry(), "ES"); + + final Iterator iterator = attrQeuryenResponse + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + final PersonalAttribute attribute = iterator.next(); + if (attribute.getName().equalsIgnoreCase( + "canonicalResidenceAddress")) { + assertEquals("State incorrect: ", state, attribute + .getComplexValue().get("state")); + assertEquals("Town incorrect: ", town, attribute + .getComplexValue().get("town")); + assertEquals("Postal code incorrect: ", postalCode, attribute + .getComplexValue().get("postalCode")); + assertEquals("Street name incorrect: ", streetName, attribute + .getComplexValue().get("streetName")); + assertEquals("Street number incorrect: ", streetNumber, + attribute.getComplexValue().get("streetNumber")); + } + } + } + + /** + * Test generate attribute query response fail in response to it's null. + * @throws STORKSAMLEngineException + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test //( expected=STORKSAMLEngineException.class) + public final void testGenerateAttrQueryResponseFailInResponseToNull() throws STORKSAMLEngineException { + final String identifier = attrQueryenRequest.getSamlId(); + attrQueryenRequest.setSamlId(null); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setSamlId(identifier); + LOG.error("Error"); + //throw new STORKSAMLEngineException(e); + } + } + + /** + * Test generate attribute query response fail assertion consumer URL err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + /*@Test + public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() + throws STORKSAMLEngineException { + + final String assertConsumerUrl = attrQueryenRequest + .getAssertionConsumerServiceURL(); + attrQueryenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + attrQueryResponse = getEngine().generateSTORKAuthnResponseFail(attrQueryenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + attrQueryenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate attribute query response fail code error err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryResponseFailCodeErrorNull() + throws STORKSAMLEngineException { + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setStatusCode(null); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + fail("generateAttrQueryResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test generate attribute query request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryResponse() throws STORKSAMLEngineException { + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(dateOfBirth); + + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + complex.put("one", "two"); + + //eIDNumber.setValue(null); + //eIDNumber.setValue(idNumber); + //eIDNumber.setComplexValue(complex); + + eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); + palist.add(eIDNumber); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + + canRessAddress.setComplexValue(address); + palist.add(canRessAddress); + + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAttrQueryResponse storkResponse = getEngine() + .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, + destinationUrl, isNotHashing); + + attrQueryResponse = storkResponse.getTokenSaml(); + LOG.info("Request id: " + attrQueryenRequest.getSamlId()); + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); + + + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + LOG.info("RESPONSE ID: " + attrQeuryenResponse.getSamlId()); + LOG.info("RESPONSE IN_RESPONSE_TO: " + attrQeuryenResponse.getInResponseTo()); + LOG.info("RESPONSE COUNTRY: " + attrQeuryenResponse.getCountry()); + + } + + + + + + /** + * Test validate attribute query response fail is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAttrQueryResponseFailIsFail() + throws STORKSAMLEngineException { + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage("message"); + + attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, + response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); + + LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(attrQueryResponse)); + + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + LOG.info("COUNTRY: " + attrQeuryenResponse.getCountry()); + assertTrue("Generate incorrect response: ", attrQeuryenResponse.isFail()); + } + + /** + * Test generate/validate response with signedDoc + * + * @throws STORKSAMLEngineException + * the STORKSAML engine exception + */ + @Test + public final void testGenerateAttrQueryResponseWithSignedDoc() + throws STORKSAMLEngineException { + + String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + palist.add(isAgeOver); + + attrQueryenRequest.setPersonalAttributeList(palist); + + final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAttrQueryResponse storkResponse = getEngine() + .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, + destinationUrl, isNotHashing); + + attrQueryResponse = storkResponse.getTokenSaml(); + attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, + ipAddress); + + assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse + .getPersonalAttributeList().get("signedDoc").getValue().get(0) + .equals(signedDocResponse)); + + } +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java new file mode 100644 index 000000000..7223ab483 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java @@ -0,0 +1,966 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class StorkAuthRequestTest defines a class to . + */ +public class StorkAuthRequestTest { + + /** The engines. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); + private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); + + + /** + * Instantiates a new stork authentication request test. + */ + public StorkAuthRequestTest() { + pal = new PersonalAttributeList(); + + final PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + final ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + final PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + final PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + pal.add(eIDNumber); + + destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + + spName = "University of Oxford"; + spSector = "EDU001"; + spInstitution = "OXF001"; + spApplication = "APP001"; + spCountry = "EN"; + + spId = "EDU001-OXF001-APP001"; + + } + + /** The destination. */ + private String destination; + + /** The service provider name. */ + private String spName; + + /** The service provider sector. */ + private String spSector; + + /** The service provider institution. */ + private String spInstitution; + + /** The service provider application. */ + private String spApplication; + + /** The service provider country. */ + private String spCountry; + + /** The service provider id. */ + private String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The List of Personal Attributes. */ + private IPersonalAttributeList pal; + + /** The assertion consumer URL. */ + private String assertConsumerUrl; + + /** The authentication request. */ + private static byte[] authRequest; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkAuthRequestTest.class.getName()); + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + } + + /** + * Test generate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnRequest() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + //engine.generateSTORKAuthnRequest(request); + + LOG.info("STORKAuthnRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); + request.setCitizenCountryCode("ES"); + LOG.info("STORKAuthnRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); + } + + + /** + * Test generate authentication request error personal attribute name error. + */ + @Test + public final void testGenerateAuthnRequestPALsErr1() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("attrNotValid"); + worngAttr.setIsRequired(true); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + /** + * Test generate authentication request error personal attribute value error. + */ + @Test + public final void testGenerateAuthnRequestPALsErr2() { + + final IPersonalAttributeList palWrong = new PersonalAttributeList(); + + final PersonalAttribute attrNotValid = new PersonalAttribute(); + attrNotValid.setName("attrNotValid"); + attrNotValid.setIsRequired(true); + palWrong.add(attrNotValid); + + + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(palWrong); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request error provider name null. + */ + @Test + public final void testGenerateAuthnRequestSPNAmeErr1() { + + + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(null); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try + { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + catch (STORKSAMLEngineException e) + { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request authentication assurance level + * negative value. + */ + @Test + public final void testGenerateAuthnRequestQaalErr1() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(-1); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request service provider sector null. + */ + @Test + public final void testGenerateAuthnRequestSectorErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + + } + } + + /** + * Test generate authentication request service provider institution null. + */ + @Test + public final void testGenerateAuthnRequestInstitutionrErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(null); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAuthnRequestApplicationErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(null); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request service provider country null. + */ + @Test + public final void testGenerateAuthnRequestCountryErr() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(null); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test generate authentication request error with quality authentication + * assurance level wrong. + */ + @Test + public final void testGenerateAuthnRequestQaalErr2() { + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(0); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request personal attribute list null value. + */ + @Test + public final void testGenerateAuthnRequestPALErr1() { + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(null); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication request error with assertion consumer URL + * null. + */ + @Test + public final void testGenerateAuthnRequestAssertionConsumerErr1() { + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(null); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + engine.generateSTORKAuthnRequest(request); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request null parameter. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestNullParam() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAuthnRequest(null); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request error bytes encode. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestErrorEncode() + throws STORKSAMLEngineException { + try { + engine.validateSTORKAuthnRequest("messageError".getBytes()); + fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequest() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + authRequest = engine.generateSTORKAuthnRequest(request).getTokenSaml(); + + final STORKAuthnRequest validatedRequest = engine.validateSTORKAuthnRequest(authRequest); + + assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); + + } + + /** + * Test validate data authenticate request. Verified parameters after + * validation. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateDataAuthnRequest() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = engine.validateSTORKAuthnRequest(authRequest); + + assertEquals("Sestination incorrect: ", request.getDestination(), destination); + + assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); + assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); + assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); + + assertEquals("Service provider incorrect: ", request.getProviderName(), spName); + assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); + assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); + assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); + assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); + assertEquals("Asserition consumer URL incorrect: ", request.getAssertionConsumerServiceURL(), assertConsumerUrl); + + assertEquals("SP Country incorrect: ", request.getSpCountry(), spCountry); + assertEquals("SP Id incorrect: ", request.getSPID(), spId); + assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), "ES"); + + } + + /** + * Test validate file authentication request. Validate from XML file. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAuthnRequest() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml"); + + try { + engine.validateSTORKAuthnRequest(bytes); + fail("testValidateFileAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + } + } + + /** + * Test validate file authentication request tag delete. + * + * @throws Exception the exception + */ + @Test + public final void testValidateFileAuthnRequestTagDelete() throws Exception { + + final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml"); + + try { + engine.validateSTORKAuthnRequest(bytes); + fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error(e.getMessage()); + + } + } + + /** + * Test validate authentication request not trusted token. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestNotTrustedErr1() + throws STORKSAMLEngineException { + + try { + final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine + .getInstance("CONF2"); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineNotTrusted + .generateSTORKAuthnRequest(request).getTokenSaml(); + + engine.validateSTORKAuthnRequest(authReqNotTrust); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + fail("validateSTORKAuthnRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); + } + } + + /** + * Test validate authentication request trusted. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestTrusted() + throws STORKSAMLEngineException { + + final STORKSAMLEngine engineTrusted = STORKSAMLEngine + .getInstance("CONF3"); + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + + final byte[] authReqNotTrust = engineTrusted.generateSTORKAuthnRequest( + request).getTokenSaml(); + + // engine ("CONF1") no have trust certificate from "CONF2" + engine.validateSTORKAuthnRequest(authReqNotTrust); + + } + + /** + * Test generate authentication request service provider application null. + */ + @Test + public final void testGenerateAuthnRequestNADA() { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(null); + request.setSpInstitution(null); + request.setSpApplication(null); + request.setSpCountry(null); + + try { + engine.validateSTORKAuthnRequest(authRequest); + fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); + + } catch (STORKSAMLEngineException e) { + LOG.error("Error: " + e.getMessage()); + } + } + + /** + * Test validate authentication request with unknown elements. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestWithUnknownElements() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute unknown = new PersonalAttribute(); + unknown.setName("unknown"); + unknown.setIsRequired(true); + pAttList.add(unknown); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + + req = engine3.generateSTORKAuthnRequest(request); + + req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); + + assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); + assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); + + } + + /** + * Test generate Request with required elements by default + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + STORKAuthnRequest reqTrue = new STORKAuthnRequest(); + STORKAuthnRequest reqFalse = new STORKAuthnRequest(); + + reqTrue = engine.generateSTORKAuthnRequest(request); + reqFalse = engine2.generateSTORKAuthnRequest(request); + req = engine3.generateSTORKAuthnRequest(request); + + + String token = new String(req.getTokenSaml()); + String reqTrueToken = new String(reqTrue.getTokenSaml()); + String reqFalseToken = new String(reqFalse.getTokenSaml()); + + assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); + assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); + assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); + + } + + /** + * Test validating request and getting alias used to save + * the saml trusted certificate into trustore + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnRequestGettingItsAlias() throws STORKSAMLEngineException { + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + IPersonalAttributeList pAttList = new PersonalAttributeList(); + + final PersonalAttribute eIdentifier = new PersonalAttribute(); + eIdentifier.setName("eIdentifier"); + eIdentifier.setIsRequired(true); + pAttList.add(eIdentifier); + + request.setPersonalAttributeList(pAttList); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + + req = engine3.generateSTORKAuthnRequest(request); + req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + + req = engine2.generateSTORKAuthnRequest(request); + req = engine2.validateSTORKAuthnRequest(req.getTokenSaml()); + assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); + + + + } + + /** + * Test generating/validating request with signedDoc + * + * @throws STORKSAMLEngineException + * the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnRequestWithSignedDoc() + throws STORKSAMLEngineException { + + String signedDocRequest = "VGVzdCB0ZXh0"; + + final STORKAuthnRequest request = new STORKAuthnRequest(); + + PersonalAttributeList paler = new PersonalAttributeList(); + + final PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + paler.add(eIDNumber); + + final PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + final ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + paler.add(isAgeOver); + + final PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + final ArrayList signedDocs = new ArrayList(); + signedDocs.add(signedDocRequest); + signedDoc.setValue(signedDocs); + signedDoc.setIsRequired(false); + paler.add(signedDoc); + + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(paler); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // new parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + STORKAuthnRequest req = new STORKAuthnRequest(); + + req = engine.generateSTORKAuthnRequest(request); + req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); + + assertTrue("SignedDoc request should be the same: ", req + .getPersonalAttributeList().get("signedDoc").getValue().get(0) + .equals(signedDocRequest)); + + + } + +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java new file mode 100644 index 000000000..481cbc28c --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java @@ -0,0 +1,931 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +package eu.stork.peps.test.simple; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.junit.Test; +import org.opensaml.xml.parse.BasicParserPool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttribute; +import eu.stork.peps.auth.commons.PersonalAttributeList; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.commons.STORKStatusCode; +import eu.stork.peps.auth.commons.STORKSubStatusCode; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; + +/** + * The Class AuthRequestTest. + */ +public class StorkResponseTest { + + /** The engine. */ + private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); + + /** + * Gets the engine. + * + * @return the engine + */ + public static STORKSAMLEngine getEngine() { + return engine; + } + + /** + * Sets the engine. + * + * @param newEngine the new engine + */ + public static void setEngine(final STORKSAMLEngine newEngine) { + StorkResponseTest.engine = newEngine; + } + + /** The destination. */ + private static String destination; + + /** The service provider name. */ + private static String spName; + + /** The service provider sector. */ + private static String spSector; + + /** The service provider institution. */ + private static String spInstitution; + + /** The service provider application. */ + private static String spApplication; + + /** The service provider country. */ + private static String spCountry; + + /** The service provider id. */ + private static String spId; + + /** The quality authentication assurance level. */ + private static final int QAAL = 3; + + /** The state. */ + private static String state = "ES"; + + /** The town. */ + private static String town = "Madrid"; + + /** The municipality code. */ + private static String municipalityCode = "MA001"; + + /** The postal code. */ + private static String postalCode = "28038"; + + /** The street name. */ + private static String streetName = "Marchamalo"; + + /** The street number. */ + private static String streetNumber = "3"; + + /** The apartament number. */ + private static String apartamentNumber = "5º E"; + + /** The List of Personal Attributes. */ + private static IPersonalAttributeList pal; + + /** The assertion consumer URL. */ + private static String assertConsumerUrl; + + /** The authentication request. */ + private static byte[] authRequest; + + /** The authentication response. */ + private static byte[] authResponse; + + /** The authentication request. */ + private static STORKAuthnRequest authenRequest; + + /** The authentication response. */ + private static STORKAuthnResponse authnResponse; + + /** The Constant LOG. */ + private static final Logger LOG = LoggerFactory + .getLogger(StorkResponseTest.class.getName()); + + /** + * Instantiates a new stork response test. + */ + public StorkResponseTest() { + super(); + } + + /** The IP address. */ + private static String ipAddress; + + /** The is hashing. */ + private final boolean isHashing = Boolean.TRUE; + + /** The is not hashing. */ + private final boolean isNotHashing = Boolean.FALSE; + + /** The ERROR text. */ + private static final String ERROR_TXT = "generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"; + + + /** Parser manager used to parse XML. */ + private static BasicParserPool parser; + + + + static { + parser = new BasicParserPool(); + parser.setNamespaceAware(true); + + pal = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + pal.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + pal.add(dateOfBirth); + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + pal.add(eIDNumber); + + final PersonalAttribute givenName = new PersonalAttribute(); + givenName.setName("givenName"); + givenName.setIsRequired(true); + pal.add(givenName); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + pal.add(canRessAddress); + + PersonalAttribute newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + pal.add(newAttribute); + + destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; + assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; + spName = "University Oxford"; + + spName = "University of Oxford"; + spSector = "EDU001"; + spInstitution = "OXF001"; + spApplication = "APP001"; + spCountry = "EN"; + + spId = "EDU001-APP001-APP001"; + + final STORKAuthnRequest request = new STORKAuthnRequest(); + request.setDestination(destination); + request.setProviderName(spName); + request.setQaa(QAAL); + request.setPersonalAttributeList(pal); + request.setAssertionConsumerServiceURL(assertConsumerUrl); + + // news parameters + request.setSpSector(spSector); + request.setSpInstitution(spInstitution); + request.setSpApplication(spApplication); + request.setSpCountry(spCountry); + request.setSPID(spId); + request.setCitizenCountryCode("ES"); + + try { + authRequest = getEngine().generateSTORKAuthnRequest(request) + .getTokenSaml(); + + authenRequest = getEngine().validateSTORKAuthnRequest(authRequest); + + } catch (STORKSAMLEngineException e) { + fail("Error create STORKAuthnRequest"); + } + + ipAddress = "111.222.333.444"; + + pal = new PersonalAttributeList(); + + isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ages = new ArrayList(); + + ages.add("16"); + ages.add("18"); + + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(isAgeOver); + + dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(dateOfBirth); + + eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + eIDNumber.setValue(idNumber); + eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + pal.add(eIDNumber); + + canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("municipalityCode", municipalityCode); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + address.put("apartamentNumber", apartamentNumber); + + canRessAddress.setComplexValue(address); + pal.add(canRessAddress); + + newAttribute = new PersonalAttribute(); + newAttribute.setName("newAttribute2"); + newAttribute.setIsRequired(true); + newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap values = new HashMap(); + + values.put("value1", "value1"); + values.put("value2", "value2"); + values.put("value3", "value3"); + values.put("value4", "value4"); + + newAttribute.setComplexValue(values); + pal.add(newAttribute); + + } + + /** + * Test generate authentication request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnResponse() throws STORKSAMLEngineException { + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + final STORKAuthnResponse storkResponse = getEngine() + .generateSTORKAuthnResponse(authenRequest, response, ipAddress, + isNotHashing); + + authResponse = storkResponse.getTokenSaml(); + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); + } + + /** + * Test validation id parameter mandatory. + */ + @Test + public final void testResponseMandatoryId() { + final String identifier = authenRequest.getSamlId(); + authenRequest.setSamlId(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + authenRequest.setSamlId(identifier); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response in response to err1. + */ + @Test + public final void testResponseMandatoryIssuer() { + + final String issuer = authenRequest.getIssuer(); + authenRequest.setIssuer(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + authenRequest.setIssuer(issuer); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response assertion consumer null. + */ + @Test + public final void testResponseMandatoryAssertionConsumerServiceURL() { + final String asserConsumerUrl = authenRequest + .getAssertionConsumerServiceURL(); + authenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + authenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response IP address null. + */ + @Test + public final void testResponseValidationIP() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, null, + isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test generate authentication response with personal attribute list null. + */ + @Test + public final void testResponseMandatoryPersonalAttributeList() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(null); + + + try { + getEngine().generateSTORKAuthnResponse(authenRequest, response, + ipAddress, isHashing); + fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication response token null. + */ + @Test + public final void testResponseInvalidParametersToken() { + try { + getEngine().validateSTORKAuthnResponse(null, ipAddress); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication response IP null. + */ + @Test + public final void testResponseInvalidParametersIP() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setPersonalAttributeList(pal); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response parameter name wrong. + */ + @Test + public final void testResponseInvalidParametersAttr() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("AttrWrong"); + wrongList.add(worngAttr); + + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrSimpleValue() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoValue() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrNoName() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + /** + * Test validate authentication response set null complex value into attribute. + */ + @Test + public final void testResponseInvalidParametersAttrComplexValue() { + final STORKAuthnResponse response = new STORKAuthnResponse(); + final IPersonalAttributeList wrongList = new PersonalAttributeList(); + + final PersonalAttribute worngAttr = new PersonalAttribute(); + worngAttr.setName("isAgeOver"); + worngAttr.setComplexValue(null); + wrongList.add(worngAttr); + + response.setPersonalAttributeList(wrongList); + try { + authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + // In Conf1 ipValidate is false + getEngine().validateSTORKAuthnResponse(authResponse, null); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test validate authentication response IP distinct and disabled validation + * IP. + */ + @Test + public final void testResponseInvalidParametersIPDistinct() { + try { + // ipAddress origin "111.222.333.444" + // ipAddrValidation = false + // Subject Confirmation Bearer. + + getEngine().validateSTORKAuthnResponse(authResponse, "127.0.0.1"); + fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test response invalid parameters invalid token. + */ + @Test + public final void testResponseInvalidParametersTokenMsg() { + try { + // ipAddress origin "111.222.333.444" + // Subject Confirmation Bearer. + getEngine().validateSTORKAuthnResponse("errorMessage".getBytes(), + ipAddress); + fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + /** + * Test validate authentication response is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseIsFail() + throws STORKSAMLEngineException { + try { + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + fail("Generate incorrect response"); + } catch (Exception e) { + LOG.error("ERROR: " + e.getMessage()); + } + } + + /** + * Test validate authentication response destination. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseDestination() + throws STORKSAMLEngineException { + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + assertEquals("Destination incorrect: ", + authnResponse.getInResponseTo(), authenRequest.getSamlId()); + } + + /** + * Test validate authentication response values. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public final void testValidateAuthenticationResponseValuesComplex() + throws STORKSAMLEngineException { + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + assertEquals("Country incorrect:", authnResponse.getCountry(), "EN"); + + final Iterator iterator = authnResponse + .getPersonalAttributeList().iterator(); + + while (iterator.hasNext()) { + final PersonalAttribute attribute = iterator.next(); + if (attribute.getName().equalsIgnoreCase( + "canonicalResidenceAddress")) { + assertEquals("State incorrect: ", state, attribute + .getComplexValue().get("state")); + assertEquals("Municipality Code incorrect: ", municipalityCode, + attribute.getComplexValue().get("municipalityCode")); + assertEquals("Town incorrect: ", town, attribute + .getComplexValue().get("town")); + assertEquals("Postal code incorrect: ", postalCode, attribute + .getComplexValue().get("postalCode")); + assertEquals("Street name incorrect: ", streetName, attribute + .getComplexValue().get("streetName")); + assertEquals("Street number incorrect: ", streetNumber, + attribute.getComplexValue().get("streetNumber")); + assertEquals("Apartament number incorrect: ", apartamentNumber, + attribute.getComplexValue().get("apartamentNumber")); + } + } + } + + /** + * Test generate authenticate response fail in response to it's null. + * @throws STORKSAMLEngineException + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test //( expected=STORKSAMLEngineException.class) + public final void testGenerateAuthnResponseFailInResponseToNull() throws STORKSAMLEngineException { + final String identifier = authenRequest.getSamlId(); + authenRequest.setSamlId(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail(ERROR_TXT); + } catch (STORKSAMLEngineException e) { + authenRequest.setSamlId(identifier); + LOG.error("Error"); + //throw new STORKSAMLEngineException(e); + } + } + + /** + * Test generate authenticate response fail assertion consumer URL err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() + throws STORKSAMLEngineException { + + final String assertConsumerUrl = authenRequest + .getAssertionConsumerServiceURL(); + authenRequest.setAssertionConsumerServiceURL(null); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + authenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); + LOG.error("Error"); + } + } + + /** + * Test generate authentication response fail code error err1. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthnResponseFailCodeErrorNull() + throws STORKSAMLEngineException { + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(null); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage(""); + + try { + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); + } catch (STORKSAMLEngineException e) { + LOG.error("Error"); + } + } + + + + + /** + * Test generate authentication request without errors. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthnResponse() throws STORKSAMLEngineException { + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(true); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(isAgeOver); + + PersonalAttribute dateOfBirth = new PersonalAttribute(); + dateOfBirth.setName("dateOfBirth"); + dateOfBirth.setIsRequired(false); + final ArrayList date = new ArrayList(); + date.add("16/12/2008"); + dateOfBirth.setValue(date); + dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + palist.add(dateOfBirth); + + + PersonalAttribute eIDNumber = new PersonalAttribute(); + eIDNumber.setName("eIdentifier"); + eIDNumber.setIsRequired(true); + + final ArrayList idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + complex.put("one", "two"); + + //eIDNumber.setValue(null); + //eIDNumber.setValue(idNumber); + //eIDNumber.setComplexValue(complex); + + eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); + palist.add(eIDNumber); + + PersonalAttribute canRessAddress = new PersonalAttribute(); + canRessAddress.setName("canonicalResidenceAddress"); + canRessAddress.setIsRequired(true); + canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); + final HashMap address = new HashMap(); + + address.put("state", state); + address.put("municipalityCode", municipalityCode); + address.put("town", town); + address.put("postalCode", postalCode); + address.put("streetName", streetName); + address.put("streetNumber", streetNumber); + address.put("apartamentNumber", apartamentNumber); + + canRessAddress.setComplexValue(address); + palist.add(canRessAddress); + + + final STORKAuthnResponse response = new STORKAuthnResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAuthnResponse storkResponse = getEngine() + .generateSTORKAuthnResponse(authenRequest, response, ipAddress, + isNotHashing); + + authResponse = storkResponse.getTokenSaml(); + LOG.info("Request id: " + authenRequest.getSamlId()); + + LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); + + + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + LOG.info("RESPONSE ID: " + authnResponse.getSamlId()); + LOG.info("RESPONSE IN_RESPONSE_TO: " + authnResponse.getInResponseTo()); + LOG.info("RESPONSE COUNTRY: " + authnResponse.getCountry()); + + } + + + + + + /** + * Test validate authentication response fail is fail. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + @Test + public final void testValidateAuthenticationResponseFailIsFail() + throws STORKSAMLEngineException { + + final STORKAuthnResponse response = new STORKAuthnResponse(); + response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); + response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); + response.setMessage("message"); + + authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, + response, ipAddress, isNotHashing).getTokenSaml(); + + LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(authResponse)); + + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + LOG.info("COUNTRY: " + authnResponse.getCountry()); + assertTrue("Generate incorrect response: ", authnResponse.isFail()); + } + + /** + * Test generate/validate response with signedDoc + * + * @throws STORKSAMLEngineException + * the STORKSAML engine exception + */ + @Test + public final void testGenerateAuthenResponseWithSignedDoc() + throws STORKSAMLEngineException { + + String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + palist.add(isAgeOver); + + authenRequest.setPersonalAttributeList(palist); + + final STORKAuthnResponse response = new STORKAuthnResponse(); + + response.setPersonalAttributeList(palist); + + final STORKAuthnResponse storkResponse = getEngine() + .generateSTORKAuthnResponse(authenRequest, response, ipAddress, + isNotHashing); + + authResponse = storkResponse.getTokenSaml(); + authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, + ipAddress); + + assertTrue("SignedDoc response should be the same: ", authnResponse + .getPersonalAttributeList().get("signedDoc").getValue().get(0) + .equals(signedDocResponse)); + + } + +} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java new file mode 100644 index 000000000..34fed0e39 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java @@ -0,0 +1,20 @@ +/* + * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. You may + * obtain a copy of the Licence at: + * + * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Licence for the specific language governing permissions and limitations under + * the Licence. + */ + +/** + * Provides the classes necessary to create a SAML message. + * @since 1.0 + */ +package eu.stork.peps.test.simple; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops new file mode 100644 index 000000000..fe8b26f95 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops @@ -0,0 +1,101 @@ +K 25 +svn:wc:ra_dav:version-url +V 67 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources +END +keyStoreCountry1.jks +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry1.jks +END +keyStoreCountry2.jks +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry2.jks +END +keyStoreCountry3.jks +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry3.jks +END +p11Conf.cfg +K 25 +svn:wc:ra_dav:version-url +V 78 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/p11Conf.cfg +END +logback-test.xml +K 25 +svn:wc:ra_dav:version-url +V 83 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/logback-test.xml +END +SamlEngine.xml +K 25 +svn:wc:ra_dav:version-url +V 81 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/SamlEngine.xml +END +SignModule_P11.xml +K 25 +svn:wc:ra_dav:version-url +V 85 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/SignModule_P11.xml +END +StorkSamlEngine_Conf0.xml +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf0.xml +END +StorkSamlEngine_Conf1.xml +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf1.xml +END +SignModule_Conf0.xml +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf0.xml +END +StorkSamlEngine_Conf2.xml +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf2.xml +END +SignModule_Conf1.xml +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf1.xml +END +StorkSamlEngine_Conf3.xml +K 25 +svn:wc:ra_dav:version-url +V 92 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf3.xml +END +SignModule_Conf2.xml +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf2.xml +END +SignModule_Conf3.xml +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf3.xml +END +keyStoreCountry0.jks +K 25 +svn:wc:ra_dav:version-url +V 88 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry0.jks +END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/.svn/entries new file mode 100644 index 000000000..1afc5a426 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/entries @@ -0,0 +1,575 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +data +dir + +logback-test.xml +file + + + + +2013-12-20T12:27:57.250475Z +9645eaa7005e2fd5856a650a46e58b75 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +530 + +SamlEngine.xml +file + + + + +2013-12-20T12:27:57.250475Z +e2a6926fe3dabd0b07ea0c7f61a5c9a9 +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2236 + +SignModule_P11.xml +file + + + + +2013-12-20T12:27:57.254475Z +13d70d84e25f491976cbbd9a0e3edafe +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +436 + +StorkSamlEngine_Conf0.xml +file + + + + +2013-12-20T12:27:57.250475Z +4ec0bc5ac4fafef57b60184cded62f9f +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3912 + +StorkSamlEngine_Conf1.xml +file + + + + +2013-12-20T12:27:57.250475Z +4ec0bc5ac4fafef57b60184cded62f9f +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +3912 + +SignModule_Conf0.xml +file + + + + +2013-12-20T12:27:57.250475Z +ad61baa5b5d5a0c648b2e4c05b637add +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +541 + +StorkSamlEngine_Conf2.xml +file + + + + +2013-12-20T12:27:57.250475Z +7092c091691b1862d989f856cdc57b82 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2827 + +SignModule_Conf1.xml +file + + + + +2013-12-20T12:27:57.250475Z +16be2497f59cbd9c57acc81b783ecff1 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +522 + +StorkSamlEngine_Conf3.xml +file + + + + +2013-12-20T12:27:57.250475Z +44066ee14d9b2a03f7ee2f72c965c287 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +2774 + +SignModule_Conf2.xml +file + + + + +2013-12-20T12:27:57.250475Z +fb7a26c03ef7400fe296b7d60837dff0 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +522 + +SignModule_Conf3.xml +file + + + + +2013-12-20T12:27:57.250475Z +128795cf3937e23a2af256cc5db88b84 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +540 + +keyStoreCountry0.jks +file + + + + +2013-12-20T12:27:57.250475Z +241d66f1af1a3937dfbbcccc7b7432c8 +2013-12-16T15:04:09.136643Z +316 +emsomavmi +has-props + + + + + + + + + + + + + + + + + + + + +1376 + +keyStoreCountry1.jks +file + + + + +2013-12-20T12:27:57.250475Z +821660c55e39b47f7cd6c750e366531d +2013-12-16T15:04:09.136643Z +316 +emsomavmi +has-props + + + + + + + + + + + + + + + + + + + + +1313 + +keyStoreCountry2.jks +file + + + + +2013-12-20T12:27:57.250475Z +821660c55e39b47f7cd6c750e366531d +2013-12-16T15:04:09.136643Z +316 +emsomavmi +has-props + + + + + + + + + + + + + + + + + + + + +1313 + +keyStoreCountry3.jks +file + + + + +2013-12-20T12:27:57.250475Z +821660c55e39b47f7cd6c750e366531d +2013-12-16T15:04:09.136643Z +316 +emsomavmi +has-props + + + + + + + + + + + + + + + + + + + + +1313 + +p11Conf.cfg +file + + + + +2013-12-20T12:27:57.250475Z +d7154f1fb90d3edbad739f703a30ff3d +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +510 + diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base new file mode 100644 index 000000000..5e9587e65 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base new file mode 100644 index 000000000..5e9587e65 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base new file mode 100644 index 000000000..5e9587e65 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base new file mode 100644 index 000000000..5e9587e65 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base new file mode 100644 index 000000000..6bb61ae29 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base new file mode 100644 index 000000000..eb9ed6f5d --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry0.jks + local-demo + local-demo + CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS + 529E05C8 + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base new file mode 100644 index 000000000..af68d33aa --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry1.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base new file mode 100644 index 000000000..b13cb390a --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry2.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base new file mode 100644 index 000000000..ed933020a --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry3.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base new file mode 100644 index 000000000..64eb426c8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base @@ -0,0 +1,11 @@ + + + + + HWModule sign with interface PKCS11. + p11Config.cfg + ******* + CN=XXXXXXXXX + xxxxxxxxxxxxxx + PKCS11 + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base new file mode 100644 index 000000000..0a28a5de8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base @@ -0,0 +1,91 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base new file mode 100644 index 000000000..0a28a5de8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base @@ -0,0 +1,91 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base new file mode 100644 index 000000000..435ef4b82 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base @@ -0,0 +1,64 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base new file mode 100644 index 000000000..bec8934f8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base @@ -0,0 +1,61 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + http://www.stork.gov.eu/1.0/unknown + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base new file mode 100644 index 000000000..289e952fe Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base differ diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base differ diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base differ diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base differ diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base new file mode 100644 index 000000000..ff900e124 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base @@ -0,0 +1,23 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base new file mode 100644 index 000000000..b712219c1 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base @@ -0,0 +1,24 @@ +//ATTRIBUTE VALUE +//name name suffix of this provider instance +//library pathname of PKCS#11 implementation +//slotListIndex slot index + +//PREFIX DESCRIPTION +//CKO_ Object class +//CKA_ Attribute +//CKK_ Key type + +//attributes(operation, keytype, keyalgorithm) = { +// name1 = value1 +// [...] +//} + +name=nameProvider +library=library.dll +slotListIndex=0 +attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={ + CKA_VERIFY=true +} +attributes(*,CKO_PRIVATE_KEY,CKK_RSA)={ + CKA_SIGN=true +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml new file mode 100644 index 000000000..6b0482795 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml new file mode 100644 index 000000000..99c1b043d --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks + local-demo + local-demo + CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS + 529E05C8 + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml new file mode 100644 index 000000000..af68d33aa --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry1.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml new file mode 100644 index 000000000..b13cb390a --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry2.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml new file mode 100644 index 000000000..ed933020a --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry3.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml new file mode 100644 index 000000000..64eb426c8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml @@ -0,0 +1,11 @@ + + + + + HWModule sign with interface PKCS11. + p11Config.cfg + ******* + CN=XXXXXXXXX + xxxxxxxxxxxxxx + PKCS11 + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml new file mode 100644 index 000000000..c7cee3af4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks + local-demo + local-demo + CN=local-demo-cert, O=Indra, L=Madrid, ST=Spain, C=ES + 4BA89DB2 + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml new file mode 100644 index 000000000..0a28a5de8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml @@ -0,0 +1,91 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml new file mode 100644 index 000000000..0a28a5de8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml @@ -0,0 +1,91 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml new file mode 100644 index 000000000..435ef4b82 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml @@ -0,0 +1,64 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml new file mode 100644 index 000000000..bec8934f8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml @@ -0,0 +1,61 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + http://www.stork.gov.eu/1.0/unknown + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml new file mode 100644 index 000000000..0a28a5de8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml @@ -0,0 +1,91 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops new file mode 100644 index 000000000..3843fc6b7 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 72 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data +END diff --git a/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries new file mode 100644 index 000000000..2eb50bbe8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +eu +dir + diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops new file mode 100644 index 000000000..56d18dd28 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 75 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu +END diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries new file mode 100644 index 000000000..798ea16b3 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +stork +dir + diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops new file mode 100644 index 000000000..16ec86311 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 81 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork +END diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries new file mode 100644 index 000000000..8ec7f9903 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +STORKSAMLEngine +dir + diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops new file mode 100644 index 000000000..178273e8c --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops @@ -0,0 +1,41 @@ +K 25 +svn:wc:ra_dav:version-url +V 97 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine +END +AuthnRequestTagDelete.xml +K 25 +svn:wc:ra_dav:version-url +V 122 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml +END +AttrQueryRequestTagDelete.xml +K 25 +svn:wc:ra_dav:version-url +V 126 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml +END +AuthnRequest.xml +K 25 +svn:wc:ra_dav:version-url +V 113 +/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml +END +AttrQueryRequest.xml +K 25 +svn:wc:ra_dav:version-url +V 118 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml +END +AuthnRequestTagDeleteEncoded.xml +K 25 +svn:wc:ra_dav:version-url +V 129 +/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml +END +AttrQueryResponse.xml +K 25 +svn:wc:ra_dav:version-url +V 119 +/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml +END diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries new file mode 100644 index 000000000..16e2ccd8d --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +357 +https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine +https://webgate.ec.europa.eu/CITnet/svn/STORK2 + + + +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + +aa842e49-f825-43fc-93ba-11ee9fd5a035 + +AttrQueryResponse.xml +file + + + + +2013-12-20T12:27:57.242475Z +8f576c406bd8b2756899bbe1738e56d6 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +6092 + +AuthnRequestTagDelete.xml +file + + + + +2013-12-20T12:27:57.242475Z +13df3f7c9b0fb6e10ac782c43b8f3cdb +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2611 + +AttrQueryRequestTagDelete.xml +file + + + + +2013-12-20T12:27:57.242475Z +cd245752b96826be0c3b72e3428c6aac +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +4045 + +AuthnRequest.xml +file + + + + +2013-12-20T12:27:57.242475Z +e993b1b24f5abbfa974485b0cbbc0211 +2013-07-25T08:47:40.940990Z +6 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +3898 + +AttrQueryRequest.xml +file + + + + +2013-12-20T12:27:57.242475Z +d78d68c7f18dc10e7cd7343954388987 +2013-12-16T15:04:09.136643Z +316 +emsomavmi + + + + + + + + + + + + + + + + + + + + + +4253 + +AuthnRequestTagDeleteEncoded.xml +file + + + + +2013-12-20T12:27:57.242475Z +c5122af357fd2a8339239853479b4aed +2013-10-24T15:44:04.704923Z +56 +emgrtargr + + + + + + + + + + + + + + + + + + + + + +2612 + diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base new file mode 100644 index 000000000..852727dc5 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base @@ -0,0 +1,11 @@ +http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl +eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT +VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 +MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph +dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt +by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 +2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj +9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G +CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl +XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK +W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base new file mode 100644 index 000000000..9f9fe5156 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base @@ -0,0 +1,15 @@ +http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v +LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG +A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv +Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab +ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU +0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n +6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 +y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z +9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F +6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM +pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT +/NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq +yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 +Ppm8IFVTk8mYfX8/jw==3falsefalsefalse1618SveinbjörnES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base new file mode 100644 index 000000000..b7e578c2d --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base @@ -0,0 +1,10 @@ +http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v +MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM +BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k +ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja +Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ +525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG +SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr +y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG +1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base new file mode 100644 index 000000000..c822702df --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base @@ -0,0 +1,26 @@ +http://S-PEPS.gov.xx + + + + + + + + + +yzsqaxBNicOrixBUno5cL0CBOpE= + + + +Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC +wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi +YIN/BUEtXkoYTjPtkmA= + +MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw +MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu +h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r +/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk +3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K +eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq +KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base new file mode 100644 index 000000000..2a54c7d59 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base @@ -0,0 +1,14 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base new file mode 100644 index 000000000..3239cf6e7 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base @@ -0,0 +1,14 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml new file mode 100644 index 000000000..852727dc5 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml @@ -0,0 +1,11 @@ +http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl +eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT +VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 +MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph +dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt +by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 +2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj +9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G +CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl +XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK +W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml new file mode 100644 index 000000000..9f9fe5156 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml @@ -0,0 +1,15 @@ +http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v +LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG +A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv +Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab +ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU +0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n +6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 +y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z +9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F +6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM +pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT +/NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq +yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 +Ppm8IFVTk8mYfX8/jw==3falsefalsefalse1618SveinbjörnES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml new file mode 100644 index 000000000..b7e578c2d --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml @@ -0,0 +1,10 @@ +http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v +MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM +BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k +ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja +Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ +525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG +SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr +y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG +1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml new file mode 100644 index 000000000..c822702df --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml @@ -0,0 +1,26 @@ +http://S-PEPS.gov.xx + + + + + + + + + +yzsqaxBNicOrixBUno5cL0CBOpE= + + + +Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC +wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi +YIN/BUEtXkoYTjPtkmA= + +MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw +MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu +h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r +/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk +3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K +eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq +KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml new file mode 100644 index 000000000..2a54c7d59 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml @@ -0,0 +1,14 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml new file mode 100644 index 000000000..3239cf6e7 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml @@ -0,0 +1,14 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks new file mode 100644 index 000000000..289e952fe Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks differ diff --git a/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jks b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jks new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jks differ diff --git a/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jks b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jks new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jks differ diff --git a/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jks b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jks new file mode 100644 index 000000000..5399bf689 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jks differ diff --git a/id/server/stork2-saml-engine/src/test/resources/logback-test.xml b/id/server/stork2-saml-engine/src/test/resources/logback-test.xml new file mode 100644 index 000000000..ff900e124 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/logback-test.xml @@ -0,0 +1,23 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg b/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg new file mode 100644 index 000000000..b712219c1 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg @@ -0,0 +1,24 @@ +//ATTRIBUTE VALUE +//name name suffix of this provider instance +//library pathname of PKCS#11 implementation +//slotListIndex slot index + +//PREFIX DESCRIPTION +//CKO_ Object class +//CKA_ Attribute +//CKK_ Key type + +//attributes(operation, keytype, keyalgorithm) = { +// name1 = value1 +// [...] +//} + +name=nameProvider +library=library.dll +slotListIndex=0 +attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={ + CKA_VERIFY=true +} +attributes(*,CKO_PRIVATE_KEY,CKK_RSA)={ + CKA_SIGN=true +} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks b/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks new file mode 100644 index 000000000..efaeac86c Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks differ -- cgit v1.2.3 From 9cb68043945f53246928443cea723b58ee2b1c24 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 21 Jan 2014 14:38:35 +0100 Subject: updated samlengine --- id/server/idserverlib/pom.xml | 27 +- id/server/stork2-commons/Releases | 24 +- id/server/stork2-commons/pom.xml | 36 +- id/server/stork2-commons/src/.svn/all-wcprops | 5 - id/server/stork2-commons/src/.svn/entries | 34 - id/server/stork2-commons/src/main/.svn/all-wcprops | 5 - id/server/stork2-commons/src/main/.svn/entries | 37 - .../src/main/config/.svn/all-wcprops | 5 - .../stork2-commons/src/main/config/.svn/entries | 31 - .../src/main/config/embedded/.svn/all-wcprops | 11 - .../src/main/config/embedded/.svn/entries | 62 - .../.svn/text-base/pepsUtil.properties.svn-base | 232 -- .../src/main/config/embedded/pepsUtil.properties | 37 +- .../stork2-commons/src/main/java/.svn/all-wcprops | 5 - .../stork2-commons/src/main/java/.svn/entries | 31 - .../src/main/java/eu/.svn/all-wcprops | 5 - .../stork2-commons/src/main/java/eu/.svn/entries | 31 - .../src/main/java/eu/stork/.svn/all-wcprops | 5 - .../src/main/java/eu/stork/.svn/entries | 31 - .../src/main/java/eu/stork/peps/.svn/all-wcprops | 5 - .../src/main/java/eu/stork/peps/.svn/entries | 31 - .../main/java/eu/stork/peps/auth/.svn/all-wcprops | 5 - .../src/main/java/eu/stork/peps/auth/.svn/entries | 34 - .../eu/stork/peps/auth/commons/.svn/all-wcprops | 167 -- .../java/eu/stork/peps/auth/commons/.svn/entries | 949 ------- .../text-base/AttributeConstants.java.svn-base | 72 - .../.svn/text-base/AttributeProvider.java.svn-base | 74 - .../text-base/AttributeProvidersMap.java.svn-base | 94 - .../.svn/text-base/AttributeSource.java.svn-base | 119 - .../.svn/text-base/AttributeUtil.java.svn-base | 231 -- .../.svn/text-base/CitizenConsent.java.svn-base | 123 - .../commons/.svn/text-base/Country.java.svn-base | 95 - .../.svn/text-base/CountryCodes.java.svn-base | 79 - .../commons/.svn/text-base/DateUtil.java.svn-base | 169 -- .../text-base/IAttributeProvidersMap.java.svn-base | 82 - .../text-base/IPersonalAttributeList.java.svn-base | 140 - .../.svn/text-base/IStorkLogger.java.svn-base | 239 -- .../.svn/text-base/IStorkSession.java.svn-base | 85 - .../commons/.svn/text-base/Linker.java.svn-base | 173 -- .../.svn/text-base/PEPSErrors.java.svn-base | 348 --- .../.svn/text-base/PEPSParameters.java.svn-base | 511 ---- .../commons/.svn/text-base/PEPSUtil.java.svn-base | 353 --- .../.svn/text-base/PEPSValues.java.svn-base | 325 --- .../.svn/text-base/PersonalAttribute.java.svn-base | 323 --- .../text-base/PersonalAttributeList.java.svn-base | 305 -- .../text-base/STORKAttrQueryRequest.java.svn-base | 426 --- .../text-base/STORKAttrQueryResponse.java.svn-base | 301 -- .../.svn/text-base/STORKAuthnRequest.java.svn-base | 495 ---- .../text-base/STORKAuthnResponse.java.svn-base | 309 -- .../.svn/text-base/STORKStatusCode.java.svn-base | 68 - .../text-base/STORKSubStatusCode.java.svn-base | 71 - .../.svn/text-base/package-info.java.svn-base | 9 - .../eu/stork/peps/auth/commons/AttributeName.java | 74 + .../stork/peps/auth/commons/AttributeProvider.java | 12 +- .../peps/auth/commons/AttributeProvidersMap.java | 14 +- .../stork/peps/auth/commons/AttributeSource.java | 81 +- .../eu/stork/peps/auth/commons/AttributeUtil.java | 2 +- .../eu/stork/peps/auth/commons/CitizenConsent.java | 10 +- .../peps/auth/commons/IAttributeListProcessor.java | 148 + .../peps/auth/commons/IPersonalAttributeList.java | 54 + .../java/eu/stork/peps/auth/commons/Linker.java | 151 +- .../eu/stork/peps/auth/commons/PEPSErrors.java | 46 +- .../eu/stork/peps/auth/commons/PEPSParameters.java | 110 +- .../java/eu/stork/peps/auth/commons/PEPSUtil.java | 2 +- .../eu/stork/peps/auth/commons/PEPSValues.java | 4 + .../stork/peps/auth/commons/PersonalAttribute.java | 27 +- .../peps/auth/commons/PersonalAttributeList.java | 143 +- .../peps/auth/commons/STORKAttrQueryRequest.java | 23 +- .../peps/auth/commons/STORKAttrQueryResponse.java | 87 + .../peps/auth/commons/STORKAuthnResponse.java | 76 +- .../peps/auth/commons/STORKLogoutRequest.java | 197 ++ .../peps/auth/commons/STORKLogoutResponse.java | 250 ++ .../peps/auth/commons/exceptions/.svn/all-wcprops | 53 - .../peps/auth/commons/exceptions/.svn/entries | 300 -- .../text-base/AbstractPEPSException.java.svn-base | 173 -- .../.svn/text-base/CPEPSException.java.svn-base | 143 - .../InternalErrorPEPSException.java.svn-base | 74 - .../InvalidParameterPEPSException.java.svn-base | 54 - .../InvalidSessionPEPSException.java.svn-base | 46 - .../text-base/SecurityPEPSException.java.svn-base | 67 - .../text-base/StorkPEPSException.java.svn-base | 53 - .../.svn/text-base/package-info.java.svn-base | 7 - .../eu/stork/peps/auth/specific/.svn/all-wcprops | 41 - .../java/eu/stork/peps/auth/specific/.svn/entries | 232 -- .../.svn/text-base/IAUService.java.svn-base | 183 -- .../text-base/ICheckAttributeValue.java.svn-base | 37 - .../.svn/text-base/IDeriveAttribute.java.svn-base | 40 - .../.svn/text-base/INormaliseValue.java.svn-base | 35 - .../text-base/ITranslatorService.java.svn-base | 100 - .../.svn/text-base/package-info.java.svn-base | 8 - .../eu/stork/peps/auth/specific/IAUService.java | 32 + .../peps/auth/specific/ITranslatorService.java | 4 +- .../src/main/resources/.svn/all-wcprops | 11 - .../stork2-commons/src/main/resources/.svn/entries | 62 - .../resources/.svn/text-base/log4j.xml.svn-base | 19 - id/server/stork2-commons/src/test/.svn/all-wcprops | 5 - id/server/stork2-commons/src/test/.svn/entries | 34 - .../stork2-commons/src/test/java/.svn/all-wcprops | 5 - .../stork2-commons/src/test/java/.svn/entries | 31 - .../src/test/java/eu/.svn/all-wcprops | 5 - .../stork2-commons/src/test/java/eu/.svn/entries | 31 - .../src/test/java/eu/stork/.svn/all-wcprops | 5 - .../src/test/java/eu/stork/.svn/entries | 31 - .../src/test/java/eu/stork/peps/.svn/all-wcprops | 5 - .../src/test/java/eu/stork/peps/.svn/entries | 31 - .../test/java/eu/stork/peps/tests/.svn/all-wcprops | 41 - .../src/test/java/eu/stork/peps/tests/.svn/entries | 232 -- .../text-base/AttributeUtilTestCase.java.svn-base | 537 ---- .../.svn/text-base/DateUtilTestCase.java.svn-base | 294 -- .../.svn/text-base/PEPSUtilTestCase.java.svn-base | 553 ---- .../PersonalAttributeListTestCase.java.svn-base | 557 ---- .../PersonalAttributeTestCase.java.svn-base | 182 -- .../.svn/text-base/package-info.java.svn-base | 5 - .../peps/tests/AttributeProvidersMapTestCase.java | 134 + .../stork/peps/tests/AttributeSourceTestCase.java | 88 + .../peps/tests/PersonalAttributeListTestCase.java | 196 +- .../src/test/resources/.svn/all-wcprops | 11 - .../stork2-commons/src/test/resources/.svn/entries | 62 - .../resources/.svn/text-base/log4j.xml.svn-base | 19 - id/server/stork2-saml-engine/Releases | 83 + .../build/classes/.svn/all-wcprops | 5 - .../stork2-saml-engine/build/classes/.svn/entries | 34 - .../build/classes/main/.svn/all-wcprops | 5 - .../build/classes/main/.svn/entries | 31 - .../build/classes/main/java/.svn/all-wcprops | 5 - .../build/classes/main/java/.svn/entries | 34 - .../classes/main/java/META-INF/.svn/all-wcprops | 11 - .../build/classes/main/java/META-INF/.svn/entries | 62 - .../META-INF/.svn/text-base/MANIFEST.MF.svn-base | 3 - .../build/classes/main/java/META-INF/MANIFEST.MF | 3 - .../build/classes/main/java/eu/.svn/all-wcprops | 5 - .../build/classes/main/java/eu/.svn/entries | 31 - .../classes/main/java/eu/stork/.svn/all-wcprops | 5 - .../build/classes/main/java/eu/stork/.svn/entries | 31 - .../main/java/eu/stork/peps/.svn/all-wcprops | 5 - .../classes/main/java/eu/stork/peps/.svn/entries | 37 - .../main/java/eu/stork/peps/auth/.svn/all-wcprops | 5 - .../main/java/eu/stork/peps/auth/.svn/entries | 31 - .../eu/stork/peps/auth/engine/.svn/all-wcprops | 35 - .../java/eu/stork/peps/auth/engine/.svn/entries | 201 -- .../engine/.svn/text-base/SAMLEngine.java.svn-base | 409 --- .../.svn/text-base/SAMLEngineUtils.java.svn-base | 833 ------ .../.svn/text-base/STORKSAMLEngine.java.svn-base | 2983 -------------------- .../.svn/text-base/X509PrincipalUtil.java.svn-base | 69 - .../.svn/text-base/package-info.java.svn-base | 19 - .../eu/stork/peps/auth/engine/SAMLEngine.class | Bin 8470 -> 0 bytes .../stork/peps/auth/engine/SAMLEngineUtils.class | Bin 9902 -> 0 bytes .../stork/peps/auth/engine/STORKSAMLEngine.class | Bin 10692 -> 0 bytes .../stork/peps/auth/engine/X509PrincipalUtil.class | Bin 2286 -> 0 bytes .../stork/peps/auth/engine/core/.svn/all-wcprops | 119 - .../eu/stork/peps/auth/engine/core/.svn/entries | 680 ----- .../AuthenticationAttributes.java.svn-base | 57 - .../text-base/CitizenCountryCode.java.svn-base | 56 - .../text-base/EIDCrossBorderShare.java.svn-base | 58 - .../text-base/EIDCrossSectorShare.java.svn-base | 56 - .../.svn/text-base/EIDSectorShare.java.svn-base | 57 - .../core/.svn/text-base/QAAAttribute.java.svn-base | 63 - .../text-base/RequestedAttribute.java.svn-base | 140 - .../text-base/RequestedAttributes.java.svn-base | 51 - .../core/.svn/text-base/SAMLCore.java.svn-base | 98 - .../.svn/text-base/SAMLEngineSignI.java.svn-base | 88 - .../.svn/text-base/SPApplication.java.svn-base | 56 - .../core/.svn/text-base/SPCountry.java.svn-base | 56 - .../engine/core/.svn/text-base/SPID.java.svn-base | 56 - .../.svn/text-base/SPInformation.java.svn-base | 56 - .../.svn/text-base/SPInstitution.java.svn-base | 56 - .../core/.svn/text-base/SPSector.java.svn-base | 56 - .../.svn/text-base/STORKSAMLCore.java.svn-base | 508 ---- .../VIDPAuthenticationAttributes.java.svn-base | 72 - .../core/.svn/text-base/package-info.java.svn-base | 19 - .../engine/core/AuthenticationAttributes.class | Bin 1165 -> 0 bytes .../peps/auth/engine/core/CitizenCountryCode.class | Bin 991 -> 0 bytes .../auth/engine/core/EIDCrossBorderShare.class | Bin 997 -> 0 bytes .../auth/engine/core/EIDCrossSectorShare.class | Bin 998 -> 0 bytes .../peps/auth/engine/core/EIDSectorShare.class | Bin 943 -> 0 bytes .../stork/peps/auth/engine/core/QAAAttribute.class | Bin 1071 -> 0 bytes .../peps/auth/engine/core/RequestedAttribute.class | Bin 1926 -> 0 bytes .../auth/engine/core/RequestedAttributes.class | Bin 953 -> 0 bytes .../eu/stork/peps/auth/engine/core/SAMLCore.class | Bin 1279 -> 0 bytes .../peps/auth/engine/core/SAMLEngineSignI.class | Bin 1413 -> 0 bytes .../peps/auth/engine/core/SPApplication.class | Bin 961 -> 0 bytes .../eu/stork/peps/auth/engine/core/SPCountry.class | Bin 937 -> 0 bytes .../java/eu/stork/peps/auth/engine/core/SPID.class | Bin 907 -> 0 bytes .../peps/auth/engine/core/SPInformation.class | Bin 1025 -> 0 bytes .../peps/auth/engine/core/SPInstitution.class | Bin 961 -> 0 bytes .../eu/stork/peps/auth/engine/core/SPSector.class | Bin 931 -> 0 bytes .../peps/auth/engine/core/STORKSAMLCore.class | Bin 6958 -> 0 bytes .../engine/core/VIDPAuthenticationAttributes.class | Bin 1318 -> 0 bytes .../peps/auth/engine/core/impl/.svn/all-wcprops | 395 --- .../stork/peps/auth/engine/core/impl/.svn/entries | 2238 --------------- .../AuthenticationAttributesBuilder.java.svn-base | 56 - .../AuthenticationAttributesImpl.java.svn-base | 109 - ...uthenticationAttributesMarshaller.java.svn-base | 30 - ...henticationAttributesUnmarshaller.java.svn-base | 54 - .../CitizenCountryCodeBuilder.java.svn-base | 50 - .../text-base/CitizenCountryCodeImpl.java.svn-base | 82 - .../CitizenCountryCodeMarshaller.java.svn-base | 45 - .../CitizenCountryCodeUnmarshaller.java.svn-base | 41 - .../EIDCrossBorderShareBuilder.java.svn-base | 52 - .../EIDCrossBorderShareImpl.java.svn-base | 87 - .../EIDCrossBorderShareMarshaller.java.svn-base | 47 - .../EIDCrossBorderShareUnmarshaller.java.svn-base | 43 - .../EIDCrossSectorShareBuilder.java.svn-base | 52 - .../EIDCrossSectorShareImpl.java.svn-base | 89 - .../EIDCrossSectorShareMarshaller.java.svn-base | 46 - .../EIDCrossSectorShareUnmarshaller.java.svn-base | 47 - .../text-base/EIDSectorShareBuilder.java.svn-base | 51 - .../text-base/EIDSectorShareImpl.java.svn-base | 85 - .../EIDSectorShareMarshaller.java.svn-base | 46 - .../EIDSectorShareUnmarshaller.java.svn-base | 47 - .../text-base/QAAAttributeBuilder.java.svn-base | 52 - .../.svn/text-base/QAAAttributeImpl.java.svn-base | 84 - .../text-base/QAAAttributeMarshaller.java.svn-base | 45 - .../QAAAttributeUnmarshaller.java.svn-base | 41 - .../RequestedAttributeBuilder.java.svn-base | 54 - .../text-base/RequestedAttributeImpl.java.svn-base | 220 -- .../RequestedAttributeMarshaller.java.svn-base | 89 - .../RequestedAttributeUnmarshaller.java.svn-base | 96 - .../RequestedAttributesBuilder.java.svn-base | 54 - .../RequestedAttributesImpl.java.svn-base | 95 - .../RequestedAttributesMarshaller.java.svn-base | 33 - .../RequestedAttributesUnmarshaller.java.svn-base | 52 - .../text-base/SPApplicationBuilder.java.svn-base | 51 - .../.svn/text-base/SPApplicationImpl.java.svn-base | 84 - .../SPApplicationMarshaller.java.svn-base | 46 - .../SPApplicationUnmarshaller.java.svn-base | 42 - .../.svn/text-base/SPCountryBuilder.java.svn-base | 52 - .../.svn/text-base/SPCountryImpl.java.svn-base | 82 - .../text-base/SPCountryMarshaller.java.svn-base | 45 - .../text-base/SPCountryUnmarshaller.java.svn-base | 42 - .../impl/.svn/text-base/SPIDBuilder.java.svn-base | 50 - .../impl/.svn/text-base/SPIDImpl.java.svn-base | 82 - .../.svn/text-base/SPIDMarshaller.java.svn-base | 45 - .../.svn/text-base/SPIDUnmarshaller.java.svn-base | 41 - .../text-base/SPInformationBuilder.java.svn-base | 41 - .../.svn/text-base/SPInformationImpl.java.svn-base | 110 - .../SPInformationMarshaller.java.svn-base | 33 - .../SPInformationUnmarshaller.java.svn-base | 52 - .../text-base/SPInstitutionBuilder.java.svn-base | 51 - .../.svn/text-base/SPInstitutionImpl.java.svn-base | 84 - .../SPInstitutionMarshaller.java.svn-base | 46 - .../SPInstitutionUnmarshaller.java.svn-base | 41 - .../.svn/text-base/SPSectorBuilder.java.svn-base | 50 - .../impl/.svn/text-base/SPSectorImpl.java.svn-base | 84 - .../text-base/SPSectorMarshaller.java.svn-base | 45 - .../text-base/SPSectorUnmarshaller.java.svn-base | 42 - .../core/impl/.svn/text-base/SignHW.java.svn-base | 399 --- .../.svn/text-base/SignModuleFactory.java.svn-base | 64 - .../core/impl/.svn/text-base/SignP12.java.svn-base | 468 --- .../core/impl/.svn/text-base/SignSW.java.svn-base | 423 --- ...DPAuthenticationAttributesBuilder.java.svn-base | 41 - .../VIDPAuthenticationAttributesImpl.java.svn-base | 132 - ...uthenticationAttributesMarshaller.java.svn-base | 33 - ...henticationAttributesUnmarshaller.java.svn-base | 55 - .../impl/.svn/text-base/package-info.java.svn-base | 19 - .../impl/AuthenticationAttributesBuilder.class | Bin 1714 -> 0 bytes .../core/impl/AuthenticationAttributesImpl.class | Bin 3821 -> 0 bytes .../impl/AuthenticationAttributesMarshaller.class | Bin 845 -> 0 bytes .../AuthenticationAttributesUnmarshaller.class | Bin 1971 -> 0 bytes .../core/impl/CitizenCountryCodeBuilder.class | Bin 1630 -> 0 bytes .../engine/core/impl/CitizenCountryCodeImpl.class | Bin 2395 -> 0 bytes .../core/impl/CitizenCountryCodeMarshaller.class | Bin 1674 -> 0 bytes .../core/impl/CitizenCountryCodeUnmarshaller.class | Bin 1379 -> 0 bytes .../core/impl/EIDCrossBorderShareBuilder.class | Bin 1644 -> 0 bytes .../engine/core/impl/EIDCrossBorderShareImpl.class | Bin 2407 -> 0 bytes .../core/impl/EIDCrossBorderShareMarshaller.class | Bin 1681 -> 0 bytes .../impl/EIDCrossBorderShareUnmarshaller.class | Bin 1386 -> 0 bytes .../core/impl/EIDCrossSectorShareBuilder.class | Bin 1594 -> 0 bytes .../engine/core/impl/EIDCrossSectorShareImpl.class | Bin 2407 -> 0 bytes .../core/impl/EIDCrossSectorShareMarshaller.class | Bin 1681 -> 0 bytes .../impl/EIDCrossSectorShareUnmarshaller.class | Bin 1474 -> 0 bytes .../engine/core/impl/EIDSectorShareBuilder.class | Bin 1574 -> 0 bytes .../auth/engine/core/impl/EIDSectorShareImpl.class | Bin 2347 -> 0 bytes .../core/impl/EIDSectorShareMarshaller.class | Bin 1690 -> 0 bytes .../core/impl/EIDSectorShareUnmarshaller.class | Bin 1439 -> 0 bytes .../engine/core/impl/QAAAttributeBuilder.class | Bin 1546 -> 0 bytes .../auth/engine/core/impl/QAAAttributeImpl.class | Bin 2311 -> 0 bytes .../engine/core/impl/QAAAttributeMarshaller.class | Bin 1632 -> 0 bytes .../core/impl/QAAAttributeUnmarshaller.class | Bin 1337 -> 0 bytes .../core/impl/RequestedAttributeBuilder.class | Bin 1630 -> 0 bytes .../engine/core/impl/RequestedAttributeImpl.class | Bin 5272 -> 0 bytes .../core/impl/RequestedAttributeMarshaller.class | Bin 2206 -> 0 bytes .../core/impl/RequestedAttributeUnmarshaller.class | Bin 2875 -> 0 bytes .../core/impl/RequestedAttributesBuilder.class | Bin 1644 -> 0 bytes .../engine/core/impl/RequestedAttributesImpl.class | Bin 3807 -> 0 bytes .../core/impl/RequestedAttributesMarshaller.class | Bin 830 -> 0 bytes .../impl/RequestedAttributesUnmarshaller.class | Bin 1896 -> 0 bytes .../engine/core/impl/SPApplicationBuilder.class | Bin 1560 -> 0 bytes .../auth/engine/core/impl/SPApplicationImpl.class | Bin 2335 -> 0 bytes .../engine/core/impl/SPApplicationMarshaller.class | Bin 1639 -> 0 bytes .../core/impl/SPApplicationUnmarshaller.class | Bin 1344 -> 0 bytes .../auth/engine/core/impl/SPCountryBuilder.class | Bin 1504 -> 0 bytes .../peps/auth/engine/core/impl/SPCountryImpl.class | Bin 2287 -> 0 bytes .../engine/core/impl/SPCountryMarshaller.class | Bin 1611 -> 0 bytes .../engine/core/impl/SPCountryUnmarshaller.class | Bin 1316 -> 0 bytes .../peps/auth/engine/core/impl/SPIDBuilder.class | Bin 1434 -> 0 bytes .../peps/auth/engine/core/impl/SPIDImpl.class | Bin 2227 -> 0 bytes .../auth/engine/core/impl/SPIDMarshaller.class | Bin 1576 -> 0 bytes .../auth/engine/core/impl/SPIDUnmarshaller.class | Bin 1281 -> 0 bytes .../engine/core/impl/SPInformationBuilder.class | Bin 1716 -> 0 bytes .../auth/engine/core/impl/SPInformationImpl.class | Bin 3234 -> 0 bytes .../engine/core/impl/SPInformationMarshaller.class | Bin 812 -> 0 bytes .../core/impl/SPInformationUnmarshaller.class | Bin 1798 -> 0 bytes .../engine/core/impl/SPInstitutionBuilder.class | Bin 1560 -> 0 bytes .../auth/engine/core/impl/SPInstitutionImpl.class | Bin 2335 -> 0 bytes .../engine/core/impl/SPInstitutionMarshaller.class | Bin 1639 -> 0 bytes .../core/impl/SPInstitutionUnmarshaller.class | Bin 1344 -> 0 bytes .../auth/engine/core/impl/SPSectorBuilder.class | Bin 1490 -> 0 bytes .../peps/auth/engine/core/impl/SPSectorImpl.class | Bin 2005 -> 0 bytes .../auth/engine/core/impl/SPSectorMarshaller.class | Bin 1604 -> 0 bytes .../engine/core/impl/SPSectorUnmarshaller.class | Bin 1309 -> 0 bytes .../stork/peps/auth/engine/core/impl/SignHW.class | Bin 9658 -> 0 bytes .../auth/engine/core/impl/SignModuleFactory.class | Bin 1603 -> 0 bytes .../stork/peps/auth/engine/core/impl/SignP12.class | Bin 9402 -> 0 bytes .../stork/peps/auth/engine/core/impl/SignSW.class | Bin 9522 -> 0 bytes .../impl/VIDPAuthenticationAttributesBuilder.class | Bin 1914 -> 0 bytes .../impl/VIDPAuthenticationAttributesImpl.class | Bin 4627 -> 0 bytes .../VIDPAuthenticationAttributesMarshaller.class | Bin 857 -> 0 bytes .../VIDPAuthenticationAttributesUnmarshaller.class | Bin 2157 -> 0 bytes .../peps/auth/engine/core/impl/package-info.class | Bin 151 -> 0 bytes .../stork/peps/auth/engine/core/package-info.class | Bin 146 -> 0 bytes .../auth/engine/core/validator/.svn/all-wcprops | 23 - .../peps/auth/engine/core/validator/.svn/entries | 130 - .../ExtensionsSchemaValidator.java.svn-base | 61 - .../QAAAttributeSchemaValidator.java.svn-base | 65 - .../.svn/text-base/package-info.java.svn-base | 19 - .../core/validator/ExtensionsSchemaValidator.class | Bin 2084 -> 0 bytes .../validator/QAAAttributeSchemaValidator.class | Bin 2209 -> 0 bytes .../auth/engine/core/validator/package-info.class | Bin 156 -> 0 bytes .../eu/stork/peps/auth/engine/package-info.class | Bin 141 -> 0 bytes .../eu/stork/peps/configuration/.svn/all-wcprops | 41 - .../java/eu/stork/peps/configuration/.svn/entries | 232 -- .../text-base/ConfigurationCreator.java.svn-base | 127 - .../text-base/ConfigurationEngine.java.svn-base | 69 - .../text-base/ConfigurationReader.java.svn-base | 224 -- .../text-base/ConfigurationSingleton.java.svn-base | 74 - .../.svn/text-base/InstanceEngine.java.svn-base | 70 - .../.svn/text-base/package-info.java.svn-base | 19 - .../peps/configuration/ConfigurationCreator.class | Bin 2116 -> 0 bytes .../peps/configuration/ConfigurationEngine.class | Bin 1278 -> 0 bytes .../peps/configuration/ConfigurationReader.class | Bin 2565 -> 0 bytes .../configuration/ConfigurationSingleton.class | Bin 2003 -> 0 bytes .../stork/peps/configuration/InstanceEngine.class | Bin 1347 -> 0 bytes .../eu/stork/peps/configuration/package-info.class | Bin 143 -> 0 bytes .../java/eu/stork/peps/exceptions/.svn/all-wcprops | 29 - .../java/eu/stork/peps/exceptions/.svn/entries | 164 -- .../text-base/SAMLEngineException.java.svn-base | 57 - .../STORKSAMLEngineException.java.svn-base | 135 - .../STORKSAMLEngineRuntimeException.java.svn-base | 56 - .../.svn/text-base/package-info.java.svn-base | 19 - .../peps/exceptions/SAMLEngineException.class | Bin 828 -> 0 bytes .../peps/exceptions/STORKSAMLEngineException.class | Bin 1585 -> 0 bytes .../STORKSAMLEngineRuntimeException.class | Bin 871 -> 0 bytes .../eu/stork/peps/exceptions/package-info.class | Bin 140 -> 0 bytes .../build/classes/test/.svn/all-wcprops | 5 - .../build/classes/test/.svn/entries | 34 - .../build/classes/test/java/.svn/all-wcprops | 5 - .../build/classes/test/java/.svn/entries | 31 - .../build/classes/test/java/eu/.svn/all-wcprops | 5 - .../build/classes/test/java/eu/.svn/entries | 31 - .../classes/test/java/eu/stork/.svn/all-wcprops | 5 - .../build/classes/test/java/eu/stork/.svn/entries | 31 - .../test/java/eu/stork/peps/.svn/all-wcprops | 5 - .../classes/test/java/eu/stork/peps/.svn/entries | 31 - .../test/java/eu/stork/peps/test/.svn/all-wcprops | 5 - .../test/java/eu/stork/peps/test/.svn/entries | 31 - .../eu/stork/peps/test/simple/.svn/all-wcprops | 47 - .../java/eu/stork/peps/test/simple/.svn/entries | 266 -- .../.svn/text-base/SSETestUtils.java.svn-base | 173 -- .../.svn/text-base/SimpleBaseTest.java.svn-base | 62 - .../StorkAttrQueryRequestTest.java.svn-base | 790 ------ .../StorkAttrQueryResponseTest.java.svn-base | 920 ------ .../text-base/StorkAuthRequestTest.java.svn-base | 966 ------- .../.svn/text-base/StorkResponseTest.java.svn-base | 931 ------ .../.svn/text-base/package-info.java.svn-base | 20 - .../eu/stork/peps/test/simple/SSETestUtils.class | Bin 2462 -> 0 bytes .../eu/stork/peps/test/simple/SimpleBaseTest.class | Bin 1811 -> 0 bytes .../test/simple/StorkAttrQueryRequestTest.class | Bin 9633 -> 0 bytes .../test/simple/StorkAttrQueryResponseTest.class | Bin 8908 -> 0 bytes .../peps/test/simple/StorkAuthRequestTest.class | Bin 10053 -> 0 bytes .../stork/peps/test/simple/StorkResponseTest.class | Bin 9361 -> 0 bytes .../eu/stork/peps/test/simple/package-info.class | Bin 141 -> 0 bytes .../build/classes/test/resources/.svn/all-wcprops | 101 - .../build/classes/test/resources/.svn/entries | 575 ---- .../.svn/prop-base/keyStoreCountry0.jks.svn-base | 5 - .../.svn/prop-base/keyStoreCountry1.jks.svn-base | 5 - .../.svn/prop-base/keyStoreCountry2.jks.svn-base | 5 - .../.svn/prop-base/keyStoreCountry3.jks.svn-base | 5 - .../.svn/text-base/SamlEngine.xml.svn-base | 63 - .../.svn/text-base/SignModule_Conf0.xml.svn-base | 12 - .../.svn/text-base/SignModule_Conf1.xml.svn-base | 12 - .../.svn/text-base/SignModule_Conf2.xml.svn-base | 12 - .../.svn/text-base/SignModule_Conf3.xml.svn-base | 12 - .../.svn/text-base/SignModule_P11.xml.svn-base | 11 - .../text-base/StorkSamlEngine_Conf0.xml.svn-base | 91 - .../text-base/StorkSamlEngine_Conf1.xml.svn-base | 91 - .../text-base/StorkSamlEngine_Conf2.xml.svn-base | 64 - .../text-base/StorkSamlEngine_Conf3.xml.svn-base | 61 - .../.svn/text-base/keyStoreCountry0.jks.svn-base | Bin 1376 -> 0 bytes .../.svn/text-base/keyStoreCountry1.jks.svn-base | Bin 1313 -> 0 bytes .../.svn/text-base/keyStoreCountry2.jks.svn-base | Bin 1313 -> 0 bytes .../.svn/text-base/keyStoreCountry3.jks.svn-base | Bin 1313 -> 0 bytes .../.svn/text-base/logback-test.xml.svn-base | 23 - .../resources/.svn/text-base/p11Conf.cfg.svn-base | 24 - .../build/classes/test/resources/SamlEngine.xml | 63 - .../classes/test/resources/SignModule_Conf0.xml | 12 - .../classes/test/resources/SignModule_Conf1.xml | 12 - .../classes/test/resources/SignModule_Conf2.xml | 12 - .../classes/test/resources/SignModule_Conf3.xml | 12 - .../classes/test/resources/SignModule_P11.xml | 11 - .../test/resources/StorkSamlEngine_Conf0.xml | 91 - .../test/resources/StorkSamlEngine_Conf1.xml | 91 - .../test/resources/StorkSamlEngine_Conf2.xml | 64 - .../test/resources/StorkSamlEngine_Conf3.xml | 61 - .../classes/test/resources/data/.svn/all-wcprops | 5 - .../build/classes/test/resources/data/.svn/entries | 31 - .../test/resources/data/eu/.svn/all-wcprops | 5 - .../classes/test/resources/data/eu/.svn/entries | 31 - .../test/resources/data/eu/stork/.svn/all-wcprops | 5 - .../test/resources/data/eu/stork/.svn/entries | 31 - .../data/eu/stork/STORKSAMLEngine/.svn/all-wcprops | 41 - .../data/eu/stork/STORKSAMLEngine/.svn/entries | 232 -- .../.svn/text-base/AttrQueryRequest.xml.svn-base | 11 - .../AttrQueryRequestTagDelete.xml.svn-base | 15 - .../.svn/text-base/AttrQueryResponse.xml.svn-base | 10 - .../.svn/text-base/AuthnRequest.xml.svn-base | 26 - .../text-base/AuthnRequestTagDelete.xml.svn-base | 14 - .../AuthnRequestTagDeleteEncoded.xml.svn-base | 14 - .../eu/stork/STORKSAMLEngine/AttrQueryRequest.xml | 11 - .../STORKSAMLEngine/AttrQueryRequestTagDelete.xml | 15 - .../eu/stork/STORKSAMLEngine/AttrQueryResponse.xml | 10 - .../data/eu/stork/STORKSAMLEngine/AuthnRequest.xml | 26 - .../STORKSAMLEngine/AuthnRequestTagDelete.xml | 14 - .../AuthnRequestTagDeleteEncoded.xml | 14 - .../classes/test/resources/keyStoreCountry0.jks | Bin 1376 -> 0 bytes .../classes/test/resources/keyStoreCountry1.jks | Bin 1313 -> 0 bytes .../classes/test/resources/keyStoreCountry2.jks | Bin 1313 -> 0 bytes .../classes/test/resources/keyStoreCountry3.jks | Bin 1313 -> 0 bytes .../build/classes/test/resources/logback-test.xml | 23 - .../build/classes/test/resources/p11Conf.cfg | 24 - id/server/stork2-saml-engine/pom.xml | 16 +- id/server/stork2-saml-engine/src/.svn/all-wcprops | 5 - id/server/stork2-saml-engine/src/.svn/entries | 34 - .../stork2-saml-engine/src/main/.svn/all-wcprops | 5 - id/server/stork2-saml-engine/src/main/.svn/entries | 31 - .../main/config/embedded/StorkSamlEngine_CPEPS.xml | 69 + .../src/main/config/embedded/quartz.properties | 5 + .../src/main/config/jBoss/context.xml | 1 + .../src/main/config/jBoss/jboss-classloading.xml | 4 + .../src/main/java/.svn/all-wcprops | 5 - .../stork2-saml-engine/src/main/java/.svn/entries | 34 - .../src/main/java/META-INF/.svn/all-wcprops | 11 - .../src/main/java/META-INF/.svn/entries | 62 - .../META-INF/.svn/text-base/MANIFEST.MF.svn-base | 3 - .../src/main/java/eu/.svn/all-wcprops | 5 - .../src/main/java/eu/.svn/entries | 31 - .../src/main/java/eu/stork/.svn/all-wcprops | 5 - .../src/main/java/eu/stork/.svn/entries | 31 - .../src/main/java/eu/stork/peps/.svn/all-wcprops | 5 - .../src/main/java/eu/stork/peps/.svn/entries | 37 - .../main/java/eu/stork/peps/auth/.svn/all-wcprops | 5 - .../src/main/java/eu/stork/peps/auth/.svn/entries | 31 - .../eu/stork/peps/auth/engine/.svn/all-wcprops | 35 - .../java/eu/stork/peps/auth/engine/.svn/entries | 201 -- .../engine/.svn/text-base/SAMLEngine.java.svn-base | 409 --- .../.svn/text-base/SAMLEngineUtils.java.svn-base | 833 ------ .../.svn/text-base/STORKSAMLEngine.java.svn-base | 2983 -------------------- .../.svn/text-base/X509PrincipalUtil.java.svn-base | 69 - .../.svn/text-base/package-info.java.svn-base | 19 - .../java/eu/stork/peps/auth/engine/SAMLEngine.java | 23 +- .../eu/stork/peps/auth/engine/SAMLEngineUtils.java | 58 +- .../eu/stork/peps/auth/engine/STORKSAMLEngine.java | 900 +++++- .../stork/peps/auth/engine/core/.svn/all-wcprops | 119 - .../eu/stork/peps/auth/engine/core/.svn/entries | 680 ----- .../AuthenticationAttributes.java.svn-base | 57 - .../text-base/CitizenCountryCode.java.svn-base | 56 - .../text-base/EIDCrossBorderShare.java.svn-base | 58 - .../text-base/EIDCrossSectorShare.java.svn-base | 56 - .../.svn/text-base/EIDSectorShare.java.svn-base | 57 - .../core/.svn/text-base/QAAAttribute.java.svn-base | 63 - .../text-base/RequestedAttribute.java.svn-base | 140 - .../text-base/RequestedAttributes.java.svn-base | 51 - .../core/.svn/text-base/SAMLCore.java.svn-base | 98 - .../.svn/text-base/SAMLEngineSignI.java.svn-base | 88 - .../.svn/text-base/SPApplication.java.svn-base | 56 - .../core/.svn/text-base/SPCountry.java.svn-base | 56 - .../engine/core/.svn/text-base/SPID.java.svn-base | 56 - .../.svn/text-base/SPInformation.java.svn-base | 56 - .../.svn/text-base/SPInstitution.java.svn-base | 56 - .../core/.svn/text-base/SPSector.java.svn-base | 56 - .../.svn/text-base/STORKSAMLCore.java.svn-base | 508 ---- .../VIDPAuthenticationAttributes.java.svn-base | 72 - .../core/.svn/text-base/package-info.java.svn-base | 19 - .../auth/engine/core/CustomAttributeQuery.java | 51 + .../engine/core/CustomRequestAbstractType.java | 176 ++ .../peps/auth/engine/core/impl/.svn/all-wcprops | 395 --- .../stork/peps/auth/engine/core/impl/.svn/entries | 2238 --------------- .../AuthenticationAttributesBuilder.java.svn-base | 56 - .../AuthenticationAttributesImpl.java.svn-base | 109 - ...uthenticationAttributesMarshaller.java.svn-base | 30 - ...henticationAttributesUnmarshaller.java.svn-base | 54 - .../CitizenCountryCodeBuilder.java.svn-base | 50 - .../text-base/CitizenCountryCodeImpl.java.svn-base | 82 - .../CitizenCountryCodeMarshaller.java.svn-base | 45 - .../CitizenCountryCodeUnmarshaller.java.svn-base | 41 - .../EIDCrossBorderShareBuilder.java.svn-base | 52 - .../EIDCrossBorderShareImpl.java.svn-base | 87 - .../EIDCrossBorderShareMarshaller.java.svn-base | 47 - .../EIDCrossBorderShareUnmarshaller.java.svn-base | 43 - .../EIDCrossSectorShareBuilder.java.svn-base | 52 - .../EIDCrossSectorShareImpl.java.svn-base | 89 - .../EIDCrossSectorShareMarshaller.java.svn-base | 46 - .../EIDCrossSectorShareUnmarshaller.java.svn-base | 47 - .../text-base/EIDSectorShareBuilder.java.svn-base | 51 - .../text-base/EIDSectorShareImpl.java.svn-base | 85 - .../EIDSectorShareMarshaller.java.svn-base | 46 - .../EIDSectorShareUnmarshaller.java.svn-base | 47 - .../text-base/QAAAttributeBuilder.java.svn-base | 52 - .../.svn/text-base/QAAAttributeImpl.java.svn-base | 84 - .../text-base/QAAAttributeMarshaller.java.svn-base | 45 - .../QAAAttributeUnmarshaller.java.svn-base | 41 - .../RequestedAttributeBuilder.java.svn-base | 54 - .../text-base/RequestedAttributeImpl.java.svn-base | 220 -- .../RequestedAttributeMarshaller.java.svn-base | 89 - .../RequestedAttributeUnmarshaller.java.svn-base | 96 - .../RequestedAttributesBuilder.java.svn-base | 54 - .../RequestedAttributesImpl.java.svn-base | 95 - .../RequestedAttributesMarshaller.java.svn-base | 33 - .../RequestedAttributesUnmarshaller.java.svn-base | 52 - .../text-base/SPApplicationBuilder.java.svn-base | 51 - .../.svn/text-base/SPApplicationImpl.java.svn-base | 84 - .../SPApplicationMarshaller.java.svn-base | 46 - .../SPApplicationUnmarshaller.java.svn-base | 42 - .../.svn/text-base/SPCountryBuilder.java.svn-base | 52 - .../.svn/text-base/SPCountryImpl.java.svn-base | 82 - .../text-base/SPCountryMarshaller.java.svn-base | 45 - .../text-base/SPCountryUnmarshaller.java.svn-base | 42 - .../impl/.svn/text-base/SPIDBuilder.java.svn-base | 50 - .../impl/.svn/text-base/SPIDImpl.java.svn-base | 82 - .../.svn/text-base/SPIDMarshaller.java.svn-base | 45 - .../.svn/text-base/SPIDUnmarshaller.java.svn-base | 41 - .../text-base/SPInformationBuilder.java.svn-base | 41 - .../.svn/text-base/SPInformationImpl.java.svn-base | 110 - .../SPInformationMarshaller.java.svn-base | 33 - .../SPInformationUnmarshaller.java.svn-base | 52 - .../text-base/SPInstitutionBuilder.java.svn-base | 51 - .../.svn/text-base/SPInstitutionImpl.java.svn-base | 84 - .../SPInstitutionMarshaller.java.svn-base | 46 - .../SPInstitutionUnmarshaller.java.svn-base | 41 - .../.svn/text-base/SPSectorBuilder.java.svn-base | 50 - .../impl/.svn/text-base/SPSectorImpl.java.svn-base | 84 - .../text-base/SPSectorMarshaller.java.svn-base | 45 - .../text-base/SPSectorUnmarshaller.java.svn-base | 42 - .../core/impl/.svn/text-base/SignHW.java.svn-base | 399 --- .../.svn/text-base/SignModuleFactory.java.svn-base | 64 - .../core/impl/.svn/text-base/SignP12.java.svn-base | 468 --- .../core/impl/.svn/text-base/SignSW.java.svn-base | 423 --- ...DPAuthenticationAttributesBuilder.java.svn-base | 41 - .../VIDPAuthenticationAttributesImpl.java.svn-base | 132 - ...uthenticationAttributesMarshaller.java.svn-base | 33 - ...henticationAttributesUnmarshaller.java.svn-base | 55 - .../impl/.svn/text-base/package-info.java.svn-base | 19 - .../core/impl/CustomAttributeQueryBuilder.java | 26 + .../engine/core/impl/CustomAttributeQueryImpl.java | 65 + .../core/impl/CustomAttributeQueryMarshaller.java | 50 + .../impl/CustomAttributeQueryUnmarshaller.java | 114 + .../stork/peps/auth/engine/core/impl/SignHW.java | 85 +- .../stork/peps/auth/engine/core/impl/SignP12.java | 106 +- .../stork/peps/auth/engine/core/impl/SignSW.java | 144 +- .../auth/engine/core/validator/.svn/all-wcprops | 23 - .../peps/auth/engine/core/validator/.svn/entries | 130 - .../ExtensionsSchemaValidator.java.svn-base | 61 - .../QAAAttributeSchemaValidator.java.svn-base | 65 - .../.svn/text-base/package-info.java.svn-base | 19 - .../validator/CustomAttributeQueryValidator.java | 57 + .../eu/stork/peps/configuration/.svn/all-wcprops | 41 - .../java/eu/stork/peps/configuration/.svn/entries | 232 -- .../text-base/ConfigurationCreator.java.svn-base | 127 - .../text-base/ConfigurationEngine.java.svn-base | 69 - .../text-base/ConfigurationReader.java.svn-base | 224 -- .../text-base/ConfigurationSingleton.java.svn-base | 74 - .../.svn/text-base/InstanceEngine.java.svn-base | 70 - .../.svn/text-base/package-info.java.svn-base | 19 - .../java/eu/stork/peps/exceptions/.svn/all-wcprops | 29 - .../java/eu/stork/peps/exceptions/.svn/entries | 164 -- .../text-base/SAMLEngineException.java.svn-base | 57 - .../STORKSAMLEngineException.java.svn-base | 135 - .../STORKSAMLEngineRuntimeException.java.svn-base | 56 - .../.svn/text-base/package-info.java.svn-base | 19 - .../stork2-saml-engine/src/test/.svn/all-wcprops | 5 - id/server/stork2-saml-engine/src/test/.svn/entries | 34 - .../src/test/java/.svn/all-wcprops | 5 - .../stork2-saml-engine/src/test/java/.svn/entries | 31 - .../src/test/java/META-INF/MANIFEST.MF | 3 - .../src/test/java/eu/.svn/all-wcprops | 5 - .../src/test/java/eu/.svn/entries | 31 - .../src/test/java/eu/stork/.svn/all-wcprops | 5 - .../src/test/java/eu/stork/.svn/entries | 31 - .../src/test/java/eu/stork/peps/.svn/all-wcprops | 5 - .../src/test/java/eu/stork/peps/.svn/entries | 31 - .../test/java/eu/stork/peps/test/.svn/all-wcprops | 5 - .../src/test/java/eu/stork/peps/test/.svn/entries | 31 - .../eu/stork/peps/test/simple/.svn/all-wcprops | 47 - .../java/eu/stork/peps/test/simple/.svn/entries | 266 -- .../.svn/text-base/SSETestUtils.java.svn-base | 173 -- .../.svn/text-base/SimpleBaseTest.java.svn-base | 62 - .../StorkAttrQueryRequestTest.java.svn-base | 790 ------ .../StorkAttrQueryResponseTest.java.svn-base | 920 ------ .../text-base/StorkAuthRequestTest.java.svn-base | 966 ------- .../.svn/text-base/StorkResponseTest.java.svn-base | 931 ------ .../.svn/text-base/package-info.java.svn-base | 20 - .../eu/stork/peps/test/simple/SSETestUtils.java | 173 -- .../eu/stork/peps/test/simple/SimpleBaseTest.java | 62 - .../test/simple/StorkAttrQueryRequestTest.java | 790 ------ .../test/simple/StorkAttrQueryResponseTest.java | 920 ------ .../peps/test/simple/StorkAuthRequestTest.java | 966 ------- .../stork/peps/test/simple/StorkResponseTest.java | 931 ------ .../eu/stork/peps/test/simple/package-info.java | 20 - .../src/test/resources/.svn/all-wcprops | 101 - .../src/test/resources/.svn/entries | 575 ---- .../.svn/prop-base/keyStoreCountry0.jks.svn-base | 5 - .../.svn/prop-base/keyStoreCountry1.jks.svn-base | 5 - .../.svn/prop-base/keyStoreCountry2.jks.svn-base | 5 - .../.svn/prop-base/keyStoreCountry3.jks.svn-base | 5 - .../.svn/text-base/SamlEngine.xml.svn-base | 63 - .../.svn/text-base/SignModule_Conf0.xml.svn-base | 12 - .../.svn/text-base/SignModule_Conf1.xml.svn-base | 12 - .../.svn/text-base/SignModule_Conf2.xml.svn-base | 12 - .../.svn/text-base/SignModule_Conf3.xml.svn-base | 12 - .../.svn/text-base/SignModule_P11.xml.svn-base | 11 - .../text-base/StorkSamlEngine_Conf0.xml.svn-base | 91 - .../text-base/StorkSamlEngine_Conf1.xml.svn-base | 91 - .../text-base/StorkSamlEngine_Conf2.xml.svn-base | 64 - .../text-base/StorkSamlEngine_Conf3.xml.svn-base | 61 - .../.svn/text-base/keyStoreCountry0.jks.svn-base | Bin 1376 -> 0 bytes .../.svn/text-base/keyStoreCountry1.jks.svn-base | Bin 1313 -> 0 bytes .../.svn/text-base/keyStoreCountry2.jks.svn-base | Bin 1313 -> 0 bytes .../.svn/text-base/keyStoreCountry3.jks.svn-base | Bin 1313 -> 0 bytes .../.svn/text-base/logback-test.xml.svn-base | 23 - .../resources/.svn/text-base/p11Conf.cfg.svn-base | 24 - .../src/test/resources/SamlEngine.xml | 60 - .../src/test/resources/data/.svn/all-wcprops | 5 - .../src/test/resources/data/.svn/entries | 31 - .../src/test/resources/data/eu/.svn/all-wcprops | 5 - .../src/test/resources/data/eu/.svn/entries | 31 - .../test/resources/data/eu/stork/.svn/all-wcprops | 5 - .../src/test/resources/data/eu/stork/.svn/entries | 31 - .../data/eu/stork/STORKSAMLEngine/.svn/all-wcprops | 41 - .../data/eu/stork/STORKSAMLEngine/.svn/entries | 232 -- .../.svn/text-base/AttrQueryRequest.xml.svn-base | 11 - .../AttrQueryRequestTagDelete.xml.svn-base | 15 - .../.svn/text-base/AttrQueryResponse.xml.svn-base | 10 - .../.svn/text-base/AuthnRequest.xml.svn-base | 26 - .../text-base/AuthnRequestTagDelete.xml.svn-base | 14 - .../AuthnRequestTagDeleteEncoded.xml.svn-base | 14 - .../eu/stork/STORKSAMLEngine/AttrQueryRequest.xml | 27 +- .../eu/stork/STORKSAMLEngine/AttrQueryResponse.xml | 25 +- 657 files changed, 3935 insertions(+), 61847 deletions(-) delete mode 100644 id/server/stork2-commons/src/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/config/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/config/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/config/embedded/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/config/embedded/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/config/embedded/.svn/text-base/pepsUtil.properties.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/java/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/java/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/java/eu/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeConstants.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvider.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvidersMap.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeSource.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeUtil.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CitizenConsent.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Country.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CountryCodes.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/DateUtil.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IAttributeProvidersMap.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IPersonalAttributeList.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkLogger.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkSession.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Linker.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSErrors.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSParameters.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSUtil.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSValues.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttribute.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttributeList.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryRequest.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryResponse.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnRequest.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnResponse.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKStatusCode.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKSubStatusCode.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeName.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeListProcessor.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutRequest.java create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutResponse.java delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/AbstractPEPSException.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/CPEPSException.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InternalErrorPEPSException.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidParameterPEPSException.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidSessionPEPSException.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/SecurityPEPSException.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/StorkPEPSException.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IAUService.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ICheckAttributeValue.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IDeriveAttribute.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/INormaliseValue.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ITranslatorService.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-commons/src/main/resources/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/main/resources/.svn/entries delete mode 100644 id/server/stork2-commons/src/main/resources/.svn/text-base/log4j.xml.svn-base delete mode 100644 id/server/stork2-commons/src/test/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/test/.svn/entries delete mode 100644 id/server/stork2-commons/src/test/java/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/test/java/.svn/entries delete mode 100644 id/server/stork2-commons/src/test/java/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/test/java/eu/.svn/entries delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/.svn/entries delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/entries delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/entries delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/AttributeUtilTestCase.java.svn-base delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/DateUtilTestCase.java.svn-base delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PEPSUtilTestCase.java.svn-base delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeListTestCase.java.svn-base delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeTestCase.java.svn-base delete mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeProvidersMapTestCase.java create mode 100644 id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeSourceTestCase.java delete mode 100644 id/server/stork2-commons/src/test/resources/.svn/all-wcprops delete mode 100644 id/server/stork2-commons/src/test/resources/.svn/entries delete mode 100644 id/server/stork2-commons/src/test/resources/.svn/text-base/log4j.xml.svn-base create mode 100644 id/server/stork2-saml-engine/Releases delete mode 100644 id/server/stork2-saml-engine/build/classes/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/META-INF/MANIFEST.MF delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngine.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLCore.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPApplication.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPCountry.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPID.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInformation.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInstitution.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPSector.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/package-info.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/package-info.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/package-info.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/package-info.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationCreator.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationEngine.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationReader.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationSingleton.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/InstanceEngine.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/package-info.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/SAMLEngineException.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.class delete mode 100644 id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/package-info.class delete mode 100644 id/server/stork2-saml-engine/build/classes/test/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class delete mode 100644 id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SamlEngine.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_P11.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/logback-test.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/p11Conf.cfg.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SamlEngine.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf0.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf1.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf2.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf3.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/SignModule_P11.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf0.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf1.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf2.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf3.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry0.jks delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry1.jks delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry2.jks delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry3.jks delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/logback-test.xml delete mode 100644 id/server/stork2-saml-engine/build/classes/test/resources/p11Conf.cfg delete mode 100644 id/server/stork2-saml-engine/src/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/main/config/embedded/StorkSamlEngine_CPEPS.xml create mode 100644 id/server/stork2-saml-engine/src/main/config/embedded/quartz.properties create mode 100644 id/server/stork2-saml-engine/src/main/config/jBoss/context.xml create mode 100644 id/server/stork2-saml-engine/src/main/config/jBoss/jboss-classloading.xml delete mode 100644 id/server/stork2-saml-engine/src/main/java/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/META-INF/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/META-INF/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomAttributeQuery.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomRequestAbstractType.java delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryBuilder.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryImpl.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryUnmarshaller.java delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/CustomAttributeQueryValidator.java delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base diff --git a/id/server/idserverlib/pom.xml b/id/server/idserverlib/pom.xml index cd9e0a7df..8a9cdd51f 100644 --- a/id/server/idserverlib/pom.xml +++ b/id/server/idserverlib/pom.xml @@ -25,16 +25,23 @@ - - MOA.id - stork-saml-engine - 1.5.2 - - - MOA.id.server - moa-id-commons - ${pom.version} - + + + MOA.id + stork-saml-engine + 1.5.2 + + + + eu.stork + SamlEngine + 1.1.0 + + + MOA.id.server + moa-id-commons + ${pom.version} + MOA moa-common diff --git a/id/server/stork2-commons/Releases b/id/server/stork2-commons/Releases index 00e3d806d..54aeb9313 100644 --- a/id/server/stork2-commons/Releases +++ b/id/server/stork2-commons/Releases @@ -37,4 +37,26 @@ Changes: Updated Version to 1.1.0 Dependencies updated Business Logic Part I changes SAML Engine Changes merged (from SamlEngine/1.1.0/Commons branch to be easier to merge this branch with trunk) - Fixed some errors on Test Case \ No newline at end of file + Fixed some errors on Test Case + +Branch : STORKCommons_1_1_1 +Date : 02-12-2013 +Changes: Updated Version to 1.1.1 + Added mandate error code + PMD quality code changes (some final identifier missing) + Added new methods to personal attribute list to get Mandatory/Optional and/or Simple/Complex attributes + Added new unit tests + +Branch : Commons (Trunk) +Date : 15-01-2014 +Version: 1.2.0 +Release: 2 +Changes: Updated Version to 1.2.0 + dded request flow of PV (incomplete) + Added AP mandatory attribute to get data for business attributes + *) based on configuration file it adds the missing attributes (eIdentifier, givenName, surname and dateOfBirth) or change isRequired to true. + changes original isRequired state in response + Added new Interface (IAttributeListProcessor) to make some operations on attribute lists + Power Validation is complete now + Business Logic I and II integration (Request Complete!) + Added new method to Personal attribute List to check if there is at least one attribute with no value. diff --git a/id/server/stork2-commons/pom.xml b/id/server/stork2-commons/pom.xml index 1fa6f538d..a71ee1628 100644 --- a/id/server/stork2-commons/pom.xml +++ b/id/server/stork2-commons/pom.xml @@ -2,17 +2,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 eu.stork - stork-commons + Commons jar Stork Commons UTF-8 - 1.1.0 + 1.2.0 + 2.6.0 ${stork.version} The STORKCommons library provides beans, Java Interfaces and utility classes to integrate PEPS and SAML Engine. + @@ -47,6 +49,34 @@ + + org.opensaml + opensaml + ${opensaml.version} + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + log4j-over-slf4j + + + org.slf4j + jul-to-slf4j + + + + org.bouncycastle @@ -79,7 +109,7 @@ - stork-commons + commons diff --git a/id/server/stork2-commons/src/.svn/all-wcprops b/id/server/stork2-commons/src/.svn/all-wcprops deleted file mode 100644 index 8c9f999e7..000000000 --- a/id/server/stork2-commons/src/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 49 -/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src -END diff --git a/id/server/stork2-commons/src/.svn/entries b/id/server/stork2-commons/src/.svn/entries deleted file mode 100644 index 8bea20479..000000000 --- a/id/server/stork2-commons/src/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-05T18:15:46.189390Z -105 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -test -dir - -main -dir - diff --git a/id/server/stork2-commons/src/main/.svn/all-wcprops b/id/server/stork2-commons/src/main/.svn/all-wcprops deleted file mode 100644 index 05728e427..000000000 --- a/id/server/stork2-commons/src/main/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 53 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main -END diff --git a/id/server/stork2-commons/src/main/.svn/entries b/id/server/stork2-commons/src/main/.svn/entries deleted file mode 100644 index 1e58ea7f9..000000000 --- a/id/server/stork2-commons/src/main/.svn/entries +++ /dev/null @@ -1,37 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -java -dir - -config -dir - -resources -dir - diff --git a/id/server/stork2-commons/src/main/config/.svn/all-wcprops b/id/server/stork2-commons/src/main/config/.svn/all-wcprops deleted file mode 100644 index a43da4e7f..000000000 --- a/id/server/stork2-commons/src/main/config/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 60 -/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/config -END diff --git a/id/server/stork2-commons/src/main/config/.svn/entries b/id/server/stork2-commons/src/main/config/.svn/entries deleted file mode 100644 index fc29ea9af..000000000 --- a/id/server/stork2-commons/src/main/config/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/config -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-28T11:11:01.095477Z -73 -emlelisst - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -embedded -dir - diff --git a/id/server/stork2-commons/src/main/config/embedded/.svn/all-wcprops b/id/server/stork2-commons/src/main/config/embedded/.svn/all-wcprops deleted file mode 100644 index 77e2a8338..000000000 --- a/id/server/stork2-commons/src/main/config/embedded/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 69 -/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/config/embedded -END -pepsUtil.properties -K 25 -svn:wc:ra_dav:version-url -V 89 -/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/config/embedded/pepsUtil.properties -END diff --git a/id/server/stork2-commons/src/main/config/embedded/.svn/entries b/id/server/stork2-commons/src/main/config/embedded/.svn/entries deleted file mode 100644 index bd9b1843e..000000000 --- a/id/server/stork2-commons/src/main/config/embedded/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/config/embedded -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-28T11:11:01.095477Z -73 -emlelisst - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -pepsUtil.properties -file - - - - -2013-12-20T12:27:56.666475Z -ea19345b61bd574891578c684550a2e8 -2013-10-28T11:11:01.095477Z -73 -emlelisst - - - - - - - - - - - - - - - - - - - - - -6770 - diff --git a/id/server/stork2-commons/src/main/config/embedded/.svn/text-base/pepsUtil.properties.svn-base b/id/server/stork2-commons/src/main/config/embedded/.svn/text-base/pepsUtil.properties.svn-base deleted file mode 100644 index eba0674e8..000000000 --- a/id/server/stork2-commons/src/main/config/embedded/.svn/text-base/pepsUtil.properties.svn-base +++ /dev/null @@ -1,232 +0,0 @@ -#Max allowed params size -validation.active=true -max.spUrl.size=150 -max.attrList.size=20000 -max.invalidAttributeList.size=20000 -max.attrName.size=100 -max.callback.size=300 -max.idp.url.size=300 -max.atp.url.size=300 -max.attrValue.size=20000 -max.attrType.size=25 -max.spId.size=40 -max.providerName.size=128 -max.spName.size=25 -max.country.size=150 -max.qaaLevel.size=1 -max.spQaaLevel.size=1 -max.errorCode.size=5 -max.errorMessage.size=300 -max.username.size=30 -max.spepsRedirectUrl.size=300 -max.speps.redirectUrl.size=300 -max.cpeps.redirectUrl.size=300 -max.cpepsRedirectUrl.size=300 -max.spepsAssertionUrl.size=300 -max.SAMLRequest.size=131072 -max.SAMLResponse.size=131072 -max.RelayState.size=80 -max.remoteAddr.size=300 -max.remoteHost.size=300 -max.localAddr.size=300 -max.localName.size=300 - -#ERROR codes/messages (accordingly to specification) - -#CountrySelector Interface errors -spCountrySelector.invalidSPQAA.code=0000001 -spCountrySelector.invalidSPQAA.message=invalid.spQAA.parameter - -spCountrySelector.invalidQaaSPid.code=0000001 -spCountrySelector.invalidQaaSPid.message=invalid.spQAAId.parameter - -spCountrySelector.invalidSpId.code=000002 -spCountrySelector.invalidSpId.message=invalid.spId.parameter - -spCountrySelector.invalidSpURL.code=000003 -spCountrySelector.invalidSpURL.message=invalid.spUrl.parameter - -domain.CountrySelectorAction.code=000003 -domain.CountrySelectorAction.message=invalid.cs.domain - -requests.CountrySelectorAction.code=000004 -requests.CountrySelectorAction.message=reached.max.requests.cs - -spCountrySelector.spNotAllowed.code=000006 -spCountrySelector.spNotAllowed.message=attr.access.deny - -spCountrySelector.invalidAttr.code=000007 -spCountrySelector.invalidAttr.message=invalid.spAttr.parameter - -spCountrySelector.invalidProviderName.code=000008 -spCountrySelector.invalidProviderName.message=invalid.spProvidername.parameter - -spCountrySelector.errorCreatingSAML.code=203001 -spCountrySelector.errorCreatingSAML.message=error.create.sp.saml - -spepsSAMLRequest.code=203001 -spepsSAMLRequest.message=error.create.saml.speps - -#ServiceProvider Interface errors -sProviderAction.invalidSPQAA.code=200001 -sProviderAction.invalidSPQAA.message=invalid.sp.qaa - -sProviderAction.invalidSPQAAId.code=200001 -sProviderAction.invalidSPQAAId.message=invalid.sp.qaaid - -sProviderAction.invalidSPId.code=200002 -sProviderAction.invalidSPId.message=invalid.sp.id - -domain.ServiceProviderAction.code=200003 -domain.ServiceProviderAction.message=invalid.sp.domain - -sProviderAction.invalidSPDomain.code=200003 -sProviderAction.invalidSPDomain.message=invalid.sp.domain - -sProviderAction.invalidCountry.code=200004 -sProviderAction.invalidCountry.message=invalid.sp.country - -sProviderAction.spNotAllowed.code=200005 -sProviderAction.spNotAllowed.message=sp.not.allowed - -sProviderAction.invalidSaml.code=200006 -sProviderAction.invalidSaml.message=invalid.sp.samlrequest - -sProviderAction.invalidSPProviderName.code=200007 -sProviderAction.invalidSPProviderName.message=sp.not.identified - -sProviderAction.invalidSPRedirect.code=200008 -sProviderAction.invalidSPRedirect.message=invalid.sp.redirectUrl - -sProviderAction.invalidRelayState.code=200009 -sProviderAction.invalidRelayState.message=invalid.sp.relaystate - -sProviderAction.invalidAttr.code=200011 -sProviderAction.invalidAttr.message=invalid.sp.attr - -requests.ServiceProviderAction.code=200012 -requests.ServiceProviderAction.message=reached.max.requests.sp - -sProviderAction.invalidSPAlias.code=203003 -sProviderAction.invalidSPAlias.message=invalid.sp.alias - -sProviderAction.errorCreatingSAML.code=203001 -sProviderAction.errorCreatingSAML.message=error.create.saml.speps - -#Internal Error -internalError.code=203001 -internalError.message=internalError - -attrList.code=202005 -attrList.message=invalid.attrList.parameter - -missing.sessionId.code=203010 -missing.sessionId.message=missing.session.id - -sessionError.code=203011 -sessionError.message=invalid.session.id - -invalid.sessionId.code=203011 -invalid.sessionId.message=invalid.session.id - -invalid.session.code=203012 -invalid.session.message=invalid.session - -callback.code=203006 -callback.message=invalid.callback.url - -idp.url.code=203006 -idp.url.message=invalid.idp.url - -IdPSAMLResponse.code=002001 -IdPSAMLResponse.message=invalid.idp.response - -authenticationFailed.code=003002 -authenticationFailed.message=authentication.failed - -username.code=003002 -username.message=authentication.failed - -invalidAttributeList.code=203001 -invalidAttributeList.message=invalid.attrlist - -invalidAttributeValue.code=203001 -invalidAttributeValue.message=invalid.attr.value - -attVerification.mandatory.code=202010 -attVerification.mandatory.message=missing.mandatory.attr - -attrValue.verification.code=203008 -attrValue.verification.message=invalid.stork.attrValue - -cpepsSAMLResponse.code=202011 -cpepsSAMLResponse.message=error.gen.cpeps.saml - -AtPSAMLResponse.code=202009 -AtPSAMLResponse.message=error.gen.atp.saml - -atp.url.code=203006 -atp.url.message=invalid.atp.url - -hash.error.code=203001 -hash.error.message=error.hash - -qaaLevel.code=203006 -qaaLevel.message=invalid.cpeps.qaalevel - -SAMLRequest.code=203001 -SAMLRequest.message=invalid.SAMLRequest - -#Colleague Request Interface errors - -colleagueRequest.invalidSAML.code=201002 -colleagueRequest.invalidSAML.message=invalid.speps.samlrequest - -colleagueRequest.invalidCountryCode.code=002001 -colleagueRequest.invalidCountryCode.message=country.cpeps.nomatch - -colleagueRequest.errorCreatingSAML.code=203001 -colleagueRequest.errorCreatingSAML.message=error.create.saml.cpeps - -colleagueRequest.invalidQaa.code=202004 -colleagueRequest.invalidQaa.message=invalid.requested.cpeps.qaalevel - -colleagueRequest.attrNull.code=202005 -colleagueRequest.attrNull.message=invalid.requested.attrlist.cpeps - -colleagueRequest.invalidRedirect.code=202001 -colleagueRequest.invalidRedirect.message=invalid.redirecturl.cpeps - -colleagueRequest.invalidDestUrl.code=203006 -colleagueRequest.invalidDestUrl.message=invalid.cpeps.destUrl - -cpepsRedirectUrl.code=203006 -cpepsRedirectUrl.message=invalid.cpeps.redirectUrl - -#Citizen Consent Interfaces errors - -citizenResponse.mandatory.code=202007 -citizenResponse.mandatory.message=no.consent.mand.attr - -cPeps.attrNull.code=202005 -cPeps.attrNull.message=invalid.attrList.cpeps - -citizenNoConsent.mandatory.code=202012 -citizenNoConsent.mandatory.message=no.consent.val.mand.attr - -#Colleague Response Interface errors - -colleagueResponse.invalidSAML.code=202002 -colleagueResponse.invalidSAML.message=invalid.cpeps.samlresp - -auRequestIdError.code=201005 -auRequestIdError.message=invalid.speps.saml.id - -audienceRestrictionError.code=201004 -audienceRestrictionError.message=speps.saml.condition.notmet - -spepsSAMLResponse.code=200010 -spepsSAMLResponse.message=error.gen.speps.saml - -#Hash Digests -hashDigest.className=org.bouncycastle.crypto.digests.SHA512Digest diff --git a/id/server/stork2-commons/src/main/config/embedded/pepsUtil.properties b/id/server/stork2-commons/src/main/config/embedded/pepsUtil.properties index eba0674e8..1e92f390d 100644 --- a/id/server/stork2-commons/src/main/config/embedded/pepsUtil.properties +++ b/id/server/stork2-commons/src/main/config/embedded/pepsUtil.properties @@ -7,6 +7,7 @@ max.attrName.size=100 max.callback.size=300 max.idp.url.size=300 max.atp.url.size=300 +max.cpepsURL.size=300 max.attrValue.size=20000 max.attrType.size=25 max.spId.size=40 @@ -30,6 +31,8 @@ max.remoteAddr.size=300 max.remoteHost.size=300 max.localAddr.size=300 max.localName.size=300 +max.apepsUrl.size=300 +max.apeps.callbackUrl.size=300 #ERROR codes/messages (accordingly to specification) @@ -107,6 +110,12 @@ sProviderAction.invalidAttr.message=invalid.sp.attr requests.ServiceProviderAction.code=200012 requests.ServiceProviderAction.message=reached.max.requests.sp +sPPowerValidationAction.invalidSPPVAttrList.code=200013 +sPPowerValidationAction.invalidSPPVAttrList.message=invalid.sp.pv.attrlist + +invalid.sp.pv.attrlist.code=200013 +invalid.sp.pv.attrlist.message=invalid.sp.pv.attrlist + sProviderAction.invalidSPAlias.code=203003 sProviderAction.invalidSPAlias.message=invalid.sp.alias @@ -129,6 +138,9 @@ sessionError.message=invalid.session.id invalid.sessionId.code=203011 invalid.sessionId.message=invalid.session.id +missing.mandate.code=203013 +missing.mandate.message=missing.mandate + invalid.session.code=203012 invalid.session.message=invalid.session @@ -159,7 +171,7 @@ attVerification.mandatory.message=missing.mandatory.attr attrValue.verification.code=203008 attrValue.verification.message=invalid.stork.attrValue -cpepsSAMLResponse.code=202011 +cpepsSAMLResponse.code=202012 cpepsSAMLResponse.message=error.gen.cpeps.saml AtPSAMLResponse.code=202009 @@ -177,6 +189,9 @@ qaaLevel.message=invalid.cpeps.qaalevel SAMLRequest.code=203001 SAMLRequest.message=invalid.SAMLRequest +atp.response.error.code=202011 +atp.response.error.message=atp.response.error + #Colleague Request Interface errors colleagueRequest.invalidSAML.code=201002 @@ -194,6 +209,9 @@ colleagueRequest.invalidQaa.message=invalid.requested.cpeps.qaalevel colleagueRequest.attrNull.code=202005 colleagueRequest.attrNull.message=invalid.requested.attrlist.cpeps +colleaguePVRequest.invalidPVAttrList.code=202013 +colleaguePVRequest.invalidPVAttrList.message=invalid.speps.pv.attrlist + colleagueRequest.invalidRedirect.code=202001 colleagueRequest.invalidRedirect.message=invalid.redirecturl.cpeps @@ -228,5 +246,22 @@ audienceRestrictionError.message=speps.saml.condition.notmet spepsSAMLResponse.code=200010 spepsSAMLResponse.message=error.gen.speps.saml + +invalid.apepsRedirectUrl.code=001001 +invalid.apepsRedirectUrl.message=invalid.apeps.redirectUrl + +apepsSAMLRequest.code=001002 +apepsSAMLRequest.message=invalid.apeps.saml.request + +apepsSAMLResponse.code=001003 +apepsSAMLResponse.message=invalid.apeps.saml.response + +invalid.apepsCallbackUrl.code=001004 +invalid.apepsCallbackUrl.message=invalid.apeps.callback.url + +colleagueAttributeRequest.invalidSAML.code=001005 +colleagueAttributeRequest.invalidSAML.message=invalid.attr.request.saml + + #Hash Digests hashDigest.className=org.bouncycastle.crypto.digests.SHA512Digest diff --git a/id/server/stork2-commons/src/main/java/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/.svn/all-wcprops deleted file mode 100644 index 52b0d1aa6..000000000 --- a/id/server/stork2-commons/src/main/java/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 58 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java -END diff --git a/id/server/stork2-commons/src/main/java/.svn/entries b/id/server/stork2-commons/src/main/java/.svn/entries deleted file mode 100644 index cc94ba4ff..000000000 --- a/id/server/stork2-commons/src/main/java/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -eu -dir - diff --git a/id/server/stork2-commons/src/main/java/eu/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/.svn/all-wcprops deleted file mode 100644 index b792be687..000000000 --- a/id/server/stork2-commons/src/main/java/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 61 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu -END diff --git a/id/server/stork2-commons/src/main/java/eu/.svn/entries b/id/server/stork2-commons/src/main/java/eu/.svn/entries deleted file mode 100644 index d746a275b..000000000 --- a/id/server/stork2-commons/src/main/java/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -stork -dir - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/.svn/all-wcprops deleted file mode 100644 index bfb5156c8..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 67 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork -END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/.svn/entries deleted file mode 100644 index 081cc291c..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -peps -dir - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/all-wcprops deleted file mode 100644 index 10f18802a..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 72 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps -END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/entries deleted file mode 100644 index d8fcce9b6..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -auth -dir - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/all-wcprops deleted file mode 100644 index 479002e28..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 77 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth -END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/entries deleted file mode 100644 index c90333736..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps/auth -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -commons -dir - -specific -dir - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/all-wcprops deleted file mode 100644 index 5c34d72e7..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/all-wcprops +++ /dev/null @@ -1,167 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 85 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons -END -CitizenConsent.java -K 25 -svn:wc:ra_dav:version-url -V 105 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java -END -AttributeProvidersMap.java -K 25 -svn:wc:ra_dav:version-url -V 112 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java -END -AttributeConstants.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeConstants.java -END -AttributeUtil.java -K 25 -svn:wc:ra_dav:version-url -V 104 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java -END -STORKStatusCode.java -K 25 -svn:wc:ra_dav:version-url -V 106 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKStatusCode.java -END -STORKAttrQueryResponse.java -K 25 -svn:wc:ra_dav:version-url -V 113 -/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java -END -PersonalAttributeList.java -K 25 -svn:wc:ra_dav:version-url -V 112 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java -END -Country.java -K 25 -svn:wc:ra_dav:version-url -V 98 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/Country.java -END -PEPSErrors.java -K 25 -svn:wc:ra_dav:version-url -V 101 -/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java -END -PEPSUtil.java -K 25 -svn:wc:ra_dav:version-url -V 99 -/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java -END -PersonalAttribute.java -K 25 -svn:wc:ra_dav:version-url -V 108 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java -END -IAttributeProvidersMap.java -K 25 -svn:wc:ra_dav:version-url -V 113 -/CITnet/svn/STORK2/!svn/ver/31/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java -END -IStorkLogger.java -K 25 -svn:wc:ra_dav:version-url -V 103 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/IStorkLogger.java -END -DateUtil.java -K 25 -svn:wc:ra_dav:version-url -V 99 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/DateUtil.java -END -STORKAuthnRequest.java -K 25 -svn:wc:ra_dav:version-url -V 108 -/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java -END -STORKSubStatusCode.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKSubStatusCode.java -END -IPersonalAttributeList.java -K 25 -svn:wc:ra_dav:version-url -V 113 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java -END -AttributeProvider.java -K 25 -svn:wc:ra_dav:version-url -V 108 -/CITnet/svn/STORK2/!svn/ver/31/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java -END -IStorkSession.java -K 25 -svn:wc:ra_dav:version-url -V 104 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/IStorkSession.java -END -CountryCodes.java -K 25 -svn:wc:ra_dav:version-url -V 103 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/CountryCodes.java -END -STORKAuthnResponse.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 103 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/package-info.java -END -AttributeSource.java -K 25 -svn:wc:ra_dav:version-url -V 106 -/CITnet/svn/STORK2/!svn/ver/31/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java -END -Linker.java -K 25 -svn:wc:ra_dav:version-url -V 97 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/Linker.java -END -PEPSValues.java -K 25 -svn:wc:ra_dav:version-url -V 101 -/CITnet/svn/STORK2/!svn/ver/31/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java -END -PEPSParameters.java -K 25 -svn:wc:ra_dav:version-url -V 105 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java -END -STORKAttrQueryRequest.java -K 25 -svn:wc:ra_dav:version-url -V 112 -/CITnet/svn/STORK2/!svn/ver/56/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java -END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/entries deleted file mode 100644 index 78c1138bc..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/entries +++ /dev/null @@ -1,949 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps/auth/commons -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -AttributeSource.java -file - - - - -2013-12-20T12:27:56.638475Z -0f5436915d275475d2e30e1ac8aa9916 -2013-10-10T17:38:31.956327Z -31 -emlelisst - - - - - - - - - - - - - - - - - - - - - -2576 - -Linker.java -file - - - - -2013-12-20T12:27:56.638475Z -7e2de1580308d3fa7c91f95eed36fcff -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -4707 - -package-info.java -file - - - - -2013-12-20T12:27:56.638475Z -8d8068e217f10425f76a8d37192ccd80 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -277 - -PEPSValues.java -file - - - - -2013-12-20T12:27:56.638475Z -95c122e156ff030f46dd02bacaef7b2a -2013-10-10T17:38:31.956327Z -31 -emlelisst - - - - - - - - - - - - - - - - - - - - - -7515 - -PEPSParameters.java -file - - - - -2013-12-20T12:27:56.638475Z -3bbae3c0d36d323b2551d8735becbbf3 -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -12811 - -STORKAttrQueryRequest.java -file - - - - -2013-12-20T12:27:56.638475Z -f24b34d7b7778b050000759b8e51e135 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -10086 - -CitizenConsent.java -file - - - - -2013-12-20T12:27:56.638475Z -65152dd2df078e7d9ba767293ee3089e -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3419 - -AttributeProvidersMap.java -file - - - - -2013-12-20T12:27:56.638475Z -dd0a71bc5e428238622d01103d1ff592 -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -2570 - -AttributeConstants.java -file - - - - -2013-12-20T12:27:56.638475Z -940dcb9e93ede62e221f4b25abd6576b -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1831 - -exceptions -dir - -AttributeUtil.java -file - - - - -2013-12-20T12:27:56.638475Z -fa7359e18bb73f5e6a40a10602334001 -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -7921 - -STORKStatusCode.java -file - - - - -2013-12-20T12:27:56.638475Z -771689c75a8263c7e3966e820d59025e -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1906 - -STORKAttrQueryResponse.java -file - - - - -2013-12-20T12:27:56.638475Z -7f38f84cce71009e69f5b122cc56b9a4 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -6750 - -PersonalAttributeList.java -file - - - - -2013-12-20T12:27:56.638475Z -6d50cc23699503bb7a1444c9a16cff8c -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -9413 - -Country.java -file - - - - -2013-12-20T12:27:56.638475Z -9cbde5f25b646d02dae7ccf424906b4a -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -2208 - -PEPSErrors.java -file - - - - -2013-12-20T12:27:56.638475Z -8cd32a1d957e59b567eeb14ac9d989b6 -2013-10-28T11:11:01.095477Z -73 -emlelisst - - - - - - - - - - - - - - - - - - - - - -10810 - -PEPSUtil.java -file - - - - -2013-12-20T12:27:56.634475Z -54dfabdb89ec6069a2ec2e33c8d925d6 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -11507 - -PersonalAttribute.java -file - - - - -2013-12-20T12:27:56.634475Z -76a8ff69fd13e5f67f1404249ca1d8a1 -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -8471 - -IAttributeProvidersMap.java -file - - - - -2013-12-20T12:27:56.634475Z -225257e8d6d7b9e6bcc4bea2463c33be -2013-10-10T17:38:31.956327Z -31 -emlelisst - - - - - - - - - - - - - - - - - - - - - -2534 - -IStorkLogger.java -file - - - - -2013-12-20T12:27:56.634475Z -f15979b29f52d1674103528aed914ae7 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -4766 - -DateUtil.java -file - - - - -2013-12-20T12:27:56.634475Z -59f9cd2a3d1169a0f1a797b28719921a -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -5702 - -STORKAuthnRequest.java -file - - - - -2013-12-20T12:27:56.634475Z -3f36e65f0c4f1c7df753784b2e64f00b -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -11269 - -STORKSubStatusCode.java -file - - - - -2013-12-20T12:27:56.634475Z -65e615e0119d4125d5f4f58af8bcd18b -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2181 - -IPersonalAttributeList.java -file - - - - -2013-12-20T12:27:56.634475Z -8a39da025b26fd5782611eeadeb69e03 -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -4664 - -AttributeProvider.java -file - - - - -2013-12-20T12:27:56.634475Z -a16d3c5a83ced423ccc22f1d841c3575 -2013-10-10T17:38:31.956327Z -31 -emlelisst - - - - - - - - - - - - - - - - - - - - - -1525 - -IStorkSession.java -file - - - - -2013-12-20T12:27:56.634475Z -5a8701b1fd27998d5cf3280a5c99bcb0 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2745 - -CountryCodes.java -file - - - - -2013-12-20T12:27:56.638475Z -f91b0f8df0b2a68fe1b900d425257c23 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3527 - -STORKAuthnResponse.java -file - - - - -2013-12-20T12:27:56.638475Z -413495295761fd9c49a0b1e50befc68f -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -6797 - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeConstants.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeConstants.java.svn-base deleted file mode 100644 index 09769641c..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeConstants.java.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -/** - * This enum class contains all the STORK PEPS, Commons and Specific errors - * constant identifiers. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.2 $, $Date: 2010-11-17 05:15:28 $ - */ -public enum AttributeConstants { - - /** - * Represents the attribute's name index. - */ - ATTR_NAME_INDEX(0), - /** - * Represents the attribute's type index. - */ - ATTR_TYPE_INDEX(1), - /** - * Represents the attribute's value index. - */ - ATTR_VALUE_INDEX(2), - /** - * Represents the attribute's status index. - */ - ATTR_STATUS_INDEX(3), - /** - * Represents the number of allowed tuples. - */ - NUMBER_TUPLES(4); - - /** - * Represents the constant's value. - */ - private int attribute; - - /** - * Solo Constructor. - * - * @param attr The Attribute Constant value. - */ - AttributeConstants(final int attr) { - - this.attribute = attr; - } - - /** - * Return the Constant Value. - * - * @return The constant value. - */ - public int intValue() { - - return attribute; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvider.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvider.java.svn-base deleted file mode 100644 index 013f4caf3..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvider.java.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -package eu.stork.peps.auth.commons; - -/** - * This class is a bean used to store the information relative to the Attribute Provider. - * - * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) - * - * @version $Revision: 1.00 $, $Date: 2013-09-17 $ - */ -public final class AttributeProvider { - - /** - * Provider Id. - */ - private String providerId; - - /** - * Provider Name. - */ - private String providerName; - - /** - * Attribute Provider Constructor. - * - * @param pId Id of the Attribute Provider. - * @param pName Name of the Attribute Provider. - */ - public AttributeProvider(final String pId, final String pName) { - - this.providerId = pId; - this.providerName = pName; - } - - /** - * Getter for the providerId value. - * - * @return The providerId value. - */ - public String getProviderId() { - - return providerId; - } - - /** - * Setter for the providerId value. - * - * @param pId Id of the Attribute Provider. - */ - public void setProviderId(final String pId) { - - this.providerId = pId; - } - - /** - * Getter for the providerName value. - * - * @return The providerName value. - */ - public String getProviderName() { - - return providerName; - } - - /** - * Setter for the providerName value. - * - * @param name Name of the Attribute Provider. - */ - public void setProviderName(final String name) { - - this.providerName = name; - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvidersMap.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvidersMap.java.svn-base deleted file mode 100644 index 8806ba866..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeProvidersMap.java.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -package eu.stork.peps.auth.commons; - -import java.util.Iterator; -import java.util.LinkedHashMap; - -import org.apache.log4j.Logger; - -/** - * Implementation of the AttributeProviderMap using a LinkedHashMap. - * - * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) - * - * @version $Revision: 1.01 $, $Date: 2013-09-20 $ - * - * @see LinkedHashMap - */ -public class AttributeProvidersMap extends LinkedHashMap - implements IAttributeProvidersMap { - /** - * Logger object. - */ - private static final Logger LOG = Logger.getLogger(AttributeProvidersMap.class.getName()); - - /** - * Unique identifier. - */ - private static final long serialVersionUID = 8949081185106296122L; - - /** - * {@inheritDoc} - */ - @Override - public IPersonalAttributeList get(AttributeSource key) { - return this.get((Object) key); - } - - /** - * {@inheritDoc} - */ - @Override - public IPersonalAttributeList remove(AttributeSource key) { - return this.remove((Object) key); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean containsKey(AttributeSource key) { - return this.containsKey((Object) key); - } - - /** - * {@inheritDoc} - */ - @Override - public Iterator keyIterator() { - return this.keySet().iterator(); - } - - public void trace() { - Iterator iterator; - Iterator iterator2; - AttributeSource source; - IPersonalAttributeList pal; - PersonalAttribute pa; - - iterator = this.keyIterator(); - LOG.trace("Start dumping of AttributeProvidersMap\n======================="); - while (iterator.hasNext()) { - source = iterator.next(); - - LOG.trace("Source details: type [" + source.getSourceType() + "], URL [" + source.getProviderURL() + "]"); - - if(source.getSourceType() == AttributeSource.SOURCE_LOCAL_APROVIDER) - LOG.trace("-> Attribute Provider: ID [" + source.getProvider().getProviderId() + "], name [" + source.getProvider().getProviderName() + "]"); - else - LOG.trace("-> Country: ID [" + source.getCountry().getCountryId() + "], name [" + source.getCountry().getCountryName() + "]"); - - pal = this.get(source); - LOG.trace("++++++++=>"); - iterator2 = pal.iterator(); - while (iterator2.hasNext()) { - pa = iterator2.next(); - - LOG.trace("-> Citizen Attribute: name [" + pa.getName() + "], name [" + pa.isRequired() + "]"); - } - LOG.trace("<=++++++++"); - - LOG.trace("-----------------------"); - } - LOG.trace("END\n======================="); - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeSource.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeSource.java.svn-base deleted file mode 100644 index 4b9dc33e9..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeSource.java.svn-base +++ /dev/null @@ -1,119 +0,0 @@ -package eu.stork.peps.auth.commons; - -/** - * This class is a bean used to store the information relative to the Attribute Source (either AttributeProvider or Country). - * - * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) - * - * @version $Revision: 1.00 $, $Date: 2013-09-19 $ - */ -public final class AttributeSource { - public static final int SOURCE_LOCAL_APROVIDER = 1; - public static final int SOURCE_REMOTE_COUNTRY = 2; - - /** - * Provider source. - */ - private int sourceType; - - /** - * Provider URL. - */ - private String providerURL; - - /** - * The local Attribute Provider. - */ - private AttributeProvider provider; - - /** - * The remote Country. - */ - private Country country; - - /** - * Attribute Source Constructor. - * - * @param provider The local Attribute Provider. - * @param pURL URL of the Attribute Provider. - */ - public AttributeSource(final AttributeProvider provider, final String pURL) { - this.setSourceType(SOURCE_LOCAL_APROVIDER); - - this.setProvider(provider); - this.setProviderURL(pURL); - } - - /** - * Attribute Source Constructor. - * - * @param country The remote Country. - * @param pURL URL of the Country. - */ - public AttributeSource(final Country country, final String pURL) { - this.setSourceType(SOURCE_REMOTE_COUNTRY); - - this.setCountry(country); - this.setProviderURL(pURL); - } - - /** - * @param sourceType the sourceType to set - */ - public void setSourceType(int sourceType) { - this.sourceType = sourceType; - } - - /** - * @return the sourceType - */ - public int getSourceType() { - return sourceType; - } - - /** - * @param providerURL the providerURL to set - */ - public void setProviderURL(String providerURL) { - this.providerURL = providerURL; - } - - /** - * @return the providerURL - */ - public String getProviderURL() { - return providerURL; - } - - /** - * @param provider the provider to set - */ - public void setProvider(AttributeProvider provider) { - this.setSourceType(SOURCE_LOCAL_APROVIDER); - - this.provider = provider; - } - - /** - * @return the provider - */ - public AttributeProvider getProvider() { - return provider; - } - - /** - * @param country the country to set - */ - public void setCountry(Country country) { - this.setSourceType(SOURCE_REMOTE_COUNTRY); - - this.country = country; - } - - /** - * @return the country - */ - public Country getCountry() { - return country; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeUtil.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeUtil.java.svn-base deleted file mode 100644 index 84e3576e5..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/AttributeUtil.java.svn-base +++ /dev/null @@ -1,231 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang.StringUtils; - -/** - * This class holds static helper methods. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.5 $, $Date: 2010-12-15 23:19:59 $ - */ -public final class AttributeUtil { - - /** - * Private constructor. Prevents the class from being instantiated. - */ - private AttributeUtil() { - // empty constructor - } - - /** - * Safe escape any given string. - * - * @param value The HTTP Value to escaped. - * - * @return The value escaped value. - */ - public static String escape(final String value) { - - final String attrSep = PEPSValues.ATTRIBUTE_SEP.toString(); - final String attrTupleSep = PEPSValues.ATTRIBUTE_TUPLE_SEP.toString(); - final String attrValueSep = PEPSValues.ATTRIBUTE_VALUE_SEP.toString(); - - final String escAttrSep = "%" + (int) attrSep.charAt(0); - final String escAttrTupleSep = "%" + (int) attrTupleSep.charAt(0); - final String escAttrValueSep = "%" + (int) attrValueSep.charAt(0); - - return value.replace(attrSep, escAttrSep) - .replace(attrTupleSep, escAttrTupleSep) - .replace(attrValueSep, escAttrValueSep); - } - - /** - * Unescape any given string. - * - * @param value The HTTP Value to be unescaped. - * - * @return The value unescaped value. - */ - public static String unescape(final String value) { - final String attrSep = PEPSValues.ATTRIBUTE_SEP.toString(); - final String attrTupleSep = PEPSValues.ATTRIBUTE_TUPLE_SEP.toString(); - final String attrValueSep = PEPSValues.ATTRIBUTE_VALUE_SEP.toString(); - - final String escAttrSep = "%" + (int) attrSep.charAt(0); - final String escAttrTupleSep = "%" + (int) attrTupleSep.charAt(0); - final String escAttrValueSep = "%" + (int) attrValueSep.charAt(0); - - return value.replace(escAttrSep, attrSep) - .replace(escAttrTupleSep, attrTupleSep) - .replace(escAttrValueSep, attrValueSep); - } - - /** - * Appends the string representation of an object to a StringBuilder. - * - * @param strBuilder The StringBuilder to append to. - * @param val The string representation of an object. - */ - public static void appendIfNotNull(final StringBuilder strBuilder, - final Object val) { - - if (val != null) { - strBuilder.append(val); - } - } - - /** - * Given a separator and a list of strings, joins the list, as a string, - * separated by the separator string. - * - * @param list The list of strings to join. - * @param separator The separator string. - * @return the list, as a string, separated by the separator string. - */ - public static String listToString(final List list, - final String separator) { - - final StringBuilder strBuilder = new StringBuilder(); - for (final String s : list) { - if (!StringUtils.isEmpty(s)) { - strBuilder.append(AttributeUtil.escape(s) + separator); - } - } - return strBuilder.toString(); - } - - /** - * Given a separator and a map of strings to strings, joins the map, as a - * string, separated by the separator string with the pair key/value - * concatenated with a '='. - * - * @param map The map of strings to join. - * @param separator The separator string. - * - * @return the map of strings, as a string, separated by the separator string - * with the pair key/value concatenated with a '='. - */ - public static String mapToString(final Map map, - final String separator) { - - final StringBuilder strBuilder = new StringBuilder(); - final Iterator> valuesIt = map.entrySet().iterator(); - while (valuesIt.hasNext()) { - final Entry entry = valuesIt.next(); - strBuilder.append(entry.getKey()); - strBuilder.append('='); - strBuilder.append(AttributeUtil.escape(entry.getValue())); - strBuilder.append(separator); - } - return strBuilder.toString(); - } - - /** - * Validates the attribute value format. - * - * @param value The attribute value to validate. - * - * @return true if value has a valid format. - */ - public static boolean isValidValue(final String value) { - boolean retVal = false; - if (value != null && value.charAt(0) == '[' && value.endsWith("]")) { - final String tmpAttrValue = value.substring(1, value.length() - 1); - final String[] vals = - tmpAttrValue.split(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - - if (tmpAttrValue.length() >= 0 - || (vals.length > 0 && vals[0].length() > 0)) { - retVal = true; - } - } - return retVal; - } - - /** - * Validates the attribute type value. It's case insensitive. E.g. return true - * value to: a) "true", "TRUE", "True", ... b) "false", "FALSE", "False", ... - * - * @param type The attribute type value. - * - * @return true if type has a true or false (case insensitive) value. - */ - public static boolean isValidType(final String type) { - return StringUtils.isNotEmpty(type) && (PEPSValues.TRUE.toString().equalsIgnoreCase(type) || PEPSValues.FALSE.toString().equalsIgnoreCase(type)) ; - } - - /** - * Validates the Personal attribute tuple. E.g. name:type:[value]:status - * - * @param tuples The Personal attribute's tuple. - * - * @return true if the tuples' format is valid. - * - * @see PEPSUtil#validateParameter(String, String, String) - * @see String#equalsIgnoreCase(String) - */ - public static boolean hasValidTuples(final String[] tuples) { - boolean retVal = false; - - int numberTuples = AttributeConstants.NUMBER_TUPLES.intValue(); - if (tuples != null && tuples.length == numberTuples) { - // validate attrName - final int attrNameIndex = AttributeConstants.ATTR_NAME_INDEX.intValue(); - final int attrTypeIndex = AttributeConstants.ATTR_TYPE_INDEX.intValue(); - final int attrValueIndex = AttributeConstants.ATTR_VALUE_INDEX.intValue(); - - retVal = - StringUtils.isNotEmpty(tuples[attrNameIndex]) - && StringUtils.isNotEmpty(tuples[attrTypeIndex]) - && StringUtils.isNotEmpty(tuples[attrValueIndex]) - && AttributeUtil.isValidType(tuples[attrTypeIndex]) - && AttributeUtil.isValidValue(tuples[attrValueIndex]); - } - return retVal; - } - - /** - * Check if all mandatory attributes have values. - * - * @param personalAttrList The Personal Attributes List. - * - * @return true if all mandatory attributes have values, false if at least one - * attribute doesn't have value. - */ - public static boolean checkMandatoryAttributes( - final IPersonalAttributeList personalAttrList) { - - final Iterator itAttributes = - personalAttrList.values().iterator(); - boolean retVal = true; - while (itAttributes.hasNext() && retVal) { - final PersonalAttribute attr = itAttributes.next(); - if (attr.isRequired() - && !STORKStatusCode.STATUS_AVAILABLE.toString() - .equals(attr.getStatus())) { - retVal = false; - } - } - return retVal; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CitizenConsent.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CitizenConsent.java.svn-base deleted file mode 100644 index 2245178f4..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CitizenConsent.java.svn-base +++ /dev/null @@ -1,123 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.util.ArrayList; -import java.util.List; - -/** - * This class is a bean used to store the information relative to the Citizen - * Consent. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $ - */ -public final class CitizenConsent { - - /** - * Mandatory attributes list. - */ - private List mandatoryList; - - /** - * Optional attributes list. - */ - private List optionalList; - - /** - * Citizen Consent default Constructor. - */ - public CitizenConsent() { - this.mandatoryList = new ArrayList(); - this.optionalList = new ArrayList(); - } - - /** - * Getter for the mandatoryList value. - * - * @return The mandatoryList value. - */ - public List getMandatoryList() { - return this.mandatoryList; - } - - /** - * Setter for the mandatoryList value. - * - * @param mandatoryAttrList Mandatory parameters list. - */ - public void setMandatoryList(final List mandatoryAttrList) { - this.mandatoryList = mandatoryAttrList; - } - - /** - * Setter for some mandatoryAttribute. Adds the input parameter to the - * mandatoryList. - * - * @param mandatoryAttr Attribute to add to the mandatoryList. - */ - public void setMandatoryAttribute(final String mandatoryAttr) { - this.mandatoryList.add(mandatoryAttr); - } - - /** - * Getter for the optionalList value. - * - * @return The optionalList value. - */ - public List getOptionalList() { - return optionalList; - } - - /** - * Setter for the optionalList value. - * - * @param optAttrList Optional parameters list. - */ - public void setOptionalList(final List optAttrList) { - this.optionalList = optAttrList; - } - - /** - * Setter for some optionalAttr. Adds the input parameter to the optionalList. - * - * @param optionalAttr Attribute to add to the optionalList. - */ - public void setOptionalAttribute(final String optionalAttr) { - this.optionalList.add(optionalAttr); - } - - /** - * Returns a string in the following format. "Mandatory attributes: - * mandatoryAttr1;mandatoryAttr2;mandatoryAttrN Optional attributes: - * optionalAttr1;optionalAttr2;optionalAttrN" - * - * @return {@inheritDoc} - */ - public String toString() { - final StringBuilder strbldr = new StringBuilder(); - strbldr.append("Mandatory attributes: "); - for (String str : mandatoryList) { - strbldr.append(str + ";"); - } - strbldr.append(" Optional attributes: "); - for (String str : optionalList) { - strbldr.append(str + ";"); - } - return strbldr.toString(); - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Country.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Country.java.svn-base deleted file mode 100644 index 001f9317a..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Country.java.svn-base +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.io.Serializable; - -/** - * This class is a bean used to store the information relative to the Country. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.10 $, $Date: 2010-11-17 05:15:28 $ - */ -public final class Country implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1135994036496370993L; - -/** - * Country Id. - */ - private String countryId; - - /** - * Country Name. - */ - private String countryName; - - /** - * Country Constructor. - * - * @param cId Id of the Country. - * @param cName Name of the Country. - */ - public Country(final String cId, final String cName) { - - this.countryId = cId; - this.countryName = cName; - } - - /** - * Getter for the countryId value. - * - * @return The countryId value. - */ - public String getCountryId() { - - return countryId; - } - - /** - * Setter for the countryId value. - * - * @param cId Id of the Country. - */ - public void setCountryId(final String cId) { - - this.countryId = cId; - } - - /** - * Getter for the countryName value. - * - * @return The countryName value. - */ - public String getCountryName() { - - return countryName; - } - - /** - * Setter for the countryName value. - * - * @param name Name of the Country. - */ - public void setCountryName(final String name) { - - this.countryName = name; - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CountryCodes.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CountryCodes.java.svn-base deleted file mode 100644 index 54345f3ea..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/CountryCodes.java.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.util.Arrays; -import java.util.List; - -/** - * This class contains all the ISO 3166-1 Alpha 3 Country Codes. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.2 $, $Date: 2011-04-14 00:24:56 $ - */ -public final class CountryCodes { - - /** - * Private Constructor. - */ - private CountryCodes() { - - } - - /** - * ISO 3166-1 Alpha 3 Country Codes. - */ - private static List countrysAlpha3 = Arrays.asList("ABW", "AFG", - "AGO", "AIA", "ALA", "ALB", "AND", "ANT", "ARE", "ARG", "ARM", "ASM", - "ATA", "ATF", "ATG", "AUS", "AUT", "AZE", "BDI", "BEL", "BEN", "BES", - "BFA", "BGD", "BGR", "BHR", "BHS", "BIH", "BLM", "BLR", "BLZ", "BMU", - "BOL", "BRA", "BRB", "BRN", "BTN", "BUR", "BVT", "BWA", "BYS", "CAF", - "CAN", "CCK", "CHE", "CHL", "CHN", "CIV", "CMR", "COD", "COG", "COK", - "COL", "COM", "CPV", "CRI", "CSK", "CUB", "CUW", "CXR", "CYM", "CYP", - "CZE", "DEU", "DJI", "DMA", "DNK", "DOM", "DZA", "ECU", "EGY", "ERI", - "ESH", "ESP", "EST", "ETH", "FIN", "FJI", "FLK", "FRA", "FRO", "FSM", - "GAB", "GBR", "GEO", "GGY", "GHA", "GIB", "GIN", "GLP", "GMB", "GNB", - "GNQ", "GRC", "GRD", "GRL", "GTM", "GUF", "GUM", "GUY", "HKG", "HMD", - "HND", "HRV", "HTI", "HUN", "IDN", "IMN", "IND", "IOT", "IRL", "IRN", - "IRQ", "ISL", "ISR", "ITA", "JAM", "JEY", "JOR", "JPN", "KAZ", "KEN", - "KGZ", "KHM", "KIR", "KNA", "KOR", "KWT", "LAO", "LBN", "LBR", "LBY", - "LCA", "LIE", "LKA", "LSO", "LTU", "LUX", "LVA", "MAC", "MAF", "MAR", - "MCO", "MDA", "MDG", "MDV", "MEX", "MHL", "MKD", "MLI", "MLT", "MMR", - "MNE", "MNG", "MNP", "MOZ", "MRT", "MSR", "MTQ", "MUS", "MWI", "MYS", - "MYT", "NAM", "NCL", "NER", "NFK", "NGA", "NIC", "NIU", "NLD", "NOR", - "NPL", "NRU", "NZL", "OMN", "PAK", "PAN", "PCN", "PER", "PHL", "PLW", - "PNG", "POL", "PRI", "PRK", "PRT", "PRY", "PSE", "PYF", "QAT", "REU", - "ROM", "ROU", "RUS", "RWA", "SAU", "SCG", "SDN", "SEN", "SGP", "SGS", - "SHN", "SJM", "SLB", "SLE", "SLV", "SMR", "SOM", "SPM", "SRB", "STP", - "SUR", "SVK", "SVN", "SXW", "SWE", "SWZ", "SYC", "SYR", "TCA", "TCD", - "TGO", "THA", "TJK", "TKL", "TKM", "TLS", "TMP", "TON", "TTO", "TUN", - "TUR", "TUV", "TWN", "TZA", "UGA", "UKR", "UMI", "URY", "USA", "UZB", - "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF", "WSM", "YEM", - "YUG", "ZAF", "ZAR", "ZMB", "ZWE"); - - /** - * Searches the CountryCode (3166-1 alpha3 format) an return true if it - * exists. - * - * @param countryCode The Country code to search. - * - * @return true if the CountryCode exists, false otherwise. - */ - public static boolean hasCountryCodeAlpha3(final String countryCode) { - - return CountryCodes.countrysAlpha3.contains(countryCode); - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/DateUtil.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/DateUtil.java.svn-base deleted file mode 100644 index 9c0bd6775..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/DateUtil.java.svn-base +++ /dev/null @@ -1,169 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.sql.Timestamp; -import java.util.GregorianCalendar; - -import org.apache.log4j.Logger; -import org.joda.time.DateTime; -import org.joda.time.Years; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; - -import eu.stork.peps.auth.commons.exceptions.SecurityPEPSException; - -/** - * This class holds static helper methods for Date Operations. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.4 $, $Date: 2010-11-17 05:15:28 $ - */ -public final class DateUtil { - - /** - * Logger object. - */ - private static final Logger LOG = Logger.getLogger(DateUtil.class.getName()); - - /** - * yyyy Date format size. - */ - private static final int YEAR_DATE_SIZE = 4; - - /** - * yyyyMM Date format size. - */ - private static final int MONTH_DATE_SIZE = 6; - - /** - * Private constructor. Prevents the class from being instantiated. - */ - private DateUtil() { - // empty constructor - } - - /** - * Fulfils dateValue with a valid date. The following roles are applied: a) If - * the dateValue only contains the year then fulfils with last year's day. - * e.g. this method returns 19951231 to the 1995 dateValue. b) If the - * dateValue contains the year and the month then fulfils with last month's - * day. e.g. this method returns 19950630 to the 199505 dateValue. - * - * @param dateValue The date to be fulfilled. - * - * @return The dateValue fulfilled. - */ - private static String fulfilDate(final String dateValue) { - - final StringBuffer strBuf = new StringBuffer(); - strBuf.append(dateValue); - // if the IdP just provides the year then we must fullfil the date. - if (dateValue.length() == YEAR_DATE_SIZE) { - strBuf.append(PEPSValues.LAST_MONTH.toString()); - } - // if the IdP provides the year and the month then we must fullfil the - // date. - if (dateValue.length() == MONTH_DATE_SIZE - || strBuf.length() == MONTH_DATE_SIZE) { - // IdP doesn't provide the day, so we will use DateTime to - // calculate it. - final String noDayCons = PEPSValues.NO_DAY_DATE_FORMAT.toString(); - final DateTimeFormatter fmt = DateTimeFormat.forPattern(noDayCons); - final DateTime dateTime = fmt.parseDateTime(strBuf.toString()); - // Append the last month's day. - strBuf.append(dateTime.dayOfMonth().withMaximumValue().getDayOfMonth()); - } - - return strBuf.toString(); - } - - /** - * Validates the dateValue format: a) if has a valid size; b) if has a numeric - * value; Note: dateValue must have the format yyyyMMdd. - * - * @param dateValueTmp The date to be validated. - * @param pattern The accepted date format. - * - * @return true if the date has a valid format. - */ - public static boolean isValidFormatDate(final String dateValueTmp, - final String pattern) { - - boolean retVal = true; - try { - final String dateValue = DateUtil.fulfilDate(dateValueTmp); - - final DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern); - fmt.parseDateTime(dateValue); - } catch (final Exception e) { - // We catch Exception because we only have to return false - // value! - retVal = false; - } - return retVal; - } - - /** - * Calculates the age for a given date string. - * - * @param dateVal The date to be validated. - * @param now The current date. - * @param pattern The date pattern. - * - * @return The age value. - */ - public static int calculateAge(final String dateVal, final DateTime now, - final String pattern) { - - if (DateUtil.isValidFormatDate(dateVal, pattern)) { - try { - final String dateValueTemp = DateUtil.fulfilDate(dateVal); - final DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern); - final DateTime dateTime = fmt.parseDateTime(dateValueTemp); - // Calculating age - final Years age = Years.yearsBetween(dateTime, now); - - return age.getYears(); - } catch (final IllegalArgumentException e) { - LOG.warn("Invalid date format (" + pattern - + ") or an invalid dateValue."); - throw new SecurityPEPSException( - PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorCode()), - PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorMessage()), - e); - } - } else { - LOG.warn("Couldn't calculate Age, invalid date!"); - throw new SecurityPEPSException( - PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorCode()), - PEPSUtil.getConfig(PEPSErrors.INVALID_ATTRIBUTE_VALUE.errorMessage())); - } - - } - - /** - * Generates the current timestamp. - * - * @return timestamp The current timestamp - */ - public static Timestamp currentTimeStamp() { - final GregorianCalendar cal = new GregorianCalendar(); - final long millis = cal.getTimeInMillis(); - return new Timestamp(millis); - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IAttributeProvidersMap.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IAttributeProvidersMap.java.svn-base deleted file mode 100644 index 733399ca3..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IAttributeProvidersMap.java.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -package eu.stork.peps.auth.commons; - -import java.util.Iterator; - -/** - * Interface for Attributes Providers map. - * - * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) - * - * @version $Revision: 1.00 $, $Date: 2013-09-20 $ - */ -public interface IAttributeProvidersMap { - - /** - * Returns the object associated the the given key. - * - * @param key with which the specified value is to be associated. - * - * @return The object associated the the given key. - */ - IPersonalAttributeList get(AttributeSource key); - - /** - * Associates a key to a value, and inserts them in the session object. - * - * @param key with which the specified value is to be associated. - * @param value to be associated with the specified key. - * - * @return previous value associated with specified key, or null if there was - * no mapping for key. A null return can also indicate that the map - * previously associated null with the specified key. - */ - Object put(AttributeSource key, IPersonalAttributeList value); - - /** - * Removes the mapping for this key. - * - * @param key with which the specified value is to be associated. - * - * @return previous value associated with specified key, or null if there was - * no mapping for key. A null return can also indicate that the map - * previously associated null with the specified key. - */ - IPersonalAttributeList remove(AttributeSource key); - - /** - * Returns the number of key-value mappings in this map. - * - * @return the number of key-value mappings in this map. - */ - int size(); - - /** - * Returns true if this map contains a mapping for the specified key. - * - * @param key with which the specified value is to be associated. - * - * @return true if this map contains a mapping for the specified key. - */ - boolean containsKey(AttributeSource key); - - /** - * Removes all mappings from this map. - */ - void clear(); - - /** - * Returns true if this map contains no key-value mappings. - * - * @return true if this map contains no key-value mappings. - */ - boolean isEmpty(); - - /** - * Returns an Iterator of the keys contained in this map. The implementation must - * take care in order for the Iterator to have predictable order of the returned - * keys. - * - * @return an iterator of the keys contained in this map - */ - Iterator keyIterator(); -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IPersonalAttributeList.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IPersonalAttributeList.java.svn-base deleted file mode 100644 index 83b8e57fe..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IPersonalAttributeList.java.svn-base +++ /dev/null @@ -1,140 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.util.Collection; -import java.util.Iterator; - -/** - * Interface for {@link PersonalAttributeList}. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.16 $, $Date: 2010-11-17 05:15:28 $ - * - * @see PersonalAttribute - */ -@SuppressWarnings("PMD.CloneMethodMustImplementCloneable") -public interface IPersonalAttributeList extends Iterable, - Cloneable { - - /** - * Associates the specified value with the specified key in this Personal - * Attribute List. - * - * @param key with which the specified value is to be associated. - * @param value to be associated with the specified key. - * - * @return the previous value associated with key, or null if there was no - * mapping for key. - * - * @see PersonalAttribute - */ - PersonalAttribute put(String key, PersonalAttribute value); - - /** - * Returns the value to which the specified key is mapped, or null if this map - * contains no mapping for the key. - * - * @param key whose associated value is to be returned. - * - * @return The value to which the specified key is mapped, or null if this map - * contains no mapping for the key. - * - * @see PersonalAttribute - */ - PersonalAttribute get(Object key); - - /** - * Adds to the PersonalAttributeList the given PersonalAttribute. It sets the - * attribute name as the key to the attribute value. - * - * @param value PersonalAttribute to add to the PersonalAttributeList - */ - void add(PersonalAttribute value); - - /** - * Get the size of the Personal Attribute List. - * - * @return size of the Personal Attribute List. - */ - int size(); - - /** - * Checks if the Personal Attribute List contains the given key. - * - * @param key with which the specified value is to be associated. - * - * @return true if the Personal Attribute List contains the given key, false - * otherwise. - */ - boolean containsKey(Object key); - - /** - * Getter for the iterator of the Personal Attribute List values. - * - * @return The iterator for the Personal Attribute List values. - * - * @see PersonalAttribute - */ - Iterator iterator(); - - /** - * Creates a Personal Attribute List from a String representing an Attribute - * List. - * - * @param attrList String Object representing the attribute list. - */ - void populate(String attrList); - - /** - * Removes the mapping for this key from this map if present. - * - * @param key key whose mapping is to be removed from the map. - * @return previous value associated with specified key, or null if - * there was no mapping for key. A null return can also - * indicate that the map previously associated null with the - * specified key. - */ - PersonalAttribute remove(Object key); - - /** - * Returns a collection view of the values contained in this map. The - * collection is backed by the map, so changes to the map are reflected in the - * collection, and vice-versa. The collection supports element removal, which - * removes the corresponding mapping from this map, via the - * Iterator.remove, Collection.remove, removeAll, - * retainAll, and clear operations. It does not support the - * add or addAll operations. - * - * @return a collection view of the values contained in this map. - */ - Collection values(); - - /** - * Returns true if this map contains no key-value mappings. - * - * @return true if this map contains no key-value mappings. - */ - boolean isEmpty(); - - /** - * Returns a copy of this IPersonalAttributeList instance. - * - * @return The copy of this IPersonalAttributeList. - */ - Object clone() throws CloneNotSupportedException; - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkLogger.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkLogger.java.svn-base deleted file mode 100644 index 33eb618f0..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkLogger.java.svn-base +++ /dev/null @@ -1,239 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -/** - * Interface for stork logging. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.10 $, $Date: 2011-02-17 22:44:34 $ - */ -public interface IStorkLogger { - - /** - * Getter for SpApplication. - * - * @return The SpApplication value. - */ - String getSpApplication(); - - /** - * Setter for SpApplication. - * - * @param spApplication The SP Application. - */ - void setSpApplication(String spApplication); - - /** - * Getter for ProviderName. - * - * @return The ProviderName value. - */ - String getProviderName(); - - /** - * Setter for ProviderName. - * - * @param providerName The provider name. - */ - void setProviderName(String providerName); - - /** - * - * Getter for Origin. - * - * @return The Origin value. - * - */ - String getOrigin(); - - /** - * Setter for Origin. - * - * @param origin The origin. - */ - void setOrigin(String origin); - - /** - * - * Getter for QAA Level. - * - * @return The QAA Level value. - * - */ - int getQaaLevel(); - - /** - * Setter for QAA Level. - * - * @param qaaLevel The qaa level. - */ - void setQaaLevel(int qaaLevel); - - /** - * - * Getter for timestamp. - * - * @return The timestamp value. - * - */ - String getTimestamp(); - - /** - * Setter for timestamp. - * - * @param timestamp The request's timestamp. - */ - void setTimestamp(String timestamp); - - /** - * Getter for InResponseTo. - * - * @return The InResponseTo value. - */ - String getInResponseTo(); - - /** - * Setter for InResponseTo. - * - * @param inResponseTo The Saml's response id. - */ - void setInResponseTo(String inResponseTo); - - /** - * Getter for InResponseToSPReq. - * - * @return The InResponseToSPReq value. - */ - String getInResponseToSPReq(); - - /** - * Setter for InResponseToSPRequ. - * - * @param inResponseToSPReq The Saml's response id. - */ - void setInResponseToSPReq(String inResponseToSPReq); - - /** - * Getter for opType. - * - * @return The opType value. - */ - String getOpType(); - - /** - * Setter for opType. - * - * @param opType The operation type. - */ - void setOpType(String opType); - - /** - * Getter for destination. - * - * @return The destination value. - */ - String getDestination(); - - /** - * Setter for destinationIp. - * - * @param destination The remote IP. - */ - void setDestination(String destination); - - /** - * Getter for message or assertion consumer. - * - * @return The message or assertion consumer. - */ - String getMessage(); - - /** - * Setter for message or assertion consumer. - * - * @param message or assertion consumer. - */ - void setMessage(String message); - - /** - * Getter for country. - * - * @return The country value. - */ - String getCountry(); - - /** - * Setter for country. - * - * @param country The country. - */ - void setCountry(String country); - - /** - * Getter for samlHash. - * - * @return The samlHash value. - */ - byte[] getSamlHash(); - - /** - * Setter for samlHash. - * - * @param samlHash the encrypted SAML token - */ - void setSamlHash(byte[] samlHash); - - /** - * Getter for msgId. - * - * @return the msgId - */ - String getMsgId(); - - /** - * Setter for msgId. - * - * @param msgId the ID of the originator of this message - */ - void setMsgId(String msgId); - - /** - * Getter for sPMsgId. - * - * @return the sPMsgId - */ - String getSPMsgId(); - - /** - * Setter for sPMsgId. - * - * @param sPMsgId the ID of the originator of this message - */ - void setSPMsgId(String sPMsgId); - - /** - * The format of the returned String must be the following: - * "requestCounter#ddMMMyyyykk:mm:ss#opType#originIp#originName - * #destinationIp#destinationName#samlHash#[originatorName#msgId#]" - * - * The values enclosed in '[]' only apply when logging responses. - * - * @return {@inheritDoc} - */ - @Override - String toString(); -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkSession.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkSession.java.svn-base deleted file mode 100644 index f38b41838..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/IStorkSession.java.svn-base +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -/** - * Interface for stork session. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.9 $, $Date: 2010-11-17 05:15:28 $ - */ -public interface IStorkSession { - - /** - * Returns the object associated the the given key. - * - * @param key with which the specified value is to be associated. - * - * @return The object associated the the given key. - */ - Object get(Object key); - - /** - * Associates a key to a value, and inserts them in the session object. - * - * @param key with which the specified value is to be associated. - * @param value to be associated with the specified key. - * - * @return previous value associated with specified key, or null if there was - * no mapping for key. A null return can also indicate that the map - * previously associated null with the specified key. - */ - Object put(String key, Object value); - - /** - * Removes the mapping for this key. - * - * @param key with which the specified value is to be associated. - * - * @return previous value associated with specified key, or null if there was - * no mapping for key. A null return can also indicate that the map - * previously associated null with the specified key. - */ - Object remove(Object key); - - /** - * Returns the number of key-value mappings in this map. - * - * @return the number of key-value mappings in this map. - */ - int size(); - - /** - * Returns true if this map contains a mapping for the specified key. - * - * @param key with which the specified value is to be associated. - * - * @return true if this map contains a mapping for the specified key. - */ - boolean containsKey(Object key); - - /** - * Removes all mappings from this map. - */ - void clear(); - - /** - * Returns true if this map contains no key-value mappings. - * - * @return true if this map contains no key-value mappings. - */ - boolean isEmpty(); -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Linker.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Linker.java.svn-base deleted file mode 100644 index 43d3adaa9..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/Linker.java.svn-base +++ /dev/null @@ -1,173 +0,0 @@ -package eu.stork.peps.auth.commons; - -import java.util.Iterator; - -/** - * This class is a bean used to store the information of Attribute Providers, the Attribute - * List to be requested, the Assertions returned by the Attribute Providers and the values - * that each Attribute has. This information along with the current status of the Linker (the - * attribute providers that were queried and the remaining providers) is used by the PEPS - * actions in order to complete the Attribute gathering. - * - * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) - * - * @version $Revision: 1.20 $, $Date: 2013-10-28 $ - */ -public final class Linker { - /** - * Attributes Providers map. - */ - private IAttributeProvidersMap attributeProvidersMap; - - /** - * The current index of local (domestic) Attribute Providers. - */ - private int localIndex; - - /** - * The current index of remote (foreign) Attribute Providers - countries. - */ - private int remoteIndex; - - /** - * Constructs an empty Linker object. - */ - public Linker() { - localIndex = 0; - remoteIndex = 0; - } - - /** - * Based on the internal state of the Linker it returns the next local Attribute Source - * - * @return The next Attribute Source or null if not found - * - * @see AttributeSource - */ - public AttributeSource getNextLocalProvider() { - Iterator iterator; - AttributeSource source, found; - int curIndex = 0; - - found = null; - - if ( attributeProvidersMap!=null && !attributeProvidersMap.isEmpty() ) { - iterator = attributeProvidersMap.keyIterator(); - while (iterator.hasNext()) { - source = iterator.next(); - - if ( source.getSourceType()==AttributeSource.SOURCE_LOCAL_APROVIDER ) { - if ( curIndex>=localIndex ) { - found = source; - - break; - } - - curIndex++; - } - } - } - - return found; - } - - /** - * Based on the internal state of the Linker it returns the next remote Attribute Source - * - * @return The next Attribute Source or null if not found - * - * @see AttributeSource - */ - public AttributeSource getNextRemoteProvider() { - Iterator iterator; - AttributeSource source, found; - int curIndex = 0; - - found = null; - - if ( attributeProvidersMap !=null && !attributeProvidersMap.isEmpty() ) { - iterator = attributeProvidersMap.keyIterator(); - while (iterator.hasNext()) { - source = iterator.next(); - - if ( source.getSourceType()==AttributeSource.SOURCE_REMOTE_COUNTRY ) { - if ( curIndex>=remoteIndex ) { - found = source; - - break; - } - - curIndex++; - } - } - } - - return found; - } - - /** - * It updates the Linker with the values returned by the Attribute Source. It also advances - * to the next index in order to mark this attribute source as completed. - * - * @param source The Attribute Source that was queried for attribute values. - * @param attrResponse The attrResponse returned by the Attribute Source that contains the attribute values. - * - * @see AttributeSource, STORKAttrQueryResponse - */ - public void setProviderReponse(AttributeSource source, STORKAttrQueryResponse attrResponse) { - if ( source.getSourceType()==AttributeSource.SOURCE_REMOTE_COUNTRY ) - remoteIndex++; - else - localIndex++; - - //TODO How to store Assertions (format: byte, base64 string, entire object?) - - this.attributeProvidersMap.put(source, attrResponse.getPersonalAttributeList()); - } - - /** - * Reset the internal state of the local Attribute Source in order to start over. - */ - public void resetLocalIndex() { - localIndex = 0; - } - - /** - * Reset the internal state of the remote Attribute Source in order to start over. - */ - public void resetRemoteIndex() { - remoteIndex = 0; - } - - /** - * Setter for attributeProvidersMap. - * - * @param attributeProvidersMap The attributeProvidersMap to set. - */ - public void setAttributeProvidersMap(IAttributeProvidersMap attributeProvidersMap) { - this.attributeProvidersMap = attributeProvidersMap; - } - - /** - * Getter for attributeProvidersMap. - * - * @return attributeProvidersMap - */ - public IAttributeProvidersMap getAttributeProvidersMap() { - return attributeProvidersMap; - } - - /** - * Returns the Personal Attribute list of the provided Attribute Source. - * - * @return The IPersonalAttributeList assosiated with this source or null if empty - * - * @see IPersonalAttributeList - */ - public IPersonalAttributeList getProviderAttributes(AttributeSource source) { - if ( attributeProvidersMap.containsKey(source) ) - return attributeProvidersMap.get(source); - else - return null; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSErrors.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSErrors.java.svn-base deleted file mode 100644 index 3aa549a06..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSErrors.java.svn-base +++ /dev/null @@ -1,348 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -/** - * This enum class contains all the STORK PEPS, Commons and Specific errors - * constant identifiers. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.10 $, $Date: 2011-02-17 22:44:34 $ - */ -public enum PEPSErrors { - - /** - * Represents the 'authenticationFailed' constant error identifier. - */ - AUTHENTICATION_FAILED_ERROR("authenticationFailed"), - /** - * Represents the 'spCountrySelector.errorCreatingSAML' constant error - * identifier. - */ - SP_COUNTRY_SELECTOR_ERROR_CREATE_SAML("spCountrySelector.errorCreatingSAML"), - /** - * Represents the 'spCountrySelector.destNull' constant error identifier. - */ - SP_COUNTRY_SELECTOR_DESTNULL("spCountrySelector.destNull"), - /** - * Represents the 'spCountrySelector.invalidAttr' constant error identifier. - */ - SP_COUNTRY_SELECTOR_INVALID_ATTR("spCountrySelector.invalidAttr"), - /** - * Represents the 'spCountrySelector.invalidProviderName' constant error - * identifier. - */ - SP_COUNTRY_SELECTOR_INVALID_PROVIDER_NAME( - "spCountrySelector.invalidProviderName"), - /** - * Represents the 'spCountrySelector.invalidQaaSPid' constant error - * identifier. - */ - SP_COUNTRY_SELECTOR_INVALID_QAASPID("spCountrySelector.invalidQaaSPid"), - /** - * Represents the 'spCountrySelector.invalidSpId' constant error identifier. - */ - SP_COUNTRY_SELECTOR_INVALID_SPID("spCountrySelector.invalidSpId"), - /** - * Represents the 'spCountrySelector.invalidSPQAA' constant error identifier. - */ - SP_COUNTRY_SELECTOR_INVALID_SPQAA("spCountrySelector.invalidSPQAA"), - /** - * Represents the 'spCountrySelector.invalidSpURL' constant error identifier. - */ - SP_COUNTRY_SELECTOR_INVALID_SPURL("spCountrySelector.invalidSpURL"), - /** - * Represents the 'spCountrySelector.spNotAllowed' constant error identifier. - */ - SP_COUNTRY_SELECTOR_SPNOTALLOWED("spCountrySelector.spNotAllowed"), - - /** - * Represents the 'sProviderAction.errorCreatingSAML' constant error - * identifier. - */ - SPROVIDER_SELECTOR_ERROR_CREATE_SAML("sProviderAction.errorCreatingSAML"), - /** - * Represents the 'sProviderAction.attr' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_ATTR("sProviderAction.invalidAttr"), - /** - * Represents the 'sProviderAction.country' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_COUNTRY("sProviderAction.invalidCountry"), - /** - * Represents the 'sProviderAction.relayState' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_RELAY_STATE("sProviderAction.invalidRelayState"), - /** - * Represents the 'sProviderAction.saml' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_SAML("sProviderAction.invalidSaml"), - /** - * Represents the 'sProviderAction.spAlias' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_SPALIAS("sProviderAction.invalidSPAlias"), - /** - * Represents the 'sProviderAction.spDomain' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_SPDOMAIN("sProviderAction.invalidSPDomain"), - /** - * Represents the 'sProviderAction.spId' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_SPID("sProviderAction.invalidSPId"), - /** - * Represents the 'sProviderAction.spQAA' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_SPQAA("sProviderAction.invalidSPQAA"), - /** - * Represents the 'sProviderAction.spQAAId' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_SPQAAID("sProviderAction.invalidSPQAAId"), - /** - * Represents the 'sProviderAction.spRedirect' constant error identifier. - */ - SPROVIDER_SELECTOR_INVALID_SPREDIRECT("sProviderAction.invalidSPRedirect"), - /** - * Represents the 'sProviderAction.invalidSPProviderName' constant error - * identifier. - */ - SPROVIDER_SELECTOR_INVALID_SP_PROVIDERNAME( - "sProviderAction.invalidSPProviderName"), - /** - * Represents the 'sProviderAction.spNotAllowed' constant error identifier. - */ - SPROVIDER_SELECTOR_SPNOTALLOWED("sProviderAction.spNotAllowed"), - - - /** - * Represents the 'internalError' constant error identifier. - */ - INTERNAL_ERROR("internalError"), - - /** - * Represents the 'colleagueRequest.attrNull' constant error identifier. - */ - COLLEAGUE_REQ_ATTR_NULL("colleagueRequest.attrNull"), - /** - * Represents the 'colleagueRequest.errorCreatingSAML' constant error - * identifier. - */ - COLLEAGUE_REQ_ERROR_CREATE_SAML("colleagueRequest.errorCreatingSAML"), - /** - * Represents the 'colleagueRequest.invalidCountryCode' constant error - * identifier. - */ - COLLEAGUE_REQ_INVALID_COUNTRYCODE("colleagueRequest.invalidCountryCode"), - /** - * Represents the 'colleagueRequest.invalidDestUrl' constant error identifier. - */ - COLLEAGUE_REQ_INVALID_DEST_URL("colleagueRequest.invalidDestUrl"), - /** - * Represents the 'colleagueRequest.invalidQaa' constant error identifier. - */ - COLLEAGUE_REQ_INVALID_QAA("colleagueRequest.invalidQaa"), - /** - * Represents the 'colleagueRequest.invalidRedirect' constant error - * identifier. - */ - COLLEAGUE_REQ_INVALID_REDIRECT("colleagueRequest.invalidRedirect"), - /** - * Represents the 'colleagueRequest.invalidSAML' constant error identifier. - */ - COLLEAGUE_REQ_INVALID_SAML("colleagueRequest.invalidSAML"), - - - /** - * Represents the 'cpepsRedirectUrl' constant error identifier. - */ - CPEPS_REDIRECT_URL("cpepsRedirectUrl"), - /** - * Represents the 'spepsRedirectUrl' constant error identifier. - */ - SPEPS_REDIRECT_URL("spepsRedirectUrl"), - /** - * Represents the 'sProviderAction.invCountry' constant error identifier. - */ - SP_ACTION_INV_COUNTRY("sProviderAction.invCountry"), - - /** - * Represents the 'providernameAlias.invalid' constant error identifier. - */ - PROVIDER_ALIAS_INVALID("providernameAlias.invalid"), - - - /** - * Represents the 'cPeps.attrNull' constant error identifier. - */ - CPEPS_ATTR_NULL("cPeps.attrNull"), - - /** - * Represents the 'colleagueResponse.invalidSAML' constant error identifier. - */ - COLLEAGUE_RESP_INVALID_SAML("colleagueResponse.invalidSAML"), - - /** - * Represents the 'citizenNoConsent.mandatory' constant error identifier. - */ - CITIZEN_NO_CONSENT_MANDATORY("citizenNoConsent.mandatory"), - /** - * Represents the 'citizenResponse.mandatory' constant error identifier. - */ - CITIZEN_RESPONSE_MANDATORY("citizenResponse.mandatory"), - /** - * Represents the 'attVerification.mandatory' constant error identifier. - */ - ATT_VERIFICATION_MANDATORY("attVerification.mandatory"), - /** - * Represents the 'attrValue.verification' constant error identifier. - */ - ATTR_VALUE_VERIFICATION("attrValue.verification"), - - /** - * Represents the 'audienceRestrictionError' constant error identifier. - */ - AUDIENCE_RESTRICTION("audienceRestrictionError"), - /** - * Represents the 'auRequestIdError' constant error identifier. - */ - AU_REQUEST_ID("auRequestIdError"), - /** - * Represents the 'domain' constant error identifier. - */ - DOMAIN("domain"), - /** - * Represents the 'hash.error' constant error identifier. - */ - HASH_ERROR("hash.error"), - /** - * Represents the 'invalidAttributeList' constant error identifier. - */ - INVALID_ATTRIBUTE_LIST("invalidAttributeList"), - /** - * Represents the 'invalidAttributeValue' constant error identifier. - */ - INVALID_ATTRIBUTE_VALUE("invalidAttributeValue"), - /** - * Represents the 'qaaLevel' constant error identifier. - */ - QAALEVEL("qaaLevel"), - /** - * Represents the 'requests' constant error identifier. - */ - REQUESTS("requests"), - /** - * Represents the 'SPSAMLRequest' constant error identifier. - */ - SP_SAML_REQUEST("SPSAMLRequest"), - /** - * Represents the 'spepsSAMLRequest' constant error identifier. - */ - SPEPS_SAML_REQUEST("spepsSAMLRequest"), - /** - * Represents the 'IdPSAMLResponse' constant error identifier. - */ - IDP_SAML_RESPONSE("IdPSAMLResponse"), - /** - * Represents the 'cpepsSAMLResponse' constant error identifier. - */ - CPEPS_SAML_RESPONSE("cpepsSAMLResponse"), - /** - * Represents the 'cpepsSAMLResponse' constant error identifier. - */ - SPEPS_SAML_RESPONSE("spepsSAMLResponse"), - /** - * Represents the 'session' constant error identifier. - */ - SESSION("session"), - /** - * Represents the 'invalid.session' constant error identifier. - */ - INVALID_SESSION("invalid.session"), - /** - * Represents the 'invalid.sessionId' constant error identifier. - */ - INVALID_SESSION_ID("invalid.sessionId"), - /** - * Represents the 'missing.sessionId' constant error identifier. - */ - MISSING_SESSION_ID("sessionError"), - /** - * Represents the 'AtPSAMLResponse' constant error identifier. - */ - ATP_SAML_RESPONSE("AtPSAMLResponse"); - - /** - * Represents the constant's value. - */ - private String error; - - /** - * Solo Constructor. - * - * @param nError The Constant error value. - */ - PEPSErrors(final String nError) { - this.error = nError; - } - - /** - * Construct the errorCode Constant value. - * - * @return The errorCode Constant. - */ - public String errorCode() { - return error + ".code"; - } - - /** - * Construct the errorCode Constant value with the given code text. - * - * @param text the code text to append to the constant. - * - * @return The errorCode Constant for the given code text. - */ - public String errorCode(final String text) { - return error + "." + text + ".code"; - } - - /** - * Construct the errorMessage constant value. - * - * @return The errorMessage constant. - */ - public String errorMessage() { - return error + ".message"; - } - - /** - * Construct the errorMessage Constant value with the given message text. - * - * @param text the message text to append to the constant. - * - * @return The errorMessage Constant for the given text. - */ - public String errorMessage(final String text) { - return error + "." + text + ".message"; - } - - /** - * Return the Constant Value. - * - * @return The constant value. - */ - public String toString() { - return error; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSParameters.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSParameters.java.svn-base deleted file mode 100644 index 37b204351..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSParameters.java.svn-base +++ /dev/null @@ -1,511 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -/** - * This enum class contains all the STORK PEPS, Commons and Specific Parameters. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.13 $, $Date: 2011-07-07 20:48:45 $ - */ -public enum PEPSParameters { - - /** - * Represents the 'apId' parameter constant. - */ - AP_ID("apId"), - /** - * Represents the 'apUrl' parameter constant. - */ - AP_URL("apUrl"), - /** - * Represents the 'ap.number' parameter constant. - */ - AP_NUMBER("ap.number"), - - /** - * Represents the 'assertionConsumerServiceURL' parameter constant. - */ - ASSERTION_CONSUMER_S_URL("assertionConsumerServiceURL"), - - /** - * Represents the 'auth' parameter constant. - */ - AUTHENTICATION("auth"), - - /** - * Represents the 'auth-on-behalf-of' parameter constant. - */ - AUTHENTICATION_ON_BEHALF_OF("auth-on-behalf-of"), - - /** - * Represents the 'attr' parameter constant. - */ - ATTRIBUTE("attr"), - /** - * Represents the 'attrName' parameter constant. - */ - ATTRIBUTE_NAME("attrName"), - /** - * Represents the 'attrStatus' parameter constant. - */ - ATTRIBUTE_STATUS("attrStatus"), - /** - * Represents the 'attrType' parameter constant. - */ - ATTRIBUTE_TYPE("attrType"), - /** - * Represents the 'attrValue' parameter constant. - */ - ATTRIBUTE_VALUE("attrValue"), - /** - * Represents the 'attrList' parameter constant. - */ - ATTRIBUTE_LIST("attrList"), - /** - * Represents the 'attrTuple' parameter constant. - */ - ATTRIBUTE_TUPLE("attrTuple"), - /** - * Represents the 'attribute-missing' parameter constant. - */ - ATTRIBUTE_MISSING("attribute-missing"), - /** - * Represents the 'attributesNotAllowed' parameter constant. - */ - ATTRIBUTES_NOT_ALLOWED("attributesNotAllowed"), - /** - * Represents the 'authnRequest' parameter constant. - */ - AUTH_REQUEST("authnRequest"), - - /** - * Represents the 'attrValue.number' parameter constant. - */ - ATTR_VALUE_NUMBER("attrValue.number"), - - /** - * Represents the 'derivation.date.format' parameter constant. - */ - DERIVATION_DATE_FORMAT("derivation.date.format"), - /** - * Represents the 'deriveAttr.number' parameter constant. - */ - DERIVE_ATTRIBUTE_NUMBER("deriveAttr.number"), - - /** - * Represents the complex attributes parameter constant. - */ - COMPLEX_ADDRESS_VALUE("canonicalResidenceAddress"), - COMPLEX_NEWATTRIBUTE_VALUE("newAttribute2"), - COMPLEX_HASDEGREE_VALUE("hasDegree"), - COMPLEX_MANDATECONTENT_VALUE("mandateContent"), - /** - * Represents the 'consent-type' parameter constant. - */ - CONSENT_TYPE("consent-type"), - /** - * Represents the 'consent-value' parameter constant. - */ - CONSENT_VALUE("consent-value"), - /** - * Represents the 'country' parameter constant. - */ - COUNTRY("country"), - /** - * Represents the 'countryOrigin' parameter constant. - */ - COUNTRY_ORIGIN("countryOrigin"), - - /** - * Represents the 'cpepsURL' parameter constant. - */ - CPEPS_URL("cpepsURL"), - /** - * Represents the 'callback' parameter constant. - */ - CPEPS_CALLBACK("callback"), - /** - * Represents the 'peps.specificidpredirect.url' parameter constant. - */ - CPEPS_IDP_CALLBACK_VALUE("peps.specificidpredirect.url"), - /** - * Represents the 'peps.specificapredirect.url' parameter constant. - */ - CPEPS_AP_CALLBACK_VALUE("peps.specificapredirect.url"), - - /** - * Represents the 'errorCode' parameter constant. - */ - ERROR_CODE("errorCode"), - /** - * Represents the 'subCode' parameter constant. - */ - ERROR_SUBCODE("subCode"), - /** - * Represents the 'errorMessage' parameter constant. - */ - ERROR_MESSAGE("errorMessage"), - /** - * Represents the 'errorRedirectUrl' parameter constant. - */ - ERROR_REDIRECT_URL("errorRedirectUrl"), - - /** - * errorRedirectUrl Represents the 'external-authentication' parameter - * constant. - */ - EXTERNAL_AUTH("external-authentication"), - /** - * Represents the 'external-ap' parameter constant. - */ - EXTERNAL_AP("external-ap"), - /** - * Represents the 'external-sig-module' parameter constant. - */ - EXT_SIG_CREATOR_MOD("external-sig-module"), - - /** - * Represents the 'http-x-forwarded-for' parameter constant. - */ - HTTP_X_FORWARDED_FOR("http-x-forwarded-for"), - - /** - * Represents the 'idp.url' parameter constant. - */ - IDP_URL("idp.url"), - /** - * Represents the 'idpAUB.url' parameter constant. - */ - IDPAUB_URL("idpAUB.url"), - /** - * Represents the 'internal-authentication' parameter constant. - */ - INTERNAL_AUTH("internal-authentication"), - /** - * Represents the 'internal-ap' parameter constant. - */ - INTERNAL_AP("internal-ap"), - - /** - * Represents the 'samlIssuer' parameter constant. - */ - ISSUER("samlIssuer"), - /** - * Represents the 'samlIssuer.idp' parameter constant. - */ - ISSUER_IDP("samlIssuer.idp"), - /** - * Represents the 'samlIssuer.atp' parameter constant. - */ - ISSUER_ATP("samlIssuer.atp"), - - /** - * Represents the 'mandatory' parameter constant. - */ - MANDATORY("mandatory"), - /** - * Represents the 'mandatoryAttributeMissing' parameter constant. - */ - MANDATORY_ATTR_MISSING("mandatoryAttributeMissing"), - /** - * Represents the 'mandatoryConsentAttrMissing' parameter constant. - */ - MANDATORY_CONSENT_MISSING("mandatoryConsentAttrMissing"), - /** - * Represents the 'optional' parameter constant. - */ - OPTIONAL("optional"), - - /** - * Represents the 'no-consent-type' parameter constant. - */ - NO_CONSENT_TYPE("no-consent-type"), - /** - * Represents the 'no-consent-value' parameter constant. - */ - NO_CONSENT_VALUE("no-consent-value"), - - /** - * Represents the 'provider.name' parameter constant. - */ - PROVIDER_NAME_VALUE("providerName"), - /** - * Represents the 'cpeps.askconsent' parameter constant. - */ - PEPS_ASK_CONSENT("cpeps.askconsent"), - /** - * Represents the 'cpeps.askconsentvalue' parameter constant. - */ - PEPS_ASK_CONSENT_VALUE("cpeps.askconsentvalue"), - /** - * Represents the 'pepsAuth' parameter constant. - */ - PEPS_AUTH_CONSENT("pepsAuth"), - /** - * Represents the 'validation.bypass' parameter constant. - */ - PEPS_BYPASS("validation.bypass"), - /** - * Represents the 'cpeps.number' parameter constant. - */ - PEPS_NUMBER("cpeps.number"), - /** - * Represents the 'cpeps.specificapredirect.url' parameter constant. - */ - PEPS_SPECIFIC_URL("cpeps.specificapredirect.url"), - - /** - * Represents the 'qaaLevel' parameter constant. - */ - QAALEVEL("qaaLevel"), - - /** - * Represents the 'speps.redirectUrl' parameter constant. - */ - SPEPS_REDIRECT_URL("speps.redirectUrl"), - - /** - * Represents the 'sp.redirectUrl' parameter constant. - */ - SP_REDIRECT_URL("sp.redirectUrl"), - /** - * Represents the 'cpeps.redirectUrl' parameter constant. - */ - CPEPS_REDIRECT_URL("cpeps.redirectUrl"), - /** - * Represents the 'RelayState' parameter constant. - */ - RELAY_STATE("RelayState"), - /** - * Represents the 'remoteAddr' parameter constant. - */ - REMOTE_ADDR("remoteAddr"), - /** - * Represents the 'remoteUser' parameter constant. - */ - REMOTE_USER("remoteUser"), - - /** - * Represents the 'SAMLRequest' parameter constant. - */ - SAML_REQUEST("SAMLRequest"), - /** - * Represents the 'SAMLResponse' parameter constant. - */ - SAML_RESPONSE("SAMLResponse"), - /** - * Represents the 'SAMLFail' parameter constant. - */ - SAML_TOKEN_FAIL("SAMLFail"), - /** - * Represents the 'TokenId' parameter constant. - */ - SAML_TOKEN_ID("TokenId"), - /** - * Represents the 'inResponseTo' parameter constant. - */ - SAML_IN_RESPONSE_TO("inResponseTo"), - /** - * Represents the 'inResponseTo.idp' parameter constant. - */ - SAML_IN_RESPONSE_TO_IDP("inResponseTo.idp"), - /** - * Represents the 'inResponseTo.atp' parameter constant. - */ - SAML_IN_RESPONSE_TO_ATP("inResponseTo.atp"), - /** - * Represents the 'SignatureResponse' parameter constant. - */ - SIGNATURE_RESPONSE("SignatureResponse"), - - /** - * Represents the 'cPepsSession' parameter constant. - */ - SESSION_ID_URL("cPepsSession"), - /** - * Represents the 'spId' parameter constant. - */ - SP_ID("spId"), - /** - * Represents the 'spQaaLevel' parameter constant. - */ - SP_QAALEVEL("spQaaLevel"), - /** - * Represents the 'spUrl' parameter constant. - */ - SP_URL("spUrl"), - - /** - * Represents the 'allow.derivation.all' parameter constant. - */ - SPECIFIC_ALLOW_DERIVATION_ALL("allow.derivation.all"), - /** - * Represents the ''allow.unknowns parameter constant. - */ - SPECIFIC_ALLOW_UNKNOWNS("allow.unknowns"), - /** - * Represents the 'derivation.date.separator' parameter constant. - */ - SPECIFIC_DERIVATION_DATE_SEP("derivation.date.separator"), - /** - * Represents the 'derivation.month.position' parameter constant. - */ - SPECIFIC_DERIVATION_MONTH_POS("derivation.month.position"), - /** - * Represents the 'derivation.day.position' parameter constant. - */ - SPECIFIC_DERIVATION_DAY_POS("derivation.day.position"), - /** - * Represents the 'derivation.year.position' parameter constant. - */ - SPECIFIC_DERIVATION_YEAR_POS("derivation.year.position"), - - /** - * sp.authorized.parameters Represents the '' parameter constant. - */ - SPEPS_AUTHORIZED("sp.authorized.parameters"), - - /** - * Represents the 'spSector' constant value. - */ - SPSECTOR("spSector"), - /** - * Represents the 'spApplication' constant value. - */ - SPAPPLICATION("spApplication"), - /** - * Represents the 'spCountry' constant value. - */ - SPCOUNTRY("spCountry"), - /** - * Represents the 'spInstitution' constant value. - */ - SPINSTITUTION("spInstitution"), - /** - * Represents the 'storkAttribute.number' parameter constant. - */ - STORK_ATTRIBUTE_NUMBER("storkAttribute.number"), - /** - * Represents the 'storkAttributeValue.number' parameter constant. - */ - STORK_ATTRIBUTE_VALUE_NUMBER("storkAttributeValue.number"), - - /** - * Represents the 'username' parameter constant. - */ - USERNAME("username"), - - /** - * Represents the 'tooManyParameters' parameter constant. - */ - TOO_MANY_PARAMETERS("tooManyParameters"), - /** - * Represents the 'validation.active' parameter constant. - */ - VALIDATION_ACTIVE("validation.active"), - - /** - * Represents the 'x-forwarded-for' parameter constant. - */ - X_FORWARDED_FOR("x-forwarded-for"), - /** - * Represents the 'x-forwarded-host' parameter constant. - */ - X_FORWARDED_HOST("x-forwarded-host"), - /** - * Represents the 'XMLResponse' parameter constant. - */ - XML_RESPONSE("XMLResponse"), - - /** - * Represents the 'ap-cpeps.number' parameter constant. - */ - AP_PEPS_NUMBER("ap-cpeps.number"), - - /** - * Represents the 'atp.number' parameter constant. - */ - ATTRIBUTE_PROVIDER_NUMBER("atp.number"), - - /** - * Represents the 'apLinker' parameter constant. - */ - AP_LINKER("apLinker"), - - /** - * Represents the 'NOSEL' parameter constant (no attribute provider selected). - */ - AP_NO_SELECTION("NOSEL"), - - /** - * Represents the 'OCSEL' parameter constant (attribute provider in another country). - */ - AP_OTHER_COUNTRY("OCSEL"), - - /** - * Represents the '_provider' suffix parameter constant. - */ - AP_PROVIDER_SELECT_SUFFIX("_provider"), - - /** - * Represents the '_country' suffix parameter constant. - */ - AP_COUNTRY_SELECT_SUFFIX("_country"), - - /** - * Represents the 'next-ap' parameter constant. - */ - NEXT_AP("next-ap"), - - /** - * Represents the 'next-apeps' parameter constant. - */ - NEXT_APEPS("next-apeps"), - - /** - * Represents the 'attr-filter.number' parameter constant. - */ - ATTRIBUTES_FILTER_NUMBER("attr-filter.number"), - - /** - * Represents the 'atp.url' parameter constant. - */ - ATP_URL("atp.url"); - - /** - * Represents the constant's value. - */ - private String value; - - /** - * Solo Constructor. - * - * @param nValue The Constant value. - */ - PEPSParameters(final String nValue) { - this.value = nValue; - } - - /** - * Return the Constant Value. - * - * @return The constant value. - */ - public String toString() { - return value; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSUtil.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSUtil.java.svn-base deleted file mode 100644 index ae1f203f5..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSUtil.java.svn-base +++ /dev/null @@ -1,353 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.io.UnsupportedEncodingException; -import java.util.Properties; - -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; -import org.bouncycastle.crypto.Digest; -import org.bouncycastle.util.encoders.Base64; - -import eu.stork.peps.auth.commons.exceptions.InternalErrorPEPSException; -import eu.stork.peps.auth.commons.exceptions.InvalidParameterPEPSException; - -/** - * This class holds static helper methods. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.75 $, $Date: 2010-11-23 00:05:35 $ - */ -public final class PEPSUtil { - - /** - * Logger object. - */ - private static final Logger LOG = Logger.getLogger(PEPSUtil.class.getName()); - - /** - * Configurations object. - */ - private static Properties configs; - - /** - * Max prefix. - */ - private static final String MAX_PARAM_PREFIX = "max."; - - /** - * Code prefix to get error code. - */ - private static final String CODE_PARAM_SUFFIX = ".code"; - - /** - * param's size prefix to get max param size. - */ - private static final String MAX_PARAM_SUFFIX = ".size"; - - /** - * Message prefix to get error message. - */ - private static final String MSG_PARAM_SUFFIX = ".message"; - - /** - * Private constructor. Prevents the class from being instantiated. - */ - private PEPSUtil() { - // empty constructor - } - - /** - * Creates a single instance of this class and sets the properties. - * - * @param nConfigs The set of available configurations. - * - * @return The created PEPSUtil's class. - */ - public static PEPSUtil createInstance(final Properties nConfigs) { - if (nConfigs != null) { - PEPSUtil.configs = nConfigs; - } - return new PEPSUtil(); - } - - /** - * Getter for the Properties. - * - * @return configs The properties value. - */ - public Properties getConfigs() { - return configs; - } - - /** - * Setter for the Properties. - * - * @param nConfigs The new properties value. - */ - public static void setConfigs(final Properties nConfigs) { - if (nConfigs != null) { - PEPSUtil.configs = nConfigs; - } - } - - /** - * Returns the identifier of some configuration given a set of configurations - * and the corresponding configuration key. - * - * @param configKey The key that IDs some configuration. - * - * @return The configuration String value. - */ - public static String getConfig(final String configKey) { - return configs.getProperty(configKey); - } - - /** - * Validates the input paramValue identified by the paramName. - * - * @param paramName The name of the parameter to validate. - * @param paramValue The value of the parameter to validate. - * - * @return true if the parameter is valid. - */ - public static boolean isValidParameter(final String paramName, - final String paramValue) { - - final String validationParam = - PEPSUtil.getConfig(PEPSParameters.VALIDATION_ACTIVE.toString()); - boolean retVal = true; - - final String paramConf = MAX_PARAM_PREFIX + paramName + MAX_PARAM_SUFFIX; - - if (PEPSValues.TRUE.toString().equals(validationParam)) { - final String paramSizeStr = PEPSUtil.getConfig(paramConf); - // Checking if the parameter size exists and if it's numeric - if (StringUtils.isNumeric(paramSizeStr)) { - final int maxParamSize = Integer.valueOf(paramSizeStr); - if (StringUtils.isEmpty(paramValue) - || (paramValue.length() > maxParamSize)) { - retVal = false; - LOG.warn("Invalid parameter [" + paramName + "] value " + paramValue); - } - } else { - retVal = false; - LOG.error("Missing " + paramConf - + " configuration in the pepsUtils.properties configuration file"); - } - } - return retVal; - } - - /** - * Validates the Parameter and throws an exception if an error occurs. Throws - * an InvalidParameterPEPSException runtime exception if the parameter is - * invalid. - * - * @param className The Class Name that invoked the method. - * @param paramName The name of the parameter to validate. - * @param paramValue The value of the parameter to validate. - */ - public static void validateParameter(final String className, - final String paramName, final Object paramValue) { - - if (paramValue == null) { - PEPSUtil.validateParameter(className, paramName, ""); - } else { - PEPSUtil.validateParameter(className, paramName, paramValue.toString()); - } - } - - /** - * Validates the Parameters and throws an exception if an error occurs. - * - * @param className The Class Name that invoked the method. - * @param paramName The name of the parameter to validate. - * @param paramValue The value of the parameter to validate. - */ - public static void validateParameter(final String className, - final String paramName, final String paramValue) { - - PEPSUtil.validateParameter(className, paramName, paramValue, - PEPSUtil.getErrorCode(paramName), PEPSUtil.getErrorMessage(paramName)); - } - - /** - * Validates the Parameters and throws an exception if an error occurs. - * - * @param className The Class Name that invoked the method. - * @param paramName The name of the parameter to validate. - * @param paramValue The value of the parameter to validate. - * @param error The PEPSError to get error code and messages from configs. - */ - public static void validateParameter(final String className, - final String paramName, final String paramValue, final PEPSErrors error) { - - PEPSUtil.validateParameter(className, paramName, paramValue, - PEPSUtil.getConfig(error.errorCode()), - PEPSUtil.getConfig(error.errorMessage())); - } - - /** - * Validates the HTTP Parameter and throws an exception if an error occurs. - * Throws an InvalidParameterPEPSException runtime exception if the parameter - * is invalid. - * - * @param className The Class Name that invoked the method. - * @param paramName The name of the parameter to validate. - * @param paramValue The value of the parameter to validate. - * @param errorCode The error code to include on the exception. - * @param errorMessage The error message to include on the exception. - */ - public static void validateParameter(final String className, - final String paramName, final String paramValue, final String errorCode, - final String errorMessage) { - - if (!isValidParameter(paramName, paramValue)) { - LOG.warn("Invalid parameter [" + paramName + "] value found at " - + className); - throw new InvalidParameterPEPSException(errorCode, errorMessage); - } - } - - /** - * Getter for the error code of some given error related to the input param. - * - * @param paramName The name of the parameter associated with the error. - * - * @return The code of the error. - */ - private static String getErrorCode(final String paramName) { - return getConfig(paramName + CODE_PARAM_SUFFIX); - } - - /** - * Getter for the error message of some given error related to the input - * parameter. - * - * @param paramName The name of the parameter associated with the message. - * - * @return The message for the error. - */ - private static String getErrorMessage(final String paramName) { - return getConfig(paramName + MSG_PARAM_SUFFIX); - } - - /** - * {@link Base64} encodes the input samlToken parameter. - * - * @param samlToken the SAML Token to be encoded. - * - * @return The Base64 String representing the samlToken. - * - * @see Base64#encode - */ - public static String encodeSAMLToken(final byte[] samlToken) { - try { - return new String(Base64.encode(samlToken), "UTF8"); - } catch (UnsupportedEncodingException e) { - LOG.error(PEPSErrors.INTERNAL_ERROR.errorMessage(), e); - return null; - } - } - - /** - * Decodes the {@link Base64} String input parameter representing a samlToken. - * - * @param samlToken the SAML Token to be decoded. - * - * @return The samlToken decoded bytes. - * - * @see Base64#decode - */ - public static byte[] decodeSAMLToken(final String samlToken) { - return Base64.decode(samlToken); - } - - /** - * Hashes a SAML token. Throws an InternalErrorPEPSException runtime exception - * if the Cryptographic Engine fails. - * - * @param samlToken the SAML Token to be hashed. - * - * @return byte[] with the hashed SAML Token. - */ - public static byte[] hashPersonalToken(final byte[] samlToken) { - try { - final String className = - PEPSUtil.getConfig(PEPSValues.HASH_DIGEST_CLASS.toString()); - - final Digest digest = - (Digest) Class.forName(className).getConstructor() - .newInstance((Object[]) null); - digest.update(samlToken, 0, samlToken.length); - - final int retLength = digest.getDigestSize(); - final byte[] ret = new byte[retLength]; - - digest.doFinal(ret, 0); - return ret; - - } catch (final Exception e) { - // For all those exceptions that could be thrown, we always log it and - // thrown an InternalErrorPEPSException. - LOG.error(PEPSErrors.HASH_ERROR.errorMessage(), e); - throw new InternalErrorPEPSException( - PEPSUtil.getConfig(PEPSErrors.HASH_ERROR.errorCode()), - PEPSUtil.getConfig(PEPSErrors.HASH_ERROR.errorMessage()), e); - } - } - - /** - * Gets the Stork error code in the error message if exists! - * - * @param errorMessage The message to get the error code if exists; - * - * @return the error code if exists. Returns null otherwise. - */ - public static String getStorkErrorCode(final String errorMessage) { - if (StringUtils.isNotBlank(errorMessage) - && errorMessage.indexOf(PEPSValues.ERROR_MESSAGE_SEP.toString()) >= 0) { - final String[] msgSplitted = - errorMessage.split(PEPSValues.ERROR_MESSAGE_SEP.toString()); - if (msgSplitted.length == 2 && StringUtils.isNumeric(msgSplitted[0])) { - return msgSplitted[0]; - } - } - return null; - } - - /** - * Gets the Stork error message in the saml message if exists! - * - * @param errorMessage The message to get in the saml message if exists; - * - * @return the error message if exists. Returns the original message - * otherwise. - */ - public static String getStorkErrorMessage(final String errorMessage) { - if (StringUtils.isNotBlank(errorMessage) - && errorMessage.indexOf(PEPSValues.ERROR_MESSAGE_SEP.toString()) >= 0) { - final String[] msgSplitted = - errorMessage.split(PEPSValues.ERROR_MESSAGE_SEP.toString()); - if (msgSplitted.length == 2 && StringUtils.isNumeric(msgSplitted[0])) { - return msgSplitted[1]; - } - } - return errorMessage; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSValues.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSValues.java.svn-base deleted file mode 100644 index 568c25053..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PEPSValues.java.svn-base +++ /dev/null @@ -1,325 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -/** - * This enum class contains all the value constants. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.17 $, $Date: 2011-07-07 20:48:45 $ - */ -public enum PEPSValues { - - /** - * Represents the 'all' constant value. - */ - ALL("all"), - /** - * Represents the 'none' constant value. - */ - NONE("none"), - /** - * Represents the 'true' constant value. - */ - TRUE("true"), - /** - * Represents the 'false' constant value. - */ - FALSE("false"), - /** - * Represents the empty string constant value. - */ - EMPTY_STRING(""), - - /** - * Represents the ',' separator constant value. - */ - ATTRIBUTE_VALUE_SEP(","), - /** - * Represents the ';' separator constant value. - */ - ATTRIBUTE_SEP(";"), - /** - * Represents the ':' separator constant value. - */ - ATTRIBUTE_TUPLE_SEP(":"), - /** - * Represents the '/' separator constant value. - */ - EID_SEPARATOR("/"), - /** - * Represents the ' - ' separator constant value. - */ - ERROR_MESSAGE_SEP(" - "), - /** - * Represents the '#' parameter constant value. - */ - LOGGER_SEP("#"), - /** - * Represents the 'NOT_AVAILABLE' parameter constant value. - */ - NOT_AVAILABLE("NotAvailable"), - /** - * Represents the ';' parameter constant value. - */ - SPEPS_AUTHORIZED_SEP(";"), - - /** - * Represents the 'ap' constant value. - */ - AP("ap"), - /** - * Represents the 'C-PEPS' constant value. - */ - CPEPS("C-PEPS"), - /** - * Represents the 'cpeps' constant value. - */ - CPEPS_PREFIX("cpeps"), - /** - * Represents the 'peps' constant value. - */ - PEPS("peps"), - /** - * Represents the '-PEPS' constant value. - */ - PEPS_SUFFIX("-PEPS"), - /** - * Represents the 'SP' constant value. - */ - SP("SP"), - /** - * Represents the 'S-PEPS' constant value. - */ - SPEPS("S-PEPS"), - /** - * Represents the 'speps' constant value. - */ - SPEPS_PREFIX("speps"), - /** - * Represents the 'sp.default.parameters' constant value. - */ - DEFAULT("sp.default.parameters"), - /** - * Represents the default saml id constant value. - */ - DEFAULT_SAML_ID("1"), - /** - * Represents the 'hashDigest.className' constant value. - */ - HASH_DIGEST_CLASS("hashDigest.className"), - - /** - * Represents the 'eu.stork.communication.requests' constant value. - */ - STORK_PACKAGE_REQUEST_LOGGER_VALUE("eu.stork.communication.requests"), - /** - * Represents the 'eu.stork.communication.responses' constant value. - */ - STORK_PACKAGE_RESPONSE_LOGGER_VALUE("eu.stork.communication.responses"), - - /** - * Represents the 'S-PEPS receives request from SP' constant value. - */ - SP_REQUEST("S-PEPS receives request from SP"), - /** - * Represents the 'Get Citizen Consent' constant value. - */ - CITIZEN_CONSENT_LOG("Get Citizen Consent"), - /** - * Represents the 'C-PEPS receives request from S-PEPS' constant value. - */ - CPEPS_REQUEST("C-PEPS receives request from S-PEPS"), - /** - * Represents the 'C-PEPS generates response to S-PEPS' constant value. - */ - CPEPS_RESPONSE("C-PEPS generates response to S-PEPS"), - /** - * Represents the 'S-PEPS generates request to C-PEPS' constant value. - */ - SPEPS_REQUEST("S-PEPS generates request to C-PEPS"), - /** - * Represents the 'S-PEPS receives response from C-PEPS' constant value. - */ - SPEPS_RESPONSE("S-PEPS receives response from C-PEPS"), - /** - * Represents the 'S-PEPS generates response to SP' constant value. - */ - SP_RESPONSE("S-PEPS generates response to SP"), - /** - * Represents the 'Success' constant value. - */ - SUCCESS("Success"), - /** - * Represents the December's month number constant value. - */ - LAST_MONTH("12"), - /** - * Represents the yyyyMM constant value. - */ - NO_DAY_DATE_FORMAT("yyyyMM"), - - /** - * Represents the 'attrValue' constant value. - */ - ATTRIBUTE("attrValue"), - /** - * Represents the 'derivedAttr' constant value. - */ - DERIVE_ATTRIBUTE("deriveAttr"), - /** - * Represents the 'storkAttribute' constant value. - */ - STORK_ATTRIBUTE("storkAttribute"), - - /** - * Represents the 'properties' constant value. - */ - PROPERTIES("properties"), - /** - * Represents the 'referer' constant value. - */ - REFERER("referer"), - /** - * Represents the 'host' constant value. - */ - HOST("host"), - /** - * Represents the 'spid' constant value. - */ - SPID("spid"), - /** - * Represents the 'domain' constant value. - */ - DOMAIN("domain"), - /** - * Represents the '.validation' constant value. - */ - VALIDATION_SUFFIX(".validation"), - /** - * Represents the 'jsessionid' constant value. - */ - EQUAL("="), - /** - * Represents the 'HttpOnly' constant value. - */ - HTTP_ONLY("HttpOnly"), - /** - * Represents the 'SET-COOKIE' constant value. - */ - JSSESSION("JSESSIONID"), - /** - * Represents the '=' constant value. - */ - SETCOOKIE("SET-COOKIE"), - /** - * Represents the ';' constant value. - */ - SEMICOLON(";"), - /** - * Represents the ' ' constant value. - */ - SPACE(" "), - /** - * Represents the 'atp' constant value. - */ - APROVIDER_PREFIX("atp"), - /** - * Represents the 'ap-cpeps' constant value. - */ - AP_CPEPS_PREFIX("ap-cpeps"), - /** - * Represents the 'attr-filter' constant value. - */ - AP_ATTRFILTER_PREFIX("attr-filter"); - - /** - * Represents the constant's value. - */ - private String value; - - /** - * Solo Constructor. - * - * @param val The Constant value. - */ - PEPSValues(final String val) { - - this.value = val; - } - - /** - * Return the Constant Value. - * - * @return The constant value. - */ - public String toString() { - - return value; - } - - /** - * Construct the return value with the following structure - * CONSTANT_VALUE+index+".id". - * - * @param index the number. - * - * @return The concatenated String value. - */ - public String index(final int index) { - - return value + index + ".id"; - } - - /** - * Construct the return value with the following structure - * CONSTANT_VALUE+index+".value". - * - * @param index the number. - * - * @return The concatenated string value. - */ - public String value(final int index) { - - return value + index + ".value"; - } - - /** - * Construct the return value with the following structure - * CONSTANT_VALUE+index+".name". - * - * @param index the number. - * - * @return The concatenated String value. - */ - public String name(final int index) { - - return value + index + ".name"; - } - - /** - * Construct the return value with the following structure - * CONSTANT_VALUE+index+".url". - * - * @param index the number. - * - * @return The concatenated String value. - */ - public String url(final int index) { - - return value + index + ".url"; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttribute.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttribute.java.svn-base deleted file mode 100644 index bb9b3b694..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttribute.java.svn-base +++ /dev/null @@ -1,323 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -import eu.stork.peps.auth.commons.exceptions.InternalErrorPEPSException; - -/** - * This class is a bean used to store the information relative to the - * PersonalAttribute. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.22 $, $Date: 2010-11-17 05:15:28 $ - */ -public final class PersonalAttribute implements Serializable, Cloneable { - - /** - * Unique identifier. - */ - private static final long serialVersionUID = 2612951678412632174L; - - /** - * Logger object. - */ - private static final Logger LOG = Logger.getLogger(PersonalAttribute.class - .getName()); - - /** - * Name of the personal attribute. - */ - private String name; - - /** - * Values of the personal attribute. - */ - private List value = new ArrayList(); - - /** - * Complex values of the personal attribute. - */ - private Map complexValue = new HashMap(); - - /** - * Is the personal attribute mandatory? - */ - private transient boolean required; - - /** - * Returned status of the attribute from the IdP. - */ - private String status; - - /** - * Name of the personal attribute. - */ - private String friendlyName; - - /** - * Empty Constructor. - */ - public PersonalAttribute() { - super(); - } - - /** - * PersonalAttribute Constructor for complex values. - * - * @param attrName The attribute name. - * @param attrIsRequired The attribute type value. - * @param attrComplexValue The attribute's value. - * @param attrStatus The attribute's status value. - */ - public PersonalAttribute(final String attrName, final boolean attrIsRequired, - final List attrComplexValue, final String attrStatus) { - this.setName(attrName); - this.setIsRequired(attrIsRequired); - this.setValue(attrComplexValue); - this.setStatus(attrStatus); - } - - /** - * PersonalAttribute Constructor for complex values. - * - * @param attrName The attribute name. - * @param attrIsRequired The attribute type value. - * @param attrComplexValue The attribute's complex value. - * @param attrStatus The attribute's status value. - */ - public PersonalAttribute(final String attrName, final boolean attrIsRequired, - final Map attrComplexValue, final String attrStatus) { - this.setName(attrName); - this.setIsRequired(attrIsRequired); - this.setComplexValue(attrComplexValue); - this.setStatus(attrStatus); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public Object clone() { - - try { - final PersonalAttribute personalAttr = (PersonalAttribute) super.clone(); - personalAttr.setIsRequired(this.isRequired()); - personalAttr.setName(this.getName()); - personalAttr.setStatus(this.getStatus()); - if (!isEmptyValue()) { - final List val = - (List) ((ArrayList) this.getValue()).clone(); - personalAttr.setValue(val); - } - if (!isEmptyComplexValue()) { - final Map complexVal = - (Map) ((HashMap) this - .getComplexValue()).clone(); - personalAttr.setComplexValue(complexVal); - } - return personalAttr; - } catch (final CloneNotSupportedException e) { - // assert false; - LOG.trace("Nothing to do."); - throw new InternalErrorPEPSException( - PEPSUtil.getConfig(PEPSErrors.INTERNAL_ERROR.errorCode()), - PEPSUtil.getConfig(PEPSErrors.INTERNAL_ERROR.errorMessage()), e); - } - } - - /** - * Getter for the required value. - * - * @return The required value. - */ - public boolean isRequired() { - return required; - } - - /** - * Setter for the required value. - * - * @param attrIsRequired this attribute? - */ - public void setIsRequired(final boolean attrIsRequired) { - this.required = attrIsRequired; - } - - /** - * Getter for the name value. - * - * @return The name value. - */ - public String getName() { - return name; - } - - /** - * Setter for the name value. - * - * @param attrName The personal attribute name. - */ - public void setName(final String attrName) { - this.name = attrName; - } - - /** - * Getter for the value. - * - * @return The list of values. - */ - public List getValue() { - return value; - } - - /** - * Setter for the list of values. - * - * @param attrValue The personal attribute value. - */ - public void setValue(final List attrValue) { - if (attrValue != null) { - this.value = attrValue; - } - } - - /** - * Getter for the status. - * - * @return The status value. - */ - public String getStatus() { - return status; - } - - /** - * Setter for the status value. - * - * @param attrStatus The personal attribute status. - */ - public void setStatus(final String attrStatus) { - this.status = attrStatus; - } - - /** - * Getter for the complex value. - * - * @return The complex value. - */ - public Map getComplexValue() { - return complexValue; - } - - /** - * Setter for the complex value. - * - * @param complexVal The personal attribute Complex value. - */ - public void setComplexValue(final Map complexVal) { - if (complexVal != null) { - this.complexValue = complexVal; - } - } - - /** - * Getter for the personal's friendly name. - * - * @return The personal's friendly name value. - */ - public String getFriendlyName() { - return friendlyName; - } - - /** - * Setter for the personal's friendly name. - * - * @param fName The personal's friendly name. - */ - public void setFriendlyName(final String fName) { - this.friendlyName = fName; - } - - /** - * Return true the value is empty. - * - * @return True if the value is empty "[]"; - */ - public boolean isEmptyValue() { - return value.isEmpty() || (value.size() == 1 && value.get(0).length() == 0); - } - - /** - * Returns true if the Complex Value is empty. - * - * @return True if the Complex Value is empty; - */ - public boolean isEmptyComplexValue() { - return complexValue.isEmpty(); - } - - /** - * Returns true if the Status is empty. - * - * @return True if the Status is empty; - */ - public boolean isEmptyStatus() { - return (status == null || status.length() == 0); - } - - /** - * Prints the PersonalAttribute in the following format. - * name:required:[v,a,l,u,e,s]|[v=a,l=u,e=s]:status; - * - * @return The PersonalAttribute as a string. - */ - public String toString() { - final StringBuilder strBuild = new StringBuilder(); - - AttributeUtil.appendIfNotNull(strBuild, getName()); - strBuild.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); - AttributeUtil.appendIfNotNull(strBuild, String.valueOf(isRequired())); - strBuild.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); - strBuild.append('['); - - if (isEmptyValue()) { - if (!isEmptyComplexValue()) { - AttributeUtil.appendIfNotNull(strBuild, AttributeUtil.mapToString( - getComplexValue(), PEPSValues.ATTRIBUTE_VALUE_SEP.toString())); - } - } else { - AttributeUtil.appendIfNotNull( - strBuild, - AttributeUtil.listToString(getValue(), - PEPSValues.ATTRIBUTE_VALUE_SEP.toString())); - } - - strBuild.append(']'); - strBuild.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); - AttributeUtil.appendIfNotNull(strBuild, getStatus()); - strBuild.append(PEPSValues.ATTRIBUTE_SEP.toString()); - - return strBuild.toString(); - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttributeList.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttributeList.java.svn-base deleted file mode 100644 index d33ccfe18..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/PersonalAttributeList.java.svn-base +++ /dev/null @@ -1,305 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.StringTokenizer; - -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; - -/** - * This class is a bean used to store the information relative to the - * PersonalAttributeList. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.27 $, $Date: 2010-11-18 22:54:56 $ - * - * @see PersonalAttribute - */ -@SuppressWarnings("PMD") -public final class PersonalAttributeList extends - HashMap implements IPersonalAttributeList{ - - /** - * Logger object. - */ - private static final Logger LOG = Logger - .getLogger(PersonalAttributeList.class.getName()); - - /** - * Serial id. - */ - private static final long serialVersionUID = 7375127363889975062L; - - /** - * Hash with the latest fetched attribute name alias. - */ - private final transient Map latestAttrAlias = - new HashMap(); - - /** - * Hash with mapping number of alias or the attribute name. - */ - private final transient Map attrAliasNumber = - new HashMap(); - - /** - * Default constructor. - */ - public PersonalAttributeList() { - // The best practices recommend to call the super constructor. - super(); - } - - /** - * Constructor with initial capacity for the PersonalAttributeList size. - * - * @param capacity The initial capacity for the PersonalAttributeList. - */ - public PersonalAttributeList(final int capacity) { - super(capacity); - } - - /** - * {@inheritDoc} - */ - public Iterator iterator() { - return this.values().iterator(); - } - - /** - * {@inheritDoc} - */ - public PersonalAttribute get(final Object key) { - String attrName = (String) key; - - if (this.latestAttrAlias.containsKey(key)) { - attrName = attrName + this.latestAttrAlias.get(key); - } else { - if (this.attrAliasNumber.containsKey(key)) { - this.latestAttrAlias.put(attrName, this.attrAliasNumber.get(key)); - } - } - return super.get(attrName); - } - - /** - * {@inheritDoc} - */ - public void add(final PersonalAttribute value) { - if (value != null) { - this.put(value.getName(), value); - } - } - - /** - * {@inheritDoc} - */ - public PersonalAttribute put(final String key, final PersonalAttribute val) { - if (StringUtils.isNotEmpty(key) && val != null) { - // Validate if attribute name already exists! - String attrAlias = key; - if (this.containsKey(key)) { - if (!val.isEmptyValue() && StringUtils.isNumeric(val.getValue().get(0))) { - final String attrValue = val.getValue().get(0); - attrAlias = key + attrValue; - this.attrAliasNumber.put(key, Integer.valueOf(attrValue)); - } else { - final PersonalAttribute attr = super.get(key); - if (!attr.isEmptyValue() - && StringUtils.isNumeric(attr.getValue().get(0))) { - attrAlias = key + attr.getValue().get(0); - super.put(key, (PersonalAttribute) attr); - this.attrAliasNumber.put(key, null); - } - } - } - return super.put(attrAlias, val); - } else { - return null; - } - } - - /** - * {@inheritDoc} - */ - public void populate(final String attrList) { - final StringTokenizer strToken = - new StringTokenizer(attrList, PEPSValues.ATTRIBUTE_SEP.toString()); - - while (strToken.hasMoreTokens()) { - final PersonalAttribute persAttr = new PersonalAttribute(); - String[] tuples = - strToken.nextToken().split(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString(), - AttributeConstants.NUMBER_TUPLES.intValue()); - - // Convert to the new format if needed! - tuples = convertFormat(tuples); - - if (AttributeUtil.hasValidTuples(tuples)) { - final int attrValueIndex = - AttributeConstants.ATTR_VALUE_INDEX.intValue(); - final String tmpAttrValue = - tuples[attrValueIndex].substring(1, - tuples[attrValueIndex].length() - 1); - final String[] vals = - tmpAttrValue.split(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - - persAttr.setName(tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()]); - persAttr.setIsRequired(Boolean - .valueOf(tuples[AttributeConstants.ATTR_TYPE_INDEX.intValue()])); - - // check if it is a complex value - if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] - .equals(PEPSParameters.COMPLEX_ADDRESS_VALUE.toString())) - { - persAttr.setComplexValue(createComplexValue(vals)); - } - else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] - .equals(PEPSParameters.COMPLEX_NEWATTRIBUTE_VALUE.toString())) - { - persAttr.setComplexValue(createComplexValue(vals)); - } - - else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] - .equals(PEPSParameters.COMPLEX_HASDEGREE_VALUE.toString())) - { - persAttr.setComplexValue(createComplexValue(vals)); - } - else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] - .equals(PEPSParameters.COMPLEX_MANDATECONTENT_VALUE.toString())) - { - persAttr.setComplexValue(createComplexValue(vals)); - } - else - { - persAttr.setValue(createValues(vals)); - } - - if (tuples.length == AttributeConstants.NUMBER_TUPLES.intValue()) { - persAttr.setStatus(tuples[AttributeConstants.ATTR_STATUS_INDEX - .intValue()]); - } - this.put(tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()], - persAttr); - - } else { - LOG.warn("Invalid personal attribute list tuples"); - } - - } - } - - /** - * Returns a copy of this IPersonalAttributeList instance. - * - * @return The copy of this IPersonalAttributeList. - */ - public Object clone() { - return (PersonalAttributeList) super.clone(); - } - - /** - * Creates a string in the following format. - * - * attrName:attrType:[attrValue1,attrValue2=attrComplexValue]:attrStatus; - * - * @return {@inheritDoc} - */ - @Override - public String toString() { - final Iterator> itAttrs = - this.entrySet().iterator(); - final StringBuilder strBuilder = new StringBuilder(); - - while (itAttrs.hasNext()) { - final Entry attrEntry = itAttrs.next(); - final PersonalAttribute attr = attrEntry.getValue(); - strBuilder.append(attr.toString()); - } - - return strBuilder.toString(); - } - - /** - * Validates and creates the attribute's complex values. - * - * @param values The complex values. - * - * @return The {@link Map} with the complex values. - * - * @see Map - */ - private Map createComplexValue(final String[] values) { - final Map complexValue = new HashMap(); - for (final String val : values) { - final String[] tVal = val.split("="); - if (StringUtils.isNotEmpty(val) && tVal.length == 2) { - complexValue.put(tVal[0], AttributeUtil.unescape(tVal[1])); - } - } - return complexValue; - } - - /** - * Validates and creates the attribute values. - * - * @param vals The attribute values. - * - * @return The {@link List} with the attribute values. - * - * @see List - */ - private List createValues(final String[] vals) { - final List values = new ArrayList(); - for (final String val : vals) { - if (StringUtils.isNotEmpty(val)) { - values.add(AttributeUtil.unescape(val)); - } - } - return values; - } - - /** - * Converts the attribute tuple (attrName:attrType...) to the new format. - * - * @param tuples The attribute tuples to convert. - * - * @return The attribute tuples in the new format. - */ - private String[] convertFormat(final String[] tuples) { - final String[] newFormatTuples = - new String[AttributeConstants.NUMBER_TUPLES.intValue()]; - if (tuples != null) { - System.arraycopy(tuples, 0, newFormatTuples, 0, tuples.length); - - for (int i = tuples.length; i < newFormatTuples.length; i++) { - if (i == AttributeConstants.ATTR_VALUE_INDEX.intValue()) { - newFormatTuples[i] = "[]"; - } else { - newFormatTuples[i] = ""; - } - } - } - return newFormatTuples; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryRequest.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryRequest.java.svn-base deleted file mode 100644 index 33160f2ac..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryRequest.java.svn-base +++ /dev/null @@ -1,426 +0,0 @@ -package eu.stork.peps.auth.commons; - -import java.io.Serializable; - -import org.apache.log4j.Logger; - -public class STORKAttrQueryRequest implements Serializable, Cloneable { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = 4778480781609392750L; - - /** - * Logger object. - */ - private static final Logger LOG = Logger.getLogger(STORKAttrQueryRequest.class - .getName()); - - /** The samlId. */ - private String samlId; - - /** The destination. */ - private String destination; - - /** The distinguished name. */ - private String distinguishedName; - - /** The e id sector share. */ - private boolean eIDSectorShare; - - /** The e id cross sector share. */ - private boolean eIDCrossSectorShare; - - /** The e id cross border share. */ - private boolean eIDCrossBorderShare; - - /** The personal attribute list. */ - private IPersonalAttributeList attributeList = new PersonalAttributeList(); - - /** The qaa. */ - private int qaa; - - /** The token saml. */ - private byte[] tokenSaml = new byte[0]; - - /** The issuer. */ - private String issuer; - - /** The service provider sector. */ - private String spSector; - - /** The service provider institution. */ - private String spInstitution; - - /** The service provider application. */ - private String spApplication; - - /** The service provider country. */ - private String spCountry; - - /** The country. */ - private String country; - - /** The citizen country code. */ - private String citizenCountry; - - /** The Service Provider ID. */ - private String sPID; - - /** The Alias used at the keystore for saving this certificate. */ - private String alias; - - /** - * Gets the SP's Certificate Alias. - * - * @return alias The SP's Certificate Alias. - */ - public String getAlias() { - return alias; - } - - /** - * Sets the SP's Certificate Alias. - * - * @param nAlias The SP's Certificate Alias. - */ - public void setAlias(final String nAlias) { - this.alias = nAlias; - } - - /** - * Gets the SP ID. - * - * @return sPID The SP ID. - */ - public String getSPID() { - return sPID; - } - - /** - * Sets the SP ID. - * - * @param sPId The new sp samlId. - */ - public void setSPID(final String sPId) { - this.sPID = sPId; - } - - /** - * Gets the citizen country code. - * - * @return The citizen country code value. - */ - public String getCitizenCountryCode() { - return citizenCountry; - } - - /** - * Sets the citizen country code. - * - * @param countryCode the new citizen country code value. - */ - public void setCitizenCountryCode(final String countryCode) { - this.citizenCountry = countryCode; - } - - /** - * Gets the sp country. - * - * @return The sp country value. - */ - public String getSpCountry() { - return spCountry; - } - - /** - * Sets the sp country. - * - * @param sPCountry the new sp country value. - */ - public void setSpCountry(final String sPCountry) { - this.spCountry = sPCountry; - } - - /** - * Gets the issuer. - * - * @return The issuer value. - */ - public String getIssuer() { - return issuer; - } - - /** - * Sets the issuer. - * - * @param samlIssuer the new issuer value. - */ - public void setIssuer(final String samlIssuer) { - this.issuer = samlIssuer; - } - - /** - * Gets the SAML Token. - * - * @return The SAML Token value. - */ - public byte[] getTokenSaml() { - return tokenSaml.clone(); - } - - /** - * Sets the SAML Token. - * - * @param samlToken The new SAML Token value. - */ - public void setTokenSaml(final byte[] samlToken) { - if (samlToken != null) { - this.tokenSaml = samlToken.clone(); - } - } - - /** - * Gets the country. - * - * @return The country value. - */ - public String getCountry() { - return country; - } - - /** - * Sets the country. - * - * @param nCountry the new country value. - */ - public void setCountry(final String nCountry) { - this.country = nCountry; - } - - /** - * Getter for the qaa value. - * - * @return The qaa value value. - */ - public int getQaa() { - return qaa; - } - - /** - * Setter for the qaa value. - * - * @param qaaLevel The new qaa value. - */ - public void setQaa(final int qaaLevel) { - this.qaa = qaaLevel; - } - - /** - * Getter for the destination value. - * - * @return The destination value. - */ - public String getDestination() { - return destination; - } - - /** - * Setter for the destination value. - * - * @param detination the new destination value. - */ - public void setDestination(final String detination) { - this.destination = detination; - } - - /** - * Getter for the samlId value. - * - * @return The samlId value. - */ - public String getSamlId() { - return samlId; - } - - /** - * Setter for the samlId value. - * - * @param newSamlId the new samlId value. - */ - public void setSamlId(final String newSamlId) { - this.samlId = newSamlId; - } - - - /** - * Getter for the attributeList value. - * - * @return The attributeList value. - * - * @see IPersonalAttributeList - */ - public IPersonalAttributeList getPersonalAttributeList() { - IPersonalAttributeList personnalAttributeList = null; - try { - personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); - } catch (CloneNotSupportedException e1) { - LOG.trace("[PersonalAttribute] Nothing to do."); - } - return personnalAttributeList; - } - - /** - * Setter for the attributeList value. - * - * @param attrList the personal attribute list value. - * - * @see IPersonalAttributeList - */ - public void setPersonalAttributeList(final IPersonalAttributeList attrList) { - if (attrList != null) { - this.attributeList = attrList; - } - } - - /** - * Getter for the distinguishedName value. - * - * @return The distinguishedName value. - */ - public String getDistinguishedName() { - return distinguishedName; - } - - /** - * Setter for the distinguishedName value. - * - * @param certDN the distinguished name value. - */ - public void setDistinguishedName(final String certDN) { - this.distinguishedName = certDN; - } - - /** - * Gets the service provider sector. - * - * @return The service provider sector value. - */ - public String getSpSector() { - return spSector; - } - - /** - * Sets the service provider sector. - * - * @param samlSPSector the new service provider sector value. - */ - public void setSpSector(final String samlSPSector) { - this.spSector = samlSPSector; - } - - /** - * Gets the service provider institution. - * - * @return The service provider institution value. - */ - public String getSpInstitution() { - return spInstitution; - } - - /** - * Sets the service provider institution. - * - * @param samlSPInst the new service provider institution value. - */ - public void setSpInstitution(final String samlSPInst) { - this.spInstitution = samlSPInst; - } - - /** - * Gets the service provider application. - * - * @return The service provider application value. - */ - public String getSpApplication() { - return spApplication; - } - - /** - * Sets the service provider application. - * - * @param samlSPApp the new service provider application value. - */ - public void setSpApplication(final String samlSPApp) { - this.spApplication = samlSPApp; - } - - /** - * Checks if is eId sector share. - * - * @return true, if is eId sector share. - */ - public boolean isEIDSectorShare() { - return eIDSectorShare; - } - - /** - * Sets the eId sector share. - * - * @param eIdSectorShare the new eId sector share value. - */ - public void setEIDSectorShare(final boolean eIdSectorShare) { - this.eIDSectorShare = eIdSectorShare; - } - - /** - * Checks if is eId cross sector share. - * - * @return true, if is eId cross sector share. - */ - public boolean isEIDCrossSectorShare() { - return eIDCrossSectorShare; - } - - /** - * Sets the eId cross sector share. - * - * @param eIdCrossSectorShare the new eId cross sector share value. - */ - public void setEIDCrossSectorShare(final boolean eIdCrossSectorShare) { - this.eIDCrossSectorShare = eIdCrossSectorShare; - } - - /** - * Checks if is eId cross border share. - * - * @return true, if is eId cross border share. - */ - public boolean isEIDCrossBorderShare() { - return eIDCrossBorderShare; - } - - /** - * Sets the eId cross border share. - * - * @param eIdCrossBorderShare the new eId cross border share value. - */ - public void setEIDCrossBorderShare(final boolean eIdCrossBorderShare) { - this.eIDCrossBorderShare = eIdCrossBorderShare; - } - - /** - * Returns a copy of this STORKAttrQueryRequest instance. - * - * @return The copy of this STORKAttrQueryRequest. - * @throws CloneNotSupportedException on clone exception - */ - @Override - public Object clone() throws CloneNotSupportedException{ - STORKAttrQueryRequest storkAttrQueryReq = null; - storkAttrQueryReq = (STORKAttrQueryRequest) super.clone(); - storkAttrQueryReq.setPersonalAttributeList(getPersonalAttributeList()); - storkAttrQueryReq.setTokenSaml(getTokenSaml()); - return storkAttrQueryReq; - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryResponse.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryResponse.java.svn-base deleted file mode 100644 index 215b978dc..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAttrQueryResponse.java.svn-base +++ /dev/null @@ -1,301 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import org.apache.log4j.Logger; -import org.joda.time.DateTime; - -public class STORKAttrQueryResponse { - - /** Response Id. */ - private String samlId; - - /** Request failed? */ - private boolean fail; - - /** Status code. */ - private String statusCode; - - /** Secondary status code. */ - private String subStatusCode; - - /** Audience restriction. */ - private transient String audienceRest; - - /** Error message. */ - private String message; - - /** Id of the request that originated this response. */ - private String inResponseTo; - - /** Expiration date. */ - private DateTime notOnOrAfter; - - /** Creation date. */ - private DateTime notBefore; - - /** The SAML token. */ - private byte[] tokenSaml = new byte[0]; - - /** Country. */ - private String country; - - /** Citizen's personal attribute list. */ - private transient IPersonalAttributeList attributeList = new PersonalAttributeList(); - - /** - * Logger object. - */ - private static final Logger LOG = Logger.getLogger(STORKAttrQueryResponse.class.getName()); - - /** - * Getter for the subStatusCode. - * - * @return The subStatusCode value. - */ - public String getSubStatusCode() { - return subStatusCode; - } - - /** - * Setter for the subStatusCode. - * - * @param samlSubStatusCode the new subStatusCode value. - */ - public void setSubStatusCode(final String samlSubStatusCode) { - this.subStatusCode = samlSubStatusCode; - } - - /** - * Getter for audienceRest. - * - * @return The audienceRest value. - */ - public String getAudienceRestriction() { - return audienceRest; - } - - /** - * Setter for audienceRest. - * - * @param audRest the new audienceRest value. - */ - public void setAudienceRestriction(final String audRest) { - this.audienceRest = audRest; - } - - /** - * Getter for the samlToken. - * - * @return The samlToken value. - */ - public byte[] getTokenSaml() { - return tokenSaml.clone(); - } - - /** - * Setter for samlToken. - * - * @param samlToken the new tokenSaml value. - */ - public void setTokenSaml(final byte[] samlToken) { - if (samlToken != null) { - this.tokenSaml = samlToken.clone(); - } - } - - /** - * Getter for the country name. - * - * @return The country name value. - */ - public String getCountry() { - return country; - } - - /** - * Setter for the country name. - * - * @param cCountry the new country name value. - */ - public void setCountry(final String cCountry) { - this.country = cCountry; - } - - /** - * Getter for pal value. - * - * @return The pal value. - * - * @see PersonalAttributeList - */ - public IPersonalAttributeList getPersonalAttributeList() { - IPersonalAttributeList personnalAttributeList = null; - try { - personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); - } catch (CloneNotSupportedException e1) { - LOG.trace("[PersonalAttribute] Nothing to do."); - } - return personnalAttributeList; - } - - /** - * Setter for the Personal Attribute List value. - * - * @param attrList the new value. - * - * @see PersonalAttributeList - */ - public void setPersonalAttributeList(final IPersonalAttributeList attrList) { - if (attrList != null) { - this.attributeList = attrList; - } - } - - /** - * Getter for the inResponseTo value. - * - * @return The inResponseTo value. - */ - public String getInResponseTo() { - return inResponseTo; - } - - /** - * Setter for the inResponseTo value. - * - * @param samlInResponseTo the new inResponseTo value. - */ - public void setInResponseTo(final String samlInResponseTo) { - this.inResponseTo = samlInResponseTo; - } - - /** - * Getter for the fail value. - * - * @return The fail value. - */ - public boolean isFail() { - return fail; - } - - /** - * Setter for the fail value. - * - * @param failVal the new fail value. - */ - public void setFail(final boolean failVal) { - this.fail = failVal; - } - - /** - * Getter for the message value. - * - * @return The message value. - */ - public String getMessage() { - return message; - } - - /** - * Setter for the message value. - * - * @param msg the new message value. - */ - public void setMessage(final String msg) { - this.message = msg; - } - - /** - * Getter for the statusCode value. - * - * @return The statusCode value. - */ - public String getStatusCode() { - return statusCode; - } - - /** - * Setter for the statusCode value. - * - * @param status the new statusCode value. - */ - public void setStatusCode(final String status) { - this.statusCode = status; - } - - /** - * Getter for the samlId value. - * - * @return The samlId value. - */ - public String getSamlId() { - return samlId; - } - - /** - * Setter for the samlId value. - * - * @param nSamlId the new samlId value. - */ - public void setSamlId(final String nSamlId) { - this.samlId = nSamlId; - } - - /** - * Getter for the notOnOrAfter value. - * - * @return The notOnOrAfter value. - * - * @see DateTime - */ - public DateTime getNotOnOrAfter() { - return this.notOnOrAfter; - } - - /** - * Setter for the notOnOrAfter value. - * - * @param nOnOrAfter the new notOnOrAfter value. - * - * @see DateTime - */ - public void setNotOnOrAfter(final DateTime nOnOrAfter) { - this.notOnOrAfter = nOnOrAfter; - } - - /** - * Getter for the notBefore value. - * - * @return The notBefore value. - * - * @see DateTime - */ - public DateTime getNotBefore() { - return notBefore; - } - - /** - * Setter for the notBefore value. - * - * @param nBefore the new notBefore value. - * - * @see DateTime - */ - public void setNotBefore(final DateTime nBefore) { - this.notBefore = nBefore; - } - -} - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnRequest.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnRequest.java.svn-base deleted file mode 100644 index 2354d0eb1..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnRequest.java.svn-base +++ /dev/null @@ -1,495 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import java.io.Serializable; - -import org.apache.log4j.Logger; - -/** - * This class is a bean used to store the information relative to the - * STORKAuthnRequest (SAML Token Request). - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.21 $, $Date: 2011-02-17 22:44:34 $ - */ -public final class STORKAuthnRequest implements Serializable, Cloneable { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = 4778480781609392750L; - - /** - * Logger object. - */ - private static final Logger LOG = Logger.getLogger(STORKAuthnRequest.class - .getName()); - - /** The samlId. */ - private String samlId; - - /** The assertion consumer service url. */ - private String serviceURL; - - /** The destination. */ - private String destination; - - /** The provider name. */ - private String providerName; - - /** The distinguished name. */ - private String distinguishedName; - - /** The e id sector share. */ - private boolean eIDSectorShare; - - /** The e id cross sector share. */ - private boolean eIDCrossSectorShare; - - /** The e id cross border share. */ - private boolean eIDCrossBorderShare; - - /** The personal attribute list. */ - private IPersonalAttributeList attributeList = new PersonalAttributeList(); - - /** The qaa. */ - private int qaa; - - /** The token saml. */ - private byte[] tokenSaml = new byte[0]; - - /** The issuer. */ - private String issuer; - - /** The service provider sector. */ - private String spSector; - - /** The service provider institution. */ - private String spInstitution; - - /** The service provider application. */ - private String spApplication; - - /** The service provider country. */ - private String spCountry; - - /** The country. */ - private String country; - - /** The citizen country code. */ - private String citizenCountry; - - /** The Service Provider ID. */ - private String sPID; - - /** The Alias used at the keystore for saving this certificate. */ - private String alias; - - /** - * Gets the SP's Certificate Alias. - * - * @return alias The SP's Certificate Alias. - */ - public String getAlias() { - return alias; - } - - /** - * Sets the SP's Certificate Alias. - * - * @param nAlias The SP's Certificate Alias. - */ - public void setAlias(final String nAlias) { - this.alias = nAlias; - } - - /** - * Gets the SP ID. - * - * @return sPID The SP ID. - */ - public String getSPID() { - return sPID; - } - - /** - * Sets the SP ID. - * - * @param sPId The new sp samlId. - */ - public void setSPID(final String sPId) { - this.sPID = sPId; - } - - /** - * Gets the citizen country code. - * - * @return The citizen country code value. - */ - public String getCitizenCountryCode() { - return citizenCountry; - } - - /** - * Sets the citizen country code. - * - * @param countryCode the new citizen country code value. - */ - public void setCitizenCountryCode(final String countryCode) { - this.citizenCountry = countryCode; - } - - /** - * Gets the sp country. - * - * @return The sp country value. - */ - public String getSpCountry() { - return spCountry; - } - - /** - * Sets the sp country. - * - * @param sPCountry the new sp country value. - */ - public void setSpCountry(final String sPCountry) { - this.spCountry = sPCountry; - } - - /** - * Gets the issuer. - * - * @return The issuer value. - */ - public String getIssuer() { - return issuer; - } - - /** - * Sets the issuer. - * - * @param samlIssuer the new issuer value. - */ - public void setIssuer(final String samlIssuer) { - this.issuer = samlIssuer; - } - - /** - * Gets the SAML Token. - * - * @return The SAML Token value. - */ - public byte[] getTokenSaml() { - return tokenSaml.clone(); - } - - /** - * Sets the SAML Token. - * - * @param samlToken The new SAML Token value. - */ - public void setTokenSaml(final byte[] samlToken) { - if (samlToken != null) { - this.tokenSaml = samlToken.clone(); - } - } - - /** - * Gets the country. - * - * @return The country value. - */ - public String getCountry() { - return country; - } - - /** - * Sets the country. - * - * @param nCountry the new country value. - */ - public void setCountry(final String nCountry) { - this.country = nCountry; - } - - /** - * Getter for the qaa value. - * - * @return The qaa value value. - */ - public int getQaa() { - return qaa; - } - - /** - * Setter for the qaa value. - * - * @param qaaLevel The new qaa value. - */ - public void setQaa(final int qaaLevel) { - this.qaa = qaaLevel; - } - - /** - * Getter for the serviceURL value. - * - * @return The serviceURL value. - */ - public String getAssertionConsumerServiceURL() { - return serviceURL; - } - - /** - * Setter for the serviceURL value. - * - * @param newServiceURL the assertion consumer service URL. - */ - public void setAssertionConsumerServiceURL(final String newServiceURL) { - this.serviceURL = newServiceURL; - } - - /** - * Getter for the destination value. - * - * @return The destination value. - */ - public String getDestination() { - return destination; - } - - /** - * Setter for the destination value. - * - * @param detination the new destination value. - */ - public void setDestination(final String detination) { - this.destination = detination; - } - - /** - * Getter for the samlId value. - * - * @return The samlId value. - */ - public String getSamlId() { - return samlId; - } - - /** - * Setter for the samlId value. - * - * @param newSamlId the new samlId value. - */ - public void setSamlId(final String newSamlId) { - this.samlId = newSamlId; - } - - /** - * Getter for the providerName value. - * - * @return The provider name value. - */ - public String getProviderName() { - return providerName; - } - - /** - * Setter for the providerName value. - * - * @param samlProvider the provider name value. - */ - public void setProviderName(final String samlProvider) { - this.providerName = samlProvider; - } - - /** - * Getter for the attributeList value. - * - * @return The attributeList value. - * - * @see IPersonalAttributeList - */ - public IPersonalAttributeList getPersonalAttributeList() { - IPersonalAttributeList personnalAttributeList = null; - try { - personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); - } catch (CloneNotSupportedException e1) { - LOG.trace("[PersonalAttribute] Nothing to do."); - } - return personnalAttributeList; - } - - /** - * Setter for the attributeList value. - * - * @param attrList the personal attribute list value. - * - * @see IPersonalAttributeList - */ - public void setPersonalAttributeList(final IPersonalAttributeList attrList) { - if (attrList != null) { - this.attributeList = attrList; - } - } - - /** - * Getter for the distinguishedName value. - * - * @return The distinguishedName value. - */ - public String getDistinguishedName() { - return distinguishedName; - } - - /** - * Setter for the distinguishedName value. - * - * @param certDN the distinguished name value. - */ - public void setDistinguishedName(final String certDN) { - this.distinguishedName = certDN; - } - - /** - * Gets the service provider sector. - * - * @return The service provider sector value. - */ - public String getSpSector() { - return spSector; - } - - /** - * Sets the service provider sector. - * - * @param samlSPSector the new service provider sector value. - */ - public void setSpSector(final String samlSPSector) { - this.spSector = samlSPSector; - } - - /** - * Gets the service provider institution. - * - * @return The service provider institution value. - */ - public String getSpInstitution() { - return spInstitution; - } - - /** - * Sets the service provider institution. - * - * @param samlSPInst the new service provider institution value. - */ - public void setSpInstitution(final String samlSPInst) { - this.spInstitution = samlSPInst; - } - - /** - * Gets the service provider application. - * - * @return The service provider application value. - */ - public String getSpApplication() { - return spApplication; - } - - /** - * Sets the service provider application. - * - * @param samlSPApp the new service provider application value. - */ - public void setSpApplication(final String samlSPApp) { - this.spApplication = samlSPApp; - } - - /** - * Checks if is eId sector share. - * - * @return true, if is eId sector share. - */ - public boolean isEIDSectorShare() { - return eIDSectorShare; - } - - /** - * Sets the eId sector share. - * - * @param eIdSectorShare the new eId sector share value. - */ - public void setEIDSectorShare(final boolean eIdSectorShare) { - this.eIDSectorShare = eIdSectorShare; - } - - /** - * Checks if is eId cross sector share. - * - * @return true, if is eId cross sector share. - */ - public boolean isEIDCrossSectorShare() { - return eIDCrossSectorShare; - } - - /** - * Sets the eId cross sector share. - * - * @param eIdCrossSectorShare the new eId cross sector share value. - */ - public void setEIDCrossSectorShare(final boolean eIdCrossSectorShare) { - this.eIDCrossSectorShare = eIdCrossSectorShare; - } - - /** - * Checks if is eId cross border share. - * - * @return true, if is eId cross border share. - */ - public boolean isEIDCrossBorderShare() { - return eIDCrossBorderShare; - } - - /** - * Sets the eId cross border share. - * - * @param eIdCrossBorderShare the new eId cross border share value. - */ - public void setEIDCrossBorderShare(final boolean eIdCrossBorderShare) { - this.eIDCrossBorderShare = eIdCrossBorderShare; - } - - /** - * Returns a copy of this STORKAuthnRequest instance. - * - * @return The copy of this STORKAuthnRequest. - * @throws CloneNotSupportedException on clone exception - */ - @Override - public Object clone() throws CloneNotSupportedException{ - STORKAuthnRequest storkAuthnReq = null; - try { - storkAuthnReq = (STORKAuthnRequest) super.clone(); - storkAuthnReq.setPersonalAttributeList(getPersonalAttributeList()); - storkAuthnReq.setTokenSaml(getTokenSaml()); - } catch (final CloneNotSupportedException e) { - // assert false; - LOG.trace("[PersonalAttribute] Nothing to do."); - } - - return storkAuthnReq; - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnResponse.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnResponse.java.svn-base deleted file mode 100644 index aa98974f6..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKAuthnResponse.java.svn-base +++ /dev/null @@ -1,309 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -import org.apache.log4j.Logger; -import org.joda.time.DateTime; - -/** - * This class is a bean used to store the information relative to the - * STORKAuthnResponse. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $ - */ -public final class STORKAuthnResponse { - - /** Response Id. */ - private String samlId; - - /** Authentication failed? */ - private boolean fail; - - /** Status code. */ - private String statusCode; - - /** Secondary status code. */ - private String subStatusCode; - - /** Audience restriction. */ - private transient String audienceRest; - - /** Error message. */ - private String message; - - /** Id of the request that originated this response. */ - private String inResponseTo; - - /** Expiration date. */ - private DateTime notOnOrAfter; - - /** Creation date. */ - private DateTime notBefore; - - /** The SAML token. */ - private byte[] tokenSaml = new byte[0]; - - /** Country. */ - private String country; - - /** Citizen's personal attribute list. */ - private transient IPersonalAttributeList attributeList = new PersonalAttributeList(); - - /** - * Logger object. - */ - private static final Logger LOG = Logger.getLogger(STORKAuthnResponse.class.getName()); - - /** - * Getter for the subStatusCode. - * - * @return The subStatusCode value. - */ - public String getSubStatusCode() { - return subStatusCode; - } - - /** - * Setter for the subStatusCode. - * - * @param samlSubStatusCode the new subStatusCode value. - */ - public void setSubStatusCode(final String samlSubStatusCode) { - this.subStatusCode = samlSubStatusCode; - } - - /** - * Getter for audienceRest. - * - * @return The audienceRest value. - */ - public String getAudienceRestriction() { - return audienceRest; - } - - /** - * Setter for audienceRest. - * - * @param audRest the new audienceRest value. - */ - public void setAudienceRestriction(final String audRest) { - this.audienceRest = audRest; - } - - /** - * Getter for the samlToken. - * - * @return The samlToken value. - */ - public byte[] getTokenSaml() { - return tokenSaml.clone(); - } - - /** - * Setter for samlToken. - * - * @param samlToken the new tokenSaml value. - */ - public void setTokenSaml(final byte[] samlToken) { - if (samlToken != null) { - this.tokenSaml = samlToken.clone(); - } - } - - /** - * Getter for the country name. - * - * @return The country name value. - */ - public String getCountry() { - return country; - } - - /** - * Setter for the country name. - * - * @param cCountry the new country name value. - */ - public void setCountry(final String cCountry) { - this.country = cCountry; - } - - /** - * Getter for pal value. - * - * @return The pal value. - * - * @see PersonalAttributeList - */ - public IPersonalAttributeList getPersonalAttributeList() { - IPersonalAttributeList personnalAttributeList = null; - try { - personnalAttributeList = (IPersonalAttributeList) attributeList.clone(); - } catch (CloneNotSupportedException e1) { - LOG.trace("[PersonalAttribute] Nothing to do."); - } - return personnalAttributeList; - } - - /** - * Setter for the Personal Attribute List value. - * - * @param attrList the new value. - * - * @see PersonalAttributeList - */ - public void setPersonalAttributeList(final IPersonalAttributeList attrList) { - if (attrList != null) { - this.attributeList = attrList; - } - } - - /** - * Getter for the inResponseTo value. - * - * @return The inResponseTo value. - */ - public String getInResponseTo() { - return inResponseTo; - } - - /** - * Setter for the inResponseTo value. - * - * @param samlInResponseTo the new inResponseTo value. - */ - public void setInResponseTo(final String samlInResponseTo) { - this.inResponseTo = samlInResponseTo; - } - - /** - * Getter for the fail value. - * - * @return The fail value. - */ - public boolean isFail() { - return fail; - } - - /** - * Setter for the fail value. - * - * @param failVal the new fail value. - */ - public void setFail(final boolean failVal) { - this.fail = failVal; - } - - /** - * Getter for the message value. - * - * @return The message value. - */ - public String getMessage() { - return message; - } - - /** - * Setter for the message value. - * - * @param msg the new message value. - */ - public void setMessage(final String msg) { - this.message = msg; - } - - /** - * Getter for the statusCode value. - * - * @return The statusCode value. - */ - public String getStatusCode() { - return statusCode; - } - - /** - * Setter for the statusCode value. - * - * @param status the new statusCode value. - */ - public void setStatusCode(final String status) { - this.statusCode = status; - } - - /** - * Getter for the samlId value. - * - * @return The samlId value. - */ - public String getSamlId() { - return samlId; - } - - /** - * Setter for the samlId value. - * - * @param nSamlId the new samlId value. - */ - public void setSamlId(final String nSamlId) { - this.samlId = nSamlId; - } - - /** - * Getter for the notOnOrAfter value. - * - * @return The notOnOrAfter value. - * - * @see DateTime - */ - public DateTime getNotOnOrAfter() { - return this.notOnOrAfter; - } - - /** - * Setter for the notOnOrAfter value. - * - * @param nOnOrAfter the new notOnOrAfter value. - * - * @see DateTime - */ - public void setNotOnOrAfter(final DateTime nOnOrAfter) { - this.notOnOrAfter = nOnOrAfter; - } - - /** - * Getter for the notBefore value. - * - * @return The notBefore value. - * - * @see DateTime - */ - public DateTime getNotBefore() { - return notBefore; - } - - /** - * Setter for the notBefore value. - * - * @param nBefore the new notBefore value. - * - * @see DateTime - */ - public void setNotBefore(final DateTime nBefore) { - this.notBefore = nBefore; - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKStatusCode.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKStatusCode.java.svn-base deleted file mode 100644 index a9c4a156b..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKStatusCode.java.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -/** - * This enum class contains the SAML Token Status Code. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.13 $, $Date: 2010-11-17 05:15:28 $ - */ -public enum STORKStatusCode { - - /** URI for Requester status code. */ - REQUESTER_URI("urn:oasis:names:tc:SAML:2.0:status:Requester"), - - /** URI for Responder status code. */ - RESPONDER_URI("urn:oasis:names:tc:SAML:2.0:status:Responder"), - - /** URI for Success status code. */ - SUCCESS_URI("urn:oasis:names:tc:SAML:2.0:status:Success"), - - /** Attribute is Available. */ - STATUS_AVAILABLE("Available"), - - /** Attribute is NotAvailable. */ - STATUS_NOT_AVAILABLE("NotAvailable"), - - /** Attribute is Withheld. */ - STATUS_WITHHELD("Withheld"); - - /** - * Represents the constant's value. - */ - private String value; - - /** - * Solo Constructor. - * - * @param val The Constant value. - */ - private STORKStatusCode(final String val) { - - this.value = val; - } - - /** - * Return the Constant Value. - * - * @return The constant value. - */ - public String toString() { - - return value; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKSubStatusCode.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKSubStatusCode.java.svn-base deleted file mode 100644 index 0a711c9b7..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/STORKSubStatusCode.java.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons; - -/** - * This enum class contains the SAML Token Sub Status Code. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.7 $, $Date: 2010-11-17 05:15:28 $ - */ -public enum STORKSubStatusCode { - - /** URI for AuthnFailed status code. */ - AUTHN_FAILED_URI("urn:oasis:names:tc:SAML:2.0:status:AuthnFailed"), - - /** URI for InvalidAttrNameOrValue status code. */ - INVALID_ATTR_NAME_VALUE_URI( - "urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue"), - - /** URI for InvalidNameIDPolicy status code. */ - INVALID_NAMEID_POLICY_URI( - "urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy"), - - /** URI for VersionMismatch status code. */ - VERSION_MISMATCH_URI("urn:oasis:names:tc:SAML:2.0:status:VersionMismatch"), - - /** URI for RequestDenied status code. */ - REQUEST_DENIED_URI("urn:oasis:names:tc:SAML:2.0:status:RequestDenied"), - - /** URI for QaaNotSupported status code. */ - QAA_NOT_SUPPORTED( - "http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported"); - - /** - * Represents the constant's value. - */ - private String value; - - /** - * Solo Constructor. - * - * @param val The Constant value. - */ - private STORKSubStatusCode(final String val) { - - this.value = val; - } - - /** - * Return the Constant Value. - * - * @return The constant value. - */ - public String toString() { - - return value; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/package-info.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 19d45aaa2..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Common Authentication Service functionalities to be deployed in every PEPS - * is contained in this package. - * In particular, it contains the SAML Engine that implements the SAML messages - * management - * - * @since 1.0 - */ -package eu.stork.peps.auth.commons; diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeName.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeName.java new file mode 100644 index 000000000..a44768c7e --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeName.java @@ -0,0 +1,74 @@ +package eu.stork.peps.auth.commons; + +/** + * This class is a bean used to store information relative to Attribute Names. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: 1.00 $, $Date: 2013-11-26 $ + */ +public final class AttributeName { + + /** + * Attribute Id. + */ + private String attributeId; + + /** + * Attribute Name. + */ + private String attributeName; + + /** + * Attribute Name Constructor. + * + * @param aId Id of the Attribute Name. + * @param aName Name of the Attribute Name. + */ + public AttributeName(final String aId, final String aName) { + + this.attributeId = aId; + this.attributeName = aName; + } + + /** + * Getter for the attributeId value. + * + * @return The attributeId value. + */ + public String getAttributeId() { + + return attributeId; + } + + /** + * Setter for the attributeId value. + * + * @param aId Id of the Attribute Name. + */ + public void setAttributeId(final String aId) { + + this.attributeId = aId; + } + + /** + * Getter for the attributeName value. + * + * @return The attributeName value. + */ + public String getAttributeName() { + + return attributeName; + } + + /** + * Setter for the attributeName value. + * + * @param name Name of the Attribute Name. + */ + public void setAttributeName(final String name) { + + this.attributeName = name; + } + +} \ No newline at end of file diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java index 013f4caf3..fc776db81 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvider.java @@ -1,15 +1,21 @@ package eu.stork.peps.auth.commons; +import java.io.Serializable; + /** * This class is a bean used to store the information relative to the Attribute Provider. * * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) * - * @version $Revision: 1.00 $, $Date: 2013-09-17 $ + * @version $Revision: 1.01 $, $Date: 2013-11-28 $ */ -public final class AttributeProvider { - +public final class AttributeProvider implements Serializable { /** + * Unique identifier. + */ + private static final long serialVersionUID = 7210186241917444559L; + + /** * Provider Id. */ private String providerId; diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java index 8806ba866..85aec2625 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java @@ -30,7 +30,7 @@ public class AttributeProvidersMap extends LinkedHashMap Attribute Provider: ID [" + source.getProvider().getProviderId() + "], name [" + source.getProvider().getProviderName() + "]"); - else + } + else { LOG.trace("-> Country: ID [" + source.getCountry().getCountryId() + "], name [" + source.getCountry().getCountryName() + "]"); + } pal = this.get(source); LOG.trace("++++++++=>"); @@ -83,7 +85,7 @@ public class AttributeProvidersMap extends LinkedHashMap Citizen Attribute: name [" + pa.getName() + "], name [" + pa.isRequired() + "]"); + LOG.trace("-> Citizen Attribute: name [" + pa.getName() + "], required [" + pa.isRequired() + "]"); } LOG.trace("<=++++++++"); diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java index 4b9dc33e9..846f54f67 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java @@ -1,16 +1,30 @@ package eu.stork.peps.auth.commons; +import java.io.Serializable; + +import org.apache.log4j.Logger; + /** * This class is a bean used to store the information relative to the Attribute Source (either AttributeProvider or Country). * * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) * - * @version $Revision: 1.00 $, $Date: 2013-09-19 $ + * @version $Revision: 1.10 $, $Date: 2013-11-29 $ */ -public final class AttributeSource { +public final class AttributeSource implements Serializable { + /** + * Unique identifier. + */ + private static final long serialVersionUID = 432243595968469014L; + public static final int SOURCE_LOCAL_APROVIDER = 1; public static final int SOURCE_REMOTE_COUNTRY = 2; + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(AttributeSource.class.getName()); + /** * Provider source. */ @@ -60,7 +74,7 @@ public final class AttributeSource { /** * @param sourceType the sourceType to set */ - public void setSourceType(int sourceType) { + public void setSourceType(final int sourceType) { this.sourceType = sourceType; } @@ -74,7 +88,7 @@ public final class AttributeSource { /** * @param providerURL the providerURL to set */ - public void setProviderURL(String providerURL) { + public void setProviderURL(final String providerURL) { this.providerURL = providerURL; } @@ -88,7 +102,7 @@ public final class AttributeSource { /** * @param provider the provider to set */ - public void setProvider(AttributeProvider provider) { + public void setProvider(final AttributeProvider provider) { this.setSourceType(SOURCE_LOCAL_APROVIDER); this.provider = provider; @@ -104,7 +118,7 @@ public final class AttributeSource { /** * @param country the country to set */ - public void setCountry(Country country) { + public void setCountry(final Country country) { this.setSourceType(SOURCE_REMOTE_COUNTRY); this.country = country; @@ -116,4 +130,59 @@ public final class AttributeSource { public Country getCountry() { return country; } + + /** + * {@inheritDoc} + */ + public boolean equals(Object obj) { + boolean outcome = false; + + LOG.debug("Calling equals with Object."); + if ( obj instanceof AttributeSource ) { + LOG.debug("Calling equals with AttributeSource."); + outcome = this.equals((AttributeSource)obj); + } + + LOG.debug("Object equals outcome: " + outcome); + return outcome; + } + + /** + * Compare the given AttributeSource with the current object in order to determinine + * if they are equal. + * + * @param obj The AttributeSource to compare to + * + * @return true if the two objects are equal + */ + public boolean equals(AttributeSource obj) { + boolean outcome = false; + + if ( this.sourceType==obj.getSourceType() ) { + if ( this.sourceType==AttributeSource.SOURCE_LOCAL_APROVIDER ) { + if ( this.provider.getProviderId().equals(obj.getProvider().getProviderId()) ) + outcome = true; + } + else if ( this.sourceType==AttributeSource.SOURCE_REMOTE_COUNTRY ) { + if ( this.country.getCountryId().equals(obj.getCountry().getCountryId()) ) + outcome = true; + } + } + + LOG.debug("AttributeSource equals outcome: " + outcome); + return outcome; + } + + /** + * {@inheritDoc} + */ + public int hashCode() { + int hash = 1; + hash = hash * 17 + this.sourceType; + if ( this.sourceType==AttributeSource.SOURCE_LOCAL_APROVIDER ) + hash = hash * 31 + this.provider.getProviderName().hashCode(); + else + hash = hash * 31 + this.country.getCountryName().hashCode(); + return hash; + } } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java index 84e3576e5..af7ab6cf3 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java @@ -187,7 +187,7 @@ public final class AttributeUtil { public static boolean hasValidTuples(final String[] tuples) { boolean retVal = false; - int numberTuples = AttributeConstants.NUMBER_TUPLES.intValue(); + final int numberTuples = AttributeConstants.NUMBER_TUPLES.intValue(); if (tuples != null && tuples.length == numberTuples) { // validate attrName final int attrNameIndex = AttributeConstants.ATTR_NAME_INDEX.intValue(); diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java index 2245178f4..9ebcfbd5a 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/CitizenConsent.java @@ -108,14 +108,14 @@ public final class CitizenConsent { * @return {@inheritDoc} */ public String toString() { - final StringBuilder strbldr = new StringBuilder(); + final StringBuilder strbldr = new StringBuilder(46); strbldr.append("Mandatory attributes: "); - for (String str : mandatoryList) { - strbldr.append(str + ";"); + for (final String str : mandatoryList) { + strbldr.append(str).append(';'); } strbldr.append(" Optional attributes: "); - for (String str : optionalList) { - strbldr.append(str + ";"); + for (final String str : optionalList) { + strbldr.append(str).append(';'); } return strbldr.toString(); } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeListProcessor.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeListProcessor.java new file mode 100644 index 000000000..b13c70f04 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeListProcessor.java @@ -0,0 +1,148 @@ +package eu.stork.peps.auth.commons; + +import java.util.List; +import java.util.Map; + +/** + * Interface for {@link AttributeListProcessor}. + * + * @author ricardo.ferreira@multicert.com + * + * @version $Revision: $, $Date: $ + * + * @see IPersonalAttributeList + */ +public interface IAttributeListProcessor { + + /** + * Checks if attribute list only contains allowed attributes. + * + * @param attrList the requested attribute list + * @param attributes the allowed attributes + * + * @return true is all the attributes are allowed. + * + * @see IPersonalAttributeList + */ + boolean hasAllowedAttributes(final IPersonalAttributeList attrList, final List attributes); + + /** + * Lookup for business attribute. + * + * @param attrList the requested attribute list + * @param normalAttributes the normal attributes + * + * @return true is at least one business attribute was requested. + * + * @see IPersonalAttributeList + */ + boolean hasBusinessAttributes(final IPersonalAttributeList attrList, final List normalAttributes); + + /** + * Lookup for business attribute in normal attribute list (loaded by + * implementation). + * + * @param attrList the requested attribute list + * + * @return true is at least one business attribute was requested. + * + * @see IPersonalAttributeList + */ + boolean hasBusinessAttributes(final IPersonalAttributeList attrList); + + /** + * Adds eIdentifier, name, surname, and DateOfBirth attributes to get business + * attributes from some AP. + * + * @param attrList the requested attribute list + * @param attributes the list of attributes to add (eIdentifier, name, + * surname, and DateOfBirth). + * + * @return the requested attribute list and the new attributes added + * (eIdentifier, name, surname, and DateOfBirth). + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList addAPMandatoryAttributes(final IPersonalAttributeList attrList, final List attributes); + + /** + * Adds eIdentifier, name, surname, and DateOfBirth attributes, loaded by + * implementation, to get business attributes from some AP. + * + * @param attrList the requested attribute list + * + * @return the requested attribute list and the new attributes added + * (eIdentifier, name, surname, and DateOfBirth). + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList addAPMandatoryAttributes(final IPersonalAttributeList attrList); + + /** + * Removes from attribute list the given list of attributes. + * + * @param attrList the requested attribute list + * @param attributes the list of attributes to remove. + * + * @return the requested attribute list and the attributes removed. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList removeAPMandatoryAttributes(final IPersonalAttributeList attrList, final List attributes); + + /** + * Removes from attribute list the given list of attributes and change + * attributes status if attribute was optional in the request. + * + * @param attrList the requested attribute list + * @param attributes the map of attributes (attribute name, mandatory/optional) to remove. + * + * @return the requested attribute list and the attributes removed + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList removeAPMandatoryAttributes(IPersonalAttributeList attrList, Map attributes); + + /** + * Checks if mandate attribute exist in the requested Attribute List. Power + * attribute name to lookup is loaded by implementation. + * + * @param attrList the requested attribute list. + * + * @return true if mandate attribute exists or false otherwise. + * + * @see IPersonalAttributeList + */ + boolean hasPowerAttribute(final IPersonalAttributeList attrList); + + /** + * Checks if attribute name was requested and has value. + * + * @param attrList the requested attribute list. + * @param attrName the attribute name to lookup for . + * + * @return true if attribute was requested and has value or false otherwise. + * + * @see IPersonalAttributeList + */ + boolean hasAttributeValue(final IPersonalAttributeList attrList, final String attrName); + + /** + * Checks if attribute has value. + * + * @param attr the attribute to check. + * + * @return true if has value; + * + * @see PersonalAttribute + */ + boolean hasAttributeValue(final PersonalAttribute attr); + + /** + * Gets a map (attribute name, attribute isRequired) of attributes added to attribute list. + * + * @return the Map of attributes added and if is required to attribute list. + */ + Map getNormalAttributesAdded(); + +} \ No newline at end of file diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java index 83b8e57fe..b24c915c0 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java @@ -15,6 +15,7 @@ package eu.stork.peps.auth.commons; import java.util.Collection; import java.util.Iterator; +import java.util.Set; /** * Interface for {@link PersonalAttributeList}. @@ -123,12 +124,65 @@ public interface IPersonalAttributeList extends Iterable, */ Collection values(); + /** + * Returns a {@link Set} view of the keys contained in this map. + * The set is backed by the map, so changes to the map are + * reflected in the set, and vice-versa. If the map is modified + * while an iteration over the set is in progress (except through + * the iterator's own remove operation), the results of + * the iteration are undefined. The set supports element removal, + * which removes the corresponding mapping from the map, via the + * Iterator.remove, Set.remove, + * removeAll, retainAll, and clear + * operations. It does not support the add or addAll + * operations. + * + * @return a set view of the keys contained in this map + */ + Set keySet(); + + + /** + * Returns a IPersonalAttributeList of the complex attributes. + * + * @return an IPersonalAttributeList of the complex attributes. + */ + IPersonalAttributeList getComplexAttributes(); + + /** + * Returns a IPersonalAttributeList of the simple value attributes. + * + * @return an IPersonalAttributeList of the simple value attributes. + */ + IPersonalAttributeList getSimpleValueAttributes(); + + /** + * Returns a IPersonalAttributeList of the mandatory attributes in this map. + * + * @return an IPersonalAttributeList of the mandatory attributes contained in this map. + */ + IPersonalAttributeList getMandatoryAttributes(); + + /** + * Returns a IPersonalAttributeList of the optional attributes in this map. + * + * @return an IPersonalAttributeList of the optional attributes contained in this map. + */ + IPersonalAttributeList getOptionalAttributes(); + /** * Returns true if this map contains no key-value mappings. * * @return true if this map contains no key-value mappings. */ boolean isEmpty(); + + /** + * Returns true if this map contains at least one element that doesn't have value. + * + * @return true if this map contains at least one element that doesn't have value. + */ + boolean hasMissingValues(); /** * Returns a copy of this IPersonalAttributeList instance. diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java index 43d3adaa9..6e7c891da 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java @@ -1,6 +1,12 @@ package eu.stork.peps.auth.commons; +import java.io.Serializable; +import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; + +import org.apache.log4j.Logger; /** * This class is a bean used to store the information of Attribute Providers, the Attribute @@ -11,14 +17,29 @@ import java.util.Iterator; * * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) * - * @version $Revision: 1.20 $, $Date: 2013-10-28 $ + * @version $Revision: 1.50 $, $Date: 2013-11-28 $ */ -public final class Linker { +public final class Linker implements Serializable { + /** + * Unique identifier. + */ + private static final long serialVersionUID = -3268006381745987237L; + + /** + * Logger object. + */ + private static final Logger LOG = Logger.getLogger(Linker.class.getName()); + /** * Attributes Providers map. */ private IAttributeProvidersMap attributeProvidersMap; + /** + * Assertion map. + */ + private LinkedHashMap assertions; + /** * The current index of local (domestic) Attribute Providers. */ @@ -35,6 +56,8 @@ public final class Linker { public Linker() { localIndex = 0; remoteIndex = 0; + + assertions = new LinkedHashMap(); } /** @@ -120,9 +143,11 @@ public final class Linker { else localIndex++; - //TODO How to store Assertions (format: byte, base64 string, entire object?) + //Assertion storage + this.assertions.put(source, attrResponse); this.attributeProvidersMap.put(source, attrResponse.getPersonalAttributeList()); + //this.attributeProvidersMap.put(source, attrResponse.getTotalPersonalAttributeList()); } /** @@ -160,6 +185,8 @@ public final class Linker { /** * Returns the Personal Attribute list of the provided Attribute Source. * + * @param source The attributeSource in reference + * * @return The IPersonalAttributeList assosiated with this source or null if empty * * @see IPersonalAttributeList @@ -170,4 +197,120 @@ public final class Linker { else return null; } -} + + /** + * Returns the merged Personal Attribute list from all the Attribute Sources. + * + * @return The IPersonalAttributeList merged Personal Attribute list or null if empty + * + * @see IPersonalAttributeList + */ + public IPersonalAttributeList getAllAttributes() { + Iterator iterator; + AttributeSource source; + IPersonalAttributeList list, merged; + + merged = null; + + if ( attributeProvidersMap !=null && !attributeProvidersMap.isEmpty() ) { + iterator = attributeProvidersMap.keyIterator(); + + merged = new PersonalAttributeList(); + while (iterator.hasNext()) { + source = iterator.next(); + list = this.getProviderAttributes(source); + + for (final PersonalAttribute pa : list) { + merged.add(pa); + } + } + } + + return merged; + } + + /** + * Returns a List with all the assertions gathered by the AAS-PEPS module + * returned both by local APs or remote A-PEPS. + * + * @return The assertions returned from the APs and A-PEPS + */ + public List getAttrQueryResponseList() { + List originalAssertions; + + originalAssertions = new ArrayList(); + + //Gather all assertions + for (STORKAttrQueryResponse element : this.assertions.values()) { + originalAssertions.add(element); + } + + return originalAssertions; + } + + /** + * Checks the internal state of the Linker and if all Attribute Sources where visited + * returns true, otherwise it returns false. So if you go directly from AtPLinkerAction + * to MoreAttributesAction the call will have, since the method setProviderReponse + * was not executed from every Attribute Source. + * + * @return true if everything is OK, false otherwise + */ + public boolean isComplete() { + boolean outcome = false; + + LOG.debug("Check if linkder is complete: R[" + remoteIndex + "], L[" + localIndex + "], S[" + attributeProvidersMap.size() + "]"); + if ( attributeProvidersMap !=null && !attributeProvidersMap.isEmpty() ) { + if ( (remoteIndex + localIndex)==attributeProvidersMap.size() ) + outcome = true; + } + else { + outcome = true; + } + + return outcome; + } + + /** + * Merge the two Linker objects. + * + * @param previous The other Linker object to merge with this one. + */ + public void mergeWith(Linker previous) { + //BEFORE + if ( LOG.isDebugEnabled() ) { + LOG.debug("The attributeProvidersMap from the current object."); + ((AttributeProvidersMap)this.attributeProvidersMap).trace(); + LOG.debug("The attributeProvidersMap from the provided object."); + ((AttributeProvidersMap)previous.getAttributeProvidersMap()).trace(); + } + + IAttributeProvidersMap map = previous.getAttributeProvidersMap(); + Iterator items = map.keyIterator(); + while( items.hasNext() ) { + AttributeSource item = items.next(); + IPersonalAttributeList pal = map.get(item); + + if ( this.attributeProvidersMap.containsKey(item) ) { + IPersonalAttributeList new_pal = this.attributeProvidersMap.get(item); + + for(PersonalAttribute pa : pal) + new_pal.add(pa); + } + else { + if ( item.getSourceType()==AttributeSource.SOURCE_REMOTE_COUNTRY ) + remoteIndex++; + else + localIndex++; + + this.attributeProvidersMap.put(item, pal); + } + } + + //AFTER + if ( LOG.isDebugEnabled() ) { + LOG.debug("The attributeProvidersMap after the merge."); + ((AttributeProvidersMap)this.attributeProvidersMap).trace(); + } + } +} \ No newline at end of file diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java index 3aa549a06..5da9ba494 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java @@ -114,6 +114,11 @@ public enum PEPSErrors { * Represents the 'sProviderAction.spRedirect' constant error identifier. */ SPROVIDER_SELECTOR_INVALID_SPREDIRECT("sProviderAction.invalidSPRedirect"), + /** + * Represents the 'sPPowerValidationAction.invalidSPPVAttrList' constant error identifier. + */ + SPPOWERVALIDATION_SELECTOR_INVALID_SP_PV_ATTR_LIST("sPPowerValidationAction.invalidSPPVAttrList"), + /** * Represents the 'sProviderAction.invalidSPProviderName' constant error * identifier. @@ -163,6 +168,11 @@ public enum PEPSErrors { */ COLLEAGUE_REQ_INVALID_SAML("colleagueRequest.invalidSAML"), + /** + * Represents the 'colleaguePVRequest.invalidPVAttrList' constant error identifier. + */ + COLLEAGUE_PV_REQ_INVALID_PV_ATTR_LIST("colleaguePVRequest.invalidPVAttrList"), + /** * Represents the 'cpepsRedirectUrl' constant error identifier. @@ -278,10 +288,44 @@ public enum PEPSErrors { * Represents the 'missing.sessionId' constant error identifier. */ MISSING_SESSION_ID("sessionError"), + /** + * Represents the 'missing.mandate' constant error identifier. + */ + MISSING_MANDATE("missing.mandate"), + /** + * Represents the 'AtPSAMLResponse' constant error identifier. + */ + ATP_SAML_RESPONSE("AtPSAMLResponse"), + /** * Represents the 'AtPSAMLResponse' constant error identifier. */ - ATP_SAML_RESPONSE("AtPSAMLResponse"); + ATP_RESPONSE_ERROR("atp.response.error"), + + /** + * Represents the 'apepsSAMLRequest' constant error identifier. + */ + APEPS_SAML_REQUEST("apepsSAMLRequest"), + + /** + * Represents the 'apepsSAMLResponse' constant error identifier. + */ + APEPS_SAML_RESPONSE("apepsSAMLResponse"), + + /** + * Represents the 'invalid.apepsRedirectUrl' constant error identifier. + */ + INVALID_APEPS_REDIRECT_URL("invalid.apepsRedirectUrl"), + + /** + * Represents the 'invalid.apepsCallbackUrl' constant error identifier. + */ + INVALID_APEPS_CALLBACK_URL("invalid.apepsCallbackUrl"), + + /** + * Represents the 'colleagueAttributeRequest.invalidSAML' constant error identifier. + */ + COLLEAGUE_ATTR_REQ_INVALID_SAML("colleagueAttributeRequest.invalidSAML"); /** * Represents the constant's value. diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java index 37b204351..146e4c39d 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java @@ -75,6 +75,10 @@ public enum PEPSParameters { * Represents the 'attrList' parameter constant. */ ATTRIBUTE_LIST("attrList"), + /** + * Represents the 'apMandAttrList' parameter constant. + */ + AP_MANDATORY_ATTRIBUTE_LIST("apMandAttrList"), /** * Represents the 'attrTuple' parameter constant. */ @@ -173,6 +177,10 @@ public enum PEPSParameters { * Represents the 'external-ap' parameter constant. */ EXTERNAL_AP("external-ap"), + /** + * Represents the 'external-pv' parameter constant. + */ + EXTERNAL_PV("external-pv"), /** * Represents the 'external-sig-module' parameter constant. */ @@ -199,6 +207,10 @@ public enum PEPSParameters { * Represents the 'internal-ap' parameter constant. */ INTERNAL_AP("internal-ap"), + /** + * Represents the 'internal-pv' parameter constant. + */ + INTERNAL_PV("internal-pv"), /** * Represents the 'samlIssuer' parameter constant. @@ -225,6 +237,15 @@ public enum PEPSParameters { * Represents the 'mandatoryConsentAttrMissing' parameter constant. */ MANDATORY_CONSENT_MISSING("mandatoryConsentAttrMissing"), + /** + * Represents the 'missing-attrs' parameter constant. + */ + MISSING_ATTRS("missing-attrs"), + /** + * Represents the 'no-more-attrs' parameter constant. + */ + NO_MORE_ATTRS("no-more-attrs"), + /** * Represents the 'optional' parameter constant. */ @@ -267,6 +288,10 @@ public enum PEPSParameters { * Represents the 'cpeps.specificapredirect.url' parameter constant. */ PEPS_SPECIFIC_URL("cpeps.specificapredirect.url"), + /** + * Represents the 'pv.url' parameter constant. + */ + PV_URL("pv.url"), /** * Represents the 'qaaLevel' parameter constant. @@ -441,11 +466,21 @@ public enum PEPSParameters { */ ATTRIBUTE_PROVIDER_NUMBER("atp.number"), + /** + * Represents the 'atn.number' parameter constant. + */ + ATTRIBUTE_NAME_NUMBER("atn.number"), + /** * Represents the 'apLinker' parameter constant. */ AP_LINKER("apLinker"), + /** + * Represents the 'prevApLinker' parameter constant. + */ + PREV_AP_LINKER("prevApLinker"), + /** * Represents the 'NOSEL' parameter constant (no attribute provider selected). */ @@ -466,6 +501,11 @@ public enum PEPSParameters { */ AP_COUNTRY_SELECT_SUFFIX("_country"), + /** + * Represents the '_name' suffix parameter constant. + */ + AP_NAME_SELECT_SUFFIX("_name"), + /** * Represents the 'next-ap' parameter constant. */ @@ -476,6 +516,21 @@ public enum PEPSParameters { */ NEXT_APEPS("next-apeps"), + /** + * Represents the 'back-to-apeps' parameter constant. + */ + BACK_TO_APEPS("back-to-apeps"), + + /** + * Represents the 'is-remote-apeps' parameter constant. + */ + IS_REMOTE_APEPS("is-remote-apeps"), + + /** + * Represents the 'more-attributes' parameter constant. + */ + MORE_ATTRIBUTES("more-attributes"), + /** * Represents the 'attr-filter.number' parameter constant. */ @@ -484,7 +539,60 @@ public enum PEPSParameters { /** * Represents the 'atp.url' parameter constant. */ - ATP_URL("atp.url"); + ATP_URL("atp.url"), + /** + * Represents the 'apepsURL' parameter constant. + */ + APEPS_URL("apepsUrl"), + + /** + * Represents the 'apepsCountry' parameter constant. + */ + APEPS_COUNTRY("apepsCountry"), + + /** + * Represents the 'apepsAuthRequest' parameter constant. + */ + APEPS_ATTR_REQUEST("apepsAttrRequest"), + + /** + * Represents the 'isApepsRequest' parameter constant. + */ + APEPS_REQUEST_COMPLETE("apeps-request-complete"), + + /** + * Represents the 'apeps.callbackUrl' parameter constant. + */ + APEPS_CALLBACK_URL("apeps.callbackUrl"), + /** + * Represents the 'attrListMand' parameter constant. + */ + ATTR_LIST_MAND("attrListMand"), + + /** + * Represents the 'attrListOpt' parameter constant. + */ + ATTR_LIST_OPT("attrListOpt"), + + /** + * Represents the 'simpleAttrListMand' parameter constant. + */ + SIMPLE_ATTR_LIST_MAND("simpleAttrListMand"), + + /** + * Represents the 'simpleAttrListOpt' parameter constant. + */ + SIMPLE_ATTR_LIST_OPT("simpleAttrListOpt"), + + /** + * Represents the 'complexAttrListMand' parameter constant. + */ + COMPLEX_ATTR_LIST_MAND("complexAttrListMand"), + + /** + * Represents the 'complexAttrListOpt' parameter constant. + */ + COMPLEX_ATTR_LIST_OPT("complexAttrListOpt"); /** * Represents the constant's value. diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java index ae1f203f5..a16b03edb 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSUtil.java @@ -140,7 +140,7 @@ public final class PEPSUtil { if (StringUtils.isNumeric(paramSizeStr)) { final int maxParamSize = Integer.valueOf(paramSizeStr); if (StringUtils.isEmpty(paramValue) - || (paramValue.length() > maxParamSize)) { + || paramValue.length() > maxParamSize) { retVal = false; LOG.warn("Invalid parameter [" + paramName + "] value " + paramValue); } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java index 568c25053..e14c21cb5 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java @@ -237,6 +237,10 @@ public enum PEPSValues { * Represents the 'atp' constant value. */ APROVIDER_PREFIX("atp"), + /** + * Represents the 'atn' constant value. + */ + ANAME_PREFIX("atn"), /** * Represents the 'ap-cpeps' constant value. */ diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java index bb9b3b694..5d8281445 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.apache.log4j.Logger; @@ -55,10 +56,15 @@ public final class PersonalAttribute implements Serializable, Cloneable { */ private List value = new ArrayList(); + /** + * Type of the personal attribute. + */ + private String type; + /** * Complex values of the personal attribute. */ - private Map complexValue = new HashMap(); + private Map complexValue = new ConcurrentHashMap(); /** * Is the personal attribute mandatory? @@ -202,6 +208,25 @@ public final class PersonalAttribute implements Serializable, Cloneable { } } + + /** + * Getter for the type value. + * + * @return The name value. + */ + public String getType() { + return type; + } + + /** + * Setter for the type value. + * + * @param attrName The personal attribute type. + */ + public void setType(final String attrType) { + this.type = attrType; + } + /** * Getter for the status. * diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java index d33ccfe18..642b249d4 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java @@ -18,7 +18,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; import java.util.StringTokenizer; import org.apache.commons.lang.StringUtils; @@ -37,7 +37,7 @@ import org.apache.log4j.Logger; */ @SuppressWarnings("PMD") public final class PersonalAttributeList extends - HashMap implements IPersonalAttributeList{ + ConcurrentHashMap implements IPersonalAttributeList{ /** * Logger object. @@ -118,8 +118,9 @@ public final class PersonalAttributeList extends if (StringUtils.isNotEmpty(key) && val != null) { // Validate if attribute name already exists! String attrAlias = key; - if (this.containsKey(key)) { - if (!val.isEmptyValue() && StringUtils.isNumeric(val.getValue().get(0))) { + if (this.containsKey(attrAlias)) { + //TODO isAgeOver should not be hardcoded, a better way of handling multipe isAgeOver requests should be implemented. + if (!val.isEmptyValue() && StringUtils.isNumeric(val.getValue().get(0)) && "isAgeOver".equals( val.getName() ) ) { final String attrValue = val.getValue().get(0); attrAlias = key + attrValue; this.attrAliasNumber.put(key, Integer.valueOf(attrValue)); @@ -169,27 +170,9 @@ public final class PersonalAttributeList extends .valueOf(tuples[AttributeConstants.ATTR_TYPE_INDEX.intValue()])); // check if it is a complex value - if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] - .equals(PEPSParameters.COMPLEX_ADDRESS_VALUE.toString())) - { + if (isComplexValue(vals)) { persAttr.setComplexValue(createComplexValue(vals)); } - else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] - .equals(PEPSParameters.COMPLEX_NEWATTRIBUTE_VALUE.toString())) - { - persAttr.setComplexValue(createComplexValue(vals)); - } - - else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] - .equals(PEPSParameters.COMPLEX_HASDEGREE_VALUE.toString())) - { - persAttr.setComplexValue(createComplexValue(vals)); - } - else if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] - .equals(PEPSParameters.COMPLEX_MANDATECONTENT_VALUE.toString())) - { - persAttr.setComplexValue(createComplexValue(vals)); - } else { persAttr.setValue(createValues(vals)); @@ -215,7 +198,11 @@ public final class PersonalAttributeList extends * @return The copy of this IPersonalAttributeList. */ public Object clone() { - return (PersonalAttributeList) super.clone(); + try { + return (PersonalAttributeList) super.clone(); + } catch (CloneNotSupportedException e) { + return null; + } } /** @@ -234,7 +221,8 @@ public final class PersonalAttributeList extends while (itAttrs.hasNext()) { final Entry attrEntry = itAttrs.next(); final PersonalAttribute attr = attrEntry.getValue(); - strBuilder.append(attr.toString()); + //strBuilder.append(attr.toString()); + strBuilder.insert(0, attr.toString()); } return strBuilder.toString(); @@ -260,6 +248,22 @@ public final class PersonalAttributeList extends return complexValue; } + /** + * Checks if value is complex or not + * @param values The values to check + * @return True if succesful + */ + private boolean isComplexValue(final String[] values) { + boolean isComplex = false; + if (values.length > 0) { + final String[] tVal = values[0].split("="); + if (StringUtils.isNotEmpty(values[0]) && tVal.length == 2) { + isComplex = true; + } + } + return isComplex; + } + /** * Validates and creates the attribute values. * @@ -302,4 +306,91 @@ public final class PersonalAttributeList extends } return newFormatTuples; } -} + + /** + * Returns a IPersonalAttributeList of the complex attributes in this map. + * + * @return an IPersonalAttributeList of the complex attributes contained in this map. + */ + public IPersonalAttributeList getComplexAttributes() { + LOG.info("get complex attributes"); + IPersonalAttributeList attrList = new PersonalAttributeList(); + for(PersonalAttribute attr: this) { + if(!attr.getComplexValue().isEmpty()) { + attrList.put(attr.getName(), attr); + LOG.info("adding complex attribute:"+attr.getName()); + } + } + return attrList; + } + + /** + * Returns a IPersonalAttributeList of the mandatory attributes in this map. + * + * @return an IPersonalAttributeList of the mandatory attributes contained in this map. + */ + public IPersonalAttributeList getSimpleValueAttributes() { + LOG.info("get simple attributes"); + IPersonalAttributeList attrList = new PersonalAttributeList(); + for(PersonalAttribute attr: this) { + if(attr.getComplexValue().isEmpty()) { + attrList.put(attr.getName(), attr); + LOG.info("adding simple attribute:"+attr.getName()); + } + } + return attrList; + } + + + + /** + * Returns a IPersonalAttributeList of the mandatory attributes in this map. + * + * @return an IPersonalAttributeList of the mandatory attributes contained in this map. + */ + public IPersonalAttributeList getMandatoryAttributes() { + return getAttributesByParam(true); + } + + + /** + * Returns a IPersonalAttributeList of the attributes in this map by parameter value. + * + * @param compareValue The boolean to get mandatory (true) or optional (false) attributes. + * + * @return an IPersonalAttributeList of the mandatory attributes contained in this map if compareValue is true or optional otherwise. + */ + private IPersonalAttributeList getAttributesByParam(final boolean compareValue) { + LOG.info("get attributes by param :"+compareValue); + IPersonalAttributeList attrList = new PersonalAttributeList(); + for(PersonalAttribute attr: this) { + if(attr.isRequired() == compareValue) { + attrList.put(attr.getName(), attr); + LOG.info("adding attribute:"+attr.getName()); + } + } + return attrList; + } + + + /** + * Returns a IPersonalAttributeList of the optional attributes in this map. + * + * @return an IPersonalAttributeList of the optional attributes contained in this map. + */ + public IPersonalAttributeList getOptionalAttributes() { + return getAttributesByParam(false); + } + + /** + * {@inheritDoc} + */ + public boolean hasMissingValues() { + for(PersonalAttribute attr: this) { + if(attr.isEmptyValue() && attr.isEmptyComplexValue()) { + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java index 33160f2ac..65936f1a8 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java @@ -17,9 +17,12 @@ public class STORKAttrQueryRequest implements Serializable, Cloneable { /** The samlId. */ private String samlId; - + /** The destination. */ private String destination; + + /** The assertion consumer service url. */ + private String serviceURL; /** The distinguished name. */ private String distinguishedName; @@ -215,6 +218,24 @@ public class STORKAttrQueryRequest implements Serializable, Cloneable { this.qaa = qaaLevel; } + /** + * Getter for the serviceURL value. + * + * @return The serviceURL value. + */ + public String getAssertionConsumerServiceURL() { + return serviceURL; + } + + /** + * Setter for the serviceURL value. + * + * @param newServiceURL the assertion consumer service URL. + */ + public void setAssertionConsumerServiceURL(final String newServiceURL) { + this.serviceURL = newServiceURL; + } + /** * Getter for the destination value. * diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java index 215b978dc..4e40d6d01 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java @@ -13,8 +13,11 @@ */ package eu.stork.peps.auth.commons; +import java.util.List; + import org.apache.log4j.Logger; import org.joda.time.DateTime; +import org.opensaml.saml2.core.Assertion; public class STORKAttrQueryResponse { @@ -51,6 +54,18 @@ public class STORKAttrQueryResponse { /** Country. */ private String country; + /** The complete assertion **/ + private Assertion assertion; + + /** List of all assertions in response **/ + private List assertions; + + /** The complete list from all assertions **/ + private transient IPersonalAttributeList totalAttributeList = new PersonalAttributeList(); + + /** All personal attribute lists **/ + private List attributeLists; + /** Citizen's personal attribute list. */ private transient IPersonalAttributeList attributeList = new PersonalAttributeList(); @@ -297,5 +312,77 @@ public class STORKAttrQueryResponse { this.notBefore = nBefore; } + /** Get the assertion from the response **/ + public Assertion getAssertion() { + return assertion; + } + + /** Set the assertion in the response **/ + public void setAssertion(final Assertion nAssertion) { + this.assertion = nAssertion; + } + + public void setAssertions(List newAssert) { + this.assertions = newAssert; + } + + public List getAssertions() { + return assertions; + } + + /** + * Getter for the toal pal value. + * + * @return The total pal value. + * + * @see PersonalAttributeList + */ + public IPersonalAttributeList getTotalPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) totalAttributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the total Personal Attribute List value. + * + * @param attrList the new value. + * + * @see PersonalAttributeList + */ + public void setTotalPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.totalAttributeList = attrList; + } + } + + /** + * Getter for personal attribute lists + * + * @return The lists + * + * @see PersonalAttributeList + */ + public List getPersonalAttributeLists() { + return attributeLists; + } + + /** + * Setter for the Personal Attribute List value. + * + * @param attrList the new value. + * + * @see PersonalAttributeList + */ + public void setPersonalAttributeLists(final List attrLists) { + if (attrLists != null) { + this.attributeLists = attrLists; + } + } + } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java index aa98974f6..84fadd023 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java @@ -13,8 +13,11 @@ */ package eu.stork.peps.auth.commons; +import java.util.List; + import org.apache.log4j.Logger; import org.joda.time.DateTime; +import org.opensaml.saml2.core.Assertion; /** * This class is a bean used to store the information relative to the @@ -62,7 +65,16 @@ public final class STORKAuthnResponse { /** Citizen's personal attribute list. */ private transient IPersonalAttributeList attributeList = new PersonalAttributeList(); - + + /** List of all assertions in response **/ + private List assertions; + + /** The complete list from all assertions **/ + private transient IPersonalAttributeList totalAttributeList = new PersonalAttributeList(); + + /** All personal attribute lists **/ + private List attributeLists; + /** * Logger object. */ @@ -306,4 +318,66 @@ public final class STORKAuthnResponse { this.notBefore = nBefore; } + public void setAssertions(List newAssert) { + this.assertions = newAssert; + } + + public List getAssertions() { + return assertions; + } + + /** + * Getter for the toal pal value. + * + * @return The total pal value. + * + * @see PersonalAttributeList + */ + public IPersonalAttributeList getTotalPersonalAttributeList() { + IPersonalAttributeList personnalAttributeList = null; + try { + personnalAttributeList = (IPersonalAttributeList) totalAttributeList.clone(); + } catch (CloneNotSupportedException e1) { + LOG.trace("[PersonalAttribute] Nothing to do."); + } + return personnalAttributeList; + } + + /** + * Setter for the total Personal Attribute List value. + * + * @param attrList the new value. + * + * @see PersonalAttributeList + */ + public void setTotalPersonalAttributeList(final IPersonalAttributeList attrList) { + if (attrList != null) { + this.totalAttributeList = attrList; + } + } + + /** + * Getter for personal attribute lists + * + * @return The lists + * + * @see PersonalAttributeList + */ + public List getPersonalAttributeLists() { + return attributeLists; + } + + /** + * Setter for the Personal Attribute List value. + * + * @param attrList the new value. + * + * @see PersonalAttributeList + */ + public void setPersonalAttributeLists(final List attrLists) { + if (attrLists != null) { + this.attributeLists = attrLists; + } + } + } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutRequest.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutRequest.java new file mode 100644 index 000000000..44811aee2 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutRequest.java @@ -0,0 +1,197 @@ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; + +public class STORKLogoutRequest implements Serializable, Cloneable { + private static final long serialVersionUID = 4778480781609392750L; + + /** The samlId. */ + private String samlId; + + /** The destination. */ + private String destination; + + /** The distinguished name. */ + private String distinguishedName; + + /** The qaa. */ + private int qaa; + + /** The token saml. */ + private byte[] tokenSaml = new byte[0]; + + /** The issuer. */ + private String issuer; + + /** The country. */ + private String country; + + /** The Alias used at the keystore for saving this certificate. */ + private String alias; + + /** The ID of principal as known to SP **/ + private String spProvidedId; + + /** + * Gets the SP's Certificate Alias. + * + * @return alias The SP's Certificate Alias. + */ + public String getAlias() { + return alias; + } + + /** + * Sets the SP's Certificate Alias. + * + * @param nAlias The SP's Certificate Alias. + */ + public void setAlias(final String nAlias) { + this.alias = nAlias; + } + + /** + * Gets the issuer. + * + * @return The issuer value. + */ + public String getIssuer() { + return issuer; + } + + /** + * Sets the issuer. + * + * @param samlIssuer the new issuer value. + */ + public void setIssuer(final String samlIssuer) { + this.issuer = samlIssuer; + } + + /** + * Gets the SAML Token. + * + * @return The SAML Token value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Sets the SAML Token. + * + * @param samlToken The new SAML Token value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Gets the country. + * + * @return The country value. + */ + public String getCountry() { + return country; + } + + /** + * Sets the country. + * + * @param nCountry the new country value. + */ + public void setCountry(final String nCountry) { + this.country = nCountry; + } + + /** + * Getter for the qaa value. + * + * @return The qaa value value. + */ + public int getQaa() { + return qaa; + } + + /** + * Setter for the qaa value. + * + * @param qaaLevel The new qaa value. + */ + public void setQaa(final int qaaLevel) { + this.qaa = qaaLevel; + } + + /** + * Getter for the destination value. + * + * @return The destination value. + */ + public String getDestination() { + return destination; + } + + /** + * Setter for the destination value. + * + * @param detination the new destination value. + */ + public void setDestination(final String detination) { + this.destination = detination; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param newSamlId the new samlId value. + */ + public void setSamlId(final String newSamlId) { + this.samlId = newSamlId; + } + + /** + * Getter for the distinguishedName value. + * + * @return The distinguishedName value. + */ + public String getDistinguishedName() { + return distinguishedName; + } + + /** + * Setter for the distinguishedName value. + * + * @param certDN the distinguished name value. + */ + public void setDistinguishedName(final String certDN) { + this.distinguishedName = certDN; + } + + /** Getter for spProvidedId **/ + public String getSpProvidedId() { + return spProvidedId; + } + + public void setSpProvidedId(final String nSpProvidedId) { + this.spProvidedId = nSpProvidedId; + } + + @Override + public Object clone() throws CloneNotSupportedException{ + STORKLogoutRequest storkLogoutRequest = null; + storkLogoutRequest = (STORKLogoutRequest) super.clone(); + storkLogoutRequest.setTokenSaml(getTokenSaml()); + return storkLogoutRequest; + } +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutResponse.java new file mode 100644 index 000000000..21b53a652 --- /dev/null +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutResponse.java @@ -0,0 +1,250 @@ +package eu.stork.peps.auth.commons; + +import java.io.Serializable; + +public class STORKLogoutResponse implements Serializable, Cloneable { + private static final long serialVersionUID = 4778480781609392750L; + + /** The samlId. */ + private String samlId; + + /** The destination. */ + private String destination; + + /** The distinguished name. */ + private String distinguishedName; + + /** The token saml. */ + private byte[] tokenSaml = new byte[0]; + + /** The issuer. */ + private String issuer; + + /** The country. */ + private String country; + + /** The Alias used at the keystore for saving this certificate. */ + private String alias; + + /** Status code. */ + private String statusCode; + + /** Secondary status code. */ + private String subStatusCode; + + /** Status message. */ + private String statusMessage; + + /** Logout failed? */ + private boolean fail; + + /** + * Gets the SP's Certificate Alias. + * + * @return alias The SP's Certificate Alias. + */ + public String getAlias() { + return alias; + } + + /** + * Sets the SP's Certificate Alias. + * + * @param nAlias The SP's Certificate Alias. + */ + public void setAlias(final String nAlias) { + this.alias = nAlias; + } + + /** + * Gets the issuer. + * + * @return The issuer value. + */ + public String getIssuer() { + return issuer; + } + + /** + * Sets the issuer. + * + * @param samlIssuer the new issuer value. + */ + public void setIssuer(final String samlIssuer) { + this.issuer = samlIssuer; + } + + /** + * Gets the SAML Token. + * + * @return The SAML Token value. + */ + public byte[] getTokenSaml() { + return tokenSaml.clone(); + } + + /** + * Sets the SAML Token. + * + * @param samlToken The new SAML Token value. + */ + public void setTokenSaml(final byte[] samlToken) { + if (samlToken != null) { + this.tokenSaml = samlToken.clone(); + } + } + + /** + * Gets the country. + * + * @return The country value. + */ + public String getCountry() { + return country; + } + + /** + * Sets the country. + * + * @param nCountry the new country value. + */ + public void setCountry(final String nCountry) { + this.country = nCountry; + } + + /** + * Getter for the destination value. + * + * @return The destination value. + */ + public String getDestination() { + return destination; + } + + /** + * Setter for the destination value. + * + * @param detination the new destination value. + */ + public void setDestination(final String detination) { + this.destination = detination; + } + + /** + * Getter for the samlId value. + * + * @return The samlId value. + */ + public String getSamlId() { + return samlId; + } + + /** + * Setter for the samlId value. + * + * @param newSamlId the new samlId value. + */ + public void setSamlId(final String newSamlId) { + this.samlId = newSamlId; + } + + /** + * Getter for the distinguishedName value. + * + * @return The distinguishedName value. + */ + public String getDistinguishedName() { + return distinguishedName; + } + + /** + * Setter for the distinguishedName value. + * + * @param certDN the distinguished name value. + */ + public void setDistinguishedName(final String certDN) { + this.distinguishedName = certDN; + } + + + /** + * Getter for the fail value. + * + * @return The fail value. + */ + public boolean isFail() { + return fail; + } + + /** + * Setter for the fail value. + * + * @param failVal the new fail value. + */ + public void setFail(final boolean failVal) { + this.fail = failVal; + } + + /** + * Getter for the statusCode value. + * + * @return The statusCode value. + */ + public String getStatusCode() { + return statusCode; + } + + /** + * Getter for the subStatusCode. + * + * @return The subStatusCode value. + */ + public String getSubStatusCode() { + return subStatusCode; + } + + /** + * Setter for the subStatusCode. + * + * @param samlSubStatusCode the new subStatusCode value. + */ + public void setSubStatusCode(final String samlSubStatusCode) { + this.subStatusCode = samlSubStatusCode; + } + + /** + * Setter for the statusMessage value. + * + * @param status the new statusMessage value. + */ + public void setStatusMessage(final String status) { + this.statusMessage = status; + } + + /** + * Getter for the statusMessage value. + * + * @return The statusMessage value. + */ + public String getStatusMessage() { + return statusMessage; + } + + /** + * Setter for the statusCode value. + * + * @param status the new statusCode value. + */ + public void setStatusCode(final String status) { + this.statusCode = status; + } + + @Override + public Object clone() throws CloneNotSupportedException{ + STORKLogoutResponse storkLogoutResponse = null; + storkLogoutResponse = (STORKLogoutResponse) super.clone(); + storkLogoutResponse.setTokenSaml(getTokenSaml()); + return storkLogoutResponse; + } + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/all-wcprops deleted file mode 100644 index 14f05b17c..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/all-wcprops +++ /dev/null @@ -1,53 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 96 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions -END -InvalidParameterPEPSException.java -K 25 -svn:wc:ra_dav:version-url -V 131 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidParameterPEPSException.java -END -SecurityPEPSException.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/SecurityPEPSException.java -END -InvalidSessionPEPSException.java -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InvalidSessionPEPSException.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/package-info.java -END -CPEPSException.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/CPEPSException.java -END -StorkPEPSException.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/StorkPEPSException.java -END -AbstractPEPSException.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/AbstractPEPSException.java -END -InternalErrorPEPSException.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions/InternalErrorPEPSException.java -END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/entries deleted file mode 100644 index c2ced14f4..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/entries +++ /dev/null @@ -1,300 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps/auth/commons/exceptions -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -CPEPSException.java -file - - - - -2013-12-20T12:27:56.626475Z -5d3cb4a7303baeaf2104aaa7da301b21 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3570 - -StorkPEPSException.java -file - - - - -2013-12-20T12:27:56.626475Z -fea01f750728ea5f15b449acb517f4b2 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1690 - -AbstractPEPSException.java -file - - - - -2013-12-20T12:27:56.626475Z -c9aedb030e6dbc9f002c7cd3d52cf03f -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -4422 - -InternalErrorPEPSException.java -file - - - - -2013-12-20T12:27:56.626475Z -36d8f6310e84c550f65bef78d5dc4238 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2471 - -InvalidParameterPEPSException.java -file - - - - -2013-12-20T12:27:56.626475Z -c6ad53378b03a346ca0fc48a381ed771 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1800 - -SecurityPEPSException.java -file - - - - -2013-12-20T12:27:56.626475Z -78d50b78a69cb0c630e4e14420e3b7be -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2199 - -InvalidSessionPEPSException.java -file - - - - -2013-12-20T12:27:56.626475Z -5fd7f04ad6f6cc121084e682b2a4e678 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1555 - -package-info.java -file - - - - -2013-12-20T12:27:56.626475Z -7055c01b74382c525c7fcf110646d8fc -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -129 - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/AbstractPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/AbstractPEPSException.java.svn-base deleted file mode 100644 index e9a96d7c2..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/AbstractPEPSException.java.svn-base +++ /dev/null @@ -1,173 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons.exceptions; - -import java.io.Serializable; - -/** - * Abstract class to represent the various PEPS exceptions. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.13 $, $Date: 2010-11-17 05:15:28 $ - */ -public abstract class AbstractPEPSException extends RuntimeException implements - Serializable { - - /** - * Unique identifier. - */ - private static final long serialVersionUID = -1884417567740138022L; - - /** - * Error code. - */ - private String errorCode; - - /** - * Error message. - */ - private String errorMessage; - - /** - * SAML token. - */ - private String samlTokenFail; - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters. - * - * @param code The error code value. - * @param message The error message value. - */ - public AbstractPEPSException(final String code, final String message) { - - super(message); - this.errorCode = code; - this.errorMessage = message; - } - - /** - * Exception Constructor with the errorMessage as parameters and the Throwable - * cause. - * - * @param message The error message value. - * @param cause The throwable object. - */ - public AbstractPEPSException(final String message, final Throwable cause) { - - super(message, cause); - this.errorMessage = message; - } - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters and the Throwable cause. - * - * @param code The error code value. - * @param message The error message value. - * @param cause The throwable object. - */ - public AbstractPEPSException(final String code, final String message, - final Throwable cause) { - - super(message, cause); - this.errorCode = code; - this.errorMessage = message; - } - - /** - * Exception Constructor with three Strings representing the errorCode, - * errorMessage and encoded samlToken as parameters. - * - * @param code The error code value. - * @param message The error message value. - * @param samlToken The error SAML Token. - */ - public AbstractPEPSException(final String code, final String message, - final String samlToken) { - - super(message); - this.errorCode = code; - this.errorMessage = message; - this.samlTokenFail = samlToken; - } - - /** - * Constructor with SAML Token as argument. Error message and error code are - * embedded in the SAML. - * - * @param samlToken The error SAML Token. - */ - public AbstractPEPSException(final String samlToken) { - super(); - this.samlTokenFail = samlToken; - } - - /** - * Getter for errorCode. - * - * @return The errorCode value. - */ - public final String getErrorCode() { - return errorCode; - } - - /** - * Setter for errorCode. - * - * @param code The error code value. - */ - public final void setErrorCode(final String code) { - this.errorCode = code; - } - - /** - * Getter for errorMessage. - * - * @return The error Message value. - */ - public final String getErrorMessage() { - return errorMessage; - } - - /** - * Setter for errorMessage. - * - * @param message The error message value. - */ - public final void setErrorMessage(final String message) { - this.errorMessage = message; - } - - /** - * Getter for SAMLTokenFail. - * - * @return The error SAML Token. - */ - public final String getSamlTokenFail() { - return samlTokenFail; - } - - /** - * Setter for SAMLTokenFail. - * - * @param samlToken The error SAML token. - */ - public final void setSamlTokenFail(final String samlToken) { - this.samlTokenFail = samlToken; - } -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/CPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/CPEPSException.java.svn-base deleted file mode 100644 index 69cb20fdd..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/CPEPSException.java.svn-base +++ /dev/null @@ -1,143 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons.exceptions; - -/** - * This exception is thrown by the C-PEPS service and holds the relative - * information to present to the citizen. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.9 $, $Date: 2010-11-17 05:15:28 $ - */ -public final class CPEPSException extends RuntimeException { - - /** - * Serial id. - */ - private static final long serialVersionUID = -4012295047127999362L; - - /** - * Error code. - */ - private String errorCode; - - /** - * Error message. - */ - private String errorMessage; - - /** - * SAML token. - */ - private String samlTokenFail; - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters. - * - * @param samlToken The SAML Token. - * @param code The error code value. - * @param message The error message value. - */ - public CPEPSException(final String samlToken, final String code, - final String message) { - - super(message); - this.setErrorCode(code); - this.setErrorMessage(message); - this.setSamlTokenFail(samlToken); - } - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters. - * - * @param samlToken The SAML Token. - * @param code The error code value. - * @param message The error message value. - * @param cause The original exception; - */ - public CPEPSException(final String samlToken, final String code, - final String message, final Throwable cause) { - - super(message, cause); - this.setErrorCode(code); - this.setErrorMessage(message); - this.setSamlTokenFail(samlToken); - } - - /** - * {@inheritDoc} - */ - public String getMessage() { - return this.getErrorMessage() + " (" + this.getErrorCode() + ")"; - } - - /** - * Getter for the error code. - * - * @return The errorCode value. - */ - public String getErrorCode() { - return errorCode; - } - - /** - * Setter for the error code. - * - * @param code The error code. - */ - public void setErrorCode(final String code) { - this.errorCode = code; - } - - /** - * Getter for the error message. - * - * @return The errorMessage value. - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Setter for the error message. - * - * @param message The error message. - */ - public void setErrorMessage(final String message) { - this.errorMessage = message; - } - - /** - * Getter for the samlTokenFail. - * - * @return The samlTokenFail value. - */ - public String getSamlTokenFail() { - return samlTokenFail; - } - - /** - * Setter for the samlTokenFail. - * - * @param samlToken The error Saml Token. - */ - public void setSamlTokenFail(final String samlToken) { - this.samlTokenFail = samlToken; - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InternalErrorPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InternalErrorPEPSException.java.svn-base deleted file mode 100644 index 67514d4fe..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InternalErrorPEPSException.java.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons.exceptions; - -/** - * Internal Error Exception class. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.13 $, $Date: 2010-11-17 05:15:28 $ - * - * @see AbstractPEPSException - */ -public final class InternalErrorPEPSException extends AbstractPEPSException { - - /** - * Unique identifier. - */ - private static final long serialVersionUID = 1193001455410319795L; - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters and the Throwable cause. - * - * @param errorCode The error code value. - * @param errorMessage The error message value. - * @param cause The throwable object. - */ - public InternalErrorPEPSException(final String errorCode, - final String errorMessage, final Throwable cause) { - - super(errorCode, errorMessage, cause); - } - - /** - * Exception Constructor with three strings representing the errorCode, - * errorMessage and encoded samlToken as parameters. - * - * @param errorCode The error code value. - * @param errorMessage The error message value. - * @param samlTokenFail The error SAML Token. - */ - public InternalErrorPEPSException(final String errorCode, - final String errorMessage, final String samlTokenFail) { - - super(errorCode, errorMessage, samlTokenFail); - } - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters. - * - * @param errorCode The error code value. - * @param errorMessage The error message value. - */ - public InternalErrorPEPSException(final String errorCode, - final String errorMessage) { - - super(errorCode, errorMessage); - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidParameterPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidParameterPEPSException.java.svn-base deleted file mode 100644 index 12c83b589..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidParameterPEPSException.java.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons.exceptions; - -/** - * Invalid Parameter Exception class. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.11 $, $Date: 2010-11-17 05:15:28 $ - * - * @see InvalidParameterPEPSException - */ -public class InvalidParameterPEPSException extends AbstractPEPSException { - - /** - * Unique identifier. - */ - private static final long serialVersionUID = 2046282148740524875L; - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters. - * - * @param errorCode The error code value. - * @param errorMessage The error code message value. - */ - public InvalidParameterPEPSException(final String errorCode, - final String errorMessage) { - super(errorCode, errorMessage); - } - - /** - * Exception Constructor with one String representing the encoded samlToken. - * - * @param samlTokenFail The error SAML Token. - */ - public InvalidParameterPEPSException(final String samlTokenFail) { - super(samlTokenFail); - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidSessionPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidSessionPEPSException.java.svn-base deleted file mode 100644 index 800525eee..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/InvalidSessionPEPSException.java.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons.exceptions; - -/** - * Invalid session Exception class. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.14 $, $Date: 2010-11-17 05:15:28 $ - * - * @see InvalidParameterPEPSException - */ -public class InvalidSessionPEPSException extends InvalidParameterPEPSException { - - /** - * Unique identifier. - */ - private static final long serialVersionUID = 7147090160978319016L; - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters. - * - * @param errorCode The error code value. - * @param errorMessage The error message value. - */ - public InvalidSessionPEPSException(final String errorCode, - final String errorMessage) { - - super(errorCode, errorMessage); - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/SecurityPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/SecurityPEPSException.java.svn-base deleted file mode 100644 index fc27371d2..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/SecurityPEPSException.java.svn-base +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons.exceptions; - -/** - * Security PEPS Exception class. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.18 $, $Date: 2010-11-17 05:15:28 $ - * - * @see AbstractPEPSException - */ -public final class SecurityPEPSException extends AbstractPEPSException { - - /** - * Unique identifier. - */ - private static final long serialVersionUID = 5605743302478554967L; - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters. - * - * @param errorCode The error code value. - * @param errorMsg The error message value. - */ - public SecurityPEPSException(final String errorCode, final String errorMsg) { - super(errorCode, errorMsg); - } - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters and the Throwable cause. - * - * @param errorCode The error code value. - * @param errorMessage The error message value. - * @param cause The throwable object. - */ - public SecurityPEPSException(final String errorCode, - final String errorMessage, final Throwable cause) { - - super(errorCode, errorMessage, cause); - } - - /** - * Exception Constructor with one String representing the encoded samlToken. - * - * @param samlTokenFail The error SAML Token. - */ - public SecurityPEPSException(final String samlTokenFail) { - super(samlTokenFail); - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/StorkPEPSException.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/StorkPEPSException.java.svn-base deleted file mode 100644 index a2da61a02..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/StorkPEPSException.java.svn-base +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.commons.exceptions; - -/** - * Security PEPS Exception class. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $ - * - * @see AbstractPEPSException - */ -public final class StorkPEPSException extends AbstractPEPSException { - - /** - * Unique identifier. - */ - private static final long serialVersionUID = 8048033129798427574L; - - /** - * Exception Constructor with two Strings representing the errorCode and - * errorMessage as parameters. - * - * @param errorCode The error code value. - * @param errorMsg The error message value. - */ - public StorkPEPSException(final String errorCode, final String errorMsg) { - super(errorCode, errorMsg); - } - - /** - * {@inheritDoc} - */ - public String getMessage() { - - return "Security Error (" + this.getErrorCode() + ") processing request : " - + this.getErrorMessage(); - } - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/package-info.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index d83068beb..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/exceptions/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Package for the PEPS’ Exceptions handling. - * - * @since 1.0 - */ -package eu.stork.peps.auth.commons.exceptions; - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/all-wcprops b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/all-wcprops deleted file mode 100644 index d23abebd4..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/all-wcprops +++ /dev/null @@ -1,41 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 86 -/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/java/eu/stork/peps/auth/specific -END -ICheckAttributeValue.java -K 25 -svn:wc:ra_dav:version-url -V 112 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/ICheckAttributeValue.java -END -IDeriveAttribute.java -K 25 -svn:wc:ra_dav:version-url -V 108 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/IDeriveAttribute.java -END -IAUService.java -K 25 -svn:wc:ra_dav:version-url -V 102 -/CITnet/svn/STORK2/!svn/ver/73/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java -END -INormaliseValue.java -K 25 -svn:wc:ra_dav:version-url -V 107 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/INormaliseValue.java -END -ITranslatorService.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 104 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/java/eu/stork/peps/auth/specific/package-info.java -END diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/entries b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/entries deleted file mode 100644 index a23f672b5..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/entries +++ /dev/null @@ -1,232 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/java/eu/stork/peps/auth/specific -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-28T11:11:01.095477Z -73 -emlelisst - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -ITranslatorService.java -file - - - - -2013-12-20T12:27:56.654475Z -e36bd20ddfb7e165262a4a7891440fc9 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3144 - -package-info.java -file - - - - -2013-12-20T12:27:56.654475Z -eef7721d55c2edb02a432fc08ae9e487 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -164 - -ICheckAttributeValue.java -file - - - - -2013-12-20T12:27:56.654475Z -b0472ff15d1c86f175da134b0f0eda71 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1321 - -IDeriveAttribute.java -file - - - - -2013-12-20T12:27:56.654475Z -dce3856a97583f739cdf50ca78491277 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1504 - -IAUService.java -file - - - - -2013-12-20T12:27:56.654475Z -254f57923746e205391672afffc04313 -2013-10-28T11:11:01.095477Z -73 -emlelisst - - - - - - - - - - - - - - - - - - - - - -6011 - -INormaliseValue.java -file - - - - -2013-12-20T12:27:56.654475Z -09f6e376875762fca294be4dfecb71f1 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1237 - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IAUService.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IAUService.java.svn-base deleted file mode 100644 index 157c8f7b6..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IAUService.java.svn-base +++ /dev/null @@ -1,183 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.specific; - -import java.util.Map; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.IStorkSession; -import eu.stork.peps.auth.commons.STORKAttrQueryResponse; -import eu.stork.peps.auth.commons.STORKAuthnResponse; - -/** - * Interface for Specific Authentication methods. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com - */ -public interface IAUService { - - /** - * Prepares the citizen to be redirected to the IdP. - * - * @param personalList The Personal Attribute List. - * @param parameters The parameters. - * @param session The session object. - * @param requestAttributes The Requested attributes. - * - * @return byte[] containing a SAML Request. - * - * @see IPersonalAttributeList - * @see IStorkSession - */ - byte[] prepareCitizenAuthentication(IPersonalAttributeList personalList, - Map parameters, Map requestAttributes, - IStorkSession session); - - /** - * Authenticates a citizen. - * - * @param personalList The Personal Attribute List. - * @param parameters The parameters. - * @param requestAttributes The requested attributes. - * - * @return The updated Personal Attribute List. - * - * @see IPersonalAttributeList - */ - IPersonalAttributeList authenticateCitizen( - IPersonalAttributeList personalList, Map parameters, - Map requestAttributes); - - /** - * Prepares the Citizen browser to be redirected to the AP. - * - * @param personalList The Personal Attribute List. - * @param parameters The parameters. - * @param session The session object. - * @param requestAttributes The requested attributes. - * - * @return true in case of no error. - * - * @see IPersonalAttributeList - * @see IStorkSession - */ - boolean prepareAPRedirect(IPersonalAttributeList personalList, - Map parameters, Map requestAttributes, - IStorkSession session); - - /** - * Returns the attributes values from the AP. - * - * @param personalList The Personal Attribute List. - * @param parameters The parameters. - * @param requestAttributes The request attributes. - * - * @return The updated Personal Attribute List. - * - * @see IPersonalAttributeList - */ - IPersonalAttributeList getAttributesFromAttributeProviders( - IPersonalAttributeList personalList, Map parameters, - Map requestAttributes); - - /** - * Get the attributes from the AP with verification. - * - * @param personalList The Personal Attribute List. - * @param parameters The HTTP Parameters. - * @param requestAttributes The requested Attributes. - * @param session The session object. - * @param auProcessId The SAML identifier. - * - * @return true if the attributes were correctly verified. - * - * @see IPersonalAttributeList - * @see IStorkSession - */ - boolean getAttributesWithVerification(IPersonalAttributeList personalList, - Map parameters, Map requestAttributes, - IStorkSession session, String auProcessId); - - /** - * Validates a SAML Response. - * - * @param samlToken The SAML Token. - * @param session The session object. - * - * @return the STORKAuthnResponse associated with the validated response. - * - * @see IStorkSession - */ - STORKAuthnResponse processAuthenticationResponse(byte[] samlToken, - IStorkSession session); - - /** - * Generates a SAML Response in case of error. - * - * @param inResponseTo The SAML's identifier to response. - * @param issuer The issuer value. - * @param assertionURL The assertion URL. - * @param code The error code. - * @param subcode The sub error code. - * @param message The error message. - * @param ipUserAddress The user IP address. - * - * @return byte[] containing the SAML Response. - */ - byte[] generateErrorAuthenticationResponse(String inResponseTo, - String issuer, String assertionURL, String code, String subcode, - String message, String ipUserAddress); - - /** - * Compares two given personal attribute lists. - * - * @param original The original Personal Attribute List. - * @param modified The modified Personal Attribute List. - * @return true if the original list contains the modified one. False - * otherwise. - * - * @see IPersonalAttributeList - */ - boolean comparePersonalAttributeLists(IPersonalAttributeList original, - IPersonalAttributeList modified); - - /** - * Prepares the citizen to be redirected to the AtP. - * - * @param personalList The Personal Attribute List. - * @param parameters The parameters. - * @param session The session object. - * - * @return byte[] containing a SAML Request. - * - * @see IPersonalAttributeList - * @see IStorkSession - */ - byte[] prepareAttributeRequest(IPersonalAttributeList personalList, - Map parameters, IStorkSession session); - - /** - * Validates a SAML Response. - * - * @param samlToken The SAML Token. - * @param session The session object. - * - * @return the STORKAttrQueryResponse associated with the validated response. - * - * @see IStorkSession - */ - STORKAttrQueryResponse processAttributeResponse(byte[] samlToken, - IStorkSession session); -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ICheckAttributeValue.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ICheckAttributeValue.java.svn-base deleted file mode 100644 index 31a8d78ff..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ICheckAttributeValue.java.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.specific; - -import java.util.List; - -/** - * Interface that defines the methods to work with the validation of attributes. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com - */ -public interface ICheckAttributeValue { - - /** - * Checks if the list of values contains the expected value. - * - * @param values The List of values. - * @param expectedValue The value to check if it exists on the list. - * - * @return boolean true, if the value is present in the list. False, - * otherwise. - */ - boolean checkValue(List values, String expectedValue); - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IDeriveAttribute.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IDeriveAttribute.java.svn-base deleted file mode 100644 index 78eb53004..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/IDeriveAttribute.java.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.specific; - -import eu.stork.peps.auth.commons.IStorkSession; -import eu.stork.peps.auth.commons.PersonalAttribute; - -/** - * Interface that defines the methods to work with derivation of attributes. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com - */ -public interface IDeriveAttribute { - - /** - * Derives the attribute value. Set the Personal Attribute value to null if - * the value in session or the value of age are invalid (non-numeric or null). - * - * @param personalAttrList The Personal Attribute List. - * @param session The session object. - * - * @see PersonalAttribute The personal Attribute - * @see IStorkSession The session object. - */ - void deriveAttributeToData(PersonalAttribute personalAttrList, - IStorkSession session); - -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/INormaliseValue.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/INormaliseValue.java.svn-base deleted file mode 100644 index ca2114e32..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/INormaliseValue.java.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.specific; - -import eu.stork.peps.auth.commons.PersonalAttribute; - -/** - * Interface for attribute's value normalisation. - * - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com - */ -public interface INormaliseValue { - - /** - * Translates the attribute's value from local format to STORK format. - * - * @param personalAttribute The Personal Attribute to normalise the value. - * - * @see PersonalAttribute - */ - void normaliseAttributeValueToStork(PersonalAttribute personalAttribute); -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ITranslatorService.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ITranslatorService.java.svn-base deleted file mode 100644 index d4c152614..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/ITranslatorService.java.svn-base +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.auth.specific; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.IStorkSession; -import eu.stork.peps.auth.commons.STORKAuthnRequest; - -/** - * Interface for attributes normalization. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com - */ -public interface ITranslatorService { - - /** - * Translates the attributes from local format to STORK format. - * - * @param personalList The Personal Attribute List. - * - * @return The Personal Attribute List with normalised attributes. - * - * @see IPersonalAttributeList - */ - IPersonalAttributeList normaliseAttributeNamesToStork( - IPersonalAttributeList personalList); - - /** - * Translates the attributes values from local format to STORK format. - * - * @param personalList The Personal Attribute List. - * - * @return The PersonalAttributeList with normalised values. - * - * @see IPersonalAttributeList - */ - IPersonalAttributeList normaliseAttributeValuesToStork( - IPersonalAttributeList personalList); - - /** - * Translates the attributes from STORK format to local format. - * - * @param personalList The Personal Attribute List. - * - * @return The PersonalAttributeList with normalised attributes. - * - * @see IPersonalAttributeList - */ - IPersonalAttributeList normaliseAttributeNamesFromStork( - IPersonalAttributeList personalList); - - /** - * Derive Attribute Names To Stork format. - * - * @param personalList The Personal Attribute List, - * - * @return The PersonalAttributeList with derived attributes. - * - * @see IPersonalAttributeList - */ - IPersonalAttributeList deriveAttributeFromStork( - IPersonalAttributeList personalList); - - /** - * Derive Attribute Names from Stork format. - * - * @param session The session object. - * @param modifiedList The Personal Attribute List. - * - * @return The PersonalAttributeList with derived attributes. - * - * @see IStorkSession - * @see IPersonalAttributeList - */ - IPersonalAttributeList deriveAttributeToStork(IStorkSession session, - IPersonalAttributeList modifiedList); - - /** - * Validate the values of the attributes. - * - * @param authData The SAML's STORKAuthnRequest object. - * - * @return True, if all the attributes have values. False, otherwise. - * - * @see STORKAuthnRequest - */ - boolean checkAttributeValues(STORKAuthnRequest authData); -} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/package-info.java.svn-base b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index a25c52311..000000000 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Specific PEPS Interfaces that implements functionality of the Authentication - * Service. - * - * @since 1.0 - */ -package eu.stork.peps.auth.specific; - diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java index 157c8f7b6..5c24cc5a8 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/IAUService.java @@ -45,6 +45,23 @@ public interface IAUService { Map parameters, Map requestAttributes, IStorkSession session); + /** + * Prepares the citizen to be redirected to the PV. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param session The session object. + * @param requestAttributes The Requested attributes. + * + * @return byte[] containing a SAML Request. + * + * @see IPersonalAttributeList + * @see IStorkSession + */ + byte[] preparePVRequest(IPersonalAttributeList personalList, + Map parameters, Map requestAttributes, + IStorkSession session); + /** * Authenticates a citizen. * @@ -60,6 +77,21 @@ public interface IAUService { IPersonalAttributeList personalList, Map parameters, Map requestAttributes); + /** + * Validates a power. + * + * @param personalList The Personal Attribute List. + * @param parameters The parameters. + * @param requestAttributes The requested attributes. + * + * @return The updated Personal Attribute List (power validated). + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList powerValidation( + IPersonalAttributeList personalList, Map parameters, + Map requestAttributes); + /** * Prepares the Citizen browser to be redirected to the AP. * diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java index d4c152614..8a33897d8 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/specific/ITranslatorService.java @@ -90,11 +90,11 @@ public interface ITranslatorService { /** * Validate the values of the attributes. * - * @param authData The SAML's STORKAuthnRequest object. + * @param pal The attribute list * * @return True, if all the attributes have values. False, otherwise. * * @see STORKAuthnRequest */ - boolean checkAttributeValues(STORKAuthnRequest authData); + boolean checkAttributeValues(IPersonalAttributeList pa); } diff --git a/id/server/stork2-commons/src/main/resources/.svn/all-wcprops b/id/server/stork2-commons/src/main/resources/.svn/all-wcprops deleted file mode 100644 index 48074222b..000000000 --- a/id/server/stork2-commons/src/main/resources/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 63 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/resources -END -log4j.xml -K 25 -svn:wc:ra_dav:version-url -V 73 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/main/resources/log4j.xml -END diff --git a/id/server/stork2-commons/src/main/resources/.svn/entries b/id/server/stork2-commons/src/main/resources/.svn/entries deleted file mode 100644 index 2f7941718..000000000 --- a/id/server/stork2-commons/src/main/resources/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/main/resources -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -log4j.xml -file - - - - -2013-12-20T12:27:56.554475Z -aa8c46e41a236b8c7049713b3eeecc49 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -660 - diff --git a/id/server/stork2-commons/src/main/resources/.svn/text-base/log4j.xml.svn-base b/id/server/stork2-commons/src/main/resources/.svn/text-base/log4j.xml.svn-base deleted file mode 100644 index 8bce0bec0..000000000 --- a/id/server/stork2-commons/src/main/resources/.svn/text-base/log4j.xml.svn-base +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/id/server/stork2-commons/src/test/.svn/all-wcprops b/id/server/stork2-commons/src/test/.svn/all-wcprops deleted file mode 100644 index bf138316a..000000000 --- a/id/server/stork2-commons/src/test/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 54 -/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test -END diff --git a/id/server/stork2-commons/src/test/.svn/entries b/id/server/stork2-commons/src/test/.svn/entries deleted file mode 100644 index 2b2601393..000000000 --- a/id/server/stork2-commons/src/test/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-05T18:15:46.189390Z -105 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -java -dir - -resources -dir - diff --git a/id/server/stork2-commons/src/test/java/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/.svn/all-wcprops deleted file mode 100644 index aadac0dbf..000000000 --- a/id/server/stork2-commons/src/test/java/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 59 -/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java -END diff --git a/id/server/stork2-commons/src/test/java/.svn/entries b/id/server/stork2-commons/src/test/java/.svn/entries deleted file mode 100644 index e5c0b0d44..000000000 --- a/id/server/stork2-commons/src/test/java/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-05T18:15:46.189390Z -105 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -eu -dir - diff --git a/id/server/stork2-commons/src/test/java/eu/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/eu/.svn/all-wcprops deleted file mode 100644 index dcd996fcd..000000000 --- a/id/server/stork2-commons/src/test/java/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 62 -/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu -END diff --git a/id/server/stork2-commons/src/test/java/eu/.svn/entries b/id/server/stork2-commons/src/test/java/eu/.svn/entries deleted file mode 100644 index ec6a38da6..000000000 --- a/id/server/stork2-commons/src/test/java/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java/eu -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-05T18:15:46.189390Z -105 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -stork -dir - diff --git a/id/server/stork2-commons/src/test/java/eu/stork/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/eu/stork/.svn/all-wcprops deleted file mode 100644 index 0b2214b69..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 68 -/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu/stork -END diff --git a/id/server/stork2-commons/src/test/java/eu/stork/.svn/entries b/id/server/stork2-commons/src/test/java/eu/stork/.svn/entries deleted file mode 100644 index 1e73b71d3..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java/eu/stork -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-05T18:15:46.189390Z -105 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -peps -dir - diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/all-wcprops deleted file mode 100644 index 3646767c9..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 73 -/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu/stork/peps -END diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/entries b/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/entries deleted file mode 100644 index bc7cb99e5..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java/eu/stork/peps -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-05T18:15:46.189390Z -105 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -tests -dir - diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/all-wcprops b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/all-wcprops deleted file mode 100644 index 6f22176bb..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/all-wcprops +++ /dev/null @@ -1,41 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 79 -/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu/stork/peps/tests -END -PersonalAttributeTestCase.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 96 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/java/eu/stork/peps/tests/package-info.java -END -DateUtilTestCase.java -K 25 -svn:wc:ra_dav:version-url -V 100 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java -END -AttributeUtilTestCase.java -K 25 -svn:wc:ra_dav:version-url -V 105 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java -END -PersonalAttributeListTestCase.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/105/trunk/Commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java -END -PEPSUtilTestCase.java -K 25 -svn:wc:ra_dav:version-url -V 100 -/CITnet/svn/STORK2/!svn/ver/96/trunk/Commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java -END diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/entries b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/entries deleted file mode 100644 index b5b0e66f6..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/entries +++ /dev/null @@ -1,232 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/java/eu/stork/peps/tests -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-11-05T18:15:46.189390Z -105 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -DateUtilTestCase.java -file - - - - -2013-12-20T12:27:56.518475Z -244cc6104660a7835dbf72dadb305d71 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -8907 - -AttributeUtilTestCase.java -file - - - - -2013-12-20T12:27:56.518475Z -6037f125adf7f4c2f6873a0d99ab0705 -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -16318 - -PersonalAttributeListTestCase.java -file - - - - -2013-12-20T12:27:56.518475Z -2c1d87e43c773d9423bbeba31f64c8ed -2013-11-05T18:15:46.189390Z -105 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -17752 - -PEPSUtilTestCase.java -file - - - - -2013-12-20T12:27:56.518475Z -f54beadeab9af936f44af326eb1116d2 -2013-11-01T20:35:30.927048Z -96 -emferreri - - - - - - - - - - - - - - - - - - - - - -16714 - -PersonalAttributeTestCase.java -file - - - - -2013-12-20T12:27:56.518475Z -77386880d5ffadd21c9b3a3c7d51b990 -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -5449 - -package-info.java -file - - - - -2013-12-20T12:27:56.518475Z -04f136539bda0caa3d5ccdfee912cfce -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -92 - diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/AttributeUtilTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/AttributeUtilTestCase.java.svn-base deleted file mode 100644 index 77fc4b9c2..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/AttributeUtilTestCase.java.svn-base +++ /dev/null @@ -1,537 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.tests; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Test; - -import eu.stork.peps.auth.commons.AttributeUtil; -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PEPSValues; -import eu.stork.peps.auth.commons.PersonalAttributeList; - -/** - * The AttributeUtil's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com - * - * @version $Revision: $, $Date: $ - */ -public final class AttributeUtilTestCase { - - /** - * Empty String to be used on the tests. - */ - private static final String EMPTY_STRING = ""; - - /** - * Tuple value sample to be used on the tests. - */ - private static final String[] TUPLE_STRING = new String[] { "age", "true", - "[18]", "Available" }; - - /** - * Complex value to be used on escape/unescape tests. - */ - private static final String COMPLEX_VAL = "postalCode=4100," - + "apartmentNumber=A,state=Porto,countryCodeAddress=PT,streetNumber=379," - + "streetName=Avenida Sidonio Pais,town=Porto,"; - - /** - * Escaped Complex value to be used on escape/unescape tests. - */ - private static final String ESC_COMPLEX_VAL = "postalCode=4100%44" - + "apartmentNumber=A%44state=Porto%44countryCodeAddress=PT%44" - + "streetNumber=379%44streetName=Avenida Sidonio Pais%44town=Porto%44"; - - /** - * Simple value to be used on escape/unescape tests. - */ - private static final String SIMPLE_VAL = "Avenida da Boavista, Porto"; - - /** - * Escaped simple value to be used on escape/unescape tests. - */ - private static final String ESC_SIMPLE_VAL = "Avenida da Boavista%44 Porto"; - - /** - * Simple text to be used on escape/unescape tests. Must match the escaped - * text. - */ - private static final String SIMPLE_TEXT = "John Doe"; - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given complex - * attribute value (canonical address' example attribute value). - */ - @Test - public void testEscapeSpecialCharsComplexVal() { - assertEquals(AttributeUtil.escape(COMPLEX_VAL), ESC_COMPLEX_VAL); - } - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given - * attribute value. - */ - @Test - public void testEscapeSpecialCharsVal() { - assertEquals(AttributeUtil.escape(SIMPLE_VAL), ESC_SIMPLE_VAL); - } - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given simple - * text: no special characters to escape. - */ - @Test - public void testEscapeNormalChars() { - assertEquals(AttributeUtil.escape(SIMPLE_TEXT), SIMPLE_TEXT); - } - - /** - * Tests the {@link AttributeUtil#unescape(String)} method for the given - * escape complex attribute value (canonical address' example attribute - * value). - */ - @Test - public void testUnescapeSpecialCharsComplexVal() { - assertEquals(AttributeUtil.unescape(ESC_COMPLEX_VAL), COMPLEX_VAL); - } - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given escape - * attribute value. - */ - @Test - public void testUnescapeSpecialCharsVal() { - assertEquals(AttributeUtil.unescape(ESC_SIMPLE_VAL), SIMPLE_VAL); - } - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given simple - * text: no special characters to unescape. - */ - @Test - public void testUnescapeNormalChars() { - assertEquals(AttributeUtil.unescape(SIMPLE_TEXT), SIMPLE_TEXT); - } - - /** - * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} - * method for the given empty string. - */ - @Test - public void testAppendIfNotNullEmptyStr() { - final StringBuilder strBuilder = new StringBuilder(SIMPLE_TEXT); - AttributeUtil.appendIfNotNull(strBuilder, EMPTY_STRING); - assertEquals(strBuilder.toString(), SIMPLE_TEXT); - } - - /** - * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} - * method for the given string. - */ - @Test - public void testAppendIfNotNullStr() { - final StringBuilder strBuilder = new StringBuilder(); - AttributeUtil.appendIfNotNull(strBuilder, SIMPLE_TEXT); - assertEquals(strBuilder.toString(), SIMPLE_TEXT); - } - - /** - * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} - * method for the given null value. - */ - @Test - public void testAppendIfNotNull() { - final StringBuilder strBuilder = new StringBuilder(); - AttributeUtil.appendIfNotNull(strBuilder, null); - assertEquals(strBuilder.toString(), EMPTY_STRING); - } - - /** - * Tests the {@link AttributeUtil#listToString(List, String)} method for the - * given List with two values. - */ - @Test - public void testListToStringTwoVals() { - final List vals = new ArrayList(); - vals.add(SIMPLE_VAL); - vals.add(SIMPLE_TEXT); - - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append(SIMPLE_TEXT); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - - assertEquals( - AttributeUtil.listToString(vals, - PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#listToString(List, String)} method for the - * given List with one values. - */ - @Test - public void testListToStringOneVal() { - final List vals = new ArrayList(); - vals.add(SIMPLE_VAL); - - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - - assertEquals( - AttributeUtil.listToString(vals, - PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#listToString(List, String)} method for the - * given List with one value. - */ - @Test - public void testListToStringEmptyVal() { - final List vals = new ArrayList(); - - final StringBuilder strBuilder = new StringBuilder(); - - assertEquals( - AttributeUtil.listToString(vals, - PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method - * for the given Map with one value. - */ - @Test - public void testMapToStringOneVal() { - final Map vals = new HashMap(); - vals.put("CanonicalAddress", COMPLEX_VAL); - - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("CanonicalAddress="); - strBuilder.append(ESC_COMPLEX_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - - assertEquals(AttributeUtil.mapToString(vals, - PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method - * for the given empty Map. - */ - @Test - public void testMapToStringEmptyVal() { - final Map vals = new HashMap(); - - final StringBuilder strBuilder = new StringBuilder(); - - assertEquals(AttributeUtil.mapToString(vals, - PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * invalid List. - */ - @Test - public void testIsValidValueInvalidList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append("]"); - assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * null value. - */ - @Test - public void testIsValidValueNullList() { - assertFalse(AttributeUtil.isValidValue(null)); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * empty List. - */ - @Test - public void testIsValidValueEmptyList() { - assertTrue(AttributeUtil.isValidValue("[]")); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * empty List. - */ - @Test - public void testIsValidValueEmptyCommaList() { - assertTrue(AttributeUtil.isValidValue("[,]")); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * one simple value List. - */ - @Test - public void testIsValidValueOneValueList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * one simple value List. - */ - @Test - public void testIsValidValueOneValueCommaList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * one complex value List. - */ - @Test - public void testIsValidValueOneComplexValueList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_COMPLEX_VAL); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * one complex value List. - */ - @Test - public void testIsValidValueOneComplexValueCommaList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_COMPLEX_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * multi value List. - */ - @Test - public void testIsValidValueMultiValueList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append(SIMPLE_TEXT); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given - * invalid multi value List. - */ - @Test - public void testIsValidValueInvalidMultiValueList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append(SIMPLE_TEXT); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append("]"); - assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given - * true type. - */ - @Test - public void testIsValidTypetrue() { - assertTrue(AttributeUtil.isValidType("true")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given - * True type. - */ - @Test - public void testIsValidTypeTrue() { - assertTrue(AttributeUtil.isValidType("True")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given - * TRUE type. - */ - @Test - public void testIsValidTypeTRUE() { - assertTrue(AttributeUtil.isValidType("TRUE")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given - * invalid type. - */ - @Test - public void testIsValidTypeInvalidType() { - assertFalse(AttributeUtil.isValidType("str")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given - * false type. - */ - @Test - public void testIsValidTypefalse() { - assertTrue(AttributeUtil.isValidType("false")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given - * False type. - */ - @Test - public void testIsValidTypeFalse() { - assertTrue(AttributeUtil.isValidType("False")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given - * FALSE type. - */ - @Test - public void testIsValidTypeFALSEVal() { - assertTrue(AttributeUtil.isValidType("False")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given - * null. - */ - @Test - public void testIsValidTypeNullVal() { - assertFalse(AttributeUtil.isValidType(null)); - } - - /** - * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the - * given valid tuple. - */ - @Test - public void testHasValidTuples() { - assertTrue(AttributeUtil.hasValidTuples(TUPLE_STRING)); - } - - /** - * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the - * given invalid tuple. - */ - @Test - public void testHasValidTuplesInvalid() { - final String[] tuple = new String[]{"name", "type"}; - assertFalse(AttributeUtil.hasValidTuples(tuple)); - } - - /** - * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the - * given invalid tuple with valid size. - */ - @Test - public void testHasValidTuplesSameSizeInvalidValues() { - final String[] tuple = new String[] { "age", "type", "[18]", "Available"}; - assertFalse(AttributeUtil.hasValidTuples(tuple)); - } - - /** - * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the - * given null value. - */ - @Test - public void testHasValidTuplesNull() { - assertFalse(AttributeUtil.hasValidTuples(null)); - } - - /** - * Tests the - * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} - * method for the given attribute list.. - */ - @Test - public void testCheckMandatoryAttributes() { - final IPersonalAttributeList attrList = new PersonalAttributeList(); - attrList.populate("isAgeOver:true:[18,]:Available;"); - assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); - - } - - /** - * Tests the - * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} - * method for the given null value. - */ - @Test(expected = NullPointerException.class) - public void testCheckMandatoryAttributesNullAttrList() { - assertTrue(AttributeUtil.checkMandatoryAttributes(null)); - } - - /** - * Tests the - * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} - * method for the given empty attribute list. - */ - @Test - public void testCheckMandatoryAttributesEmptyAttrList() { - final IPersonalAttributeList attrList = new PersonalAttributeList(); - assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); - } - - /** - * Tests the - * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} - * method for the given attribute list (missing mandatory attribute). - */ - @Test - public void testCheckMandatoryAttributesMissingAttr() { - final IPersonalAttributeList attrList = new PersonalAttributeList(); - attrList.populate("isAgeOver:true:[]:NotAvailable;"); - assertFalse(AttributeUtil.checkMandatoryAttributes(attrList)); - } - -} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/DateUtilTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/DateUtilTestCase.java.svn-base deleted file mode 100644 index 5d2296997..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/DateUtilTestCase.java.svn-base +++ /dev/null @@ -1,294 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.tests; - -import java.sql.Timestamp; -import java.util.Properties; - -import org.joda.time.DateTime; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import eu.stork.peps.auth.commons.DateUtil; -import eu.stork.peps.auth.commons.PEPSUtil; -import eu.stork.peps.auth.commons.exceptions.SecurityPEPSException; - -/** - * The PersonalAttribute's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.2 $, $Date: 2010-11-17 05:17:03 $ - */ -public final class DateUtilTestCase { - - /** - * Stork Format date. - */ - private static final String FORMAT = "yyyyMMdd"; - - /** - * Expected 10 value. - */ - private static final int TEN = 10; - - /** - * Expected 11 value. - */ - private static final int ELEVEN = 11; - - /** - * The testing Date ("current" date). - */ - private static final DateTime TESTDATE = new DateTime(2011, 10, 10, 15, 20, - 0, 0); - - /** - * Init DateUtilTestCase class. - */ - @BeforeClass - public static void runsBeforeTheTestSuite() { - final Properties configs = new Properties(); - configs.setProperty("invalidAgeDateValue.code", "35"); - configs.setProperty("invalidAttributeValue.code", "34"); - configs - .setProperty( - "invalidAttributeValue.message", - "Unexpected or invalid content was encountered within a " - + " or element."); - PEPSUtil.createInstance(configs); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given year against - * the testDate: 2011-10-10 15:20:00.0. Must return 10. - */ - @Test - public void calculateAgeFromYear() { - Assert.assertTrue(TEN == DateUtil.calculateAge("2000", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given year and month - * against the testDate: 2011-10-10 15:20:00.0. Must return 11. - */ - @Test - public void calculateAgeFromEarlyMonth() { - Assert.assertTrue(ELEVEN == DateUtil.calculateAge("200001", TESTDATE, - FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given year and month - * against the testDate: 2011-10-10 15:20:00.0. Must return 10. - */ - @Test - public void calculateAgeFromSameMonth() { - Assert.assertTrue(TEN == DateUtil.calculateAge("200010", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given year and month - * against the testDate: 2011-10-10 15:20:00.0. Must return 10. - */ - @Test - public void calculateAgeFromLaterMonth() { - Assert.assertTrue(TEN == DateUtil.calculateAge("200011", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date - * against the testDate: 2011-10-10 15:20:00.0. Must return 11. - */ - @Test - public void calculateAgeFromEarlyFullDate() { - Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20000101", TESTDATE, - FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date - * against the testDate: 2011-10-10 15:20:00.0. Must return 11. - */ - @Test - public void calculateAgeFromSameDay() { - Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20001010", TESTDATE, - FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date - * against the testDate: 2011-10-10 15:20:00.0. Must return 10. - */ - @Test - public void calculateAgeFromLaterFullDate() { - Assert.assertTrue(TEN == DateUtil - .calculateAge("20001011", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date - * against the testDate: 2011-10-10 15:20:00.0. Must return a - * SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromInvalidDate() { - DateUtil.calculateAge("200", TESTDATE, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date - * against the testDate: 2011-10-10 15:20:00.0. Must return a - * SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromInvalidMonth() { - DateUtil.calculateAge("200013", TESTDATE, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date - * against the testDate: 2011-10-10 15:20:00.0. Must return a - * SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromInvalidDay() { - DateUtil.calculateAge("20000230", TESTDATE, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date - * against the testDate: 2011-10-10 15:20:00.0. Must return a - * SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromNullDate() { - DateUtil.calculateAge(null, TESTDATE, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date - * against the testDate: 2011-10-10 15:20:00.0. Must return a - * SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromNullCurDate() { - DateUtil.calculateAge("2000", null, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date - * against the testDate: 2011-10-10 15:20:00.0. Must return a - * SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromNullFormat() { - DateUtil.calculateAge("2000", TESTDATE, null); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. - * Must return true - */ - @Test - public void isValidFormatDateFromYear() { - Assert.assertTrue(DateUtil.isValidFormatDate("2000", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year and - * month. Must return true. - */ - @Test - public void isValidFormatDateFromMonth() { - Assert.assertTrue(DateUtil.isValidFormatDate("200001", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. - * Must return false. - */ - @Test - public void isValidFormatDate() { - Assert.assertTrue(DateUtil.isValidFormatDate("20000101", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. - * Must return false. - */ - @Test - public void isValidFormatDateInvalidYear() { - Assert.assertFalse(DateUtil.isValidFormatDate("200", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. - * Must return false. - */ - @Test - public void isValidFormatDateInvalidMonth() { - Assert.assertFalse(DateUtil.isValidFormatDate("200013", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. - * Must return false. - */ - @Test - public void isValidFormatDateInvalidDate() { - Assert.assertFalse(DateUtil.isValidFormatDate("20010229", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. - * Must return false. - */ - @Test - public void isValidFormatDateNullDate() { - Assert.assertFalse(DateUtil.isValidFormatDate(null, FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. - * Must return false. - */ - @Test - public void isValidFormatDateNullFormat() { - Assert.assertFalse(DateUtil.isValidFormatDate("2000", null)); - } - - /** - * Tests the {@link DateUtil#currentTimeStamp()} method for the current - * TimeStamp (TS). Must return true. - */ - @Test - public void testCurrentTimeStampBefore() { - Timestamp ts = DateUtil.currentTimeStamp(); - Assert.assertNotSame(ts, DateUtil.currentTimeStamp()); - } - - /** - * Tests the {@link DateUtil#currentTimeStamp()} method for the current - * TimeStamp (TS). Must return true. - */ - @Test - public void testCurrentTimeStampAfter() { - Timestamp ts = DateUtil.currentTimeStamp(); - Assert.assertEquals(DateUtil.currentTimeStamp(), ts); - } - -} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PEPSUtilTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PEPSUtilTestCase.java.svn-base deleted file mode 100644 index d4841ed43..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PEPSUtilTestCase.java.svn-base +++ /dev/null @@ -1,553 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.tests; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; - -import java.util.Properties; - -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PEPSErrors; -import eu.stork.peps.auth.commons.PEPSParameters; -import eu.stork.peps.auth.commons.PEPSUtil; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.exceptions.InternalErrorPEPSException; -import eu.stork.peps.auth.commons.exceptions.InvalidParameterPEPSException; - -/** - * The PEPSUtil's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com - * - * @version $Revision: $, $Date: $ - */ -public final class PEPSUtilTestCase { - - /** - * Message example. - */ - private static final String MESSAGE_SAMPLE = "003002 - Authentication Failed"; - - /** - * Error message example. - */ - private static final String ERROR_MESSAGE_SAMPLE = "Authentication Failed"; - - /** - * Error code example. - */ - private static final String ERROR_CODE_SAMPLE = "003002"; - - /** - * Properties values for testing proposes. - */ - private static final Properties CONFIGS1 = new Properties(); - - /** - * Properties values for testing proposes. - */ - private static final Properties CONFIGS2 = new Properties(); - - /** - * The empty string value: "". - */ - private static final String EMPTY_STRING = ""; - - /** - * The empty byte value: []. - */ - private static final byte[] EMPTY_BYTE = new byte[] {}; - - /** - * The empty byte hash value. - */ - private static final byte[] EMPTY_HASH_BYTE = new byte[] { -49, -125, -31, - 53, 126, -17, -72, -67, -15, 84, 40, 80, -42, 109, -128, 7, -42, 32, -28, - 5, 11, 87, 21, -36, -125, -12, -87, 33, -45, 108, -23, -50, 71, -48, -47, - 60, 93, -123, -14, -80, -1, -125, 24, -46, -121, 126, -20, 47, 99, -71, 49, - -67, 71, 65, 122, -127, -91, 56, 50, 122, -7, 39, -38, 62 }; - - /** - * The SAML example byte[] value. - */ - private static final byte[] SAML_BYTE_SAMPLE = new byte[] { 60, 115, 97, 109, - 108, 62, 46, 46, 46, 60, 47, 115, 97, 109, 108 }; - - /** - * The SAML's Base64 example value. - */ - private static final String SAML_BASE64_SAMPLE = "PHNhbWw+Li4uPC9zYW1s"; - - /** - * The SAML's Base64 byte[] example value. - */ - private static byte[] SAML_BASE64_BYTE_SAMPLE = new byte[] { 80, 72, 78, 104, - 98, 87, 119, 43, 76, 105, 52, 117, 80, 67, 57, 122, 89, 87, 49, 115 }; - - /** - * The SAML's Base64 Hash byte[] example value. - */ - private static byte[] HASH_BYTE_SAMPLE = new byte[] { 67, 38, 11, 115, 49, - -5, 54, -85, 38, 43, -99, 96, 71, -41, 50, -96, 71, -86, 90, -97, 66, -67, - 90, 101, 30, 82, -13, 60, -106, -72, -103, -75, 19, 2, -107, 107, -6, -56, - 34, -111, -44, -57, -26, -5, 33, 78, -1, 30, 21, 74, -26, 118, -46, -12, - -102, 12, -56, 30, -59, -104, -21, -42, -103, 82 }; - - /** - * Init PEPSUtilTestCase class. - */ - @BeforeClass - public static void runsBeforeTheTestSuite() { - - CONFIGS1.setProperty("max.attrList.size", "20000"); - CONFIGS1.setProperty("attrList.code", "202005"); - CONFIGS1.setProperty("attrList.message", "invalid.attrList.parameter"); - - CONFIGS1.setProperty("max.qaaLevel.size", "1"); - CONFIGS1.setProperty("max.spUrl.size", "inv"); - CONFIGS1.setProperty("validation.active", "true"); - CONFIGS1.setProperty("hashDigest.className", - "org.bouncycastle.crypto.digests.SHA512Digest"); - CONFIGS1.setProperty("invalidAgeDateValue.code", "35"); - CONFIGS1.setProperty("invalidAttributeValue.code", "34"); - CONFIGS1.setProperty("invalidAttributeValue.message", - "Unexpected or invalid content was encountered within a " - + " or element."); - } - - /** - * Tests the {@link PEPSUtil#createInstance(Properties)} method for the given - * properties object. - */ - @Test - public void testCreateInstance() { - Assert.assertNotNull(PEPSUtil.createInstance(CONFIGS2)); - } - - /** - * Tests the {@link PEPSUtil#getConfigs()}. - */ - @Test - public void testGetConfigs() { - final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); - assertEquals(pepsUtils.getConfigs(), CONFIGS1); - } - - /** - * Tests the {@link PEPSUtil#getConfigs()}. - */ - @Test - public void testGetConfigsDifferent() { - final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); - assertNotSame(pepsUtils.getConfigs(), CONFIGS2); - } - - /** - * Tests the {@link PEPSUtil#getConfig(String)} method for the given existing - * config. - */ - @Test - public void testGetConfigExists() { - assertEquals(PEPSUtil.getConfig("hashDigest.className"), - "org.bouncycastle.crypto.digests.SHA512Digest"); - } - - /** - * Tests the {@link PEPSUtil#getConfig(String)} method for the given not - * existing config. - */ - @Test - public void testGetConfigNoExists() { - assertNull(PEPSUtil.getConfig("doesnt.exists")); - } - - /** - * Tests the {@link PEPSUtil#getConfig(String)} method for the given null - * value. - */ - @Test(expected = NullPointerException.class) - public void testGetConfigNull() { - assertNull(PEPSUtil.getConfig(null)); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the - * given param values. - */ - @Test - public void testIsValidParameterExists() { - assertTrue(PEPSUtil.isValidParameter("qaaLevel", "1")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the - * given param values. - */ - @Test - public void testIsValidParameterExistsGreat() { - assertFalse(PEPSUtil.isValidParameter("qaaLevel", "12")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the - * given param values. - */ - @Test - public void testIsValidParameterExistsIvalidConf() { - assertFalse(PEPSUtil - .isValidParameter("spUrl", "http://localhost:8080/SP/")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the - * given param values. - */ - @Test - public void testIsValidParameterNotExists() { - assertFalse(PEPSUtil.isValidParameter("doesntexists", - "http://localhost:8080/SP/")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the - * given param values. - */ - @Test - public void testIsValidParameterNullParamName() { - assertFalse(PEPSUtil.isValidParameter(null, "http://localhost:8080/SP/")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the - * given param values. - */ - @Test - public void testIsValidParameterNullParamValue() { - assertFalse(PEPSUtil.isValidParameter("spUrl", null)); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} method - * for the given object values. - */ - @Test - public void testValidateParameterValid() { - final IPersonalAttributeList persAttrList = new PersonalAttributeList(); - persAttrList.populate("isAgeOver:true:[15,]:Available;"); - PEPSUtil.validateParameter("ServiceProviderAction", - PEPSParameters.ATTRIBUTE_LIST.toString(), persAttrList); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} method - * for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterNull() { - PEPSUtil.validateParameter("ServiceProviderAction", - PEPSParameters.ATTRIBUTE_LIST.toString(), null); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, String)} method - * for the given string values. - * - * The tested class just invokes - * {@link PEPSUtil#validateParameter(String, String, String, String, String)} - * so further tests will be later. - */ - @Test - public void testValidateParameter() { - PEPSUtil.validateParameter("ServiceProviderAction", - PEPSParameters.ATTRIBUTE_LIST.toString(), - "isAgeOver:true:[15,]:Available;"); - } - - /** - * Tests the - * {@link PEPSUtil#validateParameter(String, String, String, PEPSErrors)} - * method for the given string value and {@link PEPSErrors} enum. - * - * The tested class just invokes - * {@link PEPSUtil#validateParameter(String, String, String, String, String)} - * so further tests will be later. - */ - @Test - public void testValidateParameterPEPSErrors() { - PEPSUtil.validateParameter("CountrySelectorAction", - PEPSParameters.ATTRIBUTE_LIST.toString(), - "isAgeOver:true:[15,]:Available;", - PEPSErrors.SP_COUNTRY_SELECTOR_INVALID_ATTR); - } - - /** - * Tests the - * {@link PEPSUtil#validateParameter(String, String, String, String, String)} - * method for the given string values. - */ - @Test - public void testValidateParameterValidParams() { - PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "1", - "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the - * {@link PEPSUtil#validateParameter(String, String, String, String, String)} - * method for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterInvalidParamValue() { - PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "10", - "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the - * {@link PEPSUtil#validateParameter(String, String, String, String, String)} - * method for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterInvalidParamName() { - PEPSUtil.validateParameter("ServiceProviderAction", "doesnt.exists", "1", - "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the - * {@link PEPSUtil#validateParameter(String, String, String, String, String)} - * method for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterNullParamName() { - PEPSUtil.validateParameter("ServiceProviderAction", null, "1", - "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the - * {@link PEPSUtil#validateParameter(String, String, String, String, String)} - * method for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterNullParamValue() { - PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", null, - "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given - * string value. - */ - @Test - public void testEncodeSAMLToken() { - assertEquals(PEPSUtil.encodeSAMLToken(SAML_BYTE_SAMPLE), SAML_BASE64_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given - * null. - */ - @Test(expected = NullPointerException.class) - public void testEncodeSAMLTokenNull() { - assertNotSame(PEPSUtil.encodeSAMLToken(null), SAML_BASE64_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given - * empty byte[] value. - */ - @Test - public void testEncodeSAMLTokenEmpty() { - assertEquals(PEPSUtil.encodeSAMLToken(EMPTY_BYTE), EMPTY_STRING); - } - - /** - * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given - * byte[] value. - */ - @Test - public void testDecodeSAMLToken() { - assertArrayEquals(PEPSUtil.decodeSAMLToken(SAML_BASE64_SAMPLE), - SAML_BYTE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given - * null value. - */ - @Test(expected = NullPointerException.class) - public void testDecodeSAMLTokenNull() { - assertNotSame(PEPSUtil.decodeSAMLToken(null), SAML_BYTE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given - * empty string value. - */ - @Test(expected = StringIndexOutOfBoundsException.class) - public void testDecodeSAMLTokenEmpty() { - assertTrue(PEPSUtil.decodeSAMLToken(EMPTY_STRING) == EMPTY_BYTE); - } - - /** - * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given - * byte[] value. - */ - @Test - public void testHashPersonalToken() { - assertArrayEquals(PEPSUtil.hashPersonalToken(SAML_BASE64_BYTE_SAMPLE), - HASH_BYTE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given - * null value. - */ - @Test(expected = InternalErrorPEPSException.class) - public void testHashPersonalTokenNull() { - assertNull(PEPSUtil.hashPersonalToken(null)); - } - - /** - * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given - * empty value. - */ - @Test - public void testHashPersonalTokenEmpty() { - assertArrayEquals(PEPSUtil.hashPersonalToken(EMPTY_BYTE), EMPTY_HASH_BYTE); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given - * correct message. - */ - @Test - public void testGetStorkErrorCodeExists() { - assertEquals(PEPSUtil.getStorkErrorCode(MESSAGE_SAMPLE), ERROR_CODE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given - * invalid message. - */ - @Test - public void testGetStorkErrorCodeNoExists() { - assertNull(PEPSUtil.getStorkErrorCode(ERROR_MESSAGE_SAMPLE)); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given - * empty message. - */ - @Test - public void testGetStorkErrorCodeEmpty() { - assertNull(PEPSUtil.getStorkErrorCode(EMPTY_STRING)); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given - * null message. - */ - @Test - public void testGetStorkErrorCodeNull() { - assertNull(PEPSUtil.getStorkErrorCode(null)); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given - * invalid message. - */ - @Test - public void testGetStorkErrorCodeWithSepFake() { - assertNull(PEPSUtil.getStorkErrorCode("-")); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given - * invalid message. - */ - @Test - public void testGetStorkErrorCodeWithSepAndCodeFake() { - assertNull(PEPSUtil.getStorkErrorCode("000001 -")); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the - * given correct message. - */ - @Test - public void testGetStorkErrorMessageExists() { - assertEquals(PEPSUtil.getStorkErrorMessage(MESSAGE_SAMPLE), - ERROR_MESSAGE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the - * given invalid message. - */ - @Test - public void testGetStorkErrorMessageNoExists() { - assertEquals(PEPSUtil.getStorkErrorMessage(ERROR_MESSAGE_SAMPLE), - ERROR_MESSAGE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the - * given empty message. - */ - @Test - public void testGetStorkErrorMessageEmpty() { - assertEquals(PEPSUtil.getStorkErrorMessage(EMPTY_STRING), - EMPTY_STRING); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the - * given null message. - */ - @Test - public void testGetStorkErrorMessageNull() { - assertNull(PEPSUtil.getStorkErrorMessage(null)); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the - * given invalid message. - */ - @Test - public void testGetStorkErrorMessageWithSepFake() { - assertEquals(PEPSUtil.getStorkErrorMessage("-"),"-"); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the - * given invalid message. - */ - @Test - public void testGetStorkErrorMessageWithSepAndCodeFake() { - assertEquals(PEPSUtil.getStorkErrorMessage("000001 -"),"000001 -"); - } - -} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeListTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeListTestCase.java.svn-base deleted file mode 100644 index 4721c09b6..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeListTestCase.java.svn-base +++ /dev/null @@ -1,557 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.tests; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKStatusCode; - -/** - * The PersonalAttributeList's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.5 $, $Date: 2010-11-17 05:17:02 $ - */ -public final class PersonalAttributeListTestCase { - - /** - * isAgeOver constant value. - */ - private static final String ISAGEOVER_CONS = "isAgeOver"; - - /** - * An empty attribute. - */ - @SuppressWarnings("unused") - private static final PersonalAttributeList EMPTY_ATTR_LIST = - new PersonalAttributeList(0); - - /** - * An attribute with a complex value (canonicalResidenceAddress). - */ - private static PersonalAttribute complexAttrValue = null; - - /** - * Simple attribute value list string. - */ - private static final String SIMPLE_ATTRLIST = - "isAgeOver:true:[15,]:Available;"; - - /** - * Simple attribute value list string. - */ - private static final String SIMPLE_ATTRLIST2 = - "isAgeOver:true:[18,]:Available;"; - - /** - * Simple attribute value list string. - */ - private static final String SIMPLE_ATTRLIST3 = - "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; - - /** - * Simple attribute value list string. - */ - private static final String SIMPLE_ATTRLIST3_REVERSE = - "isAgeOver:true:[18,]:Available;isAgeOver:true:[15,]:Available;"; - /** - * Simple attribute value list string. - */ - private static final String COMPLEX_ATTRLIST = - "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=Ed. B," - + "state=Porto,countryCodeAddress=PT,streetNumber=379," - + "streetName=Avenida Sidonio Pais,town=Porto,]:Available;"; - /** - * Mix attribute list string. - */ - private static final String STR_MIX_ATTR_LIST = - "isAgeOver:true:[15,]:Available;canonicalResidenceAddress:true:[" - + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT," - + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto,]:" - + "Available;"; - - /** - * Attribute List example. - */ - @SuppressWarnings({ "serial" }) - private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute( - "age", true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - /** - * Init PersonalAttributeListTestCase class. - */ - @SuppressWarnings("serial") - @BeforeClass - public static void runsBeforeTheTestSuite() { - final Map values = new HashMap() { - { - put("countryCodeAddress", "PT"); - put("state", "Porto"); - put("town", "Porto"); - put("postalCode", "4100"); - put("streetName", "Avenida Sidonio Pais"); - put("streetNumber", "379"); - put("apartmentNumber", "Ed. B"); - } - }; - - complexAttrValue = - new PersonalAttribute("canonicalResidenceAddress", true, values, - STORKStatusCode.STATUS_AVAILABLE.toString()); - - } - - /** - * Testing Personal Attribute List add method. Personal Attribute list must be - * size 1 - Simple attribute. - */ - @Test - public void testAddSimpleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(ATTR_VALUE); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List add method. Personal Attribute list must be - * size 1 - Complex attribute. - */ - @Test - public void testAddCompleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(complexAttrValue); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List add method. Personal Attribute list must be - * size 0 - no attribute. - */ - @Test - public void testAddNull() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(null); - Assert.assertTrue(attrList.size() == 0); - } - - /** - * Testing Personal Attribute List add method. Same attribute name added - * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added - * twice. - */ - @SuppressWarnings("serial") - @Test - public void testAddSameAttrName() { - final PersonalAttribute attrValueUnder = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List add method. Same attribute name added - * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added - * twice. - */ - @SuppressWarnings("serial") - @Test - public void testAddSameAttrNameEmpty() { - final PersonalAttribute attrValueUnder = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add(""); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be - * size 1 - Simple Value. - */ - @Test - public void testPutSimpleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(ATTR_VALUE.getName(), ATTR_VALUE); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be - * size 1 - Complex Value. - */ - @Test - public void testPutComplexAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(ATTR_VALUE.getName(), complexAttrValue); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be - * size 0 - no attribute. - */ - @Test - public void testPutNull() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put("", null); - Assert.assertTrue(attrList.size() == 0); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be - * size 2 - IsAgeOver attribute added twice. - */ - @SuppressWarnings("serial") - @Test - public void testPutSameAttrName() { - final PersonalAttribute attrValueUnder = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(attrValueUnder.getName(), attrValueUnder); - attrList.put(attrValueOver.getName(), attrValueOver); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be - * size 2 - IsAgeOver attribute added twice. - */ - @SuppressWarnings("serial") - @Test - public void testPutSameAttrNameEmpty() { - final PersonalAttribute attrValueUnder = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add(""); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(attrValueUnder.getName(), attrValueUnder); - attrList.put(attrValueOver.getName(), attrValueOver); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List get method. Personal Attribute list must be - * size 1 - Simple attribute. - */ - @Test - public void testGetSimpleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(ATTR_VALUE); - Assert.assertEquals(ATTR_VALUE, attrList.get(ATTR_VALUE.getName())); - } - - /** - * Testing Personal Attribute List add method. Personal Attribute list must be - * size 1 - Complex attribute. - */ - @Test - public void testGetCompleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(complexAttrValue); - Assert.assertEquals(complexAttrValue.toString(), - attrList.get(complexAttrValue.getName()).toString()); - } - - /** - * Testing Personal Attribute List get method. Personal Attribute list must be - * size 2 - IsAgeOver attribute. - */ - @SuppressWarnings("serial") - @Test - public void testGetIsAgeOverAttr() { - final PersonalAttribute attrValueUnder = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertEquals(SIMPLE_ATTRLIST, - attrList.get(attrValueUnder.getName()).toString()); - Assert.assertEquals(SIMPLE_ATTRLIST2, - attrList.get(attrValueOver.getName()).toString()); - } - - /** - * Testing Personal Attribute List populate method. Personal Attribute list - * must be size 1 - Simple attribute. - */ - @Test - public void testPopulateSimpleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(SIMPLE_ATTRLIST); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List populate method. Personal Attribute list - * must be size 1 - Complex attribute. - */ - @Test - public void testPopulateComplexAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(COMPLEX_ATTRLIST); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List populate method. Personal Attribute list - * must be size 1 - Simple and Complex attribute. - */ - @Test - public void testPopulateMixAttrs() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(STR_MIX_ATTR_LIST); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List toString method using add. - */ - @SuppressWarnings("serial") - @Test - public void testToStringFromAdd() { - final PersonalAttribute attrValueUnder = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); - } - - /** - * Testing Personal Attribute List toString method using put. - * - */ - @SuppressWarnings("serial") - @Test - public void testToStringFromPut() { - final PersonalAttribute attrValueUnder = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(attrValueUnder.getName(), attrValueUnder); - attrList.put(attrValueOver.getName(), attrValueOver); - Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); - } - - /** - * Testing Personal Attribute List toString method using populate. - */ - @Test - public void testToStringFromSimplePopulate() { - final String strAttrList = "isAgeOver:true"; - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(strAttrList); - Assert.assertEquals("isAgeOver:true:[]:;", attrList.toString()); - } - - /** - * Testing Personal Attribute List toString method using populate. - */ - @Test - public void testToStringFromPopulate() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(SIMPLE_ATTRLIST3); - Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); - } - - /** - * Testing Personal Attribute List populate method, with invalid values. - */ - @Test - public void testPopulateWithInvalidValuesFormat() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate("name:type:values:status;"); - Assert.assertEquals(pal, new PersonalAttributeList()); - } - - /** - * Testing Personal Attribute List populate method, with invalid format. - */ - @Test - public void testPopulateWithInvalidFormat() { - - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate("name:type::status;"); - Assert.assertEquals(pal, new PersonalAttributeList()); - } - - /** - * Testing Personal Attribute List clone method using add. - */ - @SuppressWarnings("serial") - @Test - public void testCloneFromAdd() { - final PersonalAttribute attrValueUnder = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertNotSame(attrList, attrList.clone()); - } - - /** - * Testing Personal Attribute List clone method using put. - */ - @SuppressWarnings("serial") - @Test - public void testCloneFromPut() { - final PersonalAttribute attrValueUnder = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = - new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(attrValueUnder.getName(), attrValueUnder); - attrList.put(attrValueOver.getName(), attrValueOver); - Assert.assertNotSame(attrList, attrList.clone()); - } - - /** - * Testing Personal Attribute List clone method using populate. - */ - @Test - public void testCloneFromPopulate() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(SIMPLE_ATTRLIST3); - Assert.assertNotSame(pal, pal.clone()); - } - - /** - * Testing Personal Attribute List iterator. - */ - @Test - public void testIterator() { - final String strAttrList = - "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(strAttrList); - final Iterator itAttr = pal.iterator(); - while (itAttr.hasNext()) { - final PersonalAttribute attr = itAttr.next(); - Assert.assertEquals(ISAGEOVER_CONS, attr.getName()); - } - } -} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeTestCase.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeTestCase.java.svn-base deleted file mode 100644 index 458d510e0..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/PersonalAttributeTestCase.java.svn-base +++ /dev/null @@ -1,182 +0,0 @@ -/* - * This work is Open Source and licensed by the European Commission under the - * conditions of the European Public License v1.1 - * - * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); - * - * any use of this file implies acceptance of the conditions of this license. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package eu.stork.peps.tests; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import junit.framework.Assert; - -import org.junit.BeforeClass; -import org.junit.Test; - -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.STORKStatusCode; - -/** - * The PersonalAttribute's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, - * luis.felix@multicert.com, hugo.magalhaes@multicert.com, - * paulo.ribeiro@multicert.com - * @version $Revision: 1.4 $, $Date: 2010-11-17 05:17:03 $ - */ -public final class PersonalAttributeTestCase { - - /** - * An empty attribute. - */ - private static final PersonalAttribute EMPTYATTR = new PersonalAttribute(); - - /** - * An attribute with a complex value (canonicalResidenceAddress). - */ - private static PersonalAttribute complexAttrValue = null; - - /** - * An attribute with a simple value (age). - */ - @SuppressWarnings("serial") - private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute( - "age", true, new ArrayList() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - /** - * Init PersonalAttributeTestCase class. - */ - @SuppressWarnings("serial") - @BeforeClass - public static void runsBeforeTheTestSuite() { - final Map values = new HashMap() { - { - put("countryCodeAddress", "PT"); - put("state", "Porto"); - put("town", "Porto"); - put("postalCode", "4100"); - put("streetName", "Avenida Sidonio Pais"); - put("streetNumber", "379"); - put("apartmentNumber", "B"); - } - }; - - complexAttrValue = - new PersonalAttribute("canonicalResidenceAddress", true, values, - STORKStatusCode.STATUS_AVAILABLE.toString()); - - } - - /** - * Tests the {@link PersonalAttribute#toString()} method for the given simple - * attribute value. Values must match. - */ - @Test - public void testToStringValues() { - Assert.assertEquals("age:true:[15,]:Available;", ATTR_VALUE.toString()); - } - - /** - * Tests the {@link PersonalAttribute#toString()} method for the given complex - * attribute value. Values must match. - */ - @Test - public void testToStringComplexValues() { - Assert.assertEquals( - "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=B," - + "state=Porto,countryCodeAddress=PT,streetNumber=379," - + "streetName=Avenida Sidonio Pais,town=Porto,]:Available;", - complexAttrValue.toString()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given - * empty attribute. Must return true. - */ - @Test - public void testToIsEmptyStatusWithNull() { - Assert.assertTrue(EMPTYATTR.isEmptyStatus()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given - * new attribute. Must return true. - */ - @Test - public void testToIsEmptyStatusWithEmptyString() { - final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); - attr.setStatus(""); - Assert.assertTrue(attr.isEmptyStatus()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given - * empty attribute. Must return true. - */ - @Test - public void testToIsEmptyValueWithNull() { - final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); - attr.setValue(null); - Assert.assertTrue(attr.isEmptyValue()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given - * empty attribute. Must return true. - */ - @Test - public void testToIsEmptyValue() { - Assert.assertTrue(EMPTYATTR.isEmptyValue()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the - * given empty attribute. Must return true. - */ - @Test - public void testToIsEmptyComplexValueWithNull() { - final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); - attr.setComplexValue(null); - Assert.assertTrue(attr.isEmptyComplexValue()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the - * given empty attribute. Must return true. - */ - @Test - public void testToIsEmptyComplexValueWithEmptyComplexValue() { - Assert.assertTrue(EMPTYATTR.isEmptyComplexValue()); - } - - /** - * Tests the {@link PersonalAttribute#clone()} method for the given attribute. - * Must return true. - */ - @Test - public void testCloneToComplexValue() { - Assert.assertNotSame(complexAttrValue, complexAttrValue.clone()); - } - - /** - * Tests the {@link PersonalAttribute#clone()} method for the given attribute. - * Must return true. - */ - @Test - public void testCloneToValue() { - Assert.assertNotSame(ATTR_VALUE, ATTR_VALUE.clone()); - } -} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/package-info.java.svn-base b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 452602210..000000000 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -/** - * This package provides all JUnit test classes. - */ -package eu.stork.peps.tests; - diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeProvidersMapTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeProvidersMapTestCase.java new file mode 100644 index 000000000..2e8cc2e62 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeProvidersMapTestCase.java @@ -0,0 +1,134 @@ +package eu.stork.peps.tests; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import eu.stork.peps.auth.commons.AttributeProvider; +import eu.stork.peps.auth.commons.AttributeProvidersMap; +import eu.stork.peps.auth.commons.AttributeSource; +import eu.stork.peps.auth.commons.Country; +import eu.stork.peps.auth.commons.IAttributeProvidersMap; +import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttributeList; + +/** + * The AttributeSource's Test Case. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: $, $Date: $ + */ +public class AttributeProvidersMapTestCase { + + @Test + public void testObjectOK1() { + IAttributeProvidersMap map = new AttributeProvidersMap(); + AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL"); + IPersonalAttributeList pal = new PersonalAttributeList(); + boolean outcome = false; + + //Add a single item + map.put(source, pal); + + if ( map.containsKey(source) ) { + outcome = true; + } + + assertTrue(outcome); + } + + @Test + public void testObjectOK2() { + IAttributeProvidersMap map = new AttributeProvidersMap(); + AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL"); + IPersonalAttributeList pal = new PersonalAttributeList(); + boolean outcome = false; + + //Add a single item + map.put(source, pal); + + if ( map.containsKey(source) ) { + if ( map.get(source)!=null ) { + outcome = true; + } + } + + assertTrue(outcome); + } + + @Test + public void testObjectOK3() { + IAttributeProvidersMap map = new AttributeProvidersMap(); + AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL"); + AttributeSource target = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL"); + IPersonalAttributeList pal = new PersonalAttributeList(); + boolean outcome = false; + + //Add a single item + map.put(source, pal); + + if ( map.containsKey(target) ) { + outcome = true; + } + + assertTrue(outcome); + } + + @Test + public void testObjectOK4() { + IAttributeProvidersMap map = new AttributeProvidersMap(); + AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL"); + AttributeSource target = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL"); + IPersonalAttributeList pal = new PersonalAttributeList(); + boolean outcome = false; + + //Add a single item + map.put(source, pal); + + if ( map.containsKey(target) ) { + if ( map.get(target)!=null ) { + outcome = true; + } + } + + assertTrue(outcome); + } + + @Test + public void testObjectNOK1() { + IAttributeProvidersMap map = new AttributeProvidersMap(); + AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL"); + AttributeSource target = new AttributeSource(new Country("ID1", "Name 1"), "URL"); + IPersonalAttributeList pal = new PersonalAttributeList(); + boolean outcome = false; + + //Add a single item + map.put(source, pal); + + if ( map.containsKey(target) ) { + outcome = true; + } + + assertFalse(outcome); + } + + @Test + public void testObjectNOK2() { + IAttributeProvidersMap map = new AttributeProvidersMap(); + AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL"); + AttributeSource target = new AttributeSource(new AttributeProvider("ID2", "Name 1"), "URL"); + IPersonalAttributeList pal = new PersonalAttributeList(); + boolean outcome = false; + + //Add a single item + map.put(source, pal); + + if ( map.containsKey(target) ) { + outcome = true; + } + + assertFalse(outcome); + } +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeSourceTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeSourceTestCase.java new file mode 100644 index 000000000..31cabb612 --- /dev/null +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeSourceTestCase.java @@ -0,0 +1,88 @@ +package eu.stork.peps.tests; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import eu.stork.peps.auth.commons.AttributeProvider; +import eu.stork.peps.auth.commons.AttributeSource; +import eu.stork.peps.auth.commons.Country; + +/** + * The AttributeSource's Test Case. + * + * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) + * + * @version $Revision: $, $Date: $ + */ +public final class AttributeSourceTestCase { + private AttributeSource ap1 = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL1"); + private AttributeSource ap2 = new AttributeSource(new AttributeProvider("ID2", "Name 2"), "URL2"); + private AttributeSource ap3 = new AttributeSource(new AttributeProvider("ID1", "Name 2"), "URL2"); + private AttributeSource ap4 = new AttributeSource(new AttributeProvider("ID1", "Name 2"), "URL1"); + private AttributeSource ap5 = new AttributeSource(new AttributeProvider("ID1", "Name 1"), "URL1"); + + private AttributeSource c1 = new AttributeSource(new Country("ID1", "Name 1"), "URL1"); + private AttributeSource c2 = new AttributeSource(new Country("ID2", "Name 2"), "URL2"); + private AttributeSource c3 = new AttributeSource(new Country("ID1", "Name 2"), "URL2"); + private AttributeSource c4 = new AttributeSource(new Country("ID1", "Name 2"), "URL1"); + private AttributeSource c5 = new AttributeSource(new Country("ID1", "Name 1"), "URL1"); + + @Test + public void testNotEquals1() { + assertFalse(ap1.equals(ap2)); + } + + @Test + public void testNotEquals2() { + assertFalse(ap1.equals(c1)); + } + + @Test + public void testNotEquals3() { + assertFalse(c1.equals(c2)); + } + + @Test + public void testEquals1() { + assertTrue(ap1.equals(ap3)); + } + + @Test + public void testEquals2() { + assertTrue(ap1.equals(ap4)); + } + + @Test + public void testEquals3() { + assertTrue(ap1.equals(ap5)); + } + + @Test + public void testEquals4() { + assertTrue(c1.equals(c3)); + } + + @Test + public void testEquals5() { + assertTrue(c1.equals(c4)); + } + + @Test + public void testEquals6() { + assertTrue(c1.equals(c5)); + } + + @Test + public void testEquals7() { + Object obj = ap5; + assertTrue(ap1.equals(obj)); + } + + @Test + public void testEquals8() { + Object obj = c5; + assertTrue(c1.equals(obj)); + } +} diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java index 4721c09b6..7052b320a 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java @@ -41,6 +41,16 @@ public final class PersonalAttributeListTestCase { */ private static final String ISAGEOVER_CONS = "isAgeOver"; + /** + * 1 constant value. + */ + private static final int ONE_CONS = 1; + + /** + * 2 constant value. + */ + private static final int TWO_CONS = 2; + /** * An empty attribute. */ @@ -92,6 +102,17 @@ public final class PersonalAttributeListTestCase { + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto,]:" + "Available;"; + /** + * Mix attribute list 2 string. + */ + private static final String STR_MIX_ATTR_LIST2 = + "isAgeOver:true:[15,]:Available;canonicalResidenceAddress:true:[" + + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT," + + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto,]:Available;" + + "mandateContent:true:[" + + "isJoint=\"isjoint\",typeOfPower=\"power\",ValidTo=\"validto\",validfrom=\"validfrom\",AQAA=\"3\",isChained=\"ischained\",]:" + + "Available;"; + /** * Attribute List example. */ @@ -408,7 +429,7 @@ public final class PersonalAttributeListTestCase { final PersonalAttributeList attrList = new PersonalAttributeList(1); attrList.add(attrValueUnder); attrList.add(attrValueOver); - Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); + Assert.assertEquals(SIMPLE_ATTRLIST3_REVERSE, attrList.toString()); } /** @@ -434,7 +455,7 @@ public final class PersonalAttributeListTestCase { final PersonalAttributeList attrList = new PersonalAttributeList(1); attrList.put(attrValueUnder.getName(), attrValueUnder); attrList.put(attrValueOver.getName(), attrValueOver); - Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); + Assert.assertEquals(SIMPLE_ATTRLIST3_REVERSE, attrList.toString()); } /** @@ -455,7 +476,7 @@ public final class PersonalAttributeListTestCase { public void testToStringFromPopulate() { final PersonalAttributeList attrList = new PersonalAttributeList(1); attrList.populate(SIMPLE_ATTRLIST3); - Assert.assertEquals(SIMPLE_ATTRLIST3, attrList.toString()); + Assert.assertEquals(SIMPLE_ATTRLIST3_REVERSE, attrList.toString()); } /** @@ -554,4 +575,173 @@ public final class PersonalAttributeListTestCase { Assert.assertEquals(ISAGEOVER_CONS, attr.getName()); } } + + /** + * Testing Personal Attribute List's GetOptionalAttributes method with empty attribute list. + */ + @Test + public void testGetOptionalAttributesWithEmptyList() { + final PersonalAttributeList pal = new PersonalAttributeList(); + Assert.assertTrue(pal.getOptionalAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's GetOptionalAttributes method without optional attributes. + */ + @Test + public void testGetOptionalAttributesWithoutOptional() { + final String strAttrList = + "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getOptionalAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's GetOptionalAttributes method with one optional attribute. + */ + @Test + public void testGetOptionalAttributesWithOneOptional() { + final String strAttrList = + "age:false:[]:;isAgeOver:true:[15,]:;isAgeOver:true:[18,]:;"; + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getOptionalAttributes().size() == ONE_CONS); + } + + /** + * Testing Personal Attribute List's GetOptionalAttributes method with two optional attribute. + */ + @Test + public void testGetOptionalAttributesWithOnlyOptional() { + final String strAttrList = + "age:false:[]:;isAgeOver:false:[18,]:;"; + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getOptionalAttributes().size() == TWO_CONS); + } + + /** + * Testing Personal Attribute List's getMandatoryAttributes method with empty attribute list. + */ + @Test + public void testGetMandatoryAttributesWithEmptyList() { + final PersonalAttributeList pal = new PersonalAttributeList(); + Assert.assertTrue(pal.getMandatoryAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getMandatoryAttributes method without mandatory attributes. + */ + @Test + public void testGetMandatoryAttributesWithoutMandatory() { + final String strAttrList = + "isAgeOver:false:[15,]:Available;isAgeOver:false:[18,]:Available;"; + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getMandatoryAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's GetMandatoryAttributes method with one mandatory attribute. + */ + @Test + public void testGetMandatoryAttributesWithOneMandatory() { + final String strAttrList = + "age:true:[]:;isAgeOver:false:[15,]:;isAgeOver:false:[18,]:;"; + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getMandatoryAttributes().size() == ONE_CONS); + } + + /** + * Testing Personal Attribute List's GetMandatoryAttributes method with two mandatory attribute. + */ + @Test + public void testGetMandatoryAttributesWithOnlyMandatory() { + final String strAttrList = + "age:true:[]:;isAgeOver:true:[18,]:;"; + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getMandatoryAttributes().size() == TWO_CONS); + } + + /** + * Testing Personal Attribute List's getSimpleValueAttributes method with empty attribute list. + */ + @Test + public void testGetSimpleValueAttributesWithEmptyList() { + final PersonalAttributeList pal = new PersonalAttributeList(); + Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getSimpleValueAttributes() method without simple attributes. + */ + @Test + public void testGetSimpleValueAttributesWithoutSimple() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(COMPLEX_ATTRLIST); + Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getSimpleValueAttributes() method with one simple attribute. + */ + @Test + public void testGetSimpleValueAttributesWithOneSimple() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(STR_MIX_ATTR_LIST); + Assert.assertTrue(pal.getSimpleValueAttributes().size() == ONE_CONS); + } + + /** + * Testing Personal Attribute List's GetMandatoryAttributes method with two simple attribute. + */ + @Test + public void testGetSimpleValueAttributesWithOnlySimple() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(SIMPLE_ATTRLIST3); + Assert.assertTrue(pal.getSimpleValueAttributes().size() == TWO_CONS); + } + + /** + * Testing Personal Attribute List's getComplexValueAttributes method with empty attribute list. + */ + @Test + public void testGetComplexAttributesWithEmptyList() { + final PersonalAttributeList pal = new PersonalAttributeList(); + Assert.assertTrue(pal.getComplexAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getComplexAttributes() method without complex attributes. + */ + @Test + public void testGetComplexAttributesWithoutSimple() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(SIMPLE_ATTRLIST2); + Assert.assertTrue(pal.getComplexAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getComplexAttributes() method with one complex attribute. + */ + @Test + public void testGetComplexAttributesWithOneComplex() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(STR_MIX_ATTR_LIST); + Assert.assertTrue(pal.getComplexAttributes().size() == ONE_CONS); + } + + /** + * Testing Personal Attribute List's GetMandatoryAttributes method with only two Complex attribute. + */ + @Test + public void testGetComplexAttributesWithOnlyComplex() { + final PersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(STR_MIX_ATTR_LIST2); + Assert.assertTrue(pal.getComplexAttributes().size() == TWO_CONS); + } + } diff --git a/id/server/stork2-commons/src/test/resources/.svn/all-wcprops b/id/server/stork2-commons/src/test/resources/.svn/all-wcprops deleted file mode 100644 index a3a21b424..000000000 --- a/id/server/stork2-commons/src/test/resources/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 63 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/resources -END -log4j.xml -K 25 -svn:wc:ra_dav:version-url -V 73 -/CITnet/svn/STORK2/!svn/ver/19/trunk/Commons/src/test/resources/log4j.xml -END diff --git a/id/server/stork2-commons/src/test/resources/.svn/entries b/id/server/stork2-commons/src/test/resources/.svn/entries deleted file mode 100644 index 8876112fb..000000000 --- a/id/server/stork2-commons/src/test/resources/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/Commons/src/test/resources -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -log4j.xml -file - - - - -2013-12-20T12:27:56.542475Z -4e990a84da0033594135b05cd01a9cdd -2013-07-25T08:54:09.995385Z -7 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -645 - diff --git a/id/server/stork2-commons/src/test/resources/.svn/text-base/log4j.xml.svn-base b/id/server/stork2-commons/src/test/resources/.svn/text-base/log4j.xml.svn-base deleted file mode 100644 index 0ad2ea9a4..000000000 --- a/id/server/stork2-commons/src/test/resources/.svn/text-base/log4j.xml.svn-base +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/id/server/stork2-saml-engine/Releases b/id/server/stork2-saml-engine/Releases new file mode 100644 index 000000000..0031906e6 --- /dev/null +++ b/id/server/stork2-saml-engine/Releases @@ -0,0 +1,83 @@ +Created 06-04-2011 + +Branch : STORKPEPS_0_5_UPDATE_06042011 +Date : 06-04-2011 +Changes: Updated SAML Engine version to 0.5.1. + +Branch : STORKPEPS_0_5_UPDATE_07072011 +Date : 07-07-2011 +Changes: Inserted HttpOnly HTTP Header to present XSS Attacks. + Removed logs. + +Branch : STORKPEPS_0_6_1 +Date : 07-11-2011 +Changes: Improved error exception handling (few changes on the exception Interceptors classes) + Improved Errors (three new categories classes: SysAdmin specific errors, CPEPS translation errors, Citizen errors) + Fix some minor bugs found. + New Copyright License added. + +Branch : STORKPEPS_0_6_1 +Date : 28-11-2011 +Changes: Complex value are displayed to citizen on the Citizen Consent Value form! + Fix minor bug found on check attribute value error code and message (saml token message, log messages, citizen messages). + +Branch : STORKPEPS_1_0 +Date : 02-12-2011 +Changes: Version Update to 1.0 + +Branch : STORKPEPS_1_1_0 +Date : 01-11-2013 +Changes: Version Update to 1.1.0 + Dependencies updated + Business Logic Part I changes + SAML Engine Changes merged (from SamlEngine/1.1.0/PEPS branch to be easier to merge this branch with trunk) + Fixed some errors on Test Case + Added SAML Engine Attributes to configuration files + Jersey dependency fix + +Branch : PEPS (Trunk) +Date : 02-12-2013 +Version: 1.1.1 +Changes: Version Update to 1.1.1 + Added AUB IdP URL to peps.xml + Business Logic Part I changes: + 1 ) APResponseAction changed: + *) created private variables with filtered attribute lists (optional/mandatory and + simple/complex attributes) to send to consent value page + 2) CitizenConsentAction changed: + *) Removed callbackURL (this is in the AuthenticationOnBehalfOfAction and CitizenAuthenticationAction classes) + 3) ColleagueRequestAction changed: + created private variables with filtered attribute lists (optional/mandatory) to send to consent type page + + 4) AUSPEPSSAML - Fixed bug when missing SP URL on configurations... wrong validateParameter method used. + 5) citizenConsent.jsp - some changes on page: + *) complex attributes and simple attributes were split + *) optional and mandatory attributes shown using bootstrap + *) fixed some issues on some labels + 6) presentConsent.jsp - some changes on page: + *) optional and mandatory attributes shown using bootstrap + *) fixed some issues on some labels + + 7) applicationContext.xml - few changes: + *) removed callbackURL from CitizenConsentAction + *) callbackURL added to AuthenticationOnBehalfOfAction and CitizenAuthenticationAction + *) changed from file to classpath the origin of configuration files (peps.xml, pepsUtil.properties and specific.properties) + + Integrated Anonimity funcionality + +Branch : PEPS (Trunk) +Date : 15-01-2014 +Version: 1.2.0 +Release: 2 +Changes: Updated Version to 1.2.0 + Added request flow of PV (incomplete) + Added AP mandatory attribute to get data for business attributes + *) based on configuration file it adds the missing attributes (eIdentifier, givenName, surname and dateOfBirth) or change isRequired to true. + changes original isRequired state in response + Fixed some bugs in Test Case + Changed some packages names on S-PEPS + Power Validation is complete now + Business Logic I and II integration (Request Complete!) + BL I doesn't redirect to BL II if all attributes already have value + Bug fix on normalization + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/.svn/all-wcprops deleted file mode 100644 index a663100ff..000000000 --- a/id/server/stork2-saml-engine/build/classes/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 52 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src -END diff --git a/id/server/stork2-saml-engine/build/classes/.svn/entries b/id/server/stork2-saml-engine/build/classes/.svn/entries deleted file mode 100644 index 7c9d1968f..000000000 --- a/id/server/stork2-saml-engine/build/classes/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -test -dir - -main -dir - diff --git a/id/server/stork2-saml-engine/build/classes/main/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/.svn/all-wcprops deleted file mode 100644 index f9f3d279b..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 56 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main -END diff --git a/id/server/stork2-saml-engine/build/classes/main/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/.svn/entries deleted file mode 100644 index dc9f007e9..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -java -dir - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/.svn/all-wcprops deleted file mode 100644 index 243067f06..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 61 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/.svn/entries deleted file mode 100644 index e4a01af0d..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -META-INF -dir - -eu -dir - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/all-wcprops deleted file mode 100644 index 8de21c7f2..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 70 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/META-INF -END -MANIFEST.MF -K 25 -svn:wc:ra_dav:version-url -V 82 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/META-INF/MANIFEST.MF -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/entries deleted file mode 100644 index 7ba7a8b7d..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/META-INF -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -MANIFEST.MF -file - - - - -2013-12-20T12:27:57.282475Z -b10f37c8bb1803d98c127a01d1a71cc5 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -39 - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base deleted file mode 100644 index 5e9495128..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/MANIFEST.MF b/id/server/stork2-saml-engine/build/classes/main/java/META-INF/MANIFEST.MF deleted file mode 100644 index 5e9495128..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/all-wcprops deleted file mode 100644 index c2550210f..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 64 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/entries deleted file mode 100644 index 842aef3b7..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -stork -dir - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/all-wcprops deleted file mode 100644 index 4e9c9df08..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 70 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/entries deleted file mode 100644 index 15424fef8..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -peps -dir - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/all-wcprops deleted file mode 100644 index f6653073c..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 75 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/entries deleted file mode 100644 index e80eb4f1f..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/.svn/entries +++ /dev/null @@ -1,37 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -auth -dir - -exceptions -dir - -configuration -dir - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/all-wcprops deleted file mode 100644 index ea1d0ba15..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 80 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/entries deleted file mode 100644 index 274a429ea..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -engine -dir - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops deleted file mode 100644 index a5df7ea64..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops +++ /dev/null @@ -1,35 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 87 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine -END -SAMLEngine.java -K 25 -svn:wc:ra_dav:version-url -V 103 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java -END -SAMLEngineUtils.java -K 25 -svn:wc:ra_dav:version-url -V 108 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 105 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/package-info.java -END -STORKSAMLEngine.java -K 25 -svn:wc:ra_dav:version-url -V 108 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java -END -X509PrincipalUtil.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/entries deleted file mode 100644 index ee72945c7..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/entries +++ /dev/null @@ -1,201 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -SAMLEngine.java -file - - - - -2013-12-20T12:27:57.446475Z -06e800364af96f515b5e2b2e6da3c423 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -13855 - -SAMLEngineUtils.java -file - - - - -2013-12-20T12:27:57.446475Z -de13d8f36c3a8d7c25ed55f94f43a663 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -28573 - -package-info.java -file - - - - -2013-12-20T12:27:57.446475Z -db9d14c008d5504a156cfa955db13657 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -796 - -STORKSAMLEngine.java -file - - - - -2013-12-20T12:27:57.446475Z -4899e34f046f8a1ba1292c1e0c2f972f -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -106833 - -X509PrincipalUtil.java -file - - - - -2013-12-20T12:27:57.446475Z -5b1c22a27ba0a0bfd4c0bd4ef1890205 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2296 - -core -dir - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base deleted file mode 100644 index f8f50fc74..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine; - -import java.io.ByteArrayInputStream; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import javax.xml.XMLConstants; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.opensaml.Configuration; -import org.opensaml.DefaultBootstrap; -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.xml.ConfigurationException; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.Marshaller; -import org.opensaml.xml.io.MarshallerFactory; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.io.Unmarshaller; -import org.opensaml.xml.io.UnmarshallerFactory; -import org.opensaml.xml.io.UnmarshallingException; -import org.opensaml.xml.parse.BasicParserPool; -import org.opensaml.xml.parse.XMLParserException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.auth.engine.core.STORKSAMLCore; -import eu.stork.peps.auth.engine.core.impl.SignModuleFactory; -import eu.stork.peps.configuration.ConfigurationCreator; -import eu.stork.peps.configuration.ConfigurationReader; -import eu.stork.peps.configuration.InstanceEngine; -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * Class that wraps the operations over SAML tokens, both generation and - * validation of SAML requests and SAML responses. Compliant with "OASIS Secure - * Assertion Markup Language (SAML) 2.0, May 2005", but taking into account - * STORK specific requirements. - * - * @author fjquevedo - * @author iinigo - */ - -public class SAMLEngine { - - /** The Document Builder Factory. */ - private static javax.xml.parsers.DocumentBuilderFactory dbf = null; - - /** The instance of every engine SAML. */ - private static Map instanceConfigs; - - /** The instances of SAML engine. */ - private static Map> instances; - - /** The logger. */ - private static final Logger LOG = LoggerFactory.getLogger(SAMLEngine.class - .getName()); - - /** The Constant MODULE_SIGN_CONF. */ - private static final String MODULE_SIGN_CONF = "SignatureConf"; - - /** The Constant SAML_ENGINE_SIGN_CLASS. */ - private static final String SAML_ENGINE_SIGN_CLASS = "class"; - - /** The Constant SAML_ENGINE_CONF. */ - private static final String SAML_ENGINE_CONF = "SamlEngineConf"; - - /** The Constant SAML_ENGINE_FILE_CONF. */ - private static final String SAML_ENGINE_FILE_CONF = "fileConfiguration"; - - /** The codification of characters. */ - private static final String CHARACTER_ENCODING = "UTF-8"; - - /** The SAML core. */ - private STORKSAMLCore samlCore; - - /** The Module of Signature. */ - private SAMLEngineSignI signer; - - - /** Initializes the SAML engine. */ - /** Configure Document Builder Factory. */ - - static { - startUp(); - loadDocumentFactory(); - } - - /** - * Load document factory. - */ - private static void loadDocumentFactory() { - - try { - dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance(); - dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - dbf.setNamespaceAware(true); - dbf.setIgnoringComments(true); - } catch (ParserConfigurationException e) { - LOG.error("Error parser configuration."); - throw new STORKSAMLEngineRuntimeException(e); - } - - } - - /** - * Method that initializes the basic services for the SAML Engine, like the - * OpenSAML library and the BouncyCastle provider. - */ - private static void startUp() { - - LOG.info("SAMLEngine: Initialize OpenSAML"); - - try { - DefaultBootstrap.bootstrap(); - } catch (ConfigurationException e) { - LOG.error("Problem initializing the OpenSAML library."); - throw new STORKSAMLEngineRuntimeException(e); - } - - LOG.debug("Read all file configurations. (instances of SAMLEngine)"); - try { - instanceConfigs = ConfigurationReader.readConfiguration(); - } catch (SAMLEngineException e) { - LOG.error("Error read configuration file."); - throw new STORKSAMLEngineRuntimeException(e); - } - - LOG.debug("Create all instaces of saml engine. (instances of SAMLEngine)"); - try { - instances = ConfigurationCreator - .createConfiguration(instanceConfigs); - } catch (STORKSAMLEngineException e) { - LOG.error("Error initializing instances from Stork SAML engine."); - throw new STORKSAMLEngineRuntimeException(e); - } - } - - /** - * Instantiates a new SAML engine. - */ - private SAMLEngine() { - - } - - /** - * Instantiates a new SAML engine. - * - * @param nameInstance the name instance - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - protected SAMLEngine(final String nameInstance) - throws STORKSAMLEngineException { - LOG.info("Loading Specific Configuration."); - - LOG.debug("Create intance of saml messages."); - - Map instance = instances.get(nameInstance); - - if (instance == null || instance.isEmpty()) { - LOG.error("Instance: " + nameInstance + " not exist."); - throw new STORKSAMLEngineException("Instance: " + nameInstance - + " not exist."); - } - - Properties properties = (Properties) instance.get(SAML_ENGINE_CONF); - - if (properties == null) { - LOG.error("SamlEngine.xml: not exist."); - throw new STORKSAMLEngineException("SamlEngine.xml: not exist."); - } - - samlCore = new STORKSAMLCore(properties); - - final HashMap propertiesSign = (HashMap) instance - .get(MODULE_SIGN_CONF); - - LOG.debug("Loading Module of sign."); - signer = SignModuleFactory.getInstance(propertiesSign - .get(SAML_ENGINE_SIGN_CLASS)); - - try { - LOG.info("Initialize module of sign."); - signer.init(propertiesSign.get(SAML_ENGINE_FILE_CONF)); - LOG.info("Load cryptographic service provider of module of sign."); - signer.loadCryptServiceProvider(); - } catch (SAMLEngineException e) { - LOG.error("Error create signature module: " - + propertiesSign.get(SAML_ENGINE_FILE_CONF)); - LOG.info("Exception" + e); - throw new STORKSAMLEngineException(e); - } - } - - /** - * Gets the Signer properties. - * - * @return the SAML Sign properties - */ - protected SAMLEngineSignI getSigner() { - return signer; - } - - /** - * Gets the SAML core properties. - * - * @return the SAML core properties - */ - protected final STORKSAMLCore getSamlCoreProperties() { - return samlCore; - } - - /** - * Method that transform the received SAML object into a byte array - * representation. - * - * @param samlToken the SAML token. - * - * @return the byte[] of the SAML token. - * - * @throws SAMLEngineException the SAML engine exception - */ - private byte[] marshall(final XMLObject samlToken) - throws SAMLEngineException { - - try { - javax.xml.parsers.DocumentBuilder docBuilder = null; - - final MarshallerFactory marshallerFactory = Configuration - .getMarshallerFactory(); - - final Marshaller marshaller = marshallerFactory - .getMarshaller(samlToken); - - docBuilder = dbf.newDocumentBuilder(); - - final Document doc = docBuilder.newDocument(); - - marshaller.marshall(samlToken, doc); - - // Obtain a byte array representation of the marshalled SAML object - final DOMSource domSource = new DOMSource(doc); - final StringWriter writer = new StringWriter(); - final StreamResult result = new StreamResult(writer); - final TransformerFactory transFactory = TransformerFactory - .newInstance(); - Transformer transformer; - - transformer = transFactory.newTransformer(); - transformer.transform(domSource, result); - LOG.debug("SAML request \n"+ writer.toString()); - return writer.toString().getBytes(CHARACTER_ENCODING); - - } catch (ParserConfigurationException e) { - LOG.error("ParserConfigurationException."); - throw new SAMLEngineException(e); - } catch (MarshallingException e) { - LOG.error("MarshallingException."); - throw new SAMLEngineException(e); - } catch (TransformerConfigurationException e) { - LOG.error("TransformerConfigurationException."); - throw new SAMLEngineException(e); - } catch (TransformerException e) { - LOG.error("TransformerException."); - throw new SAMLEngineException(e); - } catch (UnsupportedEncodingException e) { - LOG.error("UnsupportedEncodingException: " + CHARACTER_ENCODING); - throw new SAMLEngineException(e); - } - } - - /** - * Method that signs a SAML Token. - * - * @param tokenSaml the token SAML - * - * @return the SAML object sign - * - * @throws SAMLEngineException the SAML engine exception - */ - private SignableSAMLObject sign(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.debug("Sign SamlToken."); - signer.sign(tokenSaml); - return tokenSaml; - } - - /** - * Sign and transform to byte array. - * - * @param samlToken the SAML token - * - * @return the byte[] of the SAML token - * - * @throws SAMLEngineException the SAML engine exception - */ - protected final byte[] signAndMarshall(final SignableSAMLObject samlToken) - throws SAMLEngineException { - LOG.debug("Marshall Saml Token."); - SignableSAMLObject signElement = sign(samlToken); - return marshall(signElement); - } - - /** - * Method that unmarshalls a SAML Object from a byte array representation to - * an XML Object. - * - * @param samlToken Byte array representation of a SAML Object - * - * @return XML Object (superclass of SAMLObject) - * - * @throws SAMLEngineException the SAML engine exception - */ - protected final XMLObject unmarshall(final byte[] samlToken) - throws SAMLEngineException { - try { - // Get parser pool manager - final BasicParserPool ppMgr = new BasicParserPool(); - // Note: this is necessary due to an unresolved Xerces deferred DOM - // issue/bug - final HashMap features = new HashMap(); - features.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); - ppMgr.setBuilderFeatures(features); - - ppMgr.setNamespaceAware(true); - - // Parse SAMLToken - Document document = ppMgr.parse(new ByteArrayInputStream(samlToken)); - if (document != null){ - final Element root = document.getDocumentElement(); - // Get appropriate unmarshaller - final UnmarshallerFactory unmarshallerFact = Configuration.getUnmarshallerFactory(); - // Unmarshall using the SAML Token root element - if (unmarshallerFact != null && root != null){ - final Unmarshaller unmarshaller = unmarshallerFact.getUnmarshaller(root); - try { - return unmarshaller.unmarshall(root); - } catch (NullPointerException e){ - LOG.error("Error element tag incomplet or null."); - throw new SAMLEngineException("NullPointerException", e); - } - } else { - LOG.error("Error element tag incomplet or null."); - throw new SAMLEngineException("NullPointerException : unmarshallerFact or root is null"); - } - } else { - LOG.error("Error element tag incomplet or null."); - throw new SAMLEngineException("NullPointerException : document is null"); - } - } catch (XMLParserException e) { - LOG.error("XML Parsing Error.", e); - throw new SAMLEngineException(e); - } catch (UnmarshallingException e) { - LOG.error("TransformerException.", e); - throw new SAMLEngineException(e); - } catch (NullPointerException e) { - LOG.error("Error element tag incomplet or null.", e); - throw new SAMLEngineException(e); - } - } - - /** - * Method that validates an XML Signature contained in a SAML Token. - * - * @param samlToken the SAML token - * - * @return the SAML object - * - * @throws SAMLEngineException the SAML engine exception - */ - protected final SAMLObject validateSignature( - final SignableSAMLObject samlToken) throws SAMLEngineException { - - LOG.info("Validate Signature"); - signer.validateSignature(samlToken); - - return samlToken; - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base deleted file mode 100644 index 60f7c3091..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base +++ /dev/null @@ -1,833 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.commons.lang.StringUtils; -import org.joda.time.DateTime; -import org.opensaml.Configuration; -import org.opensaml.common.SAMLVersion; -import org.opensaml.common.impl.SecureRandomIdentifierGenerator; -import org.opensaml.saml2.common.Extensions; -import org.opensaml.saml2.common.impl.ExtensionsBuilder; -import org.opensaml.saml2.core.Assertion; -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.core.AttributeQuery; -import org.opensaml.saml2.core.AttributeValue; -import org.opensaml.saml2.core.AuthnContext; -import org.opensaml.saml2.core.AuthnRequest; -import org.opensaml.saml2.core.AuthnStatement; -import org.opensaml.saml2.core.Issuer; -import org.opensaml.saml2.core.NameID; -import org.opensaml.saml2.core.Response; -import org.opensaml.saml2.core.Status; -import org.opensaml.saml2.core.StatusCode; -import org.opensaml.saml2.core.StatusMessage; -import org.opensaml.saml2.core.Subject; -import org.opensaml.saml2.core.SubjectConfirmation; -import org.opensaml.saml2.core.SubjectConfirmationData; -import org.opensaml.saml2.core.SubjectLocality; -import org.opensaml.saml2.core.impl.AssertionBuilder; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.schema.XSAny; -import org.opensaml.xml.schema.XSString; -import org.opensaml.xml.signature.KeyInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -import eu.stork.peps.auth.engine.core.QAAAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.SAMLCore; -import eu.stork.peps.auth.engine.core.SPApplication; -import eu.stork.peps.auth.engine.core.SPCountry; -import eu.stork.peps.auth.engine.core.SPInstitution; -import eu.stork.peps.auth.engine.core.SPSector; -import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * The Class SAMLEngineUtils. - * - * @author fjquevedo - * @author iinigo - */ -public final class SAMLEngineUtils { - - /** The Constant UTF_8. */ - public static final String UTF_8 = "UTF-8"; - - /** The Constant SHA_512. */ - public static final String SHA_512 = "SHA-512"; - - - /** The generator. */ - private static SecureRandomIdentifierGenerator generator; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(SAMLEngineUtils.class.getName()); - - /** - * Method that generates a random value according to NCName grammar. - * - * NCName ::= NCNameStartChar NCNameChar* NCNameChar ::= NameChar - ':' - * NCNameStartChar ::= Letter | '_' NameStartChar ::= ":" | [A-Z] | "_" | - * [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | - * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | - * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] - * NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | - * [#x203F-#x2040] Name ::= NameStartChar (NameChar)* Letter ::= BaseChar | - * Ideographic BaseChar ::= [#x0041-#x005A] | [#x0061-#x007A] | - * [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | - * [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | - * [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | - * [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | - * [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | - * [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | - * [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | - * [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | - * #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | - * [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | - * [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | - * [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | - * [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | - * [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | - * [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | - * [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | - * #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | - * [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | - * #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | - * [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | - * [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | - * [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | - * [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | - * [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | - * [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | - * [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | - * [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | - * [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | - * [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | - * [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | - * [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | - * #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | - * [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | - * [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | - * [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | - * [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | - * #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | - * #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | - * #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | - * [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | - * [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | - * [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | - * [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | - * [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | - * [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | - * [#xAC00-#xD7A3] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | - * [#x3021-#x3029] - * - * @return Random ID value - */ - - //Initialization of a generator of identifiers for all token SAML. - - static { - loadRandomIdentifierGenerator(); - } - - - /** - * Load random identifier generator. - * - *@throws STORKSAMLEngineRuntimeException the STORKSAML engine runtime exception - */ - private static void loadRandomIdentifierGenerator() { - - try { - generator = new SecureRandomIdentifierGenerator(); - } catch (NoSuchAlgorithmException ex) { - LOG.error("Error init SecureRandomIdentifierGenerator", ex); - throw new STORKSAMLEngineRuntimeException(ex); - } - - } - - /** - * Creates the SAML object. - * - * @param qname the QName - * - * @return the XML object - */ - public static XMLObject createSamlObject(final QName qname) { - return Configuration.getBuilderFactory().getBuilder(qname).buildObject( - qname); - } - - /** - * Creates the SAML object. - * - * @param qname the quality name - * @param qname1 the qname1 - * - * @return the xML object - */ - public static XMLObject createSamlObject(final QName qname, - final QName qname1) { - return Configuration.getBuilderFactory().getBuilder(qname1) - .buildObject(qname, qname1); - } - - /** - * Encode value with an specific algorithm. - * - * @param value the value - * @param alg the algorithm - * - * @return the string - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static String encode(final String value, final String alg) - throws STORKSAMLEngineException { - LOG.debug("Encode value with " + alg + " algorithm."); - byte[] buffer; - - final StringBuffer hash = new StringBuffer(""); - try { - buffer = value.getBytes(UTF_8); - MessageDigest msgDig; - msgDig = MessageDigest.getInstance(alg); - - - msgDig.update(buffer); - final byte[] digest = msgDig.digest(); - - final int signedByte = 0xff; - for (byte aux : digest) { - final int byt = aux & signedByte; - if (Integer.toHexString(byt).length() == 1) { - hash.append('0'); - } - hash.append(Integer.toHexString(byt)); - } - - } catch (UnsupportedEncodingException e1) { - LOG.error("UnsupportedEncodingException: " + UTF_8); - throw new STORKSAMLEngineException(e1); - } catch (NoSuchAlgorithmException e) { - LOG.error("NoSuchAlgorithmException: " + alg); - throw new STORKSAMLEngineException(e); - } - - return hash.toString(); - } - - /** - * Generate assertion. - * - * @param version the version - * @param identifier the identifier - * @param issueInstant the issue instant - * @param issuer the issuer - * - * @return the assertion - */ - public static Assertion generateAssertion(final SAMLVersion version, - final String identifier, final DateTime issueInstant, - final Issuer issuer) { - final AssertionBuilder assertionBuilder = new AssertionBuilder(); - final Assertion assertion = assertionBuilder.buildObject(); - assertion.setVersion(version); - assertion.setID(identifier); - assertion.setIssueInstant(issueInstant); - - // - assertion.setIssuer(issuer); - return assertion; - } - - /** - * Generate authentication statement. - * - * @param authnInstant the authentication instant - * @param authnContext the authentication context - * - * @return the authentication statement - */ - public static AuthnStatement generateAthnStatement(final DateTime authnInstant, - final AuthnContext authnContext) { - // - final AuthnStatement authnStatement = (AuthnStatement) SAMLEngineUtils - .createSamlObject(AuthnStatement.DEFAULT_ELEMENT_NAME); - - authnStatement.setAuthnInstant(authnInstant); - authnStatement.setAuthnContext(authnContext); - - return authnStatement; - } - - - - - - /** - * Generate attribute from a list of values. - * - * @param name the name of the attribute. - * @param status the status of the parameter: "Available", "NotAvailable" or - * "Withheld". - * @param values the value of the attribute. - * @param isHashing the is hashing with "SHA-512" algorithm. - * @return the attribute - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static Attribute generateAttrComplex(final String name, - final String status, final Map values, - final boolean isHashing) throws STORKSAMLEngineException { - LOG.debug("Generate attribute complex: " + name); - final Attribute attribute = (Attribute) SAMLEngineUtils - .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); - - attribute.setName(name); - attribute.setNameFormat(Attribute.URI_REFERENCE); - - attribute.getUnknownAttributes().put( - new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", - SAMLCore.STORK10_PREFIX.getValue()), status); - - if (!values.isEmpty()) { - LOG.debug("Add attribute values."); - - // Create an attribute that contains all XSAny elements. - final XSAny attrValue = (XSAny) SAMLEngineUtils.createSamlObject( - AttributeValue.DEFAULT_ELEMENT_NAME, XSAny.TYPE_NAME); - - final Iterator> iterator = values.entrySet() - .iterator(); - while (iterator.hasNext()) { - final Map.Entry pairs = iterator.next(); - - final String value = pairs.getValue(); - - if (StringUtils.isNotBlank(value)) { - // Create the attribute statement - final XSAny attrValueSimple = (XSAny) SAMLEngineUtils - .createSamlObject(new QName(SAMLCore.STORK10_NS.getValue(), - pairs.getKey().toString(), - SAMLCore.STORK10_PREFIX.getValue()), XSAny.TYPE_NAME); - - // if it's necessary encode the information. - if (isHashing) { - attrValueSimple - .setTextContent(encode(value, SHA_512)); - } else { - attrValueSimple.setTextContent(value); - } - - attrValue.getUnknownXMLObjects().add(attrValueSimple); - attribute.getAttributeValues().add(attrValue); - } - } - - } - return attribute; - } - - /** - * Generate extension. - * - * @return the extensions - */ - public static Extensions generateExtension() { - final ExtensionsBuilder extensionsBuilder = new ExtensionsBuilder(); - return extensionsBuilder.buildObject( - "urn:oasis:names:tc:SAML:2.0:protocol", "Extensions", "saml2p"); - } - - - - - /** - * Generate issuer. - * - * @return the issuer - */ - public static Issuer generateIssuer() { - return (Issuer) SAMLEngineUtils - .createSamlObject(Issuer.DEFAULT_ELEMENT_NAME); - } - - /** - * Generate key info. - * - * @return the key info - */ - public static KeyInfo generateKeyInfo() { - return (KeyInfo) SAMLEngineUtils - .createSamlObject(KeyInfo.DEFAULT_ELEMENT_NAME); - } - - /** - * Generate name id. - * - * @return the name id - */ - public static NameID generateNameID() { - return (NameID) SAMLEngineUtils - .createSamlObject(NameID.DEFAULT_ELEMENT_NAME); - } - - /** - * Generate name id. - * - * @param nameQualifier the name qualifier - * @param format the format - * @param spNameQualifier the sP name qualifier - * - * @return the name id - */ - public static NameID generateNameID(final String nameQualifier, - final String format, final String spNameQualifier) { - // - final NameID nameId = (NameID) Configuration.getBuilderFactory() - .getBuilder(NameID.DEFAULT_ELEMENT_NAME).buildObject( - NameID.DEFAULT_ELEMENT_NAME); - - // optional - nameId.setNameQualifier(nameQualifier); - - // optional - nameId.setFormat(format); - - // optional - nameId.setSPNameQualifier(spNameQualifier); - - return nameId; - } - - /** - * Generate NCName. - * - * @return the string - */ - public static String generateNCName() { - return generator.generateIdentifier(); - } - - - /** - * Generate the quality authentication assurance level. - * - * @param qaal the level of quality authentication assurance. - * - * @return the quality authentication assurance attribute - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static QAAAttribute generateQAAAttribute(final int qaal) - throws STORKSAMLEngineException { - LOG.debug("Generate QAAAttribute."); - - final QAAAttribute qaaAttribute = (QAAAttribute) SAMLEngineUtils - .createSamlObject(QAAAttribute.DEF_ELEMENT_NAME); - qaaAttribute.setQaaLevel(String.valueOf(qaal)); - return qaaAttribute; - } - - /** - * Generate requested attribute. - * - * @param name the name - * @param friendlyName the friendly name - * @param isRequired the is required - * @param value the value - * - * @return the requested attribute - */ - public static RequestedAttribute generateReqAuthnAttributeSimple( - final String name, final String friendlyName, - final String isRequired, final List value) { - LOG.debug("Generate the requested attribute."); - - final RequestedAttribute requested = (RequestedAttribute) SAMLEngineUtils - .createSamlObject(RequestedAttribute.DEF_ELEMENT_NAME); - requested.setName(name); - requested.setNameFormat(RequestedAttribute.URI_REFERENCE); - - requested.setFriendlyName(friendlyName); - - requested.setIsRequired(isRequired); - - // The value is optional in an authentication request. - if (!value.isEmpty()) { - for (int nextValue = 0; nextValue < value.size(); nextValue++) { - final String valor = value.get(nextValue); - if (StringUtils.isNotBlank(valor)) { - - if(!name.equals("http://www.stork.gov.eu/1.0/signedDoc")){ - - // Create the attribute statement - final XSAny attrValue = (XSAny) SAMLEngineUtils - .createSamlObject( - new QName(SAMLCore.STORK10_NS.getValue(), - "AttributeValue", - SAMLCore.STORK10_PREFIX.getValue()), - XSAny.TYPE_NAME); - - attrValue.setTextContent(valor.trim()); - requested.getAttributeValues().add(attrValue); - - }else{ - - DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); - domFactory.setNamespaceAware(true); - Document document = null; - DocumentBuilder builder; - - // Parse the signedDoc value into an XML DOM Document - try { - builder = domFactory.newDocumentBuilder(); - InputStream is; - is = new ByteArrayInputStream(valor.trim().getBytes("UTF-8")); - document = builder.parse(is); - is.close(); - } catch (SAXException e1) { - LOG.error("SAX Error while parsing signModule attribute", e1); - throw new STORKSAMLEngineRuntimeException(e1); - } catch (ParserConfigurationException e2) { - LOG.error("Parser Configuration Error while parsing signModule attribute", e2); - throw new STORKSAMLEngineRuntimeException(e2); - } catch (UnsupportedEncodingException e3) { - LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); - throw new STORKSAMLEngineRuntimeException(e3); - } catch (IOException e4) { - LOG.error("IO Error while parsing signModule attribute", e4); - throw new STORKSAMLEngineRuntimeException(e4); - } - - // Create the XML statement(this will be overwritten with the previous DOM structure) - final XSAny xmlValue = (XSAny) SAMLEngineUtils - .createSamlObject( - new QName(SAMLCore.STORK10_NS.getValue(), - "XMLValue", - SAMLCore.STORK10_PREFIX.getValue()), - XSAny.TYPE_NAME); - - //Set the signedDoc XML content to this element - xmlValue.setDOM(document.getDocumentElement()); - - // Create the attribute statement - final XSAny attrValue = (XSAny) SAMLEngineUtils - .createSamlObject( - new QName(SAMLCore.STORK10_NS.getValue(), - "AttributeValue", - SAMLCore.STORK10_PREFIX.getValue()), - XSAny.TYPE_NAME); - - //Add previous signedDocXML to the AttributeValue Element - attrValue.getUnknownXMLObjects().add(xmlValue); - - requested.getAttributeValues().add(attrValue); - } - - - } - } - } - - return requested; - } - - /** - * Generate response. - * - * @param version the version - * @param identifier the identifier - * @param issueInstant the issue instant - * @param status the status - * - * @return the response - */ - public static Response generateResponse(final SAMLVersion version, - final String identifier, final DateTime issueInstant, - final Status status) { - final Response response = (Response) SAMLEngineUtils - .createSamlObject(Response.DEFAULT_ELEMENT_NAME); - response.setID(identifier); - response.setIssueInstant(issueInstant); - response.setStatus(status); - return response; - } - - /** - * Method that generates a SAML Authentication Request basing on the - * provided information. - * - * @param identifier the identifier - * @param version the version - * @param issueInstant the issue instant - * - * @return the authentication request - */ - public static AuthnRequest generateSAMLAuthnRequest(final String identifier, - final SAMLVersion version, final DateTime issueInstant) { - LOG.debug("Generate basic authentication request."); - final AuthnRequest authnRequest = (AuthnRequest) SAMLEngineUtils - .createSamlObject(AuthnRequest.DEFAULT_ELEMENT_NAME); - - authnRequest.setID(identifier); - authnRequest.setVersion(version); - authnRequest.setIssueInstant(issueInstant); - return authnRequest; - } - - public static AttributeQuery generateSAMLAttrQueryRequest(final String identifier, - final SAMLVersion version, final DateTime issueInstant) { - LOG.debug("Generate attribute query request."); - final AttributeQuery attrQueryRequest = (AttributeQuery) SAMLEngineUtils - .createSamlObject(AttributeQuery.DEFAULT_ELEMENT_NAME); - - attrQueryRequest.setID(identifier); - attrQueryRequest.setVersion(version); - attrQueryRequest.setIssueInstant(issueInstant); - return attrQueryRequest; - } - - /** - * Generate service provider application. - * - * @param spApplication the service provider application - * - * @return the sP application - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SPApplication generateSPApplication(final String spApplication) - throws STORKSAMLEngineException { - LOG.debug("Generate SPApplication."); - - final SPApplication applicationAttr = (SPApplication) SAMLEngineUtils - .createSamlObject(SPApplication.DEF_ELEMENT_NAME); - applicationAttr.setSPApplication(spApplication); - return applicationAttr; - } - - /** - * Generate service provider country. - * - * @param spCountry the service provider country - * - * @return the service provider country - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SPCountry generateSPCountry(final String spCountry) - throws STORKSAMLEngineException { - LOG.debug("Generate SPApplication."); - - final SPCountry countryAttribute = (SPCountry) SAMLEngineUtils - .createSamlObject(SPCountry.DEF_ELEMENT_NAME); - countryAttribute.setSPCountry(spCountry); - return countryAttribute; - } - - /** - * Generate service provider institution. - * - * @param spInstitution the service provider institution - * - * @return the service provider institution - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SPInstitution generateSPInstitution(final String spInstitution) - throws STORKSAMLEngineException { - LOG.debug("Generate SPInstitution."); - - final SPInstitution institutionAttr = (SPInstitution) SAMLEngineUtils - .createSamlObject(SPInstitution.DEF_ELEMENT_NAME); - institutionAttr.setSPInstitution(spInstitution); - return institutionAttr; - } - - /** - * Generate service provider sector. - * - * @param spSector the service provider sector - * - * @return the service provider sector - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SPSector generateSPSector(final String spSector) - throws STORKSAMLEngineException { - LOG.debug("Generate SPSector."); - - final SPSector sectorAttribute = (SPSector) SAMLEngineUtils - .createSamlObject(SPSector.DEF_ELEMENT_NAME); - sectorAttribute.setSPSector(spSector); - return sectorAttribute; - } - - /** - * Generate status. - * - * @param statusCode the status code - * - * @return the status - */ - public static Status generateStatus(final StatusCode statusCode) { - final Status status = (Status) SAMLEngineUtils - .createSamlObject(Status.DEFAULT_ELEMENT_NAME); - status.setStatusCode(statusCode); - return status; - } - - /** - * Generate status code. - * - * @param value the value - * - * @return the status code - */ - public static StatusCode generateStatusCode(final String value) { - final StatusCode statusCode = (StatusCode) SAMLEngineUtils - .createSamlObject(StatusCode.DEFAULT_ELEMENT_NAME); - statusCode.setValue(value); - return statusCode; - } - - - /** - * Generate status message. - * - * @param message the message - * - * @return the status message - */ - public static StatusMessage generateStatusMessage(final String message) { - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .createSamlObject(StatusMessage.DEFAULT_ELEMENT_NAME); - statusMessage.setMessage(message); - return statusMessage; - } - - /** - * Generate subject. - * - * @return the subject - */ - public static Subject generateSubject() { - return (Subject) SAMLEngineUtils - .createSamlObject(Subject.DEFAULT_ELEMENT_NAME); - } - - /** - * Generate subject confirmation. - * - * @param method the method - * @param data the data - * - * @return the subject confirmation - */ - public static SubjectConfirmation generateSubjectConfirmation( - final String method, final SubjectConfirmationData data) { - final SubjectConfirmation subjectConf = (SubjectConfirmation) Configuration - .getBuilderFactory().getBuilder( - SubjectConfirmation.DEFAULT_ELEMENT_NAME).buildObject( - SubjectConfirmation.DEFAULT_ELEMENT_NAME); - - subjectConf.setMethod(method); - - subjectConf.setSubjectConfirmationData(data); - - return subjectConf; - } - - - /** - * Generate subject confirmation data. - * - * @param notOnOrAfter the not on or after - * @param recipient the recipient - * @param inResponseTo the in response to - * - * @return the subject confirmation data - */ - public static SubjectConfirmationData generateSubjectConfirmationData( - final DateTime notOnOrAfter, final String recipient, - final String inResponseTo) { - final SubjectConfirmationData subjectConfData = (SubjectConfirmationData) SAMLEngineUtils - .createSamlObject(SubjectConfirmationData.DEFAULT_ELEMENT_NAME); - subjectConfData.setNotOnOrAfter(notOnOrAfter); - subjectConfData.setRecipient(recipient); - subjectConfData.setInResponseTo(inResponseTo); - return subjectConfData; - } - - - /** - * Generate subject locality. - * - * @param address the address - * - * @return the subject locality - */ - public static SubjectLocality generateSubjectLocality(final String address) { - final SubjectLocality subjectLocality = (SubjectLocality) SAMLEngineUtils - .createSamlObject(SubjectLocality.DEFAULT_ELEMENT_NAME); - subjectLocality.setAddress(address); - return subjectLocality; - } - - - - - /** - * Method that returns the current time. - * - * @return the current time - */ - public static DateTime getCurrentTime() { - return new DateTime(); - } - - - /** - * Instantiates a new SAML engine utilities. - */ - private SAMLEngineUtils() { - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base deleted file mode 100644 index 3cac2f637..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base +++ /dev/null @@ -1,2983 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.apache.commons.lang.StringUtils; -import org.bouncycastle.jce.X509Principal; -import org.joda.time.DateTime; -import org.opensaml.Configuration; -import org.opensaml.common.SAMLVersion; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.common.Extensions; -import org.opensaml.saml2.core.Assertion; -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.core.AttributeQuery; -import org.opensaml.saml2.core.AttributeStatement; -import org.opensaml.saml2.core.AttributeValue; -import org.opensaml.saml2.core.Audience; -import org.opensaml.saml2.core.AudienceRestriction; -import org.opensaml.saml2.core.AuthnContext; -import org.opensaml.saml2.core.AuthnContextDecl; -import org.opensaml.saml2.core.AuthnRequest; -import org.opensaml.saml2.core.AuthnStatement; -import org.opensaml.saml2.core.Conditions; -import org.opensaml.saml2.core.Issuer; -import org.opensaml.saml2.core.NameID; -import org.opensaml.saml2.core.OneTimeUse; -import org.opensaml.saml2.core.Response; -import org.opensaml.saml2.core.Status; -import org.opensaml.saml2.core.StatusCode; -import org.opensaml.saml2.core.StatusMessage; -import org.opensaml.saml2.core.Subject; -import org.opensaml.saml2.core.SubjectConfirmation; -import org.opensaml.saml2.core.SubjectConfirmationData; -import org.opensaml.saml2.core.SubjectLocality; -import org.opensaml.saml2.core.impl.SubjectConfirmationBuilder; -import org.opensaml.xml.Namespace; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.schema.XSAny; -import org.opensaml.xml.schema.impl.XSAnyBuilder; -import org.opensaml.xml.schema.impl.XSAnyImpl; -import org.opensaml.xml.schema.impl.XSAnyMarshaller; -import org.opensaml.xml.schema.impl.XSAnyUnmarshaller; -import org.opensaml.xml.schema.impl.XSStringImpl; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.util.Base64; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; -import org.opensaml.xml.validation.ValidatorSuite; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAttrQueryRequest; -import eu.stork.peps.auth.commons.STORKAttrQueryResponse; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.commons.STORKAuthnResponse; -import eu.stork.peps.auth.engine.core.AuthenticationAttributes; -import eu.stork.peps.auth.engine.core.CitizenCountryCode; -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; -import eu.stork.peps.auth.engine.core.EIDSectorShare; -import eu.stork.peps.auth.engine.core.QAAAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttributes; -import eu.stork.peps.auth.engine.core.SAMLCore; -import eu.stork.peps.auth.engine.core.SPApplication; -import eu.stork.peps.auth.engine.core.SPCountry; -import eu.stork.peps.auth.engine.core.SPID; -import eu.stork.peps.auth.engine.core.SPInformation; -import eu.stork.peps.auth.engine.core.SPInstitution; -import eu.stork.peps.auth.engine.core.SPSector; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; -import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesBuilder; -import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesMarshaller; -import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeBuilder; -import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeMarshaller; -import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareBuilder; -import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareMarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareBuilder; -import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareMarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDSectorShareBuilder; -import eu.stork.peps.auth.engine.core.impl.EIDSectorShareMarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDSectorShareUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.QAAAttributeBuilder; -import eu.stork.peps.auth.engine.core.impl.QAAAttributeMarshaller; -import eu.stork.peps.auth.engine.core.impl.QAAAttributeUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributeBuilder; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributeMarshaller; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributeUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributesBuilder; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributesMarshaller; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributesUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPApplicationBuilder; -import eu.stork.peps.auth.engine.core.impl.SPApplicationMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPApplicationUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPCountryBuilder; -import eu.stork.peps.auth.engine.core.impl.SPCountryMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPCountryUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPIDBuilder; -import eu.stork.peps.auth.engine.core.impl.SPIDMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPIDUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPInformationBuilder; -import eu.stork.peps.auth.engine.core.impl.SPInformationMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPInformationUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPInstitutionBuilder; -import eu.stork.peps.auth.engine.core.impl.SPInstitutionMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPInstitutionUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPSectorBuilder; -import eu.stork.peps.auth.engine.core.impl.SPSectorMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPSectorUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesBuilder; -import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesMarshaller; -import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesUnmarshaller; -import eu.stork.peps.auth.engine.core.validator.ExtensionsSchemaValidator; -import eu.stork.peps.auth.engine.core.validator.QAAAttributeSchemaValidator; -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * Class that wraps the operations over SAML tokens, both generation and - * validation of SAML STORK requests and SAML STORK responses. Complaint with - * "OASIS Secure Assertion Markup Language (SAML) 2.0, May 2005", but taking - * into account STORK specific requirements. - * - * @author fjquevedo - * @author iinigo - */ -public final class STORKSAMLEngine extends SAMLEngine { - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(STORKSAMLEngine.class.getName()); - - private static final String ATTRIBUTE_EMPTY_LITERAL = "Attribute name is null or empty."; - /** - * Gets the single instance of STORKSAMLEngine. - * - * @param nameInstance the name instance - * - * @return single instance of STORKSAMLEngine - */ - public static synchronized STORKSAMLEngine getInstance( - final String nameInstance) { - STORKSAMLEngine engine = null; - LOG.info("Get instance: " + nameInstance); - try { - engine = new STORKSAMLEngine(nameInstance.trim()); - } catch (Exception e) { - LOG.error("Error get instance: " + nameInstance); - } - return engine; - } - - /** - * Instantiate a new STORKSAML engine. - * - * @param nameInstance the name instance - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private STORKSAMLEngine(final String nameInstance) - throws STORKSAMLEngineException { - // Initialization OpenSAML. - super(nameInstance); - LOG.info("Register STORK objects provider."); - Configuration.registerObjectProvider(QAAAttribute.DEF_ELEMENT_NAME, - new QAAAttributeBuilder(), new QAAAttributeMarshaller(), - new QAAAttributeUnmarshaller()); - - Configuration.registerObjectProvider(EIDSectorShare.DEF_ELEMENT_NAME, - new EIDSectorShareBuilder(), new EIDSectorShareMarshaller(), - new EIDSectorShareUnmarshaller()); - - Configuration.registerObjectProvider( - EIDCrossSectorShare.DEF_ELEMENT_NAME, - new EIDCrossSectorShareBuilder(), - new EIDCrossSectorShareMarshaller(), - new EIDCrossSectorShareUnmarshaller()); - - Configuration.registerObjectProvider( - EIDCrossBorderShare.DEF_ELEMENT_NAME, - new EIDCrossBorderShareBuilder(), - new EIDCrossBorderShareMarshaller(), - new EIDCrossBorderShareUnmarshaller()); - - Configuration.registerObjectProvider(SPSector.DEF_ELEMENT_NAME, - new SPSectorBuilder(), new SPSectorMarshaller(), - new SPSectorUnmarshaller()); - - Configuration.registerObjectProvider(SPInstitution.DEF_ELEMENT_NAME, - new SPInstitutionBuilder(), new SPInstitutionMarshaller(), - new SPInstitutionUnmarshaller()); - - Configuration.registerObjectProvider(SPApplication.DEF_ELEMENT_NAME, - new SPApplicationBuilder(), new SPApplicationMarshaller(), - new SPApplicationUnmarshaller()); - - Configuration.registerObjectProvider(SPCountry.DEF_ELEMENT_NAME, - new SPCountryBuilder(), new SPCountryMarshaller(), - new SPCountryUnmarshaller()); - - Configuration.registerObjectProvider(XSAny.TYPE_NAME, - new XSAnyBuilder(), new XSAnyMarshaller(), - new XSAnyUnmarshaller()); - - Configuration.registerObjectProvider( - RequestedAttribute.DEF_ELEMENT_NAME, - new RequestedAttributeBuilder(), - new RequestedAttributeMarshaller(), - new RequestedAttributeUnmarshaller()); - - Configuration.registerObjectProvider( - RequestedAttributes.DEF_ELEMENT_NAME, - new RequestedAttributesBuilder(), - new RequestedAttributesMarshaller(), - new RequestedAttributesUnmarshaller()); - - Configuration.registerObjectProvider( - AuthenticationAttributes.DEF_ELEMENT_NAME, - new AuthenticationAttributesBuilder(), - new AuthenticationAttributesMarshaller(), - new AuthenticationAttributesUnmarshaller()); - - Configuration.registerObjectProvider( - VIDPAuthenticationAttributes.DEF_ELEMENT_NAME, - new VIDPAuthenticationAttributesBuilder(), - new VIDPAuthenticationAttributesMarshaller(), - new VIDPAuthenticationAttributesUnmarshaller()); - - Configuration.registerObjectProvider( - CitizenCountryCode.DEF_ELEMENT_NAME, - new CitizenCountryCodeBuilder(), - new CitizenCountryCodeMarshaller(), - new CitizenCountryCodeUnmarshaller()); - - Configuration.registerObjectProvider( - SPID.DEF_ELEMENT_NAME, - new SPIDBuilder(), - new SPIDMarshaller(), - new SPIDUnmarshaller()); - - Configuration.registerObjectProvider( - SPInformation.DEF_ELEMENT_NAME, - new SPInformationBuilder(), - new SPInformationMarshaller(), - new SPInformationUnmarshaller()); - - LOG.info("Register STORK object validators."); - final ValidatorSuite validatorSuite = new ValidatorSuite( - QAAAttribute.DEF_LOCAL_NAME); - - validatorSuite.registerValidator(QAAAttribute.DEF_ELEMENT_NAME, - new QAAAttributeSchemaValidator()); - final Extensions extensions = SAMLEngineUtils.generateExtension(); - validatorSuite.registerValidator(extensions.getElementQName(), - new ExtensionsSchemaValidator()); - - Configuration.registerValidatorSuite( - "stork:QualityAuthenticationAssuranceLevel", validatorSuite); - - } - - /** - * Generate authentication response base. - * - * @param status the status - * @param assertConsumerURL the assert consumer URL. - * @param inResponseTo the in response to - * - * @return the response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Response genAuthnRespBase(final Status status, - final String assertConsumerURL, final String inResponseTo) - throws STORKSAMLEngineException { - LOG.debug("Generate Authentication Response base."); - final Response response = SAMLEngineUtils.generateResponse( - SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), - SAMLEngineUtils.getCurrentTime(), status); - - // Set name Spaces - this.setNameSpaces(response); - - // Mandatory STORK - LOG.debug("Generate Issuer"); - final Issuer issuer = SAMLEngineUtils.generateIssuer(); - issuer.setValue(super.getSamlCoreProperties().getResponder()); - - // Format Entity Optional STORK - issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); - - response.setIssuer(issuer); - - // destination Mandatory Stork - response.setDestination(assertConsumerURL.trim()); - - // inResponseTo Mandatory Stork - response.setInResponseTo(inResponseTo.trim()); - - // Optional STORK - response.setConsent(super.getSamlCoreProperties() - .getConsentAuthnResponse()); - - return response; - } - - /** - * Generate attribute query response base. - * - * @param status the status - * @param destinationURL the assert consumer URL. - * @param inResponseTo the in response to - * - * @return the response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Response genAttrQueryRespBase(final Status status, - final String destinationURL, final String inResponseTo) - throws STORKSAMLEngineException { - LOG.debug("Generate Attribute query Response base."); - final Response response = SAMLEngineUtils.generateResponse( - SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), - SAMLEngineUtils.getCurrentTime(), status); - - // Set name Spaces - this.setNameSpaces(response); - - // Mandatory STORK - LOG.debug("Generate Issuer"); - final Issuer issuer = SAMLEngineUtils.generateIssuer(); - issuer.setValue(super.getSamlCoreProperties().getResponder()); - - // Format Entity Optional STORK - issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); - - response.setIssuer(issuer); - - // destination Mandatory Stork - response.setDestination(destinationURL.trim()); - - // inResponseTo Mandatory Stork - response.setInResponseTo(inResponseTo.trim()); - - // Optional STORK - response.setConsent(super.getSamlCoreProperties() - .getConsentAuthnResponse()); - - return response; - } - - /** - * Generate assertion. - * - * @param ipAddress the IP address. - * @param assertConsumerURL the assert consumer URL. - * @param inResponseTo the in response to - * @param issuer the issuer - * @param notOnOrAfter the not on or after - * - * @return the assertion - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Assertion generateAssertion(final String ipAddress, - final String assertConsumerURL, final String inResponseTo, - final String issuer, final DateTime notOnOrAfter) - throws STORKSAMLEngineException { - LOG.info("Generate Assertion."); - - // Mandatory STORK - LOG.debug("Generate Issuer to Assertion"); - final Issuer issuerAssertion = SAMLEngineUtils.generateIssuer(); - issuerAssertion.setValue(super.getSamlCoreProperties().getResponder()); - - // Format Entity Optional STORK - issuerAssertion.setFormat(super.getSamlCoreProperties() - .getFormatEntity()); - - final Assertion assertion = SAMLEngineUtils.generateAssertion( - SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), - SAMLEngineUtils.getCurrentTime(), issuerAssertion); - - final Subject subject = SAMLEngineUtils.generateSubject(); - - // Mandatory STORK verified - // String format = NameID.UNSPECIFIED - // specification: 'SAML:2.0' exist - // opensaml: "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" - // opensaml "urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified" - final String format = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"; - - final String nameQualifier = ""; - - LOG.debug("Generate NameID"); - final NameID nameId = SAMLEngineUtils.generateNameID(super - .getSamlCoreProperties().getResponder(), format, nameQualifier); - nameId.setValue(format); - subject.setNameID(nameId); - - // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. - // Optional in other case. - LOG.debug("Generate SubjectConfirmationData."); - final SubjectConfirmationData dataBearer = SAMLEngineUtils - .generateSubjectConfirmationData(SAMLEngineUtils - .getCurrentTime(), assertConsumerURL, inResponseTo); - - // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. - // Optional in other case. - LOG.debug("Generate SubjectConfirmation"); - final SubjectConfirmation subjectConf = SAMLEngineUtils - .generateSubjectConfirmation(SubjectConfirmation.METHOD_BEARER, - dataBearer); - - final ArrayList listSubjectConf = new ArrayList(); - listSubjectConf.add(subjectConf); - - for (final Iterator iter = listSubjectConf - .iterator(); iter.hasNext();) { - final SubjectConfirmation element = iter.next(); - - if (SubjectConfirmation.METHOD_BEARER.equals(element.getMethod())) { - // ipAddress Mandatory if method is Bearer. - - if (StringUtils.isBlank(ipAddress)) { - throw new STORKSAMLEngineException( - "ipAddress is null or empty"); - } - element.getSubjectConfirmationData().setAddress( - ipAddress.trim()); - } - - element.getSubjectConfirmationData() - .setRecipient(assertConsumerURL); - element.getSubjectConfirmationData().setNotOnOrAfter(notOnOrAfter); - } - - // The SAML 2.0 specification allows multiple SubjectConfirmations - subject.getSubjectConfirmations().addAll(listSubjectConf); - - // Mandatory Stork - assertion.setSubject(subject); - - // Conditions that MUST be evaluated when assessing the validity of - // and/or when using the assertion. - final Conditions conditions = this.generateConditions(SAMLEngineUtils - .getCurrentTime(), notOnOrAfter, issuer); - - assertion.setConditions(conditions); - - LOG.debug("Generate stork Authentication Statement."); - final AuthnStatement storkAuthnStat = this - .generateStorkAuthStatement(ipAddress); - assertion.getAuthnStatements().add(storkAuthnStat); - - return assertion; - } - - private String getAttributeName(final PersonalAttribute attribute) throws STORKSAMLEngineException { - if (StringUtils.isBlank(attribute.getName())) { - LOG.error(ATTRIBUTE_EMPTY_LITERAL); - throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); - } - - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.error("Attribute name: {} it is not known.", attribute - .getName()); - throw new STORKSAMLEngineException("Attribute name: " - + attribute.getName() + " it is not known."); - } - return attributeName; - } - /** - * Generate attribute statement. - * - * @param personalAttrList the personal attribute list - * @param isHashing the is hashing - * - * @return the attribute statement - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - * @throws IOException - */ - private AttributeStatement generateAttributeStatement( - final IPersonalAttributeList personalAttrList, - final boolean isHashing) throws STORKSAMLEngineException { - LOG.debug("Generate attribute statement"); - - final AttributeStatement attrStatement = (AttributeStatement) SAMLEngineUtils - .createSamlObject(AttributeStatement.DEFAULT_ELEMENT_NAME); - - for (PersonalAttribute attribute : personalAttrList) { - - String attributeName = getAttributeName(attribute); - - // Verification that only one value it's permitted, simple or - // complex, not both. - - final boolean simpleNull = (attribute.getValue() == null); - final boolean simpleEmpty = (simpleNull || (!simpleNull && attribute - .getValue().isEmpty())); - - final boolean complexNull = (attribute.getComplexValue() == null); - final boolean complexEmpty = (complexNull || (!complexNull && attribute - .getComplexValue().isEmpty())); - - if ((!simpleEmpty && !complexEmpty)) { - throw new STORKSAMLEngineException( - "Attribute name: " - + attribute.getName() - + " must be contain one value, simple or complex value."); - } else { - - if (!simpleEmpty) { - attrStatement.getAttributes().add( - this.generateAttrSimple(attributeName, attribute - .getStatus(), attribute.getValue(), - isHashing)); - } else if (!complexEmpty) { - attrStatement.getAttributes().add( - SAMLEngineUtils.generateAttrComplex(attributeName, - attribute.getStatus(), attribute - .getComplexValue(), isHashing)); - } else if (!simpleNull) { - attrStatement.getAttributes().add( - this.generateAttrSimple(attributeName, attribute - .getStatus(), new ArrayList(), - isHashing)); - } else { - // Add attribute complex. - attrStatement.getAttributes().add( - SAMLEngineUtils.generateAttrComplex(attributeName, - attribute.getStatus(), - new HashMap(), isHashing)); - } - } - } - return attrStatement; - } - private XSAny createAttributeValueForSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { - DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); - domFactory.setNamespaceAware(true); - Document document = null; - DocumentBuilder builder; - - // Parse the signedDoc value into an XML DOM Document - try { - builder = domFactory.newDocumentBuilder(); - InputStream is; - is = new ByteArrayInputStream(value.trim().getBytes("UTF-8")); - document = builder.parse(is); - is.close(); - } catch (SAXException e1) { - LOG.error("SAX Error while parsing signModule attribute", e1); - throw new STORKSAMLEngineRuntimeException(e1); - } catch (ParserConfigurationException e2) { - LOG.error("Parser Configuration Error while parsing signModule attribute", e2); - throw new STORKSAMLEngineRuntimeException(e2); - } catch (UnsupportedEncodingException e3) { - LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); - throw new STORKSAMLEngineRuntimeException(e3); - } catch (IOException e4) { - LOG.error("IO Error while parsing signModule attribute", e4); - throw new STORKSAMLEngineRuntimeException(e4); - } - - // Create the attribute statement - final XSAny xmlValue = (XSAny) SAMLEngineUtils - .createSamlObject( - AttributeValue.DEFAULT_ELEMENT_NAME, - XSAny.TYPE_NAME); - - //Set the signedDoc XML content to this element - xmlValue.setDOM(document.getDocumentElement()); - - // Create the attribute statement - final XSAny attrValue = (XSAny) SAMLEngineUtils - .createSamlObject( - AttributeValue.DEFAULT_ELEMENT_NAME, - XSAny.TYPE_NAME); - - //Add previous signedDocXML to the AttributeValue Element - - // if it's necessary encode the information. - if (!isHashing) { - attrValue.getUnknownXMLObjects().add(xmlValue); - } - return attrValue; - } - - private XSAny createAttributeValueForNonSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { - // Create the attribute statement - final XSAny attrValue = (XSAny) SAMLEngineUtils - .createSamlObject( - AttributeValue.DEFAULT_ELEMENT_NAME, - XSAny.TYPE_NAME); - // if it's necessary encode the information. - if (isHashing) { - attrValue.setTextContent(SAMLEngineUtils.encode(value, SAMLEngineUtils.SHA_512)); - } else { - attrValue.setTextContent(value); - } - return attrValue; - } - - /** - * Generate attribute from a list of values. - * - * @param name the name of the attribute. - * @param values the value of the attribute. - * @param isHashing the is hashing with "SHA-512" algorithm. - * @param status the status of the parameter: "Available", "NotAvailable" or - * "Withheld". - * - * @return the attribute - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Attribute generateAttrSimple(final String name, - final String status, final List values, - final boolean isHashing) throws STORKSAMLEngineException { - LOG.debug("Generate attribute simple: " + name); - final Attribute attribute = (Attribute) SAMLEngineUtils - .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); - - attribute.setName(name); - attribute.setNameFormat(Attribute.URI_REFERENCE); - - attribute.getUnknownAttributes().put( - new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", - SAMLCore.STORK10_PREFIX.getValue()), status); - - if (values != null) { - LOG.debug("Add attribute values."); - for (int i = 0; i < values.size(); i++) { - final String value = values.get(i); - if (StringUtils.isNotBlank(value)) { - XSAny attrValue = null; - if (!name.equals("http://www.stork.gov.eu/1.0/signedDoc")) { - // Create the attribute statement - attrValue = createAttributeValueForNonSignedDoc(value, isHashing); - - } else { - attrValue = createAttributeValueForSignedDoc(value, isHashing); - attribute.getAttributeValues().add(attrValue); - } - attribute.getAttributeValues().add(attrValue); - } - } - } - return attribute; - } - - /** - * Generate conditions that MUST be evaluated when assessing the validity of - * and/or when using the assertion. - * - * @param notBefore the not before - * @param notOnOrAfter the not on or after - * @param audienceURI the audience URI. - * - * @return the conditions - */ - private Conditions generateConditions(final DateTime notBefore, - final DateTime notOnOrAfter, final String audienceURI) { - LOG.debug("Generate conditions."); - final Conditions conditions = (Conditions) SAMLEngineUtils - .createSamlObject(Conditions.DEFAULT_ELEMENT_NAME); - conditions.setNotBefore(notBefore); - conditions.setNotOnOrAfter(notOnOrAfter); - - final AudienceRestriction restrictions = (AudienceRestriction) SAMLEngineUtils - .createSamlObject(AudienceRestriction.DEFAULT_ELEMENT_NAME); - - final Audience audience = (Audience) SAMLEngineUtils - .createSamlObject(Audience.DEFAULT_ELEMENT_NAME); - audience.setAudienceURI(audienceURI); - - restrictions.getAudiences().add(audience); - conditions.getAudienceRestrictions().add(restrictions); - - if (super.getSamlCoreProperties().isOneTimeUse()) { - final OneTimeUse oneTimeUse = (OneTimeUse) SAMLEngineUtils - .createSamlObject(OneTimeUse.DEFAULT_ELEMENT_NAME); - conditions.getConditions().add(oneTimeUse); - } - return conditions; - } - - /** - * Generate personal attribute list. - * - * @param assertion the assertion - * - * @return the personal attribute list - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private IPersonalAttributeList generatePersonalAttributeList( - final Assertion assertion) throws STORKSAMLEngineException { - LOG.debug("Generate personal attribute list from XMLObject."); - final List listExtensions = assertion.getOrderedChildren(); - - boolean find = false; - AttributeStatement requestedAttr = null; - - // Search the attribute statement. - for (int i = 0; i < listExtensions.size() && !find; i++) { - final XMLObject xml = listExtensions.get(i); - if (xml instanceof AttributeStatement) { - requestedAttr = (AttributeStatement) xml; - find = true; - } - } - - if (!find) { - LOG.error("Error: AttributeStatement it's not present."); - throw new STORKSAMLEngineException( - "AttributeStatement it's not present."); - } - - final List reqAttrs = requestedAttr.getAttributes(); - - final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); - String attributeName; - - // Process the attributes. - for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { - final Attribute attribute = reqAttrs.get(nextAttribute); - - final PersonalAttribute personalAttribute = new PersonalAttribute(); - - attributeName = attribute.getName(); - personalAttribute.setName(attributeName.substring(attributeName - .lastIndexOf('/') + 1)); - - personalAttribute.setStatus(attribute.getUnknownAttributes().get( - new QName(SAMLCore.STORK10_NS.getValue(), - "AttributeStatus", SAMLCore.STORK10_PREFIX - .getValue()))); - - final ArrayList simpleValues = new ArrayList(); - final HashMap multiValues = new HashMap(); - - final List values = attribute.getOrderedChildren(); - - - // Process the values. - for (int nextValue = 0; nextValue < values.size(); nextValue++) { - - final XMLObject xmlObject = values.get(nextValue); - - if (xmlObject instanceof XSStringImpl) { - - // Process simple value. - simpleValues.add(((XSStringImpl) xmlObject).getValue()); - - } else if (xmlObject instanceof XSAnyImpl) { - - if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextValue); - - TransformerFactory transFactory = TransformerFactory - .newInstance(); - Transformer transformer = null; - try { - transformer = transFactory.newTransformer(); - transformer.setOutputProperty( - OutputKeys.OMIT_XML_DECLARATION, "yes"); - } catch (TransformerConfigurationException e) { - LOG.error("Error transformer configuration exception", e); - } - StringWriter buffer = new StringWriter(); - try { - if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ - transformer.transform(new DOMSource(xmlString - .getUnknownXMLObjects().get(0).getDOM()), - new StreamResult(buffer)); - } - } catch (TransformerException e) { - LOG.error("Error transformer exception", e); - } - String str = buffer.toString(); - - simpleValues.add(str); - - } else if (attributeName - .equals("http://www.stork.gov.eu/1.0/canonicalResidenceAddress")) - { - LOG.info("canonicalResidenceAddress found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - - } - else if (attributeName - .equals("http://www.stork.gov.eu/1.0/newAttribute2")) - { - LOG.info("newAttribute2 found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - } - else if (attributeName - .equals("http://www.stork.gov.eu/1.0/hasDegree")) - { - LOG.info("hasDegree found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - } - else if(attributeName - .equals("http://www.stork.gov.eu/1.0/mandateContent")) - { - LOG.info("mandateContent found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - } - else { - // Process simple value. - simpleValues.add(((XSAnyImpl) xmlObject) - .getTextContent()); - } - - } else { - LOG.error("Error: attribute value it's unknown."); - throw new STORKSAMLEngineException( - "Attribute value it's unknown."); - } - } - - personalAttribute.setValue(simpleValues); - personalAttribute.setComplexValue(multiValues); - personalAttrList.add(personalAttribute); - } - - return personalAttrList; - } - - /** - * Generate stork authentication request. - * - * @param request the request that contain all parameters for generate an - * authentication request. - * - * @return the STORK authentication request that has been processed. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnRequest generateSTORKAuthnRequest( - final STORKAuthnRequest request) throws STORKSAMLEngineException { - LOG.info("Generate SAMLAuthnRequest."); - - // Validate Parameters mandatories - validateParamAuthnReq(request); - - final AuthnRequest authnRequestAux = SAMLEngineUtils - .generateSAMLAuthnRequest(SAMLEngineUtils.generateNCName(), - SAMLVersion.VERSION_20, SAMLEngineUtils - .getCurrentTime()); - - // Set name spaces. - setNameSpaces(authnRequestAux); - - // Add parameter Mandatory STORK - authnRequestAux.setForceAuthn(Boolean.TRUE); - - // Add parameter Mandatory STORK - authnRequestAux.setIsPassive(Boolean.FALSE); - - authnRequestAux.setAssertionConsumerServiceURL(request - .getAssertionConsumerServiceURL()); - - authnRequestAux.setProviderName(request.getProviderName()); - - // Add protocol binding - authnRequestAux.setProtocolBinding(super.getSamlCoreProperties() - .getProtocolBinding()); - - // Add parameter optional STORK - // Destination is mandatory if the destination is a C-PEPS - // The application must to know if the destination is a C-PEPS. - if (StringUtils.isNotBlank(request.getDestination())) { - authnRequestAux.setDestination(request.getDestination()); - } - - // Consent is optional. Set from SAMLEngine.xml - consent. - authnRequestAux.setConsent(super.getSamlCoreProperties() - .getConsentAuthnRequest()); - - final Issuer issuer = SAMLEngineUtils.generateIssuer(); - - if(request.getIssuer()!=null){ - issuer.setValue(request.getIssuer()); - } else { - issuer.setValue(super.getSamlCoreProperties().getRequester()); - } - - // Optional STORK - final String formatEntity = super.getSamlCoreProperties() - .getFormatEntity(); - if (StringUtils.isNotBlank(formatEntity)) { - issuer.setFormat(formatEntity); - } - - authnRequestAux.setIssuer(issuer); - - // Generate stork extensions. - final Extensions storkExtensions = this - .generateSTORKExtensions(request); - // add the extensions to the SAMLAuthnRequest - authnRequestAux.setExtensions(storkExtensions); - - // the result contains an authentication request token (byte[]), - // identifier of the token, and all parameters from the request. - final STORKAuthnRequest authRequest = processExtensions(authnRequestAux - .getExtensions()); - - try { - authRequest.setTokenSaml(super.signAndMarshall(authnRequestAux)); - } catch (SAMLEngineException e) { - LOG.error("Sign and Marshall.", e); - throw new STORKSAMLEngineException(e); - } - - authRequest.setSamlId(authnRequestAux.getID()); - authRequest.setDestination(authnRequestAux.getDestination()); - authRequest.setAssertionConsumerServiceURL(authnRequestAux - .getAssertionConsumerServiceURL()); - - authRequest.setProviderName(authnRequestAux.getProviderName()); - authRequest.setIssuer(authnRequestAux.getIssuer().getValue()); - - return authRequest; - } - - /** - * Generate stork authentication response. - * - * @param request the request - * @param responseAuthReq the response authentication request - * @param ipAddress the IP address - * @param isHashing the is hashing - * - * @return the sTORK authentication response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnResponse generateSTORKAuthnResponse( - final STORKAuthnRequest request, - final STORKAuthnResponse responseAuthReq, final String ipAddress, - final boolean isHashing) throws STORKSAMLEngineException { - LOG.info("generateSTORKAuthnResponse"); - - // Validate parameters - validateParamResponse(request, responseAuthReq); - - // Mandatory SAML - LOG.debug("Generate StatusCode"); - final StatusCode statusCode = SAMLEngineUtils - .generateStatusCode(StatusCode.SUCCESS_URI); - - LOG.debug("Generate Status"); - final Status status = SAMLEngineUtils.generateStatus(statusCode); - - LOG.debug("Generate StatusMessage"); - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .generateStatusMessage(StatusCode.SUCCESS_URI); - - status.setStatusMessage(statusMessage); - - LOG.debug("Generate Response"); - - // RESPONSE - final Response response = genAuthnRespBase(status, request - .getAssertionConsumerServiceURL(), request.getSamlId()); - - DateTime notOnOrAfter = new DateTime(); - - notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() - .getTimeNotOnOrAfter()); - - final Assertion assertion = this.generateAssertion(ipAddress, request - .getAssertionConsumerServiceURL(), request.getSamlId(), request - .getIssuer(), notOnOrAfter); - - final AttributeStatement attrStatement = this - .generateAttributeStatement(responseAuthReq - .getPersonalAttributeList(), isHashing); - - assertion.getAttributeStatements().add(attrStatement); - - // Add assertions - response.getAssertions().add(assertion); - - final STORKAuthnResponse authresponse = new STORKAuthnResponse(); - - try { - authresponse.setTokenSaml(super.signAndMarshall(response)); - authresponse.setSamlId(response.getID()); - } catch (SAMLEngineException e) { - LOG.error("Sign and Marshall.", e); - throw new STORKSAMLEngineException(e); - } - return authresponse; - } - - /** - * Generate stork authentication response fail. - * - * @param request the request - * @param response the response - * @param ipAddress the IP address - * @param isHashing the is hashing - * - * @return the sTORK authentication response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnResponse generateSTORKAuthnResponseFail( - final STORKAuthnRequest request, final STORKAuthnResponse response, - final String ipAddress, final boolean isHashing) - throws STORKSAMLEngineException { - LOG.info("generateSTORKAuthnResponseFail"); - - validateParamResponseFail(request, response); - - // Mandatory - final StatusCode statusCode = SAMLEngineUtils - .generateStatusCode(response.getStatusCode()); - - // Mandatory SAML - LOG.debug("Generate StatusCode."); - // Subordinate code it's optional in case not covered into next codes: - // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed - // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue - // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy - // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied - // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported - - if (StringUtils.isNotBlank(response.getSubStatusCode())) { - final StatusCode newStatusCode = SAMLEngineUtils - .generateStatusCode(response.getSubStatusCode()); - statusCode.setStatusCode(newStatusCode); - } - - LOG.debug("Generate Status."); - final Status status = SAMLEngineUtils.generateStatus(statusCode); - - if (StringUtils.isNotBlank(response.getMessage())) { - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .generateStatusMessage(response.getMessage()); - - status.setStatusMessage(statusMessage); - } - - LOG.debug("Generate Response."); - // RESPONSE - final Response responseFail = genAuthnRespBase(status, request - .getAssertionConsumerServiceURL(), request.getSamlId()); - - DateTime notOnOrAfter = new DateTime(); - - notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() - .getTimeNotOnOrAfter()); - - final Assertion assertion = this.generateAssertion(ipAddress, request - .getAssertionConsumerServiceURL(), request.getSamlId(), request - .getIssuer(), notOnOrAfter); - - responseFail.getAssertions().add(assertion); - - LOG.debug("Sign and Marshall ResponseFail."); - - final STORKAuthnResponse storkResponse = new STORKAuthnResponse(); - - try { - storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); - storkResponse.setSamlId(responseFail.getID()); - } catch (SAMLEngineException e) { - LOG.error("SAMLEngineException.", e); - throw new STORKSAMLEngineException(e); - } - return storkResponse; - } - - /** - * Generate stork attribute query request. - * - * @param request the request that contain all parameters for generate an - * attribute query request. - * - * @return the STORK attribute query request that has been processed. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryRequest generateSTORKAttrQueryRequest( - final STORKAttrQueryRequest request) throws STORKSAMLEngineException { - LOG.info("Generate STORKAttrQueryRequest."); - - // Validate Parameters mandatories - validateParamAttrQueryReq(request); - - final AttributeQuery attrQueryRequestAux = SAMLEngineUtils - .generateSAMLAttrQueryRequest(SAMLEngineUtils.generateNCName(), - SAMLVersion.VERSION_20, SAMLEngineUtils - .getCurrentTime()); - - // Set name spaces. - setNameSpaces(attrQueryRequestAux); - - - // Add parameter optional STORK - // Destination is mandatory if the destination is a C-PEPS - // The application must to know if the destination is a C-PEPS. - if (StringUtils.isNotBlank(request.getDestination())) { - attrQueryRequestAux.setDestination(request.getDestination()); - } - - // Consent is optional. Set from SAMLEngine.xml - consent. - attrQueryRequestAux.setConsent(super.getSamlCoreProperties() - .getConsentAuthnRequest()); - - final Issuer issuer = SAMLEngineUtils.generateIssuer(); - - //Set the subject - needed for attribute query validation - Subject subject = SAMLEngineUtils.generateSubject(); - SubjectConfirmationBuilder builder = new SubjectConfirmationBuilder(); - SubjectConfirmation subjectConfirmation = builder.buildObject(); - subjectConfirmation.setMethod("urn:oasis:names:tc:SAML:2.0:cm:bearer"); - subject.getSubjectConfirmations().add(subjectConfirmation); - attrQueryRequestAux.setSubject(subject); - - if(request.getIssuer()!=null){ - issuer.setValue(request.getIssuer()); - } else { - issuer.setValue(super.getSamlCoreProperties().getRequester()); - } - - // Optional STORK - final String formatEntity = super.getSamlCoreProperties() - .getFormatEntity(); - if (StringUtils.isNotBlank(formatEntity)) { - issuer.setFormat(formatEntity); - } - - attrQueryRequestAux.setIssuer(issuer); - - // Generate stork extensions. - final Extensions storkExtensions = this - .generateSTORKAttrExtensions(request); - // add the extensions to the SAMLAuthnRequest - attrQueryRequestAux.setExtensions(storkExtensions); - - // the result contains an authentication request token (byte[]), - // identifier of the token, and all parameters from the request. - final STORKAttrQueryRequest attrQueryRequest = processAttrExtensions(attrQueryRequestAux - .getExtensions()); - - try { - attrQueryRequest.setTokenSaml(super.signAndMarshall(attrQueryRequestAux)); - } catch (SAMLEngineException e) { - LOG.error("Sign and Marshall.", e); - throw new STORKSAMLEngineException(e); - } - - attrQueryRequest.setSamlId(attrQueryRequestAux.getID()); - attrQueryRequest.setDestination(attrQueryRequestAux.getDestination()); - - attrQueryRequest.setIssuer(attrQueryRequestAux.getIssuer().getValue()); - - return attrQueryRequest; - } - - /** - * Generate stork attribute query response. - * - * @param request the request - * @param responseAttrQueryReq the response authentication request - * @param ipAddress the IP address - * @param isHashing the is hashing - * - * @return the sTORK authentication response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryResponse generateSTORKAttrQueryResponse( - final STORKAttrQueryRequest request, - final STORKAttrQueryResponse responseAttrQueryReq, final String ipAddress, - final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException { - LOG.info("generateSTORKAttrQueryResponse"); - - // Validate parameters - validateParamAttrQueryResponse(request, responseAttrQueryReq); - - // Mandatory SAML - LOG.debug("Generate StatusCode"); - final StatusCode statusCode = SAMLEngineUtils - .generateStatusCode(StatusCode.SUCCESS_URI); - - LOG.debug("Generate Status"); - final Status status = SAMLEngineUtils.generateStatus(statusCode); - - LOG.debug("Generate StatusMessage"); - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .generateStatusMessage(StatusCode.SUCCESS_URI); - - status.setStatusMessage(statusMessage); - - LOG.debug("Generate Response"); - - // RESPONSE - final Response response = genAuthnRespBase(status, destinationUrl, - request.getSamlId()); - - DateTime notOnOrAfter = new DateTime(); - - notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() - .getTimeNotOnOrAfter()); - - final Assertion assertion = this.generateAssertion(ipAddress, "" - ,request.getSamlId(), request.getIssuer(), notOnOrAfter); - - final AttributeStatement attrStatement = this - .generateAttributeStatement(responseAttrQueryReq - .getPersonalAttributeList(), isHashing); - - assertion.getAttributeStatements().add(attrStatement); - - // Add assertions - response.getAssertions().add(assertion); - - final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); - - try { - attrQueryResponse.setTokenSaml(super.signAndMarshall(response)); - attrQueryResponse.setSamlId(response.getID()); - } catch (SAMLEngineException e) { - LOG.error("Sign and Marshall.", e); - throw new STORKSAMLEngineException(e); - } - return attrQueryResponse; - } - - /** - * Generate stork attribute query response fail. - * - * @param request the request - * @param response the response - * @param ipAddress the IP address - * @param isHashing the is hashing - * - * @return the STORK attribute query response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryResponse generateSTORKAttrQueryResponseFail( - final STORKAttrQueryRequest request, final STORKAttrQueryResponse response, - final String ipAddress, final String destinationUrl, final boolean isHashing) - throws STORKSAMLEngineException { - LOG.info("generateSTORKAttrQueryResponseFail"); - - validateParamAttrQueryResponseFail(request, response); - - // Mandatory - final StatusCode statusCode = SAMLEngineUtils - .generateStatusCode(response.getStatusCode()); - - // Mandatory SAML - LOG.debug("Generate StatusCode."); - // Subordinate code it's optional in case not covered into next codes: - // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed - // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue - // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy - // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied - // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported - - if (StringUtils.isNotBlank(response.getSubStatusCode())) { - final StatusCode newStatusCode = SAMLEngineUtils - .generateStatusCode(response.getSubStatusCode()); - statusCode.setStatusCode(newStatusCode); - } - - LOG.debug("Generate Status."); - final Status status = SAMLEngineUtils.generateStatus(statusCode); - - if (StringUtils.isNotBlank(response.getMessage())) { - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .generateStatusMessage(response.getMessage()); - - status.setStatusMessage(statusMessage); - } - - LOG.debug("Generate Response."); - // RESPONSE - final Response responseFail = genAuthnRespBase(status, destinationUrl, - request.getSamlId()); - - DateTime notOnOrAfter = new DateTime(); - - notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() - .getTimeNotOnOrAfter()); - - final Assertion assertion = this.generateAssertion(ipAddress, "", - request.getSamlId(), request - .getIssuer(), notOnOrAfter); - - responseFail.getAssertions().add(assertion); - - LOG.debug("Sign and Marshall ResponseFail."); - - final STORKAttrQueryResponse storkResponse = new STORKAttrQueryResponse(); - - try { - storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); - storkResponse.setSamlId(responseFail.getID()); - } catch (SAMLEngineException e) { - LOG.error("SAMLEngineException.", e); - throw new STORKSAMLEngineException(e); - } - return storkResponse; - } - - /** - * Generate stork authentication statement for the authentication statement. - * - * @param ipAddress the IP address - * - * @return the authentication statement - */ - private AuthnStatement generateStorkAuthStatement(final String ipAddress) { - LOG.debug("Generate stork authenticate statement."); - final SubjectLocality subjectLocality = SAMLEngineUtils - .generateSubjectLocality(ipAddress); - - final AuthnContext authnContext = (AuthnContext) SAMLEngineUtils - .createSamlObject(AuthnContext.DEFAULT_ELEMENT_NAME); - - final AuthnContextDecl authnContextDecl = (AuthnContextDecl) SAMLEngineUtils - .createSamlObject(AuthnContextDecl.DEFAULT_ELEMENT_NAME); - - authnContext.setAuthnContextDecl(authnContextDecl); - - final AuthnStatement authnStatement = SAMLEngineUtils - .generateAthnStatement(new DateTime(), authnContext); - - // Optional STORK - authnStatement.setSessionIndex(null); - authnStatement.setSubjectLocality(subjectLocality); - - return authnStatement; - } - - /** - * Generate stork extensions. - * - * @param request the request - * - * @return the extensions - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Extensions generateSTORKExtensions(final STORKAuthnRequest request) - throws STORKSAMLEngineException { - LOG.debug("Generate STORKExtensions"); - - final Extensions extensions = SAMLEngineUtils.generateExtension(); - - LOG.debug("Generate QAAAttribute"); - final QAAAttribute qaaAttribute = SAMLEngineUtils - .generateQAAAttribute(request.getQaa()); - extensions.getUnknownXMLObjects().add(qaaAttribute); - - - if (StringUtils.isNotEmpty(request - .getSpSector())) { - // Add information about service provider. - LOG.debug("Generate SPSector"); - final SPSector sector = SAMLEngineUtils.generateSPSector(request - .getSpSector()); - extensions.getUnknownXMLObjects().add(sector); - } - - //Delete from specification. Kept for compatibility with Provider Name value - LOG.debug("Generate SPInstitution"); - final SPInstitution institution = SAMLEngineUtils - .generateSPInstitution(request.getProviderName()); - extensions.getUnknownXMLObjects().add(institution); - - - if (StringUtils.isNotEmpty(request.getSpApplication())) { - LOG.debug("Generate SPApplication"); - final SPApplication application = SAMLEngineUtils - .generateSPApplication(request.getSpApplication()); - extensions.getUnknownXMLObjects().add(application); - } - - if (StringUtils.isNotEmpty(request.getSpCountry())) { - LOG.debug("Generate SPCountry"); - final SPCountry country = SAMLEngineUtils.generateSPCountry(request - .getSpCountry()); - extensions.getUnknownXMLObjects().add(country); - } - - //eIDSectorShare: optional; default value: false. - String valueSectorShare = super.getSamlCoreProperties() - .iseIDSectorShare(); - - if (StringUtils.isNotEmpty(valueSectorShare)) { - // Add information about the use of the SAML message. - LOG.debug("Generate EIDSectorShare"); - final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils - .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); - - eIdSectorShare.setEIDSectorShare(String.valueOf(Boolean.valueOf(valueSectorShare))); - - extensions.getUnknownXMLObjects().add(eIdSectorShare); - } - - String valueCrossSectorShare = super.getSamlCoreProperties() - .iseIDCrossSectorShare(); - - if (StringUtils.isNotEmpty(valueCrossSectorShare)) { - LOG.debug("Generate EIDCrossSectorShare"); - final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils - .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); - eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(Boolean.valueOf(valueCrossSectorShare))); - extensions.getUnknownXMLObjects().add(eIdCrossSecShare); - } - - - String valueCrossBorderShare = super.getSamlCoreProperties() - .iseIDCrossBorderShare(); - - if (StringUtils.isNotEmpty(valueCrossBorderShare)) { - LOG.debug("Generate EIDCrossBorderShare"); - final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils - .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); - eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(Boolean.valueOf(valueCrossBorderShare))); - extensions.getUnknownXMLObjects().add(eIdCrossBordShare); - } - - - // Add information about requested attributes. - LOG.debug("Generate RequestedAttributes."); - final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils - .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); - - LOG.debug("SAML Engine configuration properties load."); - final Iterator iterator = request - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - - final PersonalAttribute attribute = iterator.next(); - - if (attribute == null || StringUtils.isBlank(attribute.getName())) { - LOG.error(ATTRIBUTE_EMPTY_LITERAL); - throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); - } - - // Verified if exits the attribute name. - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.debug("Attribute name: {} was not found.", attribute - .getName()); - throw new STORKSAMLEngineException("Attribute name: " - + attribute.getName() + " was not found."); - } - - // Friendly name it's an optional attribute. - String friendlyName = null; - - if (super.getSamlCoreProperties().isFriendlyName()) { - friendlyName = attribute.getName(); - } - - - String isRequired = null; - if (super.getSamlCoreProperties().isRequired()) { - isRequired = String.valueOf(attribute.isRequired()); - } - - - LOG.debug("Generate requested attribute: " + attributeName); - final RequestedAttribute requestedAttr = SAMLEngineUtils - .generateReqAuthnAttributeSimple(attributeName, - friendlyName, isRequired, attribute - .getValue()); - - // Add requested attribute. - reqAttributes.getAttributes().add(requestedAttr); - } - - // Add requested attributes. - extensions.getUnknownXMLObjects().add(reqAttributes); - - CitizenCountryCode citizenCountryCode = null; - if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ - LOG.debug("Generate CitizenCountryCode"); - citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils - .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); - - citizenCountryCode.setCitizenCountryCode(request - .getCitizenCountryCode().toUpperCase()); - } - - SPID spid = null; - if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { - LOG.debug("Generate SPID"); - spid = (SPID) SAMLEngineUtils - .createSamlObject(SPID.DEF_ELEMENT_NAME); - - spid.setSPID(request.getSPID().toUpperCase()); - } - - AuthenticationAttributes authenticationAttr = (AuthenticationAttributes) SAMLEngineUtils - .createSamlObject(AuthenticationAttributes.DEF_ELEMENT_NAME); - - final VIDPAuthenticationAttributes vIDPauthenticationAttr = (VIDPAuthenticationAttributes) SAMLEngineUtils - .createSamlObject(VIDPAuthenticationAttributes.DEF_ELEMENT_NAME); - - final SPInformation spInformation = (SPInformation) SAMLEngineUtils - .createSamlObject(SPInformation.DEF_ELEMENT_NAME); - - if(citizenCountryCode!=null){ - vIDPauthenticationAttr.setCitizenCountryCode(citizenCountryCode); - } - - if(spid!=null){ - spInformation.setSPID(spid); - } - - vIDPauthenticationAttr.setSPInformation(spInformation); - - authenticationAttr - .setVIDPAuthenticationAttributes(vIDPauthenticationAttr); - extensions.getUnknownXMLObjects().add(authenticationAttr); - - - return extensions; - - } - - /** - * Generate stork extensions. - * - * @param request the attribute query request - * - * @return the extensions - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Extensions generateSTORKAttrExtensions(final STORKAttrQueryRequest request) - throws STORKSAMLEngineException { - LOG.debug("Generate STORKExtensions"); - - final Extensions extensions = SAMLEngineUtils.generateExtension(); - - LOG.debug("Generate QAAAttribute"); - final QAAAttribute qaaAttribute = SAMLEngineUtils - .generateQAAAttribute(request.getQaa()); - extensions.getUnknownXMLObjects().add(qaaAttribute); - - - if (StringUtils.isNotEmpty(request - .getSpSector())) { - // Add information about service provider. - LOG.debug("Generate SPSector"); - final SPSector sector = SAMLEngineUtils.generateSPSector(request - .getSpSector()); - extensions.getUnknownXMLObjects().add(sector); - } - - - if (StringUtils.isNotEmpty(request.getSpApplication())) { - LOG.debug("Generate SPApplication"); - final SPApplication application = SAMLEngineUtils - .generateSPApplication(request.getSpApplication()); - extensions.getUnknownXMLObjects().add(application); - } - - if (StringUtils.isNotEmpty(request.getSpCountry())) { - LOG.debug("Generate SPCountry"); - final SPCountry country = SAMLEngineUtils.generateSPCountry(request - .getSpCountry()); - extensions.getUnknownXMLObjects().add(country); - } - - final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils - .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); - - eIdSectorShare.setEIDSectorShare(String.valueOf(request.isEIDSectorShare())); - - extensions.getUnknownXMLObjects().add(eIdSectorShare); - - final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils - .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); - eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(request.isEIDCrossSectorShare())); - extensions.getUnknownXMLObjects().add(eIdCrossSecShare); - - final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils - .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); - eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(request.isEIDCrossBorderShare())); - extensions.getUnknownXMLObjects().add(eIdCrossBordShare); - - - // Add information about requested attributes. - LOG.debug("Generate RequestedAttributes."); - final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils - .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); - - LOG.debug("SAML Engine configuration properties load."); - final Iterator iterator = request - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - - final PersonalAttribute attribute = iterator.next(); - - if (attribute == null || StringUtils.isBlank(attribute.getName())) { - LOG.error(ATTRIBUTE_EMPTY_LITERAL); - throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); - } - - // Verified if exits the attribute name. - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.debug("Attribute name: {} was not found.", attribute - .getName()); - throw new STORKSAMLEngineException("Attribute name: " - + attribute.getName() + " was not found."); - } - - // Friendly name it's an optional attribute. - String friendlyName = null; - - if (super.getSamlCoreProperties().isFriendlyName()) { - friendlyName = attribute.getName(); - } - - - String isRequired = null; - if (super.getSamlCoreProperties().isRequired()) { - isRequired = String.valueOf(attribute.isRequired()); - } - - - LOG.debug("Generate requested attribute: " + attributeName); - final RequestedAttribute requestedAttr = SAMLEngineUtils - .generateReqAuthnAttributeSimple(attributeName, - friendlyName, isRequired, attribute - .getValue()); - - // Add requested attribute. - reqAttributes.getAttributes().add(requestedAttr); - } - - // Add requested attributes. - extensions.getUnknownXMLObjects().add(reqAttributes); - - CitizenCountryCode citizenCountryCode = null; - if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ - LOG.debug("Generate CitizenCountryCode"); - citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils - .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); - - citizenCountryCode.setCitizenCountryCode(request - .getCitizenCountryCode().toUpperCase()); - } - - SPID spid = null; - if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { - LOG.debug("Generate SPID"); - spid = (SPID) SAMLEngineUtils - .createSamlObject(SPID.DEF_ELEMENT_NAME); - - spid.setSPID(request.getSPID().toUpperCase()); - } - - - return extensions; - - } - - /** - * Gets the alias from X.509 Certificate at keystore. - * - * @param keyInfo the key info - * @param storkOwnKeyStore - * @param storkOwnKeyStore - * - * @return the alias - */ - private String getAlias(final KeyInfo keyInfo, KeyStore storkOwnKeyStore) { - - LOG.debug("Recover alias information"); - - String alias = null; - try { - final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo - .getX509Datas().get(0).getX509Certificates().get(0); - - // Transform the KeyInfo to X509Certificate. - CertificateFactory certFact; - certFact = CertificateFactory.getInstance("X.509"); - - final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 - .decode(xmlCert.getValue())); - - final X509Certificate cert = (X509Certificate) certFact - .generateCertificate(bis); - - final String tokenSerialNumber = cert.getSerialNumber().toString(16); - final X509Principal tokenIssuerDN = new X509Principal(cert.getIssuerDN().getName()); - - - String aliasCert; - X509Certificate certificate; - boolean find = false; - - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements() - && !find; ) { - aliasCert = e.nextElement(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - - final String serialNum = certificate.getSerialNumber() - .toString(16); - - X509Principal issuerDN = new X509Principal(certificate - .getIssuerDN().getName()); - - if(serialNum.equalsIgnoreCase(tokenSerialNumber) - && X509PrincipalUtil.equals2(issuerDN, tokenIssuerDN)){ - alias = aliasCert; - find = true; - } - - } - - } catch (KeyStoreException e) { - LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); - } catch (CertificateException e) { - LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); - } catch (RuntimeException e) { - LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); - } - return alias; - } - - /** - * Gets the country from X.509 Certificate. - * - * @param keyInfo the key info - * - * @return the country - */ - private String getCountry(final KeyInfo keyInfo) { - LOG.debug("Recover country information."); - - String result = ""; - try { - final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo - .getX509Datas().get(0).getX509Certificates().get(0); - - // Transform the KeyInfo to X509Certificate. - CertificateFactory certFact; - certFact = CertificateFactory.getInstance("X.509"); - - final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 - .decode(xmlCert.getValue())); - - final X509Certificate cert = (X509Certificate) certFact - .generateCertificate(bis); - - String distName = cert.getSubjectDN().toString(); - - distName = StringUtils.deleteWhitespace(StringUtils - .upperCase(distName)); - - final String countryCode = "C="; - final int init = distName.indexOf(countryCode); - - if (init > StringUtils.INDEX_NOT_FOUND) { // Exist country code. - int end = distName.indexOf(',', init); - - if (end <= StringUtils.INDEX_NOT_FOUND) { - end = distName.length(); - } - - if (init < end && end > StringUtils.INDEX_NOT_FOUND) { - result = distName.substring(init + countryCode.length(), - end); - //It must be a two characters value - if(result.length()>2){ - result = result.substring(0, 2); - } - } - } - - } catch (CertificateException e) { - LOG.error("Procces getCountry from certificate."); - } - return result.trim(); - } - - /** - * Process all elements XMLObjects from the extensions. - * - * @param extensions the extensions from the authentication request. - * - * @return the STORK authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private STORKAuthnRequest processExtensions(final Extensions extensions) - throws STORKSAMLEngineException { - LOG.debug("Procces the extensions."); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - final QAAAttribute qaa = (QAAAttribute) extensions - .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); - request.setQaa(Integer.parseInt(qaa.getQaaLevel())); - - List optionalElements = extensions.getUnknownXMLObjects( - SPSector.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( - SPSector.DEF_ELEMENT_NAME).get(0); - request.setSpSector(sector.getSPSector()); - } - - optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPApplication application = (SPApplication) extensions - .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); - request.setSpApplication(application.getSPApplication()); - } - - optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPCountry application = (SPCountry) extensions - .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); - request.setSpCountry(application.getSPCountry()); - } - - - List listCrossBorderShare = extensions - .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); - - if (!listCrossBorderShare .isEmpty()) { - final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); - request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare - .getEIDCrossBorderShare())); - } - - - List listCrosSectorShare = extensions - .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); - - if (!listCrosSectorShare.isEmpty()) { - final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); - request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare - .getEIDCrossSectorShare())); - } - - List listSectorShareExtension = extensions - .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); - if (!listSectorShareExtension.isEmpty()) { - final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); - request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); - } - - - - List authAttrs = extensions - .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); - - if (authAttrs != null && !authAttrs.isEmpty()) { - - final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs - .get(0); - - VIDPAuthenticationAttributes vidpAuthnAttr = null; - if (authnAttr != null && !authAttrs.isEmpty()){ - vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); - } - - CitizenCountryCode citizenCountryCodeElement = null; - SPInformation spInformation = null; - if (vidpAuthnAttr != null){ - citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); - spInformation = vidpAuthnAttr.getSPInformation(); - } - - String citizenCountryCode = null; - if(citizenCountryCodeElement!=null){ - citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); - } - - if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ - request.setCitizenCountryCode(citizenCountryCode); - } - - SPID spidElement = null; - if (spInformation != null){ - spidElement = spInformation.getSPID(); - } - - String spid = null; - if(spidElement!=null){ - spid = spidElement.getSPID(); - } - - if (spid != null && StringUtils.isNotBlank(spid)) { - request.setSPID(spid); - } - } - - if (extensions - .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { - LOG.error("Extensions not contains any requested attribute."); - throw new STORKSAMLEngineException( - "Extensions not contains any requested attribute."); - } - - final RequestedAttributes requestedAttr = (RequestedAttributes) extensions - .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) - .get(0); - - final List reqAttrs = requestedAttr.getAttributes(); - - final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); - - String attributeName; - for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { - final RequestedAttribute attribute = reqAttrs.get(nextAttribute); - final PersonalAttribute personalAttribute = new PersonalAttribute(); - personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); - personalAttribute.setFriendlyName(attribute.getFriendlyName()); - attributeName = attribute.getName(); - - // recover the last name from the string. - personalAttribute.setName(attributeName.substring(attributeName - .lastIndexOf('/') + 1)); - - final ArrayList valores = new ArrayList(); - final List values = attribute.getOrderedChildren(); - - for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { - - // Process attributes simples. An AuthenticationRequest only - // must contains simple values. - - final XMLObject xmlObject = values.get(nextSimpleValue); - - if(xmlObject instanceof XSStringImpl){ - - final XSStringImpl xmlString = (XSStringImpl) values - .get(nextSimpleValue); - valores.add(xmlString.getValue()); - - }else{ - - if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextSimpleValue); - - TransformerFactory transFactory = TransformerFactory.newInstance(); - Transformer transformer = null; - try { - transformer = transFactory.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - } catch (TransformerConfigurationException e) { - LOG.error("Error transformer configuration exception", e); - } - StringWriter buffer = new StringWriter(); - try { - if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ - transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), - new StreamResult(buffer)); - } - } catch (TransformerException e) { - LOG.error("Error transformer exception", e); - } - String str = buffer.toString(); - - valores.add(str); - - }else{ - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextSimpleValue); - valores.add(xmlString.getTextContent()); - } - - - - } - } - personalAttribute.setValue(valores); - personalAttrList.add(personalAttribute); - } - - request.setPersonalAttributeList(personalAttrList); - - return request; - } - - - /** - * Process all elements XMLObjects from the extensions. - * - * @param extensions the extensions from the authentication request. - * - * @return the STORK authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private STORKAttrQueryRequest processAttrExtensions(final Extensions extensions) - throws STORKSAMLEngineException { - LOG.debug("Procces the atribute query extensions."); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - final QAAAttribute qaa = (QAAAttribute) extensions - .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); - request.setQaa(Integer.parseInt(qaa.getQaaLevel())); - - List optionalElements = extensions.getUnknownXMLObjects( - SPSector.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( - SPSector.DEF_ELEMENT_NAME).get(0); - request.setSpSector(sector.getSPSector()); - } - - optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPApplication application = (SPApplication) extensions - .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); - request.setSpApplication(application.getSPApplication()); - } - - optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPCountry application = (SPCountry) extensions - .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); - request.setSpCountry(application.getSPCountry()); - } - - - List listCrossBorderShare = extensions - .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); - - if (!listCrossBorderShare .isEmpty()) { - final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); - request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare - .getEIDCrossBorderShare())); - } - - - List listCrosSectorShare = extensions - .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); - - if (!listCrosSectorShare.isEmpty()) { - final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); - request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare - .getEIDCrossSectorShare())); - } - - List listSectorShareExtension = extensions - .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); - if (!listSectorShareExtension.isEmpty()) { - final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); - request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); - } - - - - List authAttrs = extensions - .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); - - if (authAttrs != null && !authAttrs.isEmpty()) { - - final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs - .get(0); - - VIDPAuthenticationAttributes vidpAuthnAttr = null; - if (authnAttr != null && !authAttrs.isEmpty()){ - vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); - } - - CitizenCountryCode citizenCountryCodeElement = null; - SPInformation spInformation = null; - if (vidpAuthnAttr != null){ - citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); - spInformation = vidpAuthnAttr.getSPInformation(); - } - - String citizenCountryCode = null; - if(citizenCountryCodeElement!=null){ - citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); - } - - if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ - request.setCitizenCountryCode(citizenCountryCode); - } - - SPID spidElement = null; - if (spInformation != null){ - spidElement = spInformation.getSPID(); - } - - String spid = null; - if(spidElement!=null){ - spid = spidElement.getSPID(); - } - - if (spid != null && StringUtils.isNotBlank(spid)) { - request.setSPID(spid); - } - } - - if (extensions - .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { - LOG.error("Extensions not contains any requested attribute."); - throw new STORKSAMLEngineException( - "Extensions not contains any requested attribute."); - } - - final RequestedAttributes requestedAttr = (RequestedAttributes) extensions - .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) - .get(0); - - final List reqAttrs = requestedAttr.getAttributes(); - - final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); - - String attributeName; - for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { - final RequestedAttribute attribute = reqAttrs.get(nextAttribute); - final PersonalAttribute personalAttribute = new PersonalAttribute(); - personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); - personalAttribute.setFriendlyName(attribute.getFriendlyName()); - attributeName = attribute.getName(); - - // recover the last name from the string. - personalAttribute.setName(attributeName.substring(attributeName - .lastIndexOf('/') + 1)); - - final ArrayList valores = new ArrayList(); - final List values = attribute.getOrderedChildren(); - - for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { - - // Process attributes simples. An AuthenticationRequest only - // must contains simple values. - - final XMLObject xmlObject = values.get(nextSimpleValue); - - if(xmlObject instanceof XSStringImpl){ - - final XSStringImpl xmlString = (XSStringImpl) values - .get(nextSimpleValue); - valores.add(xmlString.getValue()); - - }else{ - - if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextSimpleValue); - - TransformerFactory transFactory = TransformerFactory.newInstance(); - Transformer transformer = null; - try { - transformer = transFactory.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - } catch (TransformerConfigurationException e) { - LOG.error("Error transformer configuration exception", e); - } - StringWriter buffer = new StringWriter(); - try { - if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ - transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), - new StreamResult(buffer)); - } - } catch (TransformerException e) { - LOG.error("Error transformer exception", e); - } - String str = buffer.toString(); - - valores.add(str); - - }else{ - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextSimpleValue); - valores.add(xmlString.getTextContent()); - } - - - - } - } - personalAttribute.setValue(valores); - personalAttrList.add(personalAttribute); - } - - request.setPersonalAttributeList(personalAttrList); - - return request; - } - - /** - * Sets the name spaces. - * - * @param tokenSaml the new name spaces - */ - private void setNameSpaces(final XMLObject tokenSaml) { - LOG.debug("Set namespaces."); - - final Namespace saml2 = new Namespace(SAMLConstants.SAML20_NS, - SAMLConstants.SAML20_PREFIX); - tokenSaml.addNamespace(saml2); - - final Namespace digSig = new Namespace( - "http://www.w3.org/2000/09/xmldsig#", "ds"); - tokenSaml.addNamespace(digSig); - - final Namespace storkp = new Namespace(SAMLCore.STORK10P_NS.getValue(), - SAMLCore.STORK10P_PREFIX.getValue()); - tokenSaml.addNamespace(storkp); - - final Namespace stork = new Namespace(SAMLCore.STORK10_NS.getValue(), - SAMLCore.STORK10_PREFIX.getValue()); - - tokenSaml.addNamespace(stork); - } - - /** - * Validate parameters from authentication request. - * - * @param request the request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamAuthnReq(final STORKAuthnRequest request) - throws STORKSAMLEngineException { - LOG.info("Validate parameters from authentication request."); - - // URL to which Authentication Response must be sent. - if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); - } - - // the name of the original service provider requesting the - // authentication. - if (StringUtils.isBlank(request.getProviderName())) { - throw new STORKSAMLEngineException( - "StorkSamlEngine: Service Provider it's mandatory."); - } - - // object that contain all attributes requesting. - if (request.getPersonalAttributeList() == null - || request.getPersonalAttributeList().isEmpty()) { - throw new STORKSAMLEngineException( - "attributeQueries is null or empty."); - } - - // Quality authentication assurance level. - if ((request.getQaa() < QAAAttribute.MIN_VALUE) - || (request.getQaa() > QAAAttribute.MAX_VALUE)) { - throw new STORKSAMLEngineException("Qaal: " + request.getQaa() - + ", is invalid."); - } - - } - - /** - * Validate parameters from authentication request. - * - * @param request the request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamAttrQueryReq(final STORKAttrQueryRequest request) - throws STORKSAMLEngineException { - LOG.info("Validate parameters from attribute query request."); - - // URL to which Authentication Response must be sent. - /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); - }*/ - - // the name of the original service provider requesting the - // authentication. - /*if (StringUtils.isBlank(request.getProviderName())) { - throw new STORKSAMLEngineException( - "StorkSamlEngine: Service Provider it's mandatory."); - }*/ - - // object that contain all attributes requesting. - if (request.getPersonalAttributeList() == null - || request.getPersonalAttributeList().isEmpty()) { - throw new STORKSAMLEngineException( - "attributeQueries is null or empty."); - } - - // Quality authentication assurance level. - if ((request.getQaa() < QAAAttribute.MIN_VALUE) - || (request.getQaa() > QAAAttribute.MAX_VALUE)) { - throw new STORKSAMLEngineException("Qaal: " + request.getQaa() - + ", is invalid."); - } - - } - - - /** - * Validate parameters from response. - * - * @param request the request - * @param responseAuthReq the response authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamResponse(final STORKAuthnRequest request, - final STORKAuthnResponse responseAuthReq) - throws STORKSAMLEngineException { - LOG.info("Validate parameters response."); - if (StringUtils.isBlank(request.getIssuer())) { - throw new STORKSAMLEngineException( - "Issuer must be not empty or null."); - } - - if (responseAuthReq.getPersonalAttributeList() == null - || responseAuthReq.getPersonalAttributeList().isEmpty()) { - LOG.error("PersonalAttributeList is null or empty."); - throw new STORKSAMLEngineException( - "PersonalAttributeList is null or empty."); - } - - if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "assertionConsumerServiceURL is null or empty."); - } - - if (StringUtils.isBlank(request.getSamlId())) { - throw new STORKSAMLEngineException("request ID is null or empty."); - } - } - - /** - * Validate parameters from response. - * - * @param request the request - * @param responseAttrQueryReq the response authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamAttrQueryResponse(final STORKAttrQueryRequest request, - final STORKAttrQueryResponse responseAttrQueryReq) - throws STORKSAMLEngineException { - LOG.info("Validate attribute querey parameters response."); - if (StringUtils.isBlank(request.getIssuer())) { - throw new STORKSAMLEngineException( - "Issuer must be not empty or null."); - } - - if (responseAttrQueryReq.getPersonalAttributeList() == null - || responseAttrQueryReq.getPersonalAttributeList().isEmpty()) { - LOG.error("PersonalAttributeList is null or empty."); - throw new STORKSAMLEngineException( - "PersonalAttributeList is null or empty."); - } - - /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "assertionConsumerServiceURL is null or empty."); - }*/ - - if (StringUtils.isBlank(request.getSamlId())) { - throw new STORKSAMLEngineException("request ID is null or empty."); - } - } - - /** - * Validate parameter from response fail. - * - * @param request the request - * @param response the response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamResponseFail(final STORKAuthnRequest request, - final STORKAuthnResponse response) throws STORKSAMLEngineException { - LOG.info("Validate parameters response fail."); - if (StringUtils.isBlank(response.getStatusCode())) { - throw new STORKSAMLEngineException("Code error it's null or empty."); - } - - if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "assertionConsumerServiceURL is null or empty."); - } - - if (StringUtils.isBlank(request.getSamlId())) { - throw new STORKSAMLEngineException("request ID is null or empty."); - } - } - - /** - * Validate parameter from response fail. - * - * @param request the request - * @param response the response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamAttrQueryResponseFail(final STORKAttrQueryRequest request, - final STORKAttrQueryResponse response) throws STORKSAMLEngineException { - LOG.info("Validate parameters response fail."); - if (StringUtils.isBlank(response.getStatusCode())) { - throw new STORKSAMLEngineException("Code error it's null or empty."); - } - - if (StringUtils.isBlank(request.getSamlId())) { - throw new STORKSAMLEngineException("request ID is null or empty."); - } - } - - /** - * Validate stork authentication request. - * - * @param tokenSaml the token SAML - * - * @return the sTORK authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnRequest validateSTORKAuthnRequest(final byte[] tokenSaml) - throws STORKSAMLEngineException { - LOG.info("validateSTORKAuthnRequest"); - - final AuthnRequest samlRequest = (AuthnRequest) validateStorkSaml(tokenSaml); - - LOG.debug("Validate Extensions."); - final Validator validatorExt = new ExtensionsSchemaValidator(); - try { - validatorExt.validate(samlRequest.getExtensions()); - } catch (ValidationException e) { - LOG.error("ValidationException: validate Extensions.", e); - throw new STORKSAMLEngineException(e); - } - - LOG.debug("Generate STORKAuthnRequest."); - final STORKAuthnRequest authnRequest = processExtensions(samlRequest - .getExtensions()); - - authnRequest.setCountry(this.getCountry(samlRequest.getSignature() - .getKeyInfo())); - - authnRequest.setAlias(this.getAlias(samlRequest.getSignature() - .getKeyInfo(), super.getSigner().getTrustStore())); - - authnRequest.setSamlId(samlRequest.getID()); - authnRequest.setDestination(samlRequest.getDestination()); - authnRequest.setAssertionConsumerServiceURL(samlRequest - .getAssertionConsumerServiceURL()); - - authnRequest.setProviderName(samlRequest.getProviderName()); - authnRequest.setIssuer(samlRequest.getIssuer().getValue()); - - //Delete unknown elements from requested ones - final Iterator iterator = authnRequest.getPersonalAttributeList().iterator(); - IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) authnRequest.getPersonalAttributeList(); - while (iterator.hasNext()) { - - final PersonalAttribute attribute = iterator.next(); - - // Verify if the attribute name exits. - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); - cleanPerAttrList.remove(attribute.getName()); - } - - } - authnRequest.setPersonalAttributeList(cleanPerAttrList); - - return authnRequest; - - } - - /** - * Validate stork authentication request. - * - * @param tokenSaml the token SAML - * - * @return the sTORK authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryRequest validateSTORKAttrQueryRequest(final byte[] tokenSaml) - throws STORKSAMLEngineException { - LOG.info("validateSTORKAttrQueryRequest"); - - final AttributeQuery samlRequest = (AttributeQuery) validateStorkSaml(tokenSaml); - - LOG.debug("Validate Extensions."); - final Validator validatorExt = new ExtensionsSchemaValidator(); - try { - validatorExt.validate(samlRequest.getExtensions()); - } catch (ValidationException e) { - LOG.error("ValidationException: validate Extensions.", e); - throw new STORKSAMLEngineException(e); - } - - LOG.debug("Generate STORKAttrQueryRequest."); - final STORKAttrQueryRequest attrRequest = processAttrExtensions(samlRequest - .getExtensions()); - - attrRequest.setCountry(this.getCountry(samlRequest.getSignature() - .getKeyInfo())); - - attrRequest.setAlias(this.getAlias(samlRequest.getSignature() - .getKeyInfo(), super.getSigner().getTrustStore())); - - attrRequest.setSamlId(samlRequest.getID()); - attrRequest.setDestination(samlRequest.getDestination()); - /*attrRequest.setAssertionConsumerServiceURL(samlRequest - .getAssertionConsumerServiceURL()); - - authnRequest.setProviderName(samlRequest.getProviderName());*/ - attrRequest.setIssuer(samlRequest.getIssuer().getValue()); - - //Delete unknown elements from requested ones - final Iterator iterator = attrRequest.getPersonalAttributeList().iterator(); - IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) attrRequest.getPersonalAttributeList(); - while (iterator.hasNext()) { - - final PersonalAttribute attribute = iterator.next(); - - // Verify if the attribute name exits. - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); - cleanPerAttrList.remove(attribute.getName()); - } - - } - attrRequest.setPersonalAttributeList(cleanPerAttrList); - - return attrRequest; - - } - - /** - * Validate stork authentication response. - * - * @param tokenSaml the token SAML - * @param userIP the user IP - * - * @return the Stork authentication response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnResponse validateSTORKAuthnResponse( - final byte[] tokenSaml, final String userIP) - throws STORKSAMLEngineException { - - LOG.info("validateSTORKAuthnResponse"); - final Response samlResponse = (Response) validateStorkSaml(tokenSaml); - - LOG.debug("Create StorkAuthResponse."); - final STORKAuthnResponse authnResponse = new STORKAuthnResponse(); - - authnResponse.setCountry(this.getCountry(samlResponse.getSignature() - .getKeyInfo())); - - LOG.debug("Set ID."); - authnResponse.setSamlId(samlResponse.getID()); - LOG.debug("Set InResponseTo."); - authnResponse.setInResponseTo(samlResponse.getInResponseTo()); - LOG.debug("Set statusCode."); - authnResponse.setStatusCode(samlResponse.getStatus().getStatusCode() - .getValue()); - - // Subordinate code. - if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { - authnResponse.setSubStatusCode(samlResponse.getStatus() - .getStatusCode().getStatusCode().getValue()); - } - - if (samlResponse.getStatus().getStatusMessage() != null) { - LOG.debug("Set statusMessage."); - authnResponse.setMessage(samlResponse.getStatus() - .getStatusMessage().getMessage()); - } - - LOG.debug("validateStorkResponse"); - final Assertion assertion = (Assertion) validateStorkResponse( - samlResponse, userIP); - - if(assertion!=null){ - final DateTime serverDate = new DateTime(); - - if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { - LOG.error("Token date expired (getNotOnOrAfter = " - + assertion.getConditions().getNotOnOrAfter() - + ", server_date: " + serverDate + ")"); - throw new STORKSAMLEngineException( - "Token date expired (getNotOnOrAfter = " - + assertion.getConditions().getNotOnOrAfter() - + " ), server_date: " + serverDate); - } - - LOG.debug("Set notOnOrAfter."); - authnResponse.setNotOnOrAfter(assertion.getConditions() - .getNotOnOrAfter()); - - LOG.debug("Set notBefore."); - authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); - - authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); - - authnResponse.setAudienceRestriction(((AudienceRestriction) assertion - .getConditions().getAudienceRestrictions().get(0)) - .getAudiences().get(0).getAudienceURI()); - } - - // Case no error. - if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(authnResponse - .getStatusCode())) { - LOG.debug("Status Success. Set PersonalAttributeList."); - authnResponse - .setPersonalAttributeList(generatePersonalAttributeList(assertion)); - authnResponse.setFail(false); - } else { - LOG.debug("Status Fail."); - authnResponse.setFail(true); - } - LOG.debug("Return result."); - return authnResponse; - - } - - /** - * Validate stork attribute query response. - * - * @param tokenSaml the token SAML - * @param userIP the user IP - * - * @return the Stork attribute query response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryResponse validateSTORKAttrQueryResponse( - final byte[] tokenSaml, final String userIP) - throws STORKSAMLEngineException { - - LOG.info("validateSTORKAttrQueryResponse"); - final Response samlResponse = (Response) validateStorkSaml(tokenSaml); - - LOG.debug("Create StorkAttrQueryResponse."); - final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); - - attrQueryResponse.setCountry(this.getCountry(samlResponse.getSignature() - .getKeyInfo())); - - LOG.debug("Set ID."); - attrQueryResponse.setSamlId(samlResponse.getID()); - LOG.debug("Set InResponseTo."); - attrQueryResponse.setInResponseTo(samlResponse.getInResponseTo()); - LOG.debug("Set statusCode."); - attrQueryResponse.setStatusCode(samlResponse.getStatus().getStatusCode() - .getValue()); - - // Subordinate code. - if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { - attrQueryResponse.setSubStatusCode(samlResponse.getStatus() - .getStatusCode().getStatusCode().getValue()); - } - - if (samlResponse.getStatus().getStatusMessage() != null) { - LOG.debug("Set statusMessage."); - attrQueryResponse.setMessage(samlResponse.getStatus() - .getStatusMessage().getMessage()); - } - - LOG.debug("validateStorkResponse"); - final Assertion assertion = (Assertion) validateStorkResponse( - samlResponse, userIP); - - if(assertion!=null){ - final DateTime serverDate = new DateTime(); - - if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { - LOG.error("Token date expired (getNotOnOrAfter = " - + assertion.getConditions().getNotOnOrAfter() - + ", server_date: " + serverDate + ")"); - throw new STORKSAMLEngineException( - "Token date expired (getNotOnOrAfter = " - + assertion.getConditions().getNotOnOrAfter() - + " ), server_date: " + serverDate); - } - - LOG.debug("Set notOnOrAfter."); - attrQueryResponse.setNotOnOrAfter(assertion.getConditions() - .getNotOnOrAfter()); - - LOG.debug("Set notBefore."); - attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); - - attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); - - attrQueryResponse.setAudienceRestriction(((AudienceRestriction) assertion - .getConditions().getAudienceRestrictions().get(0)) - .getAudiences().get(0).getAudienceURI()); - } - - // Case no error. - if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(attrQueryResponse - .getStatusCode())) { - LOG.debug("Status Success. Set PersonalAttributeList."); - attrQueryResponse - .setPersonalAttributeList(generatePersonalAttributeList(assertion)); - attrQueryResponse.setFail(false); - } else { - LOG.debug("Status Fail."); - attrQueryResponse.setFail(true); - } - LOG.debug("Return result."); - return attrQueryResponse; - - } - - /** - * Validate stork response. - * - * @param samlResponse the SAML response - * @param userIP the user IP - * - * @return the assertion - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Assertion validateStorkResponse(final Response samlResponse, - final String userIP) throws STORKSAMLEngineException { - // Exist only one Assertion - - if (samlResponse.getAssertions() == null - || samlResponse.getAssertions().isEmpty()) { - LOG.info("Assertion is null or empty."); //in replace of throw new STORKSAMLEngineException("Assertion is null or empty.") - return null; - } - - final Assertion assertion = (Assertion) samlResponse.getAssertions() - .get(0); - - LOG.debug("Verified method Bearer"); - for (final Iterator iter = assertion.getSubject() - .getSubjectConfirmations().iterator(); iter.hasNext();) { - final SubjectConfirmation element = iter.next(); - final boolean isBearer = SubjectConfirmation.METHOD_BEARER - .equals(element.getMethod()); - - final boolean ipValidate = super.getSamlCoreProperties() - .isIpValidation(); - - if (ipValidate) { - if (isBearer) { - if (StringUtils.isBlank(userIP)) { - LOG.error("browser_ip is null or empty."); - throw new STORKSAMLEngineException( - "browser_ip is null or empty."); - } else if (StringUtils.isBlank(element - .getSubjectConfirmationData().getAddress())) { - LOG.error("token_ip attribute is null or empty."); - throw new STORKSAMLEngineException( - "token_ip attribute is null or empty."); - } - } - - final boolean ipEqual = element.getSubjectConfirmationData() - .getAddress().equals(userIP); - - // Validation ipUser - if (!ipEqual && ipValidate) { - LOG.error("SubjectConfirmation BEARER: "); - throw new STORKSAMLEngineException( - "IPs doesn't match : token_ip (" - + element.getSubjectConfirmationData() - .getAddress() + ") browser_ip (" - + userIP + ")"); - } - } - - } - return assertion; - } - - /** - * Validate stork SAML. - * - * @param tokenSaml the token SAML - * - * @return the signable SAML object - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private SignableSAMLObject validateStorkSaml(final byte[] tokenSaml) - throws STORKSAMLEngineException { - - LOG.info("Validate StorkSaml message."); - - if (tokenSaml == null) { - LOG.error("Saml authentication request is null."); - throw new STORKSAMLEngineException( - "Saml authentication request is null."); - } - - LOG.debug("Generate AuthnRequest from request."); - SignableSAMLObject samlObject; - - try { - samlObject = (SignableSAMLObject) super.unmarshall(tokenSaml); - } catch (SAMLEngineException e) { - LOG.error("SAMLEngineException unmarshall.", e); - throw new STORKSAMLEngineException(e); - } - - boolean validateSign = true; - - if (StringUtils.isNotBlank(super.getSamlCoreProperties().getProperty( - "validateSignature"))) { - validateSign = Boolean.valueOf(super.getSamlCoreProperties() - .getProperty("validateSignature")); - } - - if (validateSign) { - LOG.debug("Validate Signature."); - try { - super.validateSignature(samlObject); - } catch (SAMLEngineException e) { - LOG.error("SAMLEngineException validateSignature.", e); - throw new STORKSAMLEngineException(e); - } - } - - LOG.debug("Validate Schema."); - final ValidatorSuite validatorSuite = Configuration - .getValidatorSuite("saml2-core-schema-validator"); - try { - validatorSuite.validate(samlObject); - } catch (ValidationException e) { - LOG.error("ValidationException.", e); - throw new STORKSAMLEngineException(e); - } - - return samlObject; - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base deleted file mode 100644 index e38cc5f0b..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -package eu.stork.peps.auth.engine; - -import org.bouncycastle.asn1.DERObjectIdentifier; -import org.bouncycastle.jce.X509Principal; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Utility class used to decrease complexity of comparison of 2 X509principal - * - * @author vanegdi - * @version $Revision: 1.00 $, $Date: 2013-05-24 20:53:51 $ - */ -public final class X509PrincipalUtil{ - - private static final DERObjectIdentifier[] DER_OBJECT_IDENTIFIERS_ARRAY= { - X509Principal.CN, - X509Principal.OU, - X509Principal.O, - X509Principal.L, - X509Principal.ST, - X509Principal.C, - X509Principal.E - }; - - private static final Logger LOG = LoggerFactory.getLogger(eu.stork.peps.auth.engine.X509PrincipalUtil.class); - - /** - * Compares 2 X509Principals to detect if they equals - * @param principal1 - * @param principal2 - * @return true if arguments are not null and equals - */ - public static boolean equals(X509Principal principal1, X509Principal principal2) { - boolean continueProcess = true; - if (principal1 == null || principal2 == null){ - return false; - } - - int cpt = 0; - while(continueProcess && cpt < DER_OBJECT_IDENTIFIERS_ARRAY.length){ - continueProcess = continueProcess && x509ValuesByIdentifierEquals(principal1, principal2, DER_OBJECT_IDENTIFIERS_ARRAY[cpt]); - cpt++; - } - return continueProcess; - } - - public static boolean equals2(X509Principal principal1, X509Principal principal2) { - - if (principal1 == null || principal2 == null){ - return false; - } - - if (principal1.getName().equals(principal2.getName())) - return true; - else - return false; - - } - - private static boolean x509ValuesByIdentifierEquals(X509Principal principal1, X509Principal principal2, DERObjectIdentifier identifier){ - return principal1.getValues(identifier).equals(principal2.getValues(identifier)); - } - - private X509PrincipalUtil(){ - // default contructor - LOG.error("Fake X509PrincipalUtil : never be called"); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index d3e353e51..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Provides the classes necessary to create a SAML message. - */ -package eu.stork.peps.auth.engine; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngine.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngine.class deleted file mode 100644 index b9bec502f..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngine.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.class deleted file mode 100644 index 0b5531618..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.class deleted file mode 100644 index cf63d0c5f..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.class deleted file mode 100644 index 7b5031ecc..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops deleted file mode 100644 index 5bda1b07b..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops +++ /dev/null @@ -1,119 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/package-info.java -END -CitizenCountryCode.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.java -END -RequestedAttribute.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.java -END -AuthenticationAttributes.java -K 25 -svn:wc:ra_dav:version-url -V 122 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java -END -QAAAttribute.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.java -END -STORKSAMLCore.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.java -END -SPInformation.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPInformation.java -END -SPInstitution.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPInstitution.java -END -EIDCrossBorderShare.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java -END -SPID.java -K 25 -svn:wc:ra_dav:version-url -V 102 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPID.java -END -SPSector.java -K 25 -svn:wc:ra_dav:version-url -V 106 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPSector.java -END -EIDSectorShare.java -K 25 -svn:wc:ra_dav:version-url -V 112 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.java -END -SAMLCore.java -K 25 -svn:wc:ra_dav:version-url -V 106 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SAMLCore.java -END -SPApplication.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPApplication.java -END -SPCountry.java -K 25 -svn:wc:ra_dav:version-url -V 107 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPCountry.java -END -RequestedAttributes.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.java -END -VIDPAuthenticationAttributes.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.java -END -SAMLEngineSignI.java -K 25 -svn:wc:ra_dav:version-url -V 113 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.java -END -EIDCrossSectorShare.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.java -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/entries deleted file mode 100644 index 72f16fa28..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/entries +++ /dev/null @@ -1,680 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -SPID.java -file - - - - -2013-12-20T12:27:57.446475Z -5befd7eed677372d2acb48b3f66e9f02 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1679 - -SPSector.java -file - - - - -2013-12-20T12:27:57.442475Z -00956c4124a9c9062fd408ab886d0a29 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1767 - -EIDSectorShare.java -file - - - - -2013-12-20T12:27:57.442475Z -4277603e70eeeea24e59449136fee007 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1788 - -SAMLCore.java -file - - - - -2013-12-20T12:27:57.442475Z -3ef05a16db7f280124687fbebbd0ca37 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2633 - -validator -dir - -SPApplication.java -file - - - - -2013-12-20T12:27:57.442475Z -97dc9337dfb28ca32ffb50a3b5329651 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1827 - -SPCountry.java -file - - - - -2013-12-20T12:27:57.442475Z -e955976114b4fa9dba61ebc3fdf3c267 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1779 - -RequestedAttributes.java -file - - - - -2013-12-20T12:27:57.442475Z -d93c2c38f6dec952d22f60827b24ee9e -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1652 - -VIDPAuthenticationAttributes.java -file - - - - -2013-12-20T12:27:57.442475Z -b3a8f3746ce11111d80d9e942339a54e -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2224 - -SAMLEngineSignI.java -file - - - - -2013-12-20T12:27:57.442475Z -fb834797256e1ed6873be19ebe860092 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2429 - -EIDCrossSectorShare.java -file - - - - -2013-12-20T12:27:57.442475Z -a693707c2bb3a43e62d8e3ed20e8844d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1856 - -impl -dir - -package-info.java -file - - - - -2013-12-20T12:27:57.446475Z -34cf10993955447fa31dd616aa4978c9 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -808 - -CitizenCountryCode.java -file - - - - -2013-12-20T12:27:57.442475Z -a741f6d7c36860e65f64186ef5cd8610 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1817 - -RequestedAttribute.java -file - - - - -2013-12-20T12:27:57.446475Z -9707a0f5bdad6888a2e021182f80b245 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3828 - -QAAAttribute.java -file - - - - -2013-12-20T12:27:57.446475Z -f0d7a0516989582d342d5ce2a3f08c9d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1917 - -AuthenticationAttributes.java -file - - - - -2013-12-20T12:27:57.446475Z -86b9b4aebe1ca7ca90ce818785374ea7 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1948 - -SPInformation.java -file - - - - -2013-12-20T12:27:57.446475Z -0159e00cdec105564bb6ac394355533b -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1705 - -STORKSAMLCore.java -file - - - - -2013-12-20T12:27:57.446475Z -0e02e7a4c0f208fd5f05191fca5ba91a -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -14229 - -SPInstitution.java -file - - - - -2013-12-20T12:27:57.446475Z -21eda2ef1cb604ce4f952fc608e7772f -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1833 - -EIDCrossBorderShare.java -file - - - - -2013-12-20T12:27:57.446475Z -17d390896e4f96f24df0da4ec83321ec -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1861 - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base deleted file mode 100644 index 07157073c..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface AuthenticationAttributes. - * @author fjquevedo - */ -public interface AuthenticationAttributes extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "AuthenticationAttributes"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "AuthenticationAttributesType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - - /** - * Gets the citizen country code. - * - * @return the citizen country code - */ - VIDPAuthenticationAttributes getVIDPAuthenticationAttributes(); - - - /** - * Sets the vIDP authentication attributes. - * - * @param newVIDPAuthenticationAttr the new vIDP authentication attributes - */ - void setVIDPAuthenticationAttributes(VIDPAuthenticationAttributes newVIDPAuthenticationAttr); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base deleted file mode 100644 index 859d37feb..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * @author fjquevedo - */ -public interface CitizenCountryCode extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "CitizenCountryCode"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "CitizenCountryCodeType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the SP country. - * - * @return the sP country - */ - String getCitizenCountryCode(); - - - /** - * Sets the citizen country code. - * - * @param citizenCountryCode the new citizen country code - */ - void setCitizenCountryCode(String citizenCountryCode); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base deleted file mode 100644 index c892eae78..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * @author fjquevedo - */ -public interface EIDCrossBorderShare extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "eIDCrossBorderShare"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "eIDCrossBorderShareType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - - /** - * Gets the eID cross border share. - * - * @return the eID cross border share - */ - String getEIDCrossBorderShare(); - - - /** - * Sets the eID cross border share. - * - * @param eIDCrossBorderShare the new eID cross border share - */ - void setEIDCrossBorderShare(String eIDCrossBorderShare); - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base deleted file mode 100644 index f879914f9..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossSectorShare. - * @author fjquevedo - */ -public interface EIDCrossSectorShare extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String ELEM_LOCAL_NAME = "eIDCrossSectorShare"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), ELEM_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "eIDCrossSectorShareType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the eID cross sector share. - * - * @return the eID cross sector share - */ - String getEIDCrossSectorShare(); - - /** - * Sets the eID cross sector share. - * - * @param eIDCrossSectorShare the new eID cross sector share - */ - void setEIDCrossSectorShare(String eIDCrossSectorShare); - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base deleted file mode 100644 index dc88f3318..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDSectorShare. - * @author fjquevedo - */ -public interface EIDSectorShare extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "eIDSectorShare"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "eIDSectorShare"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - - /** - * Gets the eID sector share. - * - * @return the eID sector share - */ - String getEIDSectorShare(); - - /** - * Sets the eID sector share. - * - * @param eIDSectorShare the new eID sector share - */ - void setEIDSectorShare(String eIDSectorShare); - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base deleted file mode 100644 index 2c09cf85b..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * STORK Quality Authentication Assurance Level Attribute Interface. - * - * @author fjquevedo - */ -public interface QAAAttribute extends SAMLObject { - - /** Element local name. */ - String DEF_LOCAL_NAME = "QualityAuthenticationAssuranceLevel"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "QualityAuthenticationAssuranceLevelAbstractType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The minimum value allowed. */ - int MIN_VALUE = 1; - - /** The Max value allowed. */ - int MAX_VALUE = 4; - - /** - * Gets the qAA level. - * - * @return the qAA level - */ - String getQaaLevel(); - - /** - * Sets the qAA level. - * - * @param qaaLevel the new qAA level - * - */ - void setQaaLevel(String qaaLevel); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base deleted file mode 100644 index 02be9e104..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; -import org.opensaml.xml.AttributeExtensibleXMLObject; -import org.opensaml.xml.schema.XSBooleanValue; -import org.opensaml.xml.XMLObject; - -/** - * The Interface RequestedAttribute. - * - * @author fjquevedo - */ -public interface RequestedAttribute extends SAMLObject, - AttributeExtensibleXMLObject { - - /** Element local name. */ - String DEF_LOCAL_NAME = "RequestedAttribute"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "RequestedAttributeAbstractType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** NAME_ATTRIB_NAME attribute name. */ - String NAME_ATTRIB_NAME = "Name"; - - /** NAME_FORMAT_ATTRIB_NAME attribute name. */ - String NAME_FORMAT_ATTR = "NameFormat"; - - /** IS_REQUIRED_ATTRIB_NAME attribute name. */ - String IS_REQUIRED_ATTR = "isRequired"; - - /** FRIENDLY_NAME_ATTRIB_NAME attribute name. */ - String FRIENDLY_NAME_ATT = "FriendlyName"; - - /** Unspecified attribute format ID. */ - String UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"; - - /** URI reference attribute format ID. */ - String URI_REFERENCE = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"; - - /** Basic attribute format ID. */ - String BASIC = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"; - - /** - * Gets the name. - * - * @return the name - */ - String getName(); - - /** - * Sets the name. - * - * @param name the new name - */ - void setName(String name); - - /** - * Gets the name format. - * - * @return the name format - */ - String getNameFormat(); - - /** - * Sets the name format. - * - * @param nameFormat the new name format - */ - void setNameFormat(String nameFormat); - - /** - * Gets the friendly name. - * - * @return the friendly name - */ - String getFriendlyName(); - - /** - * Sets the friendly name. - * - * @param friendlyName the new friendly name - */ - void setFriendlyName(String friendlyName); - - /** - * Gets the checks if is required. - * - * @return the checks if is required - */ - String isRequired(); - - /** - * Gets the checks if is required xs boolean. - * - * @return the checks if is required xs boolean - */ - String getIsRequiredXSBoolean(); - - /** - * Sets the checks if is required. - * - * @param newIsRequired the new checks if is required - */ - void setIsRequired(String newIsRequired); - - /** - * Gets the attribute values. - * - * @return the attribute values - */ - List getAttributeValues(); - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base deleted file mode 100644 index 9004b10f4..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface RequestedAttributes. - * - * @author fjquevedo - */ -public interface RequestedAttributes extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "RequestedAttributes"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "RequestedAttributesType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the attributes. - * - * @return the attributes - */ - List getAttributes(); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base deleted file mode 100644 index e511bbaeb..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -/** - * The Enumeration SAMLCore. - * - * @author fjquevedo - */ - -public enum SAMLCore { - - /** The consent authentication request. */ - CONSENT_AUTHN_REQ("consentAuthnRequest"), - - /** The consent authentication response. */ - CONSENT_AUTHN_RES("consentAuthnResponse"), - - /** The FORC e_ auth n_ tag. */ - FORCE_AUTHN_TAG("forceAuthN"), - - /** The I s_ passiv e_ tag. */ - IS_PASSIVE_TAG("isPassive"), - - /** The FORMA t_ entity. */ - FORMAT_ENTITY("formatEntity"), - - /** The FRIENDLY name. */ - FRIENDLY_NAME("friendlyName"), - - /** The IS_REQUIRED AN ATTRIBUTE */ - IS_REQUIRED("isRequired"), - - /** The PRO t_ bindin g_ tag. */ - PROT_BINDING_TAG("protocolBinding"), - - /** The ASSER t_ con s_ tag. */ - ASSERT_CONS_TAG("assertionConsumerServiceURL"), - - /** The REQUESTE r_ tag. */ - REQUESTER_TAG("requester"), - - /** The RESPONDE r_ tag. */ - RESPONDER_TAG("responder"), - - /** The STOR k10_ ns. */ - STORK10_NS("urn:eu:stork:names:tc:STORK:1.0:assertion"), - - /** The STOR k10 p_ ns. */ - STORK10P_NS("urn:eu:stork:names:tc:STORK:1.0:protocol"), - - /** The STOR k10_ prefix. */ - STORK10_PREFIX("stork"), - - /** The STOR k10 p_ prefix. */ - STORK10P_PREFIX("storkp"), - - /** The STOR k10_ bas e_ uri. */ - STORK10_BASE_URI("http://www.stork.gov.eu/1.0/"), - - /** The ON e_ tim e_ use. */ - ONE_TIME_USE("oneTimeUse"); - - /** The value. */ - private String value; - - /** - * Instantiates a new sAML core. - * - * @param fullName the full name - */ - private SAMLCore(final String fullName) { - this.value = fullName; - } - - /** - * Gets the value. - * - * @return the value - */ - public String getValue() { - return value; - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base deleted file mode 100644 index b382646be..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import java.security.KeyStore; -import java.security.cert.X509Certificate; - -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; - -import eu.stork.peps.exceptions.SAMLEngineException; - -/** - * The Interface SAMLEngineSignI. - * - * @author fjquevedo - */ -public interface SAMLEngineSignI { - - /** - * Sign. - * - * @param tokenSaml the token SAML - * - * @return the sAML object - * - * @throws SAMLEngineException the SAML engine exception - */ - SAMLObject sign(SignableSAMLObject tokenSaml) throws SAMLEngineException; - - /** - * Gets the certificate. - * - * @return the certificate - */ - X509Certificate getCertificate(); - - /** - * Gets the trustStore used when validating SAMLTokens - * - * @return the trustStore - * - */ - KeyStore getTrustStore(); - - /** - * Validate signature. - * - * @param tokenSaml the token SAML - * - * @return the sAML object - * - * @throws SAMLEngineException the SAML engine exception - */ - SAMLObject validateSignature(SignableSAMLObject tokenSaml) - throws SAMLEngineException; - - /** - * Initialize the signature module. - * - * @param fileConf the configuration file. - * - * @throws SAMLEngineException the STORKSAML engine runtime - * exception - */ - void init(String fileConf) throws SAMLEngineException; - - /** - * Load cryptographic service provider. - * - * @throws SAMLEngineException the SAML engine exception - */ - void loadCryptServiceProvider() throws SAMLEngineException; - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base deleted file mode 100644 index 9ace6d37c..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface SPApplication. - * - * @author fjquevedo - */ -public interface SPApplication extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "spApplication"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "spApplicationType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** - * Gets the service provider application. - * - * @return the service provider application - */ - String getSPApplication(); - - /** - * Sets the service provider application. - * - * @param spApplication the new service provider application - */ - void setSPApplication(String spApplication); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base deleted file mode 100644 index 569ea48c2..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface SPCountry. - * - * @author fjquevedo - */ -public interface SPCountry extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "spCountry"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "spCountryType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** - * Gets the service provider country. - * - * @return the service provider country - */ - String getSPCountry(); - - /** - * Sets the service provider country. - * - * @param spCountry the new service provider country - */ - void setSPCountry(String spCountry); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base deleted file mode 100644 index c0cf02ad0..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * @author iinigo - */ -public interface SPID extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "SPID"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "SPIDType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the SP ID. - * - * @return the SP ID - */ - String getSPID(); - - - /** - * Sets the SP ID. - * - * @param SPID the new SP ID - */ - void setSPID(String newSPID); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base deleted file mode 100644 index 34ba9c9c5..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * @author iinigo - */ -public interface SPInformation extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "SPInformation"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "SPInformationType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the SP Id. - * - * @return the SP Id - */ - SPID getSPID(); - - - /** - * Sets the SP Id. - * - * @param newSPId the new SP Id - */ - void setSPID(SPID newSPID); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base deleted file mode 100644 index 33dad474b..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * - * @author fjquevedo - */ -public interface SPInstitution extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "spInstitution"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "spInstitutionType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** - * Gets the service provider institution. - * - * @return the service provider institution - */ - String getSPInstitution(); - - /** - * Sets the service provider institution. - * - * @param spInstitution the new service provider institution - */ - void setSPInstitution(String spInstitution); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base deleted file mode 100644 index 1f49a4015..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface SPSector. - * - * @author fjquevedo - */ -public interface SPSector extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "spSector"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "spSectorType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** - * Gets the service provider sector. - * - * @return the service provider sector - */ - String getSPSector(); - - /** - * Sets the service provider sector. - * - * @param spSector the new service provider sector - */ - void setSPSector(String spSector); -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base deleted file mode 100644 index 19c71dd74..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base +++ /dev/null @@ -1,508 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import java.util.Properties; - -import org.apache.commons.lang.StringUtils; -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.core.NameIDType; -import org.opensaml.saml2.core.RequestAbstractType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * The Class SAMLCore. - * - * @author fjquevedo - */ -public final class STORKSAMLCore { - - /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(STORKSAMLCore.class.getName()); - - /** The consent authentication request. */ - private String consentAuthnReq = null; - - /** The consent authentication response. */ - private String consentAuthnResp = null; - - /** The id cross border share. */ - private String eIDCrossBordShare = null; - - /** The e id cross sect share. */ - private String eIDCrossSectShare = null; - - /** The e id sector share. */ - private String eIDSectorShare = null; - - /** The format entity. */ - private String formatEntity = null; - - /** The friendly name. */ - private boolean friendlyName = false; - - /** The IP validation. */ - private boolean ipValidation = false; - - /** The one time use. */ - private boolean oneTimeUse = true; - - /** The protocol binding. */ - private String protocolBinding = null; - - /** The requester. */ - private String requester = null; - - - /** The responder. */ - private String responder = null; - - /** The SAML core properties. */ - private Properties samlCoreProp = null; - - /** The time not on or after. */ - private Integer timeNotOnOrAfter = null; - - /** The is required parameter. */ - private boolean isRequired = true; - - private static final String SAML_ENGINE_LITERAL = "SamlEngine.xml: "; - - /** - * Gets the isRequired. - * - * @return the isRequired - */ - public boolean isRequired() { - return isRequired; - } - - /** - * Sets the isRequired. - * - * @param isRequired the required. - */ - public void setRequired(boolean isRequired) { - this.isRequired = isRequired; - } - - /** - * Instantiates a new sAML core. - * - * @param instance the instance - */ - public STORKSAMLCore(final Properties instance) { - loadConfiguration(instance); - } - - /** - * Gets the consent. - * - * @return the consent - */ - public String getConsentAuthnRequest() { - return consentAuthnReq; - } - - /** - * Gets the consent authentication response. - * - * @return the consent authentication response. - */ - public String getConsentAuthnResp() { - return consentAuthnResp; - } - - /** - * Gets the consent authentication response. - * - * @return the consent authentication response - */ - public String getConsentAuthnResponse() { - return consentAuthnResp; - } - - /** - * Gets the format entity. - * - * @return the format entity - */ - public String getFormatEntity() { - return formatEntity; - } - - /** - * Gets the property. - * - * @param key the key - * - * @return the property - */ - public String getProperty(final String key) { - return samlCoreProp.getProperty(key); - } - - /** - * Gets the protocol binding. - * - * @return the protocol binding - */ - public String getProtocolBinding() { - return protocolBinding; - } - - /** - * Gets the requester. - * - * @return the requester - */ - public String getRequester() { - return requester; - } - - /** - * Gets the responder. - * - * @return the responder - */ - public String getResponder() { - return responder; - } - - /** - * Gets the time not on or after. - * - * @return the time not on or after - */ - public Integer getTimeNotOnOrAfter() { - return timeNotOnOrAfter; - } - - /** - * Checks if is e id cross border share. - * - * @return true, if is e id cross border share - */ - public String iseIDCrossBorderShare() { - return eIDCrossBordShare; - } - - /** - * Checks if is e id cross border share. - * - * @return true, if is e id cross border share - */ - public String iseIDCrossBordShare() { - return eIDCrossBordShare; - } - - /** - * Checks if is e id cross sector share. - * - * @return true, if is e id cross sector share - */ - public String iseIDCrossSectorShare() { - return eIDCrossSectShare; - } - - /** - * Checks if is e id cross sect share. - * - * @return true, if is e id cross sect share - */ - public String iseIDCrossSectShare() { - return eIDCrossSectShare; - } - - /** - * Checks if is e id sector share. - * - * @return true, if is e id sector share - */ - public String iseIDSectorShare() { - return eIDSectorShare; - } - - /** - * Checks if is friendly name. - * - * @return true, if checks if is friendly name - */ - public boolean isFriendlyName() { - return friendlyName; - } - - /** - * Checks if is IP validation. - * - * @return true, if is IP validation - */ - public boolean isIpValidation() { - return ipValidation; - } - - /** - * Checks if is one time use. - * - * @return true, if is one time use - */ - public boolean isOneTimeUse() { - return oneTimeUse; - } - - /** - * Method that loads the configuration file for the SAML Engine. - * - * @param instance the instance of the Engine properties. - */ - private void loadConfiguration(final Properties instance) { - - try { - LOGGER.info("SAMLCore: Loading SAMLEngine properties."); - - samlCoreProp = instance; - - final String parameter = samlCoreProp - .getProperty(SAMLCore.FORMAT_ENTITY.getValue()); - - if ("entity".equalsIgnoreCase(parameter)) { - formatEntity = NameIDType.ENTITY; - } - - friendlyName = Boolean.valueOf(samlCoreProp - .getProperty(SAMLCore.FRIENDLY_NAME.getValue())); - - String isRequiredValue = samlCoreProp. - getProperty(SAMLCore.IS_REQUIRED.getValue()); - if (isRequiredValue != null) { - isRequired = Boolean.valueOf(isRequiredValue); - } - - eIDSectorShare = samlCoreProp - .getProperty("eIDSectorShare"); - eIDCrossSectShare = samlCoreProp - .getProperty("eIDCrossSectorShare"); - eIDCrossBordShare = samlCoreProp - .getProperty("eIDCrossBorderShare"); - - ipValidation = Boolean.valueOf(samlCoreProp - .getProperty("ipAddrValidation")); - - final String oneTimeUseProp = samlCoreProp - .getProperty(SAMLCore.ONE_TIME_USE.getValue()); - - if (StringUtils.isNotBlank(oneTimeUseProp)) { - oneTimeUse = Boolean.valueOf(oneTimeUseProp); - } - - // Protocol Binding - loadProtocolBiding(); - - // Consent Authentication Request - consentAuthnReq = samlCoreProp - .getProperty(SAMLCore.CONSENT_AUTHN_REQ.getValue()); - - if ("unspecified".equalsIgnoreCase(consentAuthnReq)) { - consentAuthnReq = RequestAbstractType.UNSPECIFIED_CONSENT; - } - - loadConsentAuthResp(); - - timeNotOnOrAfter = Integer.valueOf(samlCoreProp - .getProperty("timeNotOnOrAfter")); - - if (timeNotOnOrAfter.intValue() < 0) { - LOGGER.error(SAML_ENGINE_LITERAL + "timeNotOnOrAfter" - + " is negative number."); - - throw new SAMLEngineException(SAML_ENGINE_LITERAL - + "timeNotOnOrAfter" + " is negative number."); - } - - requester = samlCoreProp.getProperty(SAMLCore.REQUESTER_TAG.getValue()); - responder = samlCoreProp.getProperty(SAMLCore.RESPONDER_TAG.getValue()); - - } catch (SAMLEngineException e) { - LOGGER.error("SAMLCore: error loadConfiguration. ", e); - throw new STORKSAMLEngineRuntimeException(e); - } catch (RuntimeException e) { - LOGGER.error("SAMLCore: error loadConfiguration. ", e); - throw new STORKSAMLEngineRuntimeException(e); - } - } - - /** - * Load consent authentication response. - */ - private void loadConsentAuthResp() { - // Consent Authentication Response - consentAuthnResp = samlCoreProp - .getProperty(SAMLCore.CONSENT_AUTHN_RES.getValue()); - - if ("obtained".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = RequestAbstractType.OBTAINED_CONSENT; - } else if ("prior".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = RequestAbstractType.PRIOR_CONSENT; - } else if ("curent-implicit".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = - "urn:oasis:names:tc:SAML:2.0:consent:current-implicit"; - } else if ("curent-explicit".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = - "urn:oasis:names:tc:SAML:2.0:consent:current-explicit"; - } else if ("unspecified".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = RequestAbstractType.UNSPECIFIED_CONSENT; - } - } - - /** - * Load protocol biding. - * - * @throws SAMLEngineException the SAML engine exception - */ - private void loadProtocolBiding() throws SAMLEngineException { - // Protocol Binding - protocolBinding = samlCoreProp.getProperty(SAMLCore.PROT_BINDING_TAG.getValue()); - - if (StringUtils.isBlank(protocolBinding)) { - LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG - + " it's mandatory."); - throw new SAMLEngineException(SAML_ENGINE_LITERAL - + SAMLCore.PROT_BINDING_TAG + " it's mandatory."); - } else if (protocolBinding.equalsIgnoreCase("HTTP-POST")) { - protocolBinding = SAMLConstants.SAML2_POST_BINDING_URI; - } else { - LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG - + " it's not supporting."); - - throw new SAMLEngineException(SAML_ENGINE_LITERAL - + SAMLCore.PROT_BINDING_TAG + " it's not supporting."); - } - } - - /** - * Sets the consent authentication response. - * - * @param newConsAuthnResp the new consent authentication response - */ - public void setConsentAuthnResp(final String newConsAuthnResp) { - this.consentAuthnResp = newConsAuthnResp; - } - - /** - * Sets an eID that can be shared outside of the Service Provider’s member state. - * - * @param newEIDCrossBord the new eid cross border share - */ - public void setEIDCrossBordShare(final String newEIDCrossBord) { - this.eIDCrossBordShare = newEIDCrossBord; - } - - /** - * Sets an eID that can be shared outside of the Service Provider’s sector. - * - * @param newEIDCrossSect the new eid cross sect share - */ - public void setEIDCrossSectShare(final String newEIDCrossSect) { - this.eIDCrossSectShare = newEIDCrossSect; - } - - /** - * Sets an eID that can be shared within the Service Provider’s sector. - * - * @param newEIDSectorShare the new eid sector share - */ - public void seteIDSectorShare(final String newEIDSectorShare) { - this.eIDSectorShare = newEIDSectorShare; - } - - /** - * Sets the format entity. - * - * @param newFormatEntity the new format entity - */ - public void setFormatEntity(final String newFormatEntity) { - this.formatEntity = newFormatEntity; - } - - /** - * Sets the friendly name. - * - * @param newFriendlyName the new friendly name - */ - public void setFriendlyName(final boolean newFriendlyName) { - this.friendlyName = newFriendlyName; - } - - /** - * Sets the IP validation. - * - * @param newIpValidation the new IP validation - */ - public void setIpValidation(final boolean newIpValidation) { - this.ipValidation = newIpValidation; - } - - /** - * Sets the one time use. - * - * @param newOneTimeUse the new one time use - */ - public void setOneTimeUse(final boolean newOneTimeUse) { - this.oneTimeUse = newOneTimeUse; - } - - /** - * Sets the protocol binding. - * - * @param newProtBinding the new protocol binding - */ - public void setProtocolBinding(final String newProtBinding) { - this.protocolBinding = newProtBinding; - } - - /** - * Sets the requester. - * - * @param newRequester the new requester - */ - public void setRequester(final String newRequester) { - this.requester = newRequester; - } - - /** - * Sets the responder. - * - * @param newResponder the new responder - */ - public void setResponder(final String newResponder) { - this.responder = newResponder; - } - - /** - * Sets the time not on or after. - * - * @param newTimeNotOnOrAft the new time not on or after - */ - public void setTimeNotOnOrAfter(final Integer newTimeNotOnOrAft) { - this.timeNotOnOrAfter = newTimeNotOnOrAft; - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base deleted file mode 100644 index 3f812393e..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface VIDPAuthenticationAttributes. - * - * @author fjquevedo - */ -public interface VIDPAuthenticationAttributes extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "VIDPAuthenticationAttributes"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "VIDPAuthenticationAttributesType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - - /** - * Gets the citizen country code. - * - * @return the citizen country code - */ - CitizenCountryCode getCitizenCountryCode(); - - /** - * Sets the citizen country code. - * - * @param newCitizenCountryCode the new citizen country code - */ - void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode); - - /** - * Gets the SP information - * - * @return the SP information - */ - SPInformation getSPInformation(); - - /** - * Sets the SP information - * - * @param newSPInformation the new SPInformation - */ - void setSPInformation(SPInformation newSPInformation); - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 3393dcf78..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Interfaces for STORK 1.0 core specification types and elements. - */ -package eu.stork.peps.auth.engine.core; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.class deleted file mode 100644 index 7ab792ba7..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.class deleted file mode 100644 index beeb81ab1..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.class deleted file mode 100644 index 616d6fb8e..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.class deleted file mode 100644 index cc59003d2..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.class deleted file mode 100644 index 31f4eb7f4..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.class deleted file mode 100644 index 3482ee661..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.class deleted file mode 100644 index 55581e6dc..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.class deleted file mode 100644 index 2eac3dcd3..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLCore.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLCore.class deleted file mode 100644 index 512b52614..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLCore.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.class deleted file mode 100644 index 37ab6c686..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPApplication.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPApplication.class deleted file mode 100644 index c823866bc..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPApplication.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPCountry.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPCountry.class deleted file mode 100644 index d3314a424..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPCountry.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPID.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPID.class deleted file mode 100644 index 5db4d67b0..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPID.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInformation.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInformation.class deleted file mode 100644 index 183983a58..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInformation.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInstitution.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInstitution.class deleted file mode 100644 index e50ab4392..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPInstitution.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPSector.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPSector.class deleted file mode 100644 index 591acbe39..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/SPSector.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.class deleted file mode 100644 index 623ea5822..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.class deleted file mode 100644 index 77ce2f041..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops deleted file mode 100644 index 7eb0de6e7..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops +++ /dev/null @@ -1,395 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 97 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl -END -RequestedAttributeImpl.java -K 25 -svn:wc:ra_dav:version-url -V 125 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.java -END -EIDCrossBorderShareMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 132 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.java -END -SPIDMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.java -END -SPInformationImpl.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.java -END -SPInstitutionUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.java -END -EIDSectorShareBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 124 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.java -END -SPCountryBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.java -END -EIDCrossBorderShareImpl.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.java -END -EIDSectorShareUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.java -END -RequestedAttributesMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 132 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.java -END -RequestedAttributesImpl.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.java -END -SignHW.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java -END -QAAAttributeUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 127 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.java -END -SPInstitutionMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.java -END -SPIDUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.java -END -SPInstitutionImpl.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.java -END -EIDSectorShareMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 127 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.java -END -SPSectorUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.java -END -VIDPAuthenticationAttributesBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 138 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 115 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/package-info.java -END -VIDPAuthenticationAttributesMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 141 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.java -END -SPApplicationUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.java -END -EIDSectorShareImpl.java -K 25 -svn:wc:ra_dav:version-url -V 121 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.java -END -CitizenCountryCodeBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.java -END -EIDCrossSectorShareUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 134 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.java -END -RequestedAttributeBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.java -END -SignModuleFactory.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.java -END -RequestedAttributeMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 131 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.java -END -QAAAttributeMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 125 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.java -END -CitizenCountryCodeUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 133 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.java -END -AuthenticationAttributesUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 139 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java -END -SPIDBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.java -END -QAAAttributeImpl.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.java -END -SPSectorMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 121 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.java -END -SPApplicationMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.java -END -SPIDImpl.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.java -END -SPCountryUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 124 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.java -END -SPSectorImpl.java -K 25 -svn:wc:ra_dav:version-url -V 115 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.java -END -VIDPAuthenticationAttributesUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 143 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.java -END -SPApplicationImpl.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.java -END -EIDCrossSectorShareMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 132 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.java -END -QAAAttributeBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 122 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.java -END -CitizenCountryCodeMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 131 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.java -END -SPInformationBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.java -END -EIDCrossSectorShareImpl.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.java -END -AuthenticationAttributesMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 137 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.java -END -EIDCrossBorderShareBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java -END -RequestedAttributeUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 133 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.java -END -SPInformationUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.java -END -CitizenCountryCodeImpl.java -K 25 -svn:wc:ra_dav:version-url -V 125 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.java -END -AuthenticationAttributesImpl.java -K 25 -svn:wc:ra_dav:version-url -V 131 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.java -END -SPSectorBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 118 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.java -END -EIDCrossBorderShareUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 134 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.java -END -SignSW.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java -END -SPApplicationBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.java -END -RequestedAttributesBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.java -END -SPCountryMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 122 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.java -END -SignP12.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java -END -EIDCrossSectorShareBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.java -END -RequestedAttributesUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 134 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.java -END -SPCountryImpl.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.java -END -VIDPAuthenticationAttributesImpl.java -K 25 -svn:wc:ra_dav:version-url -V 135 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.java -END -AuthenticationAttributesBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 134 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java -END -SPInformationMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.java -END -SPInstitutionBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.java -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries deleted file mode 100644 index 1c6a5c2a8..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries +++ /dev/null @@ -1,2238 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -VIDPAuthenticationAttributesUnmarshaller.java -file - - - - -2013-12-20T12:27:57.414475Z -379336b4e33025428a27f1cec8b44056 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2104 - -RequestedAttributesImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -27cbdb6010cc87d0da987d980e933181 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2964 - -CitizenCountryCodeMarshaller.java -file - - - - -2013-12-20T12:27:57.418475Z -d5237a27554ddbe26fd86e0b10800274 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1655 - -SPInformationBuilder.java -file - - - - -2013-12-20T12:27:57.414475Z -225f5a1c91da42fbcd3a0cb68318b32c -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1477 - -AuthenticationAttributesMarshaller.java -file - - - - -2013-12-20T12:27:57.418475Z -7c4410da9e4b223a39e8cfe7fe8baca8 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -986 - -EIDCrossBorderShareBuilder.java -file - - - - -2013-12-20T12:27:57.418475Z -87ddac844ca24e090fd90e8cd258c462 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1682 - -RequestedAttributeUnmarshaller.java -file - - - - -2013-12-20T12:27:57.418475Z -757de668eb8faac10e3d467a6fb75d8b -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3435 - -CitizenCountryCodeImpl.java -file - - - - -2013-12-20T12:27:57.418475Z -e823785bbced34f6d08bea9998975575 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2642 - -SPInstitutionMarshaller.java -file - - - - -2013-12-20T12:27:57.418475Z -cc15a0beeb86be9ca8ee405fb46e2bdb -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1627 - -AuthenticationAttributesImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -fa84458a078738803e160f1fd3ff6210 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3348 - -SignSW.java -file - - - - -2013-12-20T12:27:57.422475Z -1f905fe296e2dfb66e02ea925d3a7761 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -14730 - -SPApplicationBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -03f6145382be5dc9dbf50a09172d40ba -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1638 - -SPInstitutionImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -debba0c2baa76483e40e62a5de0e1123 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2618 - -RequestedAttributesBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -8516fe8723cb2405475a0fca0909e338 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1729 - -VIDPAuthenticationAttributesBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -60bafffa1fb9223231f49a0c12109ccd -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1607 - -SPApplicationUnmarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -143466710186caf840584c038fc365d4 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1408 - -EIDCrossSectorShareBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -95a940a01539d754a0f2d5fbc58dced2 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1746 - -VIDPAuthenticationAttributesImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -71986c6390a88c027fb622f342dda7dd -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3928 - -CitizenCountryCodeBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -d6adb4dcf3f02a2115e03e197f71e7d0 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1661 - -EIDCrossSectorShareUnmarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -8b7d6524324bf334695470c97a5ae8e9 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1636 - -RequestedAttributeBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -8e01d40d3d5d57e76e68335c4dfa33fd -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1719 - -SignModuleFactory.java -file - - - - -2013-12-20T12:27:57.422475Z -ca27edd3b64fe3994d694668441242c0 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1904 - -SPInstitutionBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -c154c661d7cf09d5deeb12ddf66b69a1 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1652 - -SPIDBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -081af3337ceb54c3a8e8c3fdbdd07757 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1531 - -RequestedAttributeImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -2b0a40b8c2b3640929adb2c1500ecfa8 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -5576 - -SPIDMarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -1f25673e4ed1a76ed9763d06e73942bf -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1549 - -SPCountryBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -a6e6d09f79e112c96d03f1dff4506843 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1627 - -SPApplicationMarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -d3053090b75974af918b25e32b3c16cb -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1627 - -EIDSectorShareUnmarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -e003885ad4f424b731178f3de53a9934 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1596 - -SPCountryUnmarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -e01b8f80dbcec3c100d563b8da6c206d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1376 - -SPApplicationImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -0df0bd3dc6acdf706be767ba9e5ca6fc -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2617 - -EIDCrossSectorShareMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -e80eee7bbdb571f5a481ea66fc6b047d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1687 - -QAAAttributeBuilder.java -file - - - - -2013-12-20T12:27:57.426475Z -965b74882dfafe06f391804601049c48 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1653 - -SignHW.java -file - - - - -2013-12-20T12:27:57.426475Z -7896afe7f189a7db5835e120aa6b6037 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -13749 - -EIDCrossSectorShareImpl.java -file - - - - -2013-12-20T12:27:57.426475Z -08ad1682d1f146a114625a1dc1626f6c -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2703 - -QAAAttributeUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -b5eede63027f8b9638f905d3e905046f -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1387 - -SPInformationUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -b504aef9588b7817e1e1d37fd157076e -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1775 - -SPSectorBuilder.java -file - - - - -2013-12-20T12:27:57.426475Z -4725ddc6ef146afbe0a3cca1a97a0102 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1606 - -EIDCrossBorderShareUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -c7cd8600b386369e011a2a7f4c5f0d9c -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1472 - -SPIDUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -7090a9ec17d610025260f1af3495044d -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1332 - -EIDSectorShareMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -ded11a8620d93cbb7fe703385583827a -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1712 - -SPSectorUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -16ec587f7357a4896411cc80a10f6523 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1372 - -SPCountryMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -f03343df1d204b3f461c7a54a1e6ed35 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1592 - -SignP12.java -file - - - - -2013-12-20T12:27:57.426475Z -2d6ec5552f62f50e8eb579e11def48f7 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -15576 - -package-info.java -file - - - - -2013-12-20T12:27:57.426475Z -76a0f72a61ed971b95da33c1c8b8aa69 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -817 - -VIDPAuthenticationAttributesMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -c099f28cf58fbc0f1db727b22f3a0d5a -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1120 - -RequestedAttributesUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -d18788d30b80c2a020dded672c9d937d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1844 - -EIDSectorShareImpl.java -file - - - - -2013-12-20T12:27:57.426475Z -eb771b1a638ae3751a0f90b187748495 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2622 - -SPCountryImpl.java -file - - - - -2013-12-20T12:27:57.426475Z -a2ddffd67762f74d21509471a2e1663c -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2528 - -AuthenticationAttributesBuilder.java -file - - - - -2013-12-20T12:27:57.426475Z -99840afca17ae5400257a49dd15c3d4f -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1792 - -RequestedAttributeMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -f4b4ab1af9ecd9aaf7230786ab73f6d7 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2969 - -QAAAttributeMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -9a0f0dd3957d29547adf15ae519b1ad4 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1612 - -CitizenCountryCodeUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -ff6f71c1e4e7a3d58f8696ae9080588e -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1447 - -SPInformationMarshaller.java -file - - - - -2013-12-20T12:27:57.430475Z -126729a7293d478709678748ec47277f -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1055 - -AuthenticationAttributesUnmarshaller.java -file - - - - -2013-12-20T12:27:57.430475Z -4f9cbca52f62feb055986ed1d6cc45ed -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1929 - -EIDCrossBorderShareMarshaller.java -file - - - - -2013-12-20T12:27:57.410475Z -0334c19bff0e6bfd196de52e7f1d1547 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1689 - -QAAAttributeImpl.java -file - - - - -2013-12-20T12:27:57.410475Z -bee5948d710cfab6256be7f47bb70096 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2647 - -SPInformationImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -93e4dc0e3432b0a6f355b70230f59edd -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2979 - -SPInstitutionUnmarshaller.java -file - - - - -2013-12-20T12:27:57.410475Z -11e598b7cc89fdea183e3f4f7c2019b3 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1407 - -EIDSectorShareBuilder.java -file - - - - -2013-12-20T12:27:57.414475Z -eef58e0f54cd2c89b3ccb73dbbaf4b24 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1672 - -SPSectorMarshaller.java -file - - - - -2013-12-20T12:27:57.414475Z -1d5f1bf8fa1b6170804abc1a64ad52c4 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1584 - -EIDCrossBorderShareImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -9514676b0d03b2288c82db3d46ef150a -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2722 - -SPIDImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -17b9d0d330854aa4aaa855345c09e9c0 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2381 - -RequestedAttributesMarshaller.java -file - - - - -2013-12-20T12:27:57.414475Z -84d34f73f399fdecde91f58068f2fcd0 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1116 - -SPSectorImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -1751902990706e32763e3e931b70622e -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2411 - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base deleted file mode 100644 index 74840e135..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.AuthenticationAttributes; - -/** - * The Class AuthenticationAttributesBuilder. - * - * @author fjquevedo - */ -public class AuthenticationAttributesBuilder extends - AbstractSAMLObjectBuilder { - - - - /** - * Builds the object. - * - * @return the authentication attributes - */ - public final AuthenticationAttributes buildObject() { - return buildObject(AuthenticationAttributes.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace URI - * @param localName the local name - * @param namespacePrefix the namespace prefix - * - * @return the authentication attributes - */ - public final AuthenticationAttributes buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new AuthenticationAttributesImpl(namespaceURI, localName, - namespacePrefix); - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base deleted file mode 100644 index 1e43e7ec3..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSignableSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.AuthenticationAttributes; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class AuthenticationAttributesImpl. - * - * @author fjquevedo - */ -public final class AuthenticationAttributesImpl extends AbstractSignableSAMLObject implements -AuthenticationAttributes { - - private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticationAttributesImpl.class.getName()); - - /** The indexed children. */ - private VIDPAuthenticationAttributes vIDPAuthenAttr; - - /** - * Instantiates a new authentication attributes implementation. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected AuthenticationAttributesImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - * - */ - public List getOrderedChildren() { - final ArrayList children = new ArrayList(); - - children.add(vIDPAuthenAttr); - - if (getSignature() != null) { - children.add(getSignature()); - } - - return Collections.unmodifiableList(children); - } - - /** - * Gets the signature reference id. - * - * @return the signature reference id - * - */ - public String getSignatureReferenceID() { - return null; - } - - /** - * Gets the vidp authentication attributes. - * - * @return the VIDP authentication attributes - * - */ - public VIDPAuthenticationAttributes getVIDPAuthenticationAttributes() { - return vIDPAuthenAttr; - } - - /** - * Sets the vidp authentication attributes. - * - * @param newVIDPAuthenAttr the new vidp authen attr - * - */ - public void setVIDPAuthenticationAttributes( - final VIDPAuthenticationAttributes newVIDPAuthenAttr) { - vIDPAuthenAttr = prepareForAssignment(this.vIDPAuthenAttr, newVIDPAuthenAttr); - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base deleted file mode 100644 index 698bf56b9..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; - -/** - * The Class AuthenticationAttributesMarshaller. - * - * @author fjquevedo - */ -public class AuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { - - - - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base deleted file mode 100644 index af3e5c234..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; - -import eu.stork.peps.auth.engine.core.AuthenticationAttributes; - -/** - * The Class AuthenticationAttributesUnmarshaller. - * - * @author fjquevedo - */ -public class AuthenticationAttributesUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentObject the parent object - * @param childObject the child object - * - * @throws UnmarshallingException the unmarshalling exception - * - */ - protected final void processChildElement(final XMLObject parentObject, - final XMLObject childObject) throws UnmarshallingException { - final AuthenticationAttributes attrStatement = (AuthenticationAttributes) parentObject; - - if (childObject instanceof VIDPAuthenticationAttributes) { - attrStatement.setVIDPAuthenticationAttributes((VIDPAuthenticationAttributes) childObject); - } else { - super.processChildElement(parentObject, childObject); - } - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base deleted file mode 100644 index 64651691f..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; - -/** - * The Class CitizenCountryCodeBuilder. - * - * @author fjquevedo - */ -public class CitizenCountryCodeBuilder extends AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the citizen country code - */ - public final CitizenCountryCode buildObject() { - return buildObject(CitizenCountryCode.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the citizen country code - */ - public final CitizenCountryCode buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new CitizenCountryCodeImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base deleted file mode 100644 index 4df8084a9..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class CitizenCountryCodeImpl. - * - * @author fjquevedo - */ -public class CitizenCountryCodeImpl extends AbstractSAMLObject implements CitizenCountryCode { - - private static final Logger LOGGER = LoggerFactory.getLogger(CitizenCountryCodeImpl.class.getName()); - /** The citizen country code. */ - private String citizenCountryCode; - - /** - * Instantiates a new sP country impl. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected CitizenCountryCodeImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the citizen country code. - * - * @return the citizen country code - */ - public final String getCitizenCountryCode() { - return citizenCountryCode; - } - - /** - * Sets the citizen country code. - * - * @param newCitizenCountryCode the new citizen country code - */ - public final void setCitizenCountryCode(final String newCitizenCountryCode) { - this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base deleted file mode 100644 index decae04c5..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; - -/** - * The Class SPCountryMarshaller. - * - * @author fjquevedo - */ -public class CitizenCountryCodeMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; - XMLHelper.appendTextContent(domElement, citizenCountryCode.getCitizenCountryCode()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base deleted file mode 100644 index 93132b508..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; - -/** - * The Class CitizenCountryCodeUnmarshaller. - * - * @author fjquevedo - */ -public class CitizenCountryCodeUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; - citizenCountryCode.setCitizenCountryCode(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base deleted file mode 100644 index b939da776..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; - -/** - * The Class EIDCrossBorderShareBuilder. - * - * @author fjquevedo - */ -public class EIDCrossBorderShareBuilder extends AbstractSAMLObjectBuilder { - - - /** - * Builds the object. - * - * @return the identifier cross border share - */ - public final EIDCrossBorderShare buildObject() { - return buildObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); - } - - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the eID cross border share - */ - public final EIDCrossBorderShare buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new EIDCrossBorderShareImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base deleted file mode 100644 index 50a997031..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class EIDCrossBorderShareImpl. - * - * @author fjquevedo - */ -public class EIDCrossBorderShareImpl extends AbstractSAMLObject implements - EIDCrossBorderShare { - - private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossBorderShareImpl.class.getName()); - /** The citizen country code. */ - private String eIDCrossBorderShare; - - /** - * Instantiates a new eID cross border share implementation. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected EIDCrossBorderShareImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - - /** - * Gets the eID cross border share. - * - * @return the eID cross border share - */ - public final String getEIDCrossBorderShare() { - return eIDCrossBorderShare; - } - - - /** - * Sets the eID cross border share. - * - * @param newEIDCrossBorderShare the new eID cross border share - */ - public final void setEIDCrossBorderShare(String newEIDCrossBorderShare) { - this.eIDCrossBorderShare = prepareForAssignment(this.eIDCrossBorderShare, newEIDCrossBorderShare); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - * {@inheritDoc} - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base deleted file mode 100644 index 58fa8af65..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; - - -/** - * The Class EIDCrossBorderShareMarshaller. - * - * @author fjquevedo - */ -public class EIDCrossBorderShareMarshaller extends AbstractSAMLObjectMarshaller { - - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; - XMLHelper.appendTextContent(domElement, crossBorderShare.getEIDCrossBorderShare()); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base deleted file mode 100644 index 457e70c23..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; - -/** - * The Class EIDCrossBorderShareUnmarshaller. - * - * @author fjquevedo - */ -public class EIDCrossBorderShareUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; - crossBorderShare.setEIDCrossBorderShare(elementContent); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base deleted file mode 100644 index 9683d2ad8..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; - -/** - * The Class EIDCrossSectorShareBuilder. - * - * @author fjquevedo - */ -public class EIDCrossSectorShareBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the eID cross sector share - */ - public final EIDCrossSectorShare buildObject() { - return buildObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the eID cross sector share implementation - */ - public final EIDCrossSectorShareImpl buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new EIDCrossSectorShareImpl(namespaceURI, localName, - namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base deleted file mode 100644 index 30502f429..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; - -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * The Class EIDCrossSectorShareImpl. - * - * @author fjquevedo - */ -public class EIDCrossSectorShareImpl extends AbstractSAMLObject implements - EIDCrossSectorShare { - - private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossSectorShareImpl.class.getName()); - /** The citizen country code. */ - private String eIDCrossSectorShare; - - - /** - * Instantiates a new eID cross sector share implementation. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected EIDCrossSectorShareImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - - /** - * Gets the eID cross sector share. - * - * @return the eID cross sector share - */ - public final String getEIDCrossSectorShare() { - return eIDCrossSectorShare; - } - - - /** - * Sets the eID cross sector share. - * - * @param newEIDCrossSectorShare the new eID cross sector share - */ - public final void setEIDCrossSectorShare(String newEIDCrossSectorShare) { - this.eIDCrossSectorShare = prepareForAssignment(this.eIDCrossSectorShare, newEIDCrossSectorShare); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base deleted file mode 100644 index dfd2b81dc..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; - - -/** - * The Class EIDCrossSectorShareMarshaller. - * - * @author fjquevedo - */ -public class EIDCrossSectorShareMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; - XMLHelper.appendTextContent(domElement, crossSectorShare.getEIDCrossSectorShare()); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base deleted file mode 100644 index 6a9711ca2..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; - -/** - * The Class EIDCrossSectorShareUnmarshaller. - * - * @author fjquevedo - */ -public class EIDCrossSectorShareUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void processElementContent(final XMLObject samlObject, - final String domElement) { - - final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; - crossSectorShare.setEIDCrossSectorShare(domElement); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base deleted file mode 100644 index 75062dc69..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.EIDSectorShare; - -/** - * The Class EIDSectorShareBuilder. - * - * @author fjquevedo - */ -public class EIDSectorShareBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the eID sector share - */ - public final EIDSectorShare buildObject() { - return buildObject(EIDSectorShare.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the eID sector share - */ - public final EIDSectorShare buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new EIDSectorShareImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base deleted file mode 100644 index c548841f7..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.EIDSectorShare; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -// TODO: Auto-generated Javadoc -/** - * The Class EIDSectorShareImpl. - * - * @author fjquevedo - */ -public class EIDSectorShareImpl extends AbstractSAMLObject implements - EIDSectorShare { - - private static final Logger LOGGER = LoggerFactory.getLogger(EIDSectorShareImpl.class.getName()); - - /** The e id sector share. */ - private String eIDSectorShare; - /** - * Instantiates a new eID sector share implementation. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected EIDSectorShareImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - /** - * Gets the eID sector share. - * - * @return the eID sector share - */ - public final String getEIDSectorShare() { - return eIDSectorShare; - } - - /** - * Sets the eID sector share. - * - * @param newEIDSectorShare the new eID sector share - */ - public final void setEIDSectorShare(String newEIDSectorShare) { - this.eIDSectorShare = prepareForAssignment(this.eIDSectorShare, newEIDSectorShare); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base deleted file mode 100644 index 87ab23660..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.saml2.core.impl.AbstractNameIDTypeMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDSectorShare; - -/** - * The Class EIDSectorShareMarshaller. - * - * @author fjquevedo - */ -public class EIDSectorShareMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; - XMLHelper.appendTextContent(domElement, sectorShare.getEIDSectorShare()); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base deleted file mode 100644 index 9c661813f..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDSectorShare; - - -/** - * The Class EIDSectorShareUnmarshaller. - * - * @author fjquevedo - */ -public class EIDSectorShareUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void processElementContent(final XMLObject samlObject, - final String domElement) { - final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; - sectorShare.setEIDSectorShare(domElement); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base deleted file mode 100644 index 41676931b..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class QAAAttributeBuilder. - * - * @author fjquevedo - */ -public class QAAAttributeBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the quality authentication assurance object - */ - public final QAAAttribute buildObject() { - return buildObject(QAAAttribute.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the quality authentication assurance object - - */ - public final QAAAttribute buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new QAAAttributeImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base deleted file mode 100644 index c08986026..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.QAAAttribute; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class QAAAttributeImpl. - * - * @author fjquevedo - */ -public class QAAAttributeImpl extends AbstractSAMLObject implements - QAAAttribute { - - private static final Logger LOGGER = LoggerFactory.getLogger(QAAAttributeImpl.class.getName()); - /** The quality authentication assurance level. */ - private String qaaLevel; - - /** - * Constructor. - * - * @param namespaceURI the namespace the element is in - * @param elementLocalName the local name of the XML element this Object - * represents - * @param namespacePrefix the prefix for the given namespace - */ - protected QAAAttributeImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the quality authentication assurance level. - * - * @return the quality authentication assurance level - */ - public final String getQaaLevel() { - return qaaLevel; - } - - /** - * Sets the quality authentication assurance level. - * - * @param newQaaLevel the new quality authentication assurance level - */ - public final void setQaaLevel(final String newQaaLevel) { - this.qaaLevel = prepareForAssignment(this.qaaLevel, newQaaLevel); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base deleted file mode 100644 index 000879368..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class QAAAttributeMarshaller. - * - * @author fjquevedo - */ -public class QAAAttributeMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final QAAAttribute qaaAttribute = (QAAAttribute) samlObject; - XMLHelper.appendTextContent(domElement, qaaAttribute.getQaaLevel()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base deleted file mode 100644 index 8445e4eeb..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class QAAAttributeUnmarshaller. - * - * @author fjquevedo - */ -public class QAAAttributeUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final QAAAttribute qaaLevel = (QAAAttribute) samlObject; - qaaLevel.setQaaLevel(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base deleted file mode 100644 index 70bd6ac1f..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; - -/** - * The Class RequestedAttributeBuilder. - * - * @author fjquevedo - */ -public class RequestedAttributeBuilder extends - AbstractSAMLObjectBuilder { - - - /** - * Builds the object. - * - * @return the requested attribute - */ - public final RequestedAttribute buildObject() { - return buildObject(RequestedAttribute.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the requested attribute - */ - public final RequestedAttribute buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new RequestedAttributeImpl(namespaceURI, localName, - namespacePrefix); - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base deleted file mode 100644 index ad759230a..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.schema.XSBooleanValue; -import org.opensaml.xml.util.AttributeMap; -import org.opensaml.xml.util.XMLObjectChildrenList; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -// TODO: Auto-generated Javadoc -/** - * The Class RequestedAttributeImpl. - * - * @author fjquevedo - */ -public class RequestedAttributeImpl extends AbstractSAMLObject implements - RequestedAttribute { - - private static final Logger LOGGER = LoggerFactory.getLogger(RequestedAttributeImpl.class.getName()); - /** - * The attribute values. - */ - private final XMLObjectChildrenList attributeValues; - - /** - * The friendly name. - * - */ - private String friendlyName; - - /** - * The is required. - */ - private String isRequired; - - /** - * The name. - * - */ - private String name; - - /** - * The name format. - * - */ - private String nameFormat; - - /** - * The unknown attributes. - * - */ - private AttributeMap unknownAttributes; - - /** - * Instantiates a new requested attribute impl. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected RequestedAttributeImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - unknownAttributes = new AttributeMap(this); - attributeValues = new XMLObjectChildrenList(this); - } - - - /** - * Gets the attribute values. - * - * @return the attribute values - */ - public final List getAttributeValues() { - return attributeValues; - } - - /** - * Gets the friendly name. - * - * @return the friendly name. - */ - public final String getFriendlyName() { - return friendlyName; - } - - - /** - * Gets the checks if is required. - * - * @return the boolean if it's required. - */ - public final String isRequired() { - return isRequired; - } - - - /** - * Gets the is required xs boolean. - * - * @return the XSBoolean if it's required. - */ - public final String getIsRequiredXSBoolean() { - return isRequired; - } - - - /** - * Gets the name. - * - * @return the name - */ - public final String getName() { - return name; - } - - - /** - * Gets the name format. - * - * @return the name format. - */ - public final String getNameFormat() { - return nameFormat; - } - - /** - * Gets the ordered children. - * - * @return the list of XMLObject. - */ - public final List getOrderedChildren() { - final ArrayList children = new ArrayList(); - children.addAll(attributeValues); - return Collections.unmodifiableList(children); - } - - /** - * Gets the unknown attributes. - * - * @return the attribute map - */ - public final AttributeMap getUnknownAttributes() { - return unknownAttributes; - } - - /** - * Sets the friendly name. - * - * @param newFriendlyName the new friendly name format - */ - public final void setFriendlyName(final String newFriendlyName) { - this.friendlyName = prepareForAssignment(this.friendlyName, - newFriendlyName); - } - - /** - * Set new boolean value isRequired. - * @param newIsRequired then new value - */ - public final void setIsRequired(final String newIsRequired) { - isRequired = prepareForAssignment(this.isRequired, newIsRequired); - - } - - /** - * Sets the name. - * - * @param newName the new name - */ - public final void setName(final String newName) { - this.name = prepareForAssignment(this.name, newName); - } - - /** - * Sets the name format. - * - * @param newNameFormat the new name format - */ - public final void setNameFormat(final String newNameFormat) { - this.nameFormat = prepareForAssignment(this.nameFormat, newNameFormat); - } - - /** - * Sets the unknown attributes. - * - * @param newUnknownAttr the new unknown attributes - */ - public final void setUnknownAttributes(final AttributeMap newUnknownAttr) { - this.unknownAttributes = newUnknownAttr; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base deleted file mode 100644 index 6d0669241..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.Map.Entry; - -import javax.xml.namespace.QName; - -import org.opensaml.Configuration; -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; - -/** - * The Class RequestedAttributeMarshaller. - * - * @author fjquevedo - */ -public class RequestedAttributeMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall attributes. - * - * @param samlElement the SAML element - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallAttributes(final XMLObject samlElement, - final Element domElement) throws MarshallingException { - final RequestedAttribute requestedAttr = (RequestedAttribute) samlElement; - - if (requestedAttr.getName() != null) { - domElement.setAttributeNS(null, - RequestedAttribute.NAME_ATTRIB_NAME, requestedAttr - .getName()); - } - - if (requestedAttr.getNameFormat() != null) { - domElement.setAttributeNS(null, - RequestedAttribute.NAME_FORMAT_ATTR, requestedAttr - .getNameFormat()); - } - - if (requestedAttr.getFriendlyName() != null) { - domElement.setAttributeNS(null, - RequestedAttribute.FRIENDLY_NAME_ATT, requestedAttr - .getFriendlyName()); - } - - if (requestedAttr.getIsRequiredXSBoolean() != null) { - domElement.setAttributeNS(null, - RequestedAttribute.IS_REQUIRED_ATTR, requestedAttr - .getIsRequiredXSBoolean().toString()); - } - - Attr attr; - for (Entry entry : requestedAttr.getUnknownAttributes() - .entrySet()) { - attr = XMLHelper.constructAttribute(domElement.getOwnerDocument(), - entry.getKey()); - attr.setValue(entry.getValue()); - domElement.setAttributeNodeNS(attr); - if (Configuration.isIDAttribute(entry.getKey()) - || requestedAttr.getUnknownAttributes().isIDAttribute( - entry.getKey())) { - attr.getOwnerElement().setIdAttributeNode(attr, true); - } - } - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base deleted file mode 100644 index 551f4239d..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import javax.xml.namespace.QName; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; -import org.opensaml.xml.schema.XSBooleanValue; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Attr; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.SAMLCore; - -/** - * The Class RequestedAttributeUnmarshaller. - * - * @author fjquevedo - */ -public class RequestedAttributeUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentSAMLObject parent SAMLObject - * @param childSAMLObject child SAMLObject - * - * @throws UnmarshallingException error at unmarshall XML object - */ - protected final void processChildElement(final XMLObject parentSAMLObject, - final XMLObject childSAMLObject) throws UnmarshallingException { - - final RequestedAttribute requestedAttr = (RequestedAttribute) parentSAMLObject; - - final QName childQName = childSAMLObject.getElementQName(); - if (childQName.getLocalPart().equals("AttributeValue") - && childQName.getNamespaceURI().equals(SAMLCore.STORK10_NS.getValue())) { - requestedAttr.getAttributeValues().add(childSAMLObject); - } else { - super.processChildElement(parentSAMLObject, childSAMLObject); - } - } - - /** - * Process attribute. - * - * @param samlObject the SAML object - * @param attribute the attribute - * @throws UnmarshallingException the unmarshalling exception - */ - protected final void processAttribute(final XMLObject samlObject, - final Attr attribute) throws UnmarshallingException { - - final RequestedAttribute requestedAttr = (RequestedAttribute) samlObject; - - if (attribute.getLocalName() - .equals(RequestedAttribute.NAME_ATTRIB_NAME)) { - requestedAttr.setName(attribute.getValue()); - } else if (attribute.getLocalName().equals( - RequestedAttribute.NAME_FORMAT_ATTR)) { - requestedAttr.setNameFormat(attribute.getValue()); - } else if (attribute.getLocalName().equals( - RequestedAttribute.FRIENDLY_NAME_ATT)) { - requestedAttr.setFriendlyName(attribute.getValue()); - } else if (attribute.getLocalName().equals( - RequestedAttribute.IS_REQUIRED_ATTR)) { - requestedAttr.setIsRequired(attribute - .getValue()); - - } else { - final QName attribQName = XMLHelper.getNodeQName(attribute); - if (attribute.isId()) { - requestedAttr.getUnknownAttributes().registerID(attribQName); - } - requestedAttr.getUnknownAttributes().put(attribQName, - attribute.getValue()); - } - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base deleted file mode 100644 index 138177995..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.RequestedAttributes; - -/** - * The Class RequestedAttributesBuilder. - * - * @author fjquevedo - */ -public class RequestedAttributesBuilder extends - AbstractSAMLObjectBuilder { - - - /** - * Builds the object. - * - * @return the requested attributes - */ - public final RequestedAttributes buildObject() { - return buildObject(RequestedAttributes.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the requested attributes - */ - public final RequestedAttributes buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new RequestedAttributesImpl(namespaceURI, localName, - namespacePrefix); - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base deleted file mode 100644 index a58a08a05..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.util.IndexedXMLObjectChildrenList; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttributes; - -/** - * The Class RequestedAttributesImpl. - * - * @author fjquevedo - */ -public class RequestedAttributesImpl extends AbstractSAMLObject implements - RequestedAttributes { - - /** - * Instantiates a new requested attributes implement. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected RequestedAttributesImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - indexedChildren = new IndexedXMLObjectChildrenList(this); - } - - /** The indexed children. */ - private final IndexedXMLObjectChildrenList indexedChildren; - - /** - * Gets the indexed children. - * - * @return the indexed children - */ - public final IndexedXMLObjectChildrenList getIndexedChildren() { - return indexedChildren; - } - - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - - final ArrayList children = new ArrayList(); - - children.addAll(indexedChildren); - - return Collections.unmodifiableList(children); - - } - - /** - * Gets the attributes. - * - * @return the attributes - * - * @see eu.stork.peps.auth.engine.core.RequestedAttributes#getAttributes() - */ - @SuppressWarnings("unchecked") - public final List getAttributes() { - return (List) indexedChildren - .subList(RequestedAttribute.DEF_ELEMENT_NAME); - } - - @Override - public int hashCode() { - throw new UnsupportedOperationException("hashCode method not implemented"); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base deleted file mode 100644 index 955fe0318..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; - -/** - * The Class RequestedAttributesMarshaller. - * - * @author fjquevedo - */ -public class RequestedAttributesMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Instantiates a new requested attributes marshaller. - */ - public RequestedAttributesMarshaller() { - super(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base deleted file mode 100644 index 132d6cc59..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttributes; - -/** - * The Class RequestedAttributesUnmarshaller. - * - * @author fjquevedo - */ -public class RequestedAttributesUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentObject the parent object - * @param childObject the child object - * - * @throws UnmarshallingException error in unmarshall - */ - protected final void processChildElement(final XMLObject parentObject, - final XMLObject childObject) throws UnmarshallingException { - final RequestedAttributes attrStatement = (RequestedAttributes) parentObject; - - if (childObject instanceof RequestedAttribute) { - attrStatement.getAttributes().add((RequestedAttribute) childObject); - } else { - super.processChildElement(parentObject, childObject); - } - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base deleted file mode 100644 index a35c77936..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPApplication; - -/** - * The Class SPApplicationBuilder. - * - * @author fjquevedo - */ -public class SPApplicationBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the service provider application - */ - public final SPApplication buildObject() { - return buildObject(SPApplication.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the service provider application - */ - public final SPApplication buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPApplicationImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base deleted file mode 100644 index 6bb631a74..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPApplication; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class SPApplicationImpl. - * - * @author fjquevedo - */ -public class SPApplicationImpl extends AbstractSAMLObject implements - SPApplication { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPApplicationImpl.class.getName()); - /** The service provider application. */ - private String spApplication; - - /** - * Instantiates a new service provider application. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPApplicationImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the service provider application. - * - * @return the service provider application - */ - public final String getSPApplication() { - return spApplication; - } - - /** - * Sets the service provider application. - * - * @param newSpApplication the new service provider application - */ - public final void setSPApplication(final String newSpApplication) { - this.spApplication = prepareForAssignment(this.spApplication, - newSpApplication); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base deleted file mode 100644 index 4866c3535..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPApplication; - -/** - * The Class SPApplicationMarshaller. - * - * @author fjquevedo - */ -public class SPApplicationMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPApplication spApplication = (SPApplication) samlObject; - XMLHelper.appendTextContent(domElement, spApplication - .getSPApplication()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base deleted file mode 100644 index a28432a13..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPApplication; - - -/** - * The Class SPApplicationUnmarshaller. - * - * @author fjquevedo - */ -public class SPApplicationUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPApplication spApplication = (SPApplication) samlObject; - spApplication.setSPApplication(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base deleted file mode 100644 index 48ec92f49..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPCountry; - -/** - * The Class SPCountryBuilder. - * - * @author fjquevedo - */ -public class SPCountryBuilder extends AbstractSAMLObjectBuilder { - - - /** - * Builds the object SPCountry. - * - * @return the service provider country - */ - public final SPCountry buildObject() { - return buildObject(SPCountry.DEF_ELEMENT_NAME); - } - - - /** - * Builds the object SPCountry. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the service provider country - */ - public final SPCountry buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPCountryImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base deleted file mode 100644 index db58fb8be..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPCountry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class SPCountryImpl. - * - * @author fjquevedo - */ -public class SPCountryImpl extends AbstractSAMLObject implements SPCountry { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPCountryImpl.class.getName()); - /** The service provider country. */ - private String spCountry; - - /** - * Instantiates a new service provider country. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPCountryImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the service provider country. - * - * @return the service provider country - */ - public final String getSPCountry() { - return spCountry; - } - - /** - * Sets the service provider country. - * - * @param newSpCountry the new service provider country - */ - public final void setSPCountry(final String newSpCountry) { - this.spCountry = prepareForAssignment(this.spCountry, newSpCountry); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base deleted file mode 100644 index e82634749..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPCountry; - -/** - * The Class SPCountryMarshaller. - * - * @author fjquevedo - */ -public class SPCountryMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPCountry spCountry = (SPCountry) samlObject; - XMLHelper.appendTextContent(domElement, spCountry.getSPCountry()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base deleted file mode 100644 index deb695ac6..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPCountry; - - -/** - * The Class SPCountryUnmarshaller. - * - * @author fjquevedo - */ -public class SPCountryUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPCountry spCountry = (SPCountry) samlObject; - spCountry.setSPCountry(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base deleted file mode 100644 index b3640947b..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPID; - -/** - * The Class SPIDBuilder. - * - * @author iinigo - */ -public class SPIDBuilder extends AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the SP ID - */ - public final SPID buildObject() { - return buildObject(SPID.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the citizen country code - */ - public final SPID buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPIDImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base deleted file mode 100644 index 0c7127273..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPID; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class SPIDImpl. - * - * @author iinigo - */ -public class SPIDImpl extends AbstractSAMLObject implements SPID { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPIDImpl.class.getName()); - /** The citizen country code. */ - private String spId; - - /** - * Instantiates a new sP country impl. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPIDImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the SP ID. - * - * @return the SP ID - */ - public final String getSPID() { - return spId; - } - - /** - * Sets the SP ID. - * - * @param newSPID the new SP ID - */ - public final void setSPID(final String newSPID) { - this.spId = prepareForAssignment(this.spId, newSPID); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base deleted file mode 100644 index 24389522e..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPID; - -/** - * The Class SPIDMarshaller. - * - * @author iinigo - */ -public class SPIDMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPID spid = (SPID) samlObject; - XMLHelper.appendTextContent(domElement, spid.getSPID()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base deleted file mode 100644 index e4d230b94..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPID; - -/** - * The Class SPIDUnmarshaller. - * - * @author iinigo - */ -public class SPIDUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPID spid = (SPID) samlObject; - spid.setSPID(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base deleted file mode 100644 index a6e1fe686..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SAMLCore; -import eu.stork.peps.auth.engine.core.SPInformation; - -/** - * The Class SPInformation. - * - * @author iinigo - */ -public final class SPInformationBuilder extends AbstractSAMLObjectBuilder { - - - /** {@inheritDoc} */ - public SPInformation buildObject() { - return buildObject(SAMLCore.STORK10P_NS.getValue(), SPInformation.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); - } - - /** {@inheritDoc} */ - public SPInformation buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { - return new SPInformationImpl(namespaceURI, localName, namespacePrefix); - } - -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base deleted file mode 100644 index b5609600d..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSignableSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPID; -import eu.stork.peps.auth.engine.core.SPInformation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * The Class SPInformationImpl. - * - * @author iinigo - */ -public final class SPInformationImpl extends AbstractSignableSAMLObject implements -SPInformation { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPInformationImpl.class.getName()); - /** The citizen country code. */ - private SPID spId; - - - /** - * Instantiates a new requested attributes implement. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPInformationImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - /** - * getSPId. - * - * @return the SP ID - */ - public SPID getSPID() { - return spId; - } - - /** - * Gets the ordered children. - * - * @return the ordered children - * - */ - public List getOrderedChildren() { - final ArrayList children = new ArrayList(); - - children.add(spId); - - if (getSignature() != null) { - children.add(getSignature()); - } - - return Collections.unmodifiableList(children); - - } - - /** - * Gets the signature reference id. - * - * @return the signature reference id - * - */ - public String getSignatureReferenceID() { - return null; - } - - /** - * Sets the SP Id. - * - * @param newSPId the new SP Id - * - */ - public void setSPID(SPID newSPId) { - this.spId = prepareForAssignment(this.spId, newSPId); - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base deleted file mode 100644 index 44845948c..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; - -/** - * The Class SPInformationMarshaller. - * - * @author iinigo - */ -public class SPInformationMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Instantiates a new SP Information marshaller. - */ - public SPInformationMarshaller() { - super(); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base deleted file mode 100644 index 79b0b0f35..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.peps.auth.engine.core.SPID; -import eu.stork.peps.auth.engine.core.SPInformation; - -/** - * The Class SPInformationUnmarshaller. - * - * @author iinigo - */ -public class SPInformationUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentObject the parent object - * @param childObject the child object - * - * @throws UnmarshallingException the unmarshalling exception - * - */ - protected final void processChildElement(final XMLObject parentObject, - final XMLObject childObject) throws UnmarshallingException { - final SPInformation spInformation = (SPInformation) parentObject; - - if (childObject instanceof SPID) { - spInformation.setSPID((SPID) childObject); - } else { - super.processChildElement(parentObject, childObject); - } - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base deleted file mode 100644 index fe47cf99c..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPInstitution; - -/** - * The Class SPInstitutionBuilder. - * - * @author fjquevedo - */ -public class SPInstitutionBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the service provider institution - */ - public final SPInstitution buildObject() { - return buildObject(SPInstitution.DEF_ELEMENT_NAME); - } - - /** - * Builds the object SPInstitution. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the service provider institution - */ - public final SPInstitution buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPInstitutionImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base deleted file mode 100644 index cf1760446..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPInstitution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class SPInstitutionImpl. - * - * @author fjquevedo - */ -public class SPInstitutionImpl extends AbstractSAMLObject implements - SPInstitution { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPInstitutionImpl.class.getName()); - /** The service provider institution. */ - private String spInstitution; - - /** - * Instantiates a new service provider institution. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPInstitutionImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the service provider institution. - * - * @return the service provider institution - */ - public final String getSPInstitution() { - return spInstitution; - } - - /** - * Sets the service provider institution. - * - * @param newSpInstitution the new service provider institution - */ - public final void setSPInstitution(final String newSpInstitution) { - this.spInstitution = prepareForAssignment(this.spInstitution, - newSpInstitution); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } - } diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base deleted file mode 100644 index 504a1f035..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPInstitution; - -/** - * The Class SPInstitutionMarshaller. - * - * @author fjquevedo - */ -public class SPInstitutionMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPInstitution spInstitution = (SPInstitution) samlObject; - XMLHelper.appendTextContent(domElement, spInstitution - .getSPInstitution()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base deleted file mode 100644 index 103d5f2b2..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPInstitution; - -/** - * The Class SPInstitutionUnmarshaller. - * - * @author fjquevedo - */ -public class SPInstitutionUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPInstitution spInstitution = (SPInstitution) samlObject; - spInstitution.setSPInstitution(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base deleted file mode 100644 index a691b9008..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPSector; - -/** - * The Class SPSectorBuilder. - * - * @author fjquevedo - */ -public class SPSectorBuilder extends AbstractSAMLObjectBuilder { - - /** - * Builds the object SPSector. - * - * @return the service provider sector. - */ - public final SPSector buildObject() { - return buildObject(SPSector.DEF_ELEMENT_NAME); - } - - /** - * Builds the object SPSector. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the service provider sector - */ - public final SPSector buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPSectorImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base deleted file mode 100644 index a29810dd4..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPSector; - - -/** - * The Class SPSectorImpl. - * - * @author fjquevedo - */ -public class SPSectorImpl extends AbstractSAMLObject implements SPSector { - - /** The service provider sector. */ - private String spSector; - - /** - * Instantiates a new Service provider sector implementation. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPSectorImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - /** - * Gets the service provider sector. - * - * @return the SP sector - * - * @see eu.stork.peps.auth.engine.core.SPSector#getSPSector() - */ - public final String getSPSector() { - return spSector; - } - - - /** - * Sets the service provider sector. - * - * @param newSpSector the new service provider sector - */ - public final void setSPSector(final String newSpSector) { - this.spSector = prepareForAssignment(this.spSector, newSpSector); - } - - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - throw new UnsupportedOperationException("hashCode method not implemented"); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base deleted file mode 100644 index c5331e8f4..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPSector; - -/** - * The Class SPSectorMarshaller. - * - * @author fjquevedo - */ -public class SPSectorMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPSector spSector = (SPSector) samlObject; - XMLHelper.appendTextContent(domElement, spSector.getSPSector()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base deleted file mode 100644 index cbb05c6e5..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPSector; - -/** - * The Class SPSectorUnmarshaller. - * - * @author fjquevedo - */ -public class SPSectorUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPSector spSector = (SPSector) samlObject; - spSector.setSPSector(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base deleted file mode 100644 index 2db14f543..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base +++ /dev/null @@ -1,399 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.io.IOException; -import java.io.InputStream; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.Provider; -import java.security.Security; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.InvalidPropertiesFormatException; -import java.util.List; -import java.util.Properties; - -import eu.stork.peps.auth.engine.X509PrincipalUtil; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.NotImplementedException; -import org.bouncycastle.jce.X509Principal; -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.security.SAMLSignatureProfileValidator; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.security.SecurityConfiguration; -import org.opensaml.xml.security.SecurityException; -import org.opensaml.xml.security.credential.Credential; -import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; -import org.opensaml.xml.security.keyinfo.KeyInfoHelper; -import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; -import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; -import org.opensaml.xml.security.x509.BasicX509Credential; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.signature.Signature; -import org.opensaml.xml.signature.SignatureConstants; -import org.opensaml.xml.signature.SignatureException; -import org.opensaml.xml.signature.SignatureValidator; -import org.opensaml.xml.signature.Signer; -import org.opensaml.xml.validation.ValidationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.exceptions.SAMLEngineException; - -/** - * The Class HWSign. Module of sign. - * - * @author fjquevedo - */ -public final class SignHW implements SAMLEngineSignI { - - /** The Constant CONFIGURATION_FILE. */ - private static final String CONF_FILE = "configurationFile"; - - /** The Constant KEYSTORE_TYPE. - private static final String KEYSTORE_TYPE = "keystoreType" */ - - /** The logger. */ - private static final Logger LOG = LoggerFactory.getLogger(SignHW.class - .getName()); - - /** The stork own key store. */ - private KeyStore storkOwnKeyStore = null; - - /** - * Gets the stork own key store. - * - * @return the stork own key store - */ - public KeyStore getStorkOwnKeyStore() { - return storkOwnKeyStore; - } - - /** - * Gets the stork trustStore. - * - * @return the stork own key store - */ - public KeyStore getTrustStore() { - return storkOwnKeyStore; - } - - /** - * Sets the stork own key store. - * - * @param newkOwnKeyStore the new stork own key store - */ - public void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { - this.storkOwnKeyStore = newkOwnKeyStore; - } - - /** - * Gets the properties. - * - * @return the properties - */ - public Properties getProperties() { - return properties; - } - - /** - * Sets the properties. - * - * @param newProperties the new properties - */ - public void setProperties(final Properties newProperties) { - this.properties = newProperties; - } - - /** The HW sign prop. */ - private Properties properties = null; - - /** - * @see - * eu.stork.peps.auth.engine.core.SAMLEngineSignI#init(java.lang.String) - * @param fileConf file of configuration - * @throws SAMLEngineException error in read file - */ - public void init(final String fileConf) - throws SAMLEngineException { - InputStream inputStr = null; - try { - inputStr = SignHW.class.getResourceAsStream("/" - + fileConf); - properties = new Properties(); - - properties.loadFromXML(inputStr); - } catch (final InvalidPropertiesFormatException e) { - LOG.info("Exception: invalid properties format."); - throw new SAMLEngineException(e); - } catch (IOException e) { - LOG.info("Exception: invalid file: " + fileConf); - throw new SAMLEngineException(e); - } finally { - IOUtils.closeQuietly(inputStr); - } - } - - - /** - * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() - * @return the X509Certificate. - */ - public X509Certificate getCertificate() { - throw new NotImplementedException(); - } - - /** - * @see - * eu.stork.peps.auth.engine.core.SAMLEngineSignI#sign(SignableSAMLObject tokenSaml) - * @param tokenSaml signable SAML Object - * @return the SAMLObject signed. - * @throws SAMLEngineException error in sign token saml - */ - public SAMLObject sign(final SignableSAMLObject tokenSaml) throws SAMLEngineException { - - try { - LOG.info("Star procces of sign"); - final char[] pin = properties.getProperty("keyPassword") - .toCharArray(); - - storkOwnKeyStore.load(null, pin); - - final String serialNumber = properties.getProperty("serialNumber"); - final String issuer = properties.getProperty("issuer"); - - String alias = null; - String aliasCert; - X509Certificate certificate; - - boolean find = false; - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements() && !find;) { - aliasCert = e.nextElement(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - // Verified serial number, issuer - - final String serialNum = certificate.getSerialNumber() - .toString(16); - X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); - X509Principal issuerDNConf = new X509Principal(issuer); - - if(serialNum.equalsIgnoreCase(serialNumber) - && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ - alias = aliasCert; - find = true; - } - - } - - if (!find) { - throw new SAMLEngineException("Certificate cannot be found in keystore "); - } - certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); - final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( - alias, pin); - - LOG.info("Recover BasicX509Credential."); - final BasicX509Credential credential = new BasicX509Credential(); - - LOG.debug("Load certificate"); - credential.setEntityCertificate(certificate); - - LOG.debug("Load privateKey"); - credential.setPrivateKey(privateKey); - - LOG.info("Star procces of sign"); - final Signature signature = (Signature) org.opensaml.xml.Configuration - .getBuilderFactory().getBuilder( - Signature.DEFAULT_ELEMENT_NAME).buildObject( - Signature.DEFAULT_ELEMENT_NAME); - - LOG.debug("Begin signature with openSaml"); - signature.setSigningCredential(credential); - - signature.setSignatureAlgorithm( - SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); - - - - final SecurityConfiguration securityConf = - org.opensaml.xml.Configuration.getGlobalSecurityConfiguration(); - final NamedKeyInfoGeneratorManager keyInfoManager = securityConf - .getKeyInfoGeneratorManager(); - final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager - .getDefaultManager(); - final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager - .getFactory(credential); - final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac - .newInstance(); - - final KeyInfo keyInfo = keyInfoGenerator.generate(credential); - - signature.setKeyInfo(keyInfo); - - LOG.debug("Set Canonicalization Algorithm"); - signature.setCanonicalizationAlgorithm( - SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - - tokenSaml.setSignature(signature); - - LOG.debug("Marshall samlToken."); - org.opensaml.xml.Configuration.getMarshallerFactory() - .getMarshaller(tokenSaml).marshall(tokenSaml); - - LOG.info("Sign samlToken."); - Signer.signObject(signature); - - } catch (final MarshallingException e) { - LOG.error("MarshallingException"); - throw new SAMLEngineException(e); - } catch (final NoSuchAlgorithmException e) { - LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); - throw new SAMLEngineException(e); - } catch (final KeyStoreException e) { - LOG.error("Generic KeyStore exception."); - throw new SAMLEngineException(e); - } catch (final SignatureException e) { - LOG.error("Signature exception."); - throw new SAMLEngineException(e); - } catch (final SecurityException e) { - LOG.error("Security exception."); - throw new SAMLEngineException(e); - } catch (final CertificateException e) { - LOG.error("Certificate exception."); - throw new SAMLEngineException(e); - } catch (final IOException e) { - LOG.error("IO exception."); - throw new SAMLEngineException(e); - } catch (final UnrecoverableKeyException e) { - LOG.error("UnrecoverableKeyException exception."); - throw new SAMLEngineException(e); - } - - return tokenSaml; - } - - /** - * @see - * eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(SignableSAMLObject) - * @param tokenSaml the token saml - * @return the SAMLObject validated. - * @throws SAMLEngineException exception in validate signature - */ - public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start signature validation."); - try { - - // Validate structure signature - final SAMLSignatureProfileValidator signProfValidator = - new SAMLSignatureProfileValidator(); - - // Indicates signature id conform to SAML Signature profile - signProfValidator.validate(tokenSaml.getSignature()); - - String aliasCert; - X509Certificate certificate; - - final List trustedCred = new ArrayList(); - - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements();) { - aliasCert = e.nextElement(); - final BasicX509Credential credential = new BasicX509Credential(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - credential.setEntityCertificate(certificate); - trustedCred.add(credential); - } - - final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); - final List listCertificates = KeyInfoHelper - .getCertificates(keyInfo); - - if (listCertificates.size() != 1) { - throw new SAMLEngineException("Only must be one certificate"); - } - - // Exist only one certificate - final BasicX509Credential entityX509Cred = new BasicX509Credential(); - entityX509Cred.setEntityCertificate(listCertificates.get(0)); - - final ExplicitKeyTrustEvaluator keyTrustEvaluator = - new ExplicitKeyTrustEvaluator(); - if (!keyTrustEvaluator.validate(entityX509Cred, trustedCred)) { - throw new SAMLEngineException("Certificate it is not trusted."); - } - - final SignatureValidator sigValidator = new SignatureValidator( - entityX509Cred); - - sigValidator.validate(tokenSaml.getSignature()); - - } catch (final ValidationException e) { - LOG.error("ValidationException.", e); - throw new SAMLEngineException(e); - } catch (final KeyStoreException e) { - LOG.error("ValidationException.", e); - throw new SAMLEngineException(e); - } catch (final CertificateException e) { - LOG.error("CertificateException.", e); - throw new SAMLEngineException(e); - } - return tokenSaml; - } - - /** - * load cryptographic service provider. - * - * @throws SAMLEngineException the SAML engine exception - * Note this class was using pkcs11Provider - * final Provider pkcs11Provider = new sun.security.pkcs11.SunPKCS11(inputStream) - * if (Security.getProperty(pkcs11Provider.getName()) == null) { - * Security.insertProviderAt(pkcs11Provider, Security .getProviders().length) - * } - * storkOwnKeyStore = KeyStore.getInstance(properties.getProperty(KEYSTORE_TYPE)) - */ - public void loadCryptServiceProvider() throws SAMLEngineException { - LOG.info("Load Cryptographic Service Provider"); - InputStream inputStream = null; - - try { - inputStream = SignHW.class.getResourceAsStream("/" - + properties.getProperty(CONF_FILE)); - - } catch (final Exception e) { - throw new SAMLEngineException( - "Error loading CryptographicServiceProvider", e); - } finally { - IOUtils.closeQuietly(inputStream); - } - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base deleted file mode 100644 index 2adefddbd..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class ModuleSignFactory. - * - * @author fjquevedo - * - */ - -public final class SignModuleFactory { - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(SignModuleFactory.class.getName()); - - /** - * Instantiates a new module sign factory. - */ - private SignModuleFactory() { - - } - - /** - * Gets the single instance of SignModuleFactory. - * - * @param className the class name - * - * @return single instance of SignModuleFactory - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SAMLEngineSignI getInstance(final String className) - throws STORKSAMLEngineException { - LOG.info("[START]SignModuleFactory static"); - try { - final Class cls = Class.forName(className); - return (SAMLEngineSignI) cls.newInstance(); - } catch (Exception e) { - throw new STORKSAMLEngineException(e); - } - - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base deleted file mode 100644 index 33ed05515..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.Provider; -import java.security.Security; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.InvalidPropertiesFormatException; -import java.util.List; -import java.util.Properties; - -import eu.stork.peps.auth.engine.X509PrincipalUtil; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.NotImplementedException; -import org.bouncycastle.jce.X509Principal; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.opensaml.Configuration; -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.security.SAMLSignatureProfileValidator; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.security.SecurityConfiguration; -import org.opensaml.xml.security.SecurityException; -import org.opensaml.xml.security.credential.Credential; -import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; -import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; -import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; -import org.opensaml.xml.security.x509.BasicX509Credential; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.signature.Signature; -import org.opensaml.xml.signature.SignatureConstants; -import org.opensaml.xml.signature.SignatureException; -import org.opensaml.xml.signature.SignatureValidator; -import org.opensaml.xml.signature.Signer; -import org.opensaml.xml.util.Base64; -import org.opensaml.xml.validation.ValidationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.exceptions.SAMLEngineException; - -/** - * The Class SWSign. Class responsible for signing and validating of messages - * SAML with a certificate store software. - * - * @author fjquevedo - */ -public final class SignP12 implements SAMLEngineSignI { - - /** The logger. */ - private static final Logger LOG = LoggerFactory.getLogger(SignP12.class - .getName()); - - - /** The p12 store. */ - private KeyStore p12Store = null; - - - /** The trust store. */ - private KeyStore trustStore = null; - - - /** - * Gets the trust store. - * - * @return the trust store - */ - public KeyStore getTrustStore() { - return trustStore; - } - - /** - * Sets the trust store. - * - * @param newTrustStore the new trust store - */ - public void setTrustStore(final KeyStore newTrustStore) { - this.trustStore = newTrustStore; - } - - /** - * The instance. - * - * @return the properties - */ - - public Properties getProperties() { - return properties; - } - - - - /** - * Gets the p12 store. - * - * @return the p12 store - */ - public KeyStore getP12Store() { - return p12Store; - } - - - - /** - * Sets the p12 store. - * - * @param newP12Store the new p12 store - */ - public void setP12Store(final KeyStore newP12Store) { - this.p12Store = newP12Store; - } - - - - /** - * Sets the properties. - * - * @param newProperties the new properties - */ - public void setProperties(final Properties newProperties) { - this.properties = newProperties; - } - - /** The SW sign prop. */ - private Properties properties = null; - - - /** - * Initialize the file configuration. - * - * @param fileConf name of the file configuration - * - * @throws SAMLEngineException error at the load from file configuration - */ - public void init(final String fileConf) throws SAMLEngineException { - InputStream fileProperties = null; - properties = new Properties(); - try { - try { - LOG.debug("Fichero a cargar " + fileConf); - fileProperties = new FileInputStream(fileConf); - properties.loadFromXML(fileProperties); - } catch (Exception e) { - LOG.error("Fallo al cargar el recurso externo. Se reintenta como fichero interno."); - fileProperties = SignP12.class.getResourceAsStream("/" + fileConf); - if (fileProperties == null) { - fileProperties = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileConf); - if (fileProperties == null) { - Enumeration files = ClassLoader.getSystemClassLoader().getResources(fileConf); - if (files != null && files.hasMoreElements()) { - LOG.info("Se han encontrado recurso/s. Se toma el primero."); - fileProperties = ClassLoader.getSystemClassLoader().getResourceAsStream(files.nextElement().getFile()); - } else { - throw new IOException("No se pudo recuperar el fichero: " + fileConf, e); - } - } - } - LOG.debug("Recuperados " + fileProperties.available() + " bytes"); - properties.loadFromXML(fileProperties); - } - } catch (InvalidPropertiesFormatException e) { - LOG.info("Exception: invalid properties format."); - throw new SAMLEngineException(e); - } catch (IOException e) { - LOG.info("Exception: invalid file: " + fileConf); - throw new SAMLEngineException(e); - } finally { - IOUtils.closeQuietly(fileProperties); - } - } - - /** - * Gets the certificate. - * - * @return the X509Certificate - * - */ - public X509Certificate getCertificate() { - throw new NotImplementedException(); - } - - /** - * Sign the token SAML. - * - * @param tokenSaml token SAML - * - * @return the X509Certificate signed. - * - * @throws SAMLEngineException error at sign SAML token - * - */ - public SAMLObject sign(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start Sign process"); - try { - - final String serialNumber = properties.getProperty("serialNumber"); - final String issuer = properties.getProperty("issuer"); - - String alias = null; - String aliasCert; - X509Certificate certificate; - - boolean find = false; - for (final Enumeration e = p12Store.aliases(); e - .hasMoreElements() && !find;) { - aliasCert = e.nextElement(); - certificate = (X509Certificate) p12Store - .getCertificate(aliasCert); - - final String serialNum = certificate.getSerialNumber() - .toString(16); - - X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); - X509Principal issuerDNConf = new X509Principal(issuer); - - if(serialNum.equalsIgnoreCase(serialNumber) - && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ - alias = aliasCert; - find = true; - } - - } - - certificate = (X509Certificate) p12Store - .getCertificate(alias); - final PrivateKey privateKey = (PrivateKey) p12Store.getKey( - alias, properties.getProperty("keyPassword").toCharArray()); - - LOG.info("Recover BasicX509Credential."); - final BasicX509Credential credential = new BasicX509Credential(); - - LOG.debug("Load certificate"); - credential.setEntityCertificate(certificate); - - LOG.debug("Load privateKey"); - credential.setPrivateKey(privateKey); - - LOG.debug("Begin signature with openSaml"); - final Signature signature = (Signature) Configuration - .getBuilderFactory().getBuilder( - Signature.DEFAULT_ELEMENT_NAME).buildObject( - Signature.DEFAULT_ELEMENT_NAME); - - signature.setSigningCredential(credential); - - signature.setSignatureAlgorithm( - SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); - - final SecurityConfiguration secConfiguration = Configuration - .getGlobalSecurityConfiguration(); - final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration - .getKeyInfoGeneratorManager(); - final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager - .getDefaultManager(); - final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager - .getFactory(credential); - final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac - .newInstance(); - - final KeyInfo keyInfo = keyInfoGenerator.generate(credential); - - signature.setKeyInfo(keyInfo); - signature.setCanonicalizationAlgorithm( - SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - - tokenSaml.setSignature(signature); - - LOG.info("Marshall samlToken."); - Configuration.getMarshallerFactory().getMarshaller(tokenSaml) - .marshall(tokenSaml); - - LOG.info("Sign samlToken."); - Signer.signObject(signature); - - } catch (MarshallingException e) { - LOG.error("MarshallingException"); - throw new SAMLEngineException(e); - } catch (NoSuchAlgorithmException e) { - LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); - throw new SAMLEngineException(e); - } catch (KeyStoreException e) { - LOG.error("Generic KeyStore exception."); - throw new SAMLEngineException(e); - } catch (SignatureException e) { - LOG.error("Signature exception."); - throw new SAMLEngineException(e); - } catch (SecurityException e) { - LOG.error("Security exception."); - throw new SAMLEngineException(e); - } catch (UnrecoverableKeyException e) { - LOG.error("UnrecoverableKey exception."); - throw new SAMLEngineException(e); - } - - return tokenSaml; - } - - /** - * Validate signature. - * - * @param tokenSaml token SAML - * - * @return the SAMLObject validated. - * - * @throws SAMLEngineException error validate signature - * - */ - public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start signature validation."); - try { - - // Validate structure signature - final SAMLSignatureProfileValidator sigProfValidator = - new SAMLSignatureProfileValidator(); - try { - // Indicates signature id conform to SAML Signature profile - sigProfValidator.validate(tokenSaml.getSignature()); - } catch (ValidationException e) { - LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); - throw new SAMLEngineException(e); - } - - String aliasCert = null; - X509Certificate certificate; - - final List trustCred = new ArrayList(); - - for (final Enumeration e = trustStore.aliases(); e - .hasMoreElements();) { - aliasCert = e.nextElement(); - final BasicX509Credential credential = new BasicX509Credential(); - certificate = (X509Certificate) trustStore - .getCertificate(aliasCert); - credential.setEntityCertificate(certificate); - trustCred.add(credential); - } - - final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); - - final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo - .getX509Datas().get(0).getX509Certificates().get(0); - - final CertificateFactory certFact = CertificateFactory - .getInstance("X.509"); - final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 - .decode(xmlCert.getValue())); - final X509Certificate cert = (X509Certificate) certFact - .generateCertificate(bis); - - // Exist only one certificate - final BasicX509Credential entityX509Cred = new BasicX509Credential(); - entityX509Cred.setEntityCertificate(cert); - - // Validate trust certificates - final ExplicitKeyTrustEvaluator keyTrustEvaluator = - new ExplicitKeyTrustEvaluator(); - if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { - throw new SAMLEngineException("Certificate it is not trusted."); - } - - // Validate signature - final SignatureValidator sigValidator = new SignatureValidator( - entityX509Cred); - sigValidator.validate(tokenSaml.getSignature()); - - } catch (ValidationException e) { - LOG.error("ValidationException."); - throw new SAMLEngineException(e); - } catch (KeyStoreException e) { - LOG.error("KeyStoreException.", e); - throw new SAMLEngineException(e); - } catch (GeneralSecurityException e) { - LOG.error("GeneralSecurityException.", e); - throw new SAMLEngineException(e); - } - return tokenSaml; - } - - - /** - * Load cryptographic service provider. - * - * @throws SAMLEngineException the SAML engine exception - */ - public void loadCryptServiceProvider() throws SAMLEngineException { - LOG.info("Load Cryptographic Service Provider"); - - FileInputStream fis = null; - FileInputStream fisTrustStore = null; - - try { - // Dynamically register Bouncy Castle provider. - boolean found = false; - // Check if BouncyCastle is already registered as a provider - final Provider[] providers = Security.getProviders(); - for (int i = 0; i < providers.length; i++) { - if (providers[i].getName().equals( - BouncyCastleProvider.PROVIDER_NAME)) { - found = true; - } - } - - // Register only if the provider has not been previously registered - if (!found) { - LOG.debug("SAMLCore: Register Bouncy Castle provider."); - Security.insertProviderAt(new BouncyCastleProvider(), Security - .getProviders().length); - } - - p12Store = KeyStore.getInstance(properties - .getProperty("keystoreType")); - - fis = new FileInputStream(properties - .getProperty("keystorePath")); - - p12Store.load(fis, properties.getProperty( - "keyStorePassword").toCharArray()); - - - trustStore = KeyStore.getInstance(properties - .getProperty("trustStoreType")); - - fisTrustStore = new FileInputStream(properties - .getProperty("trustStorePath")); - trustStore.load(fisTrustStore, properties.getProperty( - "trustStorePassword").toCharArray()); - - } catch (Exception e) { - throw new SAMLEngineException( - "Error loading CryptographicServiceProvider", e); - } finally { - IOUtils.closeQuietly(fis); - IOUtils.closeQuietly(fisTrustStore); - } - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base deleted file mode 100644 index 4c7bb18a3..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.Provider; -import java.security.Security; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.InvalidPropertiesFormatException; -import java.util.List; -import java.util.Properties; - -import eu.stork.peps.auth.engine.X509PrincipalUtil; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.NotImplementedException; -import org.bouncycastle.jce.X509Principal; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.opensaml.Configuration; -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.security.SAMLSignatureProfileValidator; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.security.SecurityConfiguration; -import org.opensaml.xml.security.SecurityException; -import org.opensaml.xml.security.credential.Credential; -import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; -import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; -import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; -import org.opensaml.xml.security.x509.BasicX509Credential; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.signature.Signature; -import org.opensaml.xml.signature.SignatureConstants; -import org.opensaml.xml.signature.SignatureException; -import org.opensaml.xml.signature.SignatureValidator; -import org.opensaml.xml.signature.Signer; -import org.opensaml.xml.util.Base64; -import org.opensaml.xml.validation.ValidationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.exceptions.SAMLEngineException; - - -/** - * The Class SWSign. Class responsible for signing and validating of messages - * SAML with a certificate store software. - * - * @author fjquevedo - */ -public class SignSW implements SAMLEngineSignI { - - /** The Constant KEYSTORE_TYPE. */ - private static final String KEYSTORE_TYPE = "keystoreType"; - - /** The Constant KEY_STORE_PASSWORD. */ - private static final String KEY_STORE_PASS = "keyStorePassword"; - - /** The logger. */ - private static final Logger LOG = LoggerFactory.getLogger(SignSW.class - .getName()); - - /** The stork own key store. */ - private KeyStore storkOwnKeyStore = null; - - /** - * The instance. - * - * @return the properties - */ - - public final Properties getProperties() { - return properties; - } - - /** - * Gets the stork own key store. - * - * @return the stork own key store - */ - public final KeyStore getStorkOwnKeyStore() { - return storkOwnKeyStore; - } - - /** - * Gets the stork trustStore. - * - * @return the stork own key store - */ - public KeyStore getTrustStore() { - return storkOwnKeyStore; - } - - /** - * Sets the stork own key store. - * - * @param newkOwnKeyStore the new stork own key store - */ - public final void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { - this.storkOwnKeyStore = newkOwnKeyStore; - } - - /** - * Sets the properties. - * - * @param newProperties the new properties - */ - public final void setProperties(final Properties newProperties) { - this.properties = newProperties; - } - - /** The SW sign prop. */ - private Properties properties = null; - - - /** - * Inits the file configuration. - * - * @param fileConf name of the file configuration - * - * @throws SAMLEngineException error at the load from file configuration - */ - public final void init(final String fileConf) - throws SAMLEngineException { - InputStream fileProperties = null; - try { - fileProperties = SignSW.class.getResourceAsStream("/" - + fileConf); - properties = new Properties(); - - properties.loadFromXML(fileProperties); - fileProperties.close(); - } catch (InvalidPropertiesFormatException e) { - LOG.info("Exception: invalid properties format."); - throw new SAMLEngineException(e); - } catch (IOException e) { - LOG.info("Exception: invalid file: " + fileConf); - throw new SAMLEngineException(e); - } finally { - IOUtils.closeQuietly(fileProperties); - } - } - - /** - * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() - * @return the X509Certificate - */ - public final X509Certificate getCertificate() { - throw new NotImplementedException(); - } - - - /** - * Sign the token SAML. - * - * @param tokenSaml the token SAML. - * - * @return the SAML object - * - * @throws SAMLEngineException the SAML engine exception - * - */ - public final SAMLObject sign(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start Sign process."); - try { - final String serialNumber = properties.getProperty("serialNumber"); - final String issuer = properties.getProperty("issuer"); - - String alias = null; - String aliasCert; - X509Certificate certificate; - boolean find = false; - - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements() && !find; ) { - aliasCert = e.nextElement(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - - final String serialNum = certificate.getSerialNumber() - .toString(16); - - X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); - X509Principal issuerDNConf = new X509Principal(issuer); - - if(serialNum.equalsIgnoreCase(serialNumber) - && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ - alias = aliasCert; - find = true; - } - } - if (!find) { - throw new SAMLEngineException("Certificate cannot be found in keystore "); - } - certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); - final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( - alias, properties.getProperty("keyPassword").toCharArray()); - - LOG.info("Recover BasicX509Credential."); - final BasicX509Credential credential = new BasicX509Credential(); - - LOG.debug("Load certificate"); - credential.setEntityCertificate(certificate); - - LOG.debug("Load privateKey"); - credential.setPrivateKey(privateKey); - - LOG.debug("Begin signature with openSaml"); - final Signature signature = (Signature) Configuration - .getBuilderFactory().getBuilder( - Signature.DEFAULT_ELEMENT_NAME).buildObject( - Signature.DEFAULT_ELEMENT_NAME); - - signature.setSigningCredential(credential); - - signature.setSignatureAlgorithm( - SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); - - - final SecurityConfiguration secConfiguration = Configuration - .getGlobalSecurityConfiguration(); - final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration - .getKeyInfoGeneratorManager(); - final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager - .getDefaultManager(); - final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager - .getFactory(credential); - final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac - .newInstance(); - - KeyInfo keyInfo = keyInfoGenerator.generate(credential); - - signature.setKeyInfo(keyInfo); - signature.setCanonicalizationAlgorithm( - SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - - tokenSaml.setSignature(signature); - - LOG.info("Marshall samlToken."); - Configuration.getMarshallerFactory().getMarshaller(tokenSaml) - .marshall(tokenSaml); - - LOG.info("Sign samlToken."); - Signer.signObject(signature); - - } catch (MarshallingException e) { - LOG.error("MarshallingException"); - throw new SAMLEngineException(e); - } catch (NoSuchAlgorithmException e) { - LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); - throw new SAMLEngineException(e); - } catch (KeyStoreException e) { - LOG.error("Generic KeyStore exception."); - throw new SAMLEngineException(e); - } catch (SignatureException e) { - LOG.error("Signature exception."); - throw new SAMLEngineException(e); - } catch (SecurityException e) { - LOG.error("Security exception."); - throw new SAMLEngineException(e); - } catch (UnrecoverableKeyException e) { - LOG.error("UnrecoverableKey exception."); - throw new SAMLEngineException(e); - } - - return tokenSaml; - } - - /** - * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(org.opensaml.common.SignableSAMLObject) - * @param tokenSaml token SAML - * @return the SAMLObject validated. - * @throws SAMLEngineException error validate signature - */ - public final SAMLObject validateSignature(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start signature validation."); - try { - - // Validate structure signature - final SAMLSignatureProfileValidator sigProfValidator = - new SAMLSignatureProfileValidator(); - try { - // Indicates signature id conform to SAML Signature profile - sigProfValidator.validate(tokenSaml.getSignature()); - } catch (ValidationException e) { - LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); - throw new SAMLEngineException(e); - } - - String aliasCert = null; - X509Certificate certificate; - - final List trustCred = new ArrayList(); - - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements();) { - aliasCert = e.nextElement(); - final BasicX509Credential credential = new BasicX509Credential(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - credential.setEntityCertificate(certificate); - trustCred.add(credential); - } - - final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); - - final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo - .getX509Datas().get(0).getX509Certificates().get(0); - - final CertificateFactory certFact = CertificateFactory - .getInstance("X.509"); - final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 - .decode(xmlCert.getValue())); - final X509Certificate cert = (X509Certificate) certFact - .generateCertificate(bis); - - // Exist only one certificate - final BasicX509Credential entityX509Cred = new BasicX509Credential(); - entityX509Cred.setEntityCertificate(cert); - - // Validate trust certificates - final ExplicitKeyTrustEvaluator keyTrustEvaluator = - new ExplicitKeyTrustEvaluator(); - if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { - throw new SAMLEngineException("Certificate is not trusted."); - } - - // Validate signature - final SignatureValidator sigValidator = new SignatureValidator( - entityX509Cred); - sigValidator.validate(tokenSaml.getSignature()); - - } catch (ValidationException e) { - LOG.error("ValidationException."); - throw new SAMLEngineException(e); - } catch (KeyStoreException e) { - LOG.error("KeyStoreException.", e); - throw new SAMLEngineException(e); - } catch (GeneralSecurityException e) { - LOG.error("GeneralSecurityException.", e); - throw new SAMLEngineException(e); - } - LOG.info(tokenSaml.getSignatureReferenceID()); - LOG.info("Start signature validation - END." ); - return tokenSaml; - } - - - /** - * Load cryptographic service provider. - * - * @throws SAMLEngineException the SAML engine exception - */ - public final void loadCryptServiceProvider() throws SAMLEngineException { - LOG.info("Load Cryptographic Service Provider"); - FileInputStream fis = null; - try { - // Dynamically register Bouncy Castle provider. - boolean found = false; - // Check if BouncyCastle is already registered as a provider - final Provider[] providers = Security.getProviders(); - for (int i = 0; i < providers.length; i++) { - if (providers[i].getName().equals( - BouncyCastleProvider.PROVIDER_NAME)) { - found = true; - } - } - - // Register only if the provider has not been previously registered - if (!found) { - LOG.info("SAMLCore: Register Bouncy Castle provider."); - Security.insertProviderAt(new BouncyCastleProvider(), Security - .getProviders().length); - } - - storkOwnKeyStore = KeyStore.getInstance(properties - .getProperty(KEYSTORE_TYPE)); - - LOG.info("Loading KeyInfo from keystore file " + properties.getProperty("keystorePath")); - fis = new FileInputStream(properties - .getProperty("keystorePath")); - - storkOwnKeyStore.load(fis, properties.getProperty( - KEY_STORE_PASS).toCharArray()); - - } catch (Exception e) { - LOG.error("Error loading CryptographicServiceProvider", e); - throw new SAMLEngineException( - "Error loading CryptographicServiceProvider", e); - } finally { - IOUtils.closeQuietly(fis); - } - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base deleted file mode 100644 index a60515593..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SAMLCore; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; - -/** - * The Class VIDPAuthenticationAttributesBuilder. - * - * @author fjquevedo - */ -public final class VIDPAuthenticationAttributesBuilder extends AbstractSAMLObjectBuilder { - - - /** {@inheritDoc} */ - public VIDPAuthenticationAttributes buildObject() { - return buildObject(SAMLCore.STORK10P_NS.getValue(), VIDPAuthenticationAttributes.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); - } - - /** {@inheritDoc} */ - public VIDPAuthenticationAttributes buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { - return new VIDPAuthenticationAttributesImpl(namespaceURI, localName, namespacePrefix); - } - -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base deleted file mode 100644 index a6e7e7f60..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSignableSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; -import eu.stork.peps.auth.engine.core.SPInformation; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class VIDPAuthenticationAttributesImpl. - * - * @author fjquevedo - */ -public final class VIDPAuthenticationAttributesImpl extends AbstractSignableSAMLObject implements -VIDPAuthenticationAttributes { - - private static final Logger LOGGER = LoggerFactory.getLogger(VIDPAuthenticationAttributesImpl.class.getName()); - /** The citizen country code. */ - private CitizenCountryCode citizenCountryCode; - - /** The SP information. */ - private SPInformation spInformation; - - /** - * Instantiates a new requested attributes implement. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected VIDPAuthenticationAttributesImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - /** - * getCitizenCountryCode. - * - * @return the citizen country code - */ - public CitizenCountryCode getCitizenCountryCode() { - return citizenCountryCode; - } - - /** - * getSPInformation - * - * @return the SP information - */ - public SPInformation getSPInformation() { - return spInformation; - } - - /** - * Gets the ordered children. - * - * @return the ordered children - * - */ - public List getOrderedChildren() { - final ArrayList children = new ArrayList(); - - children.add(citizenCountryCode); - children.add(spInformation); - - if (getSignature() != null) { - children.add(getSignature()); - } - - return Collections.unmodifiableList(children); - - } - - /** - * Gets the signature reference id. - * - * @return the signature reference id - * - */ - public String getSignatureReferenceID() { - return null; - } - - /** - * Sets the citizen country code. - * - * @param newCitizenCountryCode the new citizen country code - * - */ - public void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode) { - this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); - } - - /** - * Sets the SP information. - * - * @param newSPInformation the new SP information - * - */ - public void setSPInformation(SPInformation newSPInformation) { - this.spInformation = prepareForAssignment(this.spInformation, newSPInformation); - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base deleted file mode 100644 index 5635ddd6b..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; - -/** - * The Class VIDPAuthenticationAttributesMarshaller. - * - * @author fjquevedo - */ -public class VIDPAuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Instantiates a new vIDP authentication attributes marshaller. - */ - public VIDPAuthenticationAttributesMarshaller() { - super(); - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base deleted file mode 100644 index 1de300c03..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; -import eu.stork.peps.auth.engine.core.SPInformation; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; - -/** - * The Class VIDPAuthenticationAttributesUnmarshaller. - * - * @author fjquevedo - */ -public class VIDPAuthenticationAttributesUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentObject the parent object - * @param childObject the child object - * - * @throws UnmarshallingException the unmarshalling exception - * - */ - protected final void processChildElement(final XMLObject parentObject, - final XMLObject childObject) throws UnmarshallingException { - final VIDPAuthenticationAttributes vIDPAuthenticationAttr = (VIDPAuthenticationAttributes) parentObject; - - if (childObject instanceof CitizenCountryCode) { - vIDPAuthenticationAttr.setCitizenCountryCode((CitizenCountryCode) childObject); - } else if (childObject instanceof SPInformation) { - vIDPAuthenticationAttr.setSPInformation((SPInformation) childObject); - } else { - super.processChildElement(parentObject, childObject); - } - } -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index e26da6d04..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Implementations of STORK 1.0 core specification types and elements. - */ -package eu.stork.peps.auth.engine.core.impl; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.class deleted file mode 100644 index afc14d3f2..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.class deleted file mode 100644 index 6f172c1aa..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.class deleted file mode 100644 index a6652789e..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.class deleted file mode 100644 index e7dc21755..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.class deleted file mode 100644 index 9cac304bc..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.class deleted file mode 100644 index aed48708c..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.class deleted file mode 100644 index f2c8bfebf..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.class deleted file mode 100644 index 203db3aa9..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.class deleted file mode 100644 index 6d2a92266..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.class deleted file mode 100644 index 853785a39..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.class deleted file mode 100644 index 380ed7f51..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.class deleted file mode 100644 index cbacf3d68..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.class deleted file mode 100644 index 7526f5cd5..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.class deleted file mode 100644 index e7fe1ebcd..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.class deleted file mode 100644 index f7b83f795..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.class deleted file mode 100644 index c52ffcb3a..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.class deleted file mode 100644 index 3a339f9b6..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.class deleted file mode 100644 index 1b7c57587..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.class deleted file mode 100644 index 0ef2bb926..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.class deleted file mode 100644 index aa6cec8bc..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.class deleted file mode 100644 index d71b8a49f..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.class deleted file mode 100644 index 2e63811cb..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.class deleted file mode 100644 index 7ca4a54b4..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.class deleted file mode 100644 index 9d792d441..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.class deleted file mode 100644 index 6e09ce030..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.class deleted file mode 100644 index 77cde25fb..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.class deleted file mode 100644 index e632197eb..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.class deleted file mode 100644 index 9d417de23..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.class deleted file mode 100644 index 42e05a404..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.class deleted file mode 100644 index 384a6e7dd..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.class deleted file mode 100644 index fda5bb7a6..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.class deleted file mode 100644 index e53adc5f3..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.class deleted file mode 100644 index ef70ad990..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.class deleted file mode 100644 index dbedcb2e0..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.class deleted file mode 100644 index 6850640c8..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.class deleted file mode 100644 index a41a3c9a6..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.class deleted file mode 100644 index b67c2a5d2..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.class deleted file mode 100644 index be7ca2276..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.class deleted file mode 100644 index e27c35c5a..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.class deleted file mode 100644 index a1e50ebc1..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.class deleted file mode 100644 index c0c6c0767..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.class deleted file mode 100644 index 8d9daeb02..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.class deleted file mode 100644 index 557b015a2..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.class deleted file mode 100644 index f719c2b52..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.class deleted file mode 100644 index a8e9e515b..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.class deleted file mode 100644 index 2cd4cb86c..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.class deleted file mode 100644 index 0c6d72ad0..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.class deleted file mode 100644 index f60490c63..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.class deleted file mode 100644 index 2fbf6110a..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.class deleted file mode 100644 index 40f461f2f..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.class deleted file mode 100644 index b3b226c46..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.class deleted file mode 100644 index bec370625..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.class deleted file mode 100644 index beb527290..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.class deleted file mode 100644 index d03d3452c..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.class deleted file mode 100644 index f2595a336..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.class deleted file mode 100644 index 117a436c9..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.class deleted file mode 100644 index bd026d321..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.class deleted file mode 100644 index 3fa205f5b..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.class deleted file mode 100644 index 5980b2c08..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.class deleted file mode 100644 index 30d44b660..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.class deleted file mode 100644 index caf4c794e..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.class deleted file mode 100644 index 73d233cc0..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.class deleted file mode 100644 index 95005e521..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.class deleted file mode 100644 index 4523e4d8f..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/package-info.class deleted file mode 100644 index d096453e9..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/impl/package-info.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/package-info.class deleted file mode 100644 index 6782c35f5..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/package-info.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops deleted file mode 100644 index d5bd68d13..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops +++ /dev/null @@ -1,23 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 102 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/package-info.java -END -ExtensionsSchemaValidator.java -K 25 -svn:wc:ra_dav:version-url -V 133 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.java -END -QAAAttributeSchemaValidator.java -K 25 -svn:wc:ra_dav:version-url -V 135 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.java -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries deleted file mode 100644 index abba3b480..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries +++ /dev/null @@ -1,130 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -package-info.java -file - - - - -2013-12-20T12:27:57.310475Z -cf18b043ca5fc2869360c23c2f78c37c -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -810 - -ExtensionsSchemaValidator.java -file - - - - -2013-12-20T12:27:57.310475Z -88793567b50e1817e8b534b99b7fd40e -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2003 - -QAAAttributeSchemaValidator.java -file - - - - -2013-12-20T12:27:57.310475Z -126bf77d5e22d5609d042e0445160382 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2061 - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base deleted file mode 100644 index 760d9c188..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.validator; - -import java.util.List; - -import org.opensaml.saml2.common.Extensions; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class ExtensionsSchemaValidator. - * - * @author fjquevedo - */ -public class ExtensionsSchemaValidator implements Validator { - - - /** - * validate the extensions. - * - * @param extensions the extensions - * - * @throws ValidationException the validation exception - */ - public final void validate(final Extensions extensions) - throws ValidationException { - if (extensions.getUnknownXMLObjects() == null - || extensions.getUnknownXMLObjects().size() <= 0) { - throw new ValidationException("Extension element is empty or not exist."); - } - - List qaa = extensions.getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME); - - if (qaa.size() == 1) { - final Validator validatorQaa = new QAAAttributeSchemaValidator(); - validatorQaa.validate((QAAAttribute) qaa.get(0)); - } else { - throw new ValidationException( - "Extensions must contain only one element QAALevel."); - } - - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base deleted file mode 100644 index be5dc8c34..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.validator; - -import org.opensaml.xml.util.DatatypeHelper; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class QAAAttributeSchemaValidator. - * - * @author fjquevedo - */ -public class QAAAttributeSchemaValidator implements Validator { - - - /** - * Validate action. - * - * @param qaa the quality authentication assurance level attribute - * - * @throws ValidationException the validation exception - */ - public final void validate(final QAAAttribute qaa) throws ValidationException { - validateAction(qaa); - } - - - /** - * Validate action. - * - * @param qaaAttribute the quality authentication assurance level attribute. - * - * @throws ValidationException the validation exception - */ - protected final void validateAction(final QAAAttribute qaaAttribute) - throws ValidationException { - if (DatatypeHelper.isEmpty(qaaAttribute.getQaaLevel())) { - throw new ValidationException("QAALevel label must be specified."); - } - - final int qaa = Integer.valueOf(qaaAttribute.getQaaLevel()); - - if (qaa < QAAAttribute.MIN_VALUE || qaa > QAAAttribute.MAX_VALUE) { - throw new ValidationException( - "QAALevel label must be greater than 0."); - } - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index b98cf7157..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Validation rules for STORK 1.0 core types and elements. - */ -package eu.stork.peps.auth.engine.core.validator; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.class deleted file mode 100644 index 484b3e944..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.class deleted file mode 100644 index 1fbb6d315..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/package-info.class deleted file mode 100644 index f7c2913cd..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/core/validator/package-info.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/package-info.class deleted file mode 100644 index de91b8302..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/auth/engine/package-info.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/all-wcprops deleted file mode 100644 index 96b3f2328..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/all-wcprops +++ /dev/null @@ -1,41 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 89 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 107 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/package-info.java -END -ConfigurationCreator.java -K 25 -svn:wc:ra_dav:version-url -V 115 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java -END -ConfigurationReader.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java -END -ConfigurationSingleton.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationSingleton.java -END -InstanceEngine.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/InstanceEngine.java -END -ConfigurationEngine.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationEngine.java -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/entries deleted file mode 100644 index b811dc64b..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/entries +++ /dev/null @@ -1,232 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -ConfigurationReader.java -file - - - - -2013-12-20T12:27:57.462475Z -31bb8b4c7e74e039c561bf974dea7c33 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -6979 - -ConfigurationSingleton.java -file - - - - -2013-12-20T12:27:57.466475Z -4350e34e9ec48ce7ad03db6a130559f2 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2367 - -InstanceEngine.java -file - - - - -2013-12-20T12:27:57.466475Z -36fb20db43ded05922bf0bbf785e5d48 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1820 - -ConfigurationEngine.java -file - - - - -2013-12-20T12:27:57.466475Z -99eae7ae70fa5bf4667edfb7912696c2 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1726 - -package-info.java -file - - - - -2013-12-20T12:27:57.462475Z -36f3c0e11d20c8f980d3115b21a23df0 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -806 - -ConfigurationCreator.java -file - - - - -2013-12-20T12:27:57.462475Z -4c130e8c9749dd63e58d57d4d699b7ee -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -4114 - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base deleted file mode 100644 index 2fabff7d6..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.InvalidPropertiesFormatException; -import java.util.Map; -import java.util.Properties; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class InstanceCreator. - * - * @author fjquevedo - */ -public final class ConfigurationCreator { - - /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(ConfigurationCreator.class.getName()); - - /** - * Creates the configuration. - * - * @param instanceConfs the instance configuration - * - * @return the map< string, map< string, object>> - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static Map> createConfiguration( - final Map instanceConfs) throws STORKSAMLEngineException { - - final HashMap> instances = - new HashMap>(); - - LOGGER.info("Create configuration."); - try { - // Only create instances for SAMLEngine configuration. - // INSTANCE - for (Map.Entry entry : instanceConfs - .entrySet()) { - final InstanceEngine iEngine = entry.getValue(); - - final Map intance = new HashMap(); - - // CONFIGURATION - for (ConfigurationEngine configuration : iEngine - .getConfiguration()) { - // Properties only for configuration SamlEngine. - if (configuration.getName().equalsIgnoreCase( - "SamlEngineConf")) { - intance.put(configuration.getName(), - getNewInstance(configuration.getParameters() - .get("fileConfiguration"))); - } else { - intance.put(configuration.getName(), configuration - .getParameters()); - } - } - instances.put(entry.getKey(), intance); - } - } catch (STORKSAMLEngineException ex) { - LOGGER.error("Can not create instance from file configuration."); - throw new STORKSAMLEngineException(ex); - } - return instances; - } - - - /** - * Gets the new instance. - * - * @param fileName the file name - * - * @return the properties from the new instance - * - * @throws STORKSAMLEngineException the STORKSAML engine - * runtime exception - */ - private static Properties getNewInstance(final String fileName) - throws STORKSAMLEngineException { - LOGGER.info("Create file configuration properties to Stork Saml Engine."); - InputStream fileEngineProp = null; - try { - fileEngineProp = ConfigurationCreator.class - .getResourceAsStream("/" + fileName); - final Properties configuration = new Properties(); - configuration.loadFromXML(fileEngineProp); - return configuration; - } catch (InvalidPropertiesFormatException e) { - LOGGER.error("Invalid properties format."); - throw new STORKSAMLEngineException(e); - } catch (IOException e) { - LOGGER.error("Error read file: " + fileName); - throw new STORKSAMLEngineException(e); - } finally { - IOUtils.closeQuietly(fileEngineProp); - } - } - - /** - * Instantiates a new instance creator. - */ - private ConfigurationCreator() { - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base deleted file mode 100644 index 910f4398e..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.util.Map; - -/** - * The Class ConfigurationEngine. - * - * @author fjquevedo - */ -public class ConfigurationEngine { - - /** The name of the configuration file. */ - private String name; - - /** The parameters. */ - private Map parameters; - - /** - * Gets the name. - * - * @return the name - */ - public final String getName() { - return name; - } - - /** - * Gets the parameters. - * - * @return the parameters - */ - public final Map getParameters() { - return parameters; - } - - /** - * Sets the name. - * - * @param newName the new name - */ - public final void setName(final String newName) { - this.name = newName; - } - - /** - * Sets the parameters. - * - * @param newParameters the parameters - */ - public final void setParameters(final Map newParameters) { - this.parameters = newParameters; - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base deleted file mode 100644 index 374cf3fc3..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * The Class ConfigurationReader. - * - * @author fjquevedo - */ -public final class ConfigurationReader { - - /** The Constant SAML_ENGINE_CONFIGURATION_FILE. */ - private static final String ENGINE_CONF_FILE = "SamlEngine.xml"; - - /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(ConfigurationReader.class.getName()); - - /** The Constant NODE_CONFIGURATION. */ - private static final String NODE_CONF = "configuration"; - - /** The Constant NODE_CONFIGURATION_NAME. */ - private static final String NODE_CONF_NAME = "name"; - - /** The Constant NODE_INSTANCE_NAME. */ - private static final String NODE_INST_NAME = "name"; - - /** The Constant NODE_INSTANCE. */ - private static final String NODE_INSTANCE = "instance"; - - /** The Constant NODE_CONFIGURATION_NAME. */ - private static final String NODE_PARAM_NAME = "name"; - - /** The Constant NODE_CONFIGURATION_NAME. */ - private static final String NODE_PARAM_VALUE = "value"; - - /** The Constant NODE_CONFIGURATION_NAME. */ - private static final String NODE_PARAMETER = "parameter"; - - /** - * Generate parameters. - * - * @param configurationNode the configuration node - * - * @return the map< string, string> - */ - private static Map generateParam( - final Element configurationNode) { - - final HashMap parameters = new HashMap(); - - final NodeList parameterNodes = configurationNode - .getElementsByTagName(NODE_PARAMETER); - - String parameterName; - String parameterValue; - - for (int k = 0; k < parameterNodes.getLength(); ++k) { - // for every parameter find, process. - final Element parameterNode = (Element) parameterNodes.item(k); - parameterName = parameterNode.getAttribute(NODE_PARAM_NAME); - parameterValue = parameterNode.getAttribute(NODE_PARAM_VALUE); - - // verified the content. - if (StringUtils.isBlank(parameterName) - || StringUtils.isBlank(parameterValue)) { - throw new STORKSAMLEngineRuntimeException( - "Error reader parameters (name - value)."); - } else { - parameters.put(parameterName.trim(), parameterValue.trim()); - } - } - return parameters; - } - - /** - * Read configuration. - * - * @return the map< string, instance engine> - * - * @throws SAMLEngineException the STORKSAML engine runtime - * exception - */ - public static Map readConfiguration() - throws SAMLEngineException { - - LOGGER.info("Init reader: " + ENGINE_CONF_FILE); - final Map instanceConfs = - new HashMap(); - - Document document = null; - // Load configuration file - final DocumentBuilderFactory factory = DocumentBuilderFactory - .newInstance(); - DocumentBuilder builder; - - InputStream engineConf = null; - try { - - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - - builder = factory.newDocumentBuilder(); - - engineConf = ConfigurationReader.class - .getResourceAsStream("/" + ENGINE_CONF_FILE); - - document = builder.parse(engineConf); - - // Read instance - final NodeList list = document.getElementsByTagName(NODE_INSTANCE); - - for (int indexElem = 0; indexElem < list.getLength(); ++indexElem) { - final Element element = (Element) list.item(indexElem); - - final InstanceEngine instanceConf = new InstanceEngine(); - - // read every configuration. - final String instanceName = element - .getAttribute(NODE_INST_NAME); - - if (StringUtils.isBlank(instanceName)) { - throw new STORKSAMLEngineRuntimeException( - "Error reader instance name."); - } - instanceConf.setName(instanceName.trim()); - - final NodeList confNodes = element - .getElementsByTagName(NODE_CONF); - - for (int indexNode = 0; indexNode < confNodes.getLength(); ++indexNode) { - - final Element configurationNode = (Element) confNodes - .item(indexNode); - - final String configurationName = configurationNode - .getAttribute(NODE_CONF_NAME); - - if (StringUtils.isBlank(configurationName)) { - throw new STORKSAMLEngineRuntimeException( - "Error reader configuration name."); - } - - final ConfigurationEngine confSamlEngine = - new ConfigurationEngine(); - - // Set configuration name. - confSamlEngine.setName(configurationName.trim()); - - // Read every parameter for this configuration. - final Map parameters = - generateParam(configurationNode); - - // Set parameters - confSamlEngine.setParameters(parameters); - - // Add parameters to the configuration. - instanceConf.getConfiguration().add(confSamlEngine); - } - - // Add to the list of configurations. - instanceConfs.put(element.getAttribute(NODE_INST_NAME), - instanceConf); - } - - } catch (SAXException e) { - LOGGER.error("Error: init library parser."); - throw new SAMLEngineException(e); - } catch (ParserConfigurationException e) { - LOGGER.error("Error: parser configuration file xml."); - throw new SAMLEngineException(e); - } catch (IOException e) { - LOGGER.error("Error: read configuration file."); - throw new SAMLEngineException(e); - } finally { - IOUtils.closeQuietly(engineConf); - } - - return instanceConfs; - } - - /** - * Instantiates a new configuration reader. - */ - private ConfigurationReader() { - - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base deleted file mode 100644 index 53cea621d..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * The Class InstanceCreator. - * - * @author fjquevedo - */ -public final class ConfigurationSingleton { - - /** The instance of every engine SAML. */ - private static Map instanceConfigs; - - /** The instances of SAML engine. */ - private static Map> instances; - - /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(ConfigurationSingleton.class.getName()); - - static { - LOGGER.debug("Read all file configurations. (instances of SAMLEngine)"); - try { - instanceConfigs = ConfigurationReader.readConfiguration(); - } catch (SAMLEngineException e) { - LOGGER.error("Error read configuration file."); - throw new STORKSAMLEngineRuntimeException(e); - } - } - - /** - * Gets the new instance. - * - * @param fileName the file name - * - * @return the properties from the new instance - * - * @throws STORKSAMLEngineException the STORKSAML engine runtime exception - */ - private static Map> getInstance( - final String fileName) throws STORKSAMLEngineException { - return ConfigurationCreator.createConfiguration(instanceConfigs); - } - - /** - * Instantiates a new instance creator. - */ - private ConfigurationSingleton() { - } - -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base deleted file mode 100644 index e0e2d1965..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.util.ArrayList; -import java.util.List; - -/** - * The Class InstanceConfiguration. - * - * @author fjquevedo - */ -public class InstanceEngine { - - /** The configuration. */ - private List configuration = new ArrayList(); - - /** The name. */ - private String name; - - /** - * Gets the parameters. - * - * @return the parameters - */ - public final List getConfiguration() { - return this.configuration; - } - - /** - * Gets the name. - * - * @return the name - */ - public final String getName() { - return name; - } - - /** - * Sets the parameters. - * - * @param newConfiguration the new parameters - */ - public final void setConfiguration(final List newConfiguration) { - this.configuration = newConfiguration; - } - - /** - * Sets the name. - * - * @param newName the new name - */ - public final void setName(final String newName) { - this.name = newName; - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 6d0b54297..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Provides the classes necessary to create a SAML message instance. - */ -package eu.stork.peps.configuration; diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationCreator.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationCreator.class deleted file mode 100644 index 533ca2f81..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationCreator.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationEngine.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationEngine.class deleted file mode 100644 index 9cb1ebaba..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationEngine.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationReader.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationReader.class deleted file mode 100644 index e65e54d4f..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationReader.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationSingleton.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationSingleton.class deleted file mode 100644 index 91bb3d652..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/ConfigurationSingleton.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/InstanceEngine.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/InstanceEngine.class deleted file mode 100644 index 9d07bac68..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/InstanceEngine.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/package-info.class deleted file mode 100644 index 917e6943f..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/configuration/package-info.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/all-wcprops deleted file mode 100644 index d4b9b9008..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/all-wcprops +++ /dev/null @@ -1,29 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 86 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions -END -SAMLEngineException.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java -END -STORKSAMLEngineException.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 104 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/package-info.java -END -STORKSAMLEngineRuntimeException.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.java -END diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/entries b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/entries deleted file mode 100644 index 6493ed6e8..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/entries +++ /dev/null @@ -1,164 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -STORKSAMLEngineRuntimeException.java -file - - - - -2013-12-20T12:27:57.454475Z -aebe4e4afb2f11cf42448486970a5d85 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1812 - -SAMLEngineException.java -file - - - - -2013-12-20T12:27:57.454475Z -38d2d1ec4d590abab4bb36d845d9f86b -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1710 - -STORKSAMLEngineException.java -file - - - - -2013-12-20T12:27:57.454475Z -622c95d2e770b38dafe815bcfaae8994 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3460 - -package-info.java -file - - - - -2013-12-20T12:27:57.454475Z -56145f85c2084454a3c223dd9e103846 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -792 - diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base deleted file mode 100644 index 366379ad0..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.exceptions; - -/** - * The Class SAMLEngineException. - * - * @author fjquevedo - */ -public class SAMLEngineException extends Exception { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = 2611361164977849837L; - - /** - * Instantiates a new SAMLEngine exception. - * - * @param wrappedException the wrapped exception - */ - public SAMLEngineException(final Exception wrappedException) { - super(wrappedException); - } - - /** - * Instantiates a new SAMLEngine exception. - * - * @param message the message - */ - public SAMLEngineException(final String message) { - super(message); - } - - /** - * Instantiates a new SAMLEngine exception. - * - * @param message the message - * @param wrappedException the wrapped exception - */ - public SAMLEngineException(final String message, - final Exception wrappedException) { - super(message, wrappedException); - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base deleted file mode 100644 index bddcbd1b3..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.exceptions; - -/** - * The Class STORKSAMLEngineException. - * - * @author fjquevedo - */ -public class STORKSAMLEngineException extends Exception { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = -8319723167019122930L; - - /** The error code. */ - private String errorCode; - - /** The error detail. */ - private String errorDetail; - - /** - * Instantiates a new sTORKSAML engine exception. - * - * @param wrappedException the wrapped exception - */ - public STORKSAMLEngineException(final Exception wrappedException) { - super(wrappedException); - } - - /** - * Instantiates a new sTORKSAML engine exception. - * - * @param errorMessage the error message - */ - public STORKSAMLEngineException(final String errorMessage) { - super(errorMessage); - } - - /** - * Instantiates a new sTORKSAML engine exception. - * - * @param message the message - * @param wrappedException the wrapped exception - */ - public STORKSAMLEngineException(final String message, - final Exception wrappedException) { - super(message, wrappedException); - } - - /** - * Instantiates a new sTORKSAML engine exception. - * - * @param newErrorCode the error code - * @param errorMessage the error message - * @param newErrorDetail the error detail - */ - public STORKSAMLEngineException(final String newErrorCode, - final String errorMessage, final String newErrorDetail) { - super(errorMessage); - this.errorCode = newErrorCode; - this.errorDetail = newErrorDetail; - } - - /** - * Gets the error code. - * - * @return the error code - */ - public final String getErrorCode() { - return this.errorCode; - } - - /** - * Gets the error detail. - * - * @return the error detail - */ - public final String getErrorDetail() { - return errorDetail; - } - - /** - * Gets the error message. - * - * @return the error message - */ - public final String getErrorMessage() { - return super.getMessage(); - } - - - /** - * Gets the message. - * - * @return the message of the exception. - * - * @see java.lang.Throwable#getMessage() - */ - public final String getMessage() { - return "Error (no. " + errorCode + ") processing request : " - + super.getMessage(); - } - - /** - * Sets the error code. - * - * @param newErrorCode the new error code - */ - public final void setErrorCode(final String newErrorCode) { - this.errorCode = newErrorCode; - } - - /** - * Sets the error detail. - * - * @param newErrorDetail the new error detail - */ - public final void setErrorDetail(final String newErrorDetail) { - this.errorDetail = newErrorDetail; - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base deleted file mode 100644 index 30b9b49b4..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.exceptions; - -/** - * The Class STORKSAMLEngineRuntimeException. - * - * @author fjquevedo - */ -public class STORKSAMLEngineRuntimeException extends RuntimeException { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = 5829810358581493517L; - - /** - * Instantiates a new sTORKSAML engine runtime exception. - * - * @param wrappedException the wrapped exception - */ - public STORKSAMLEngineRuntimeException(final Exception wrappedException) { - super(wrappedException); - } - - /** - * Creates a new instance of application exception. - * - * @param cause the exception cause. - */ - public STORKSAMLEngineRuntimeException(final String cause) { - super(cause); - } - - /** - * Instantiates a new sTORKSAML engine runtime exception. - * - * @param message the message - * @param wrappedException the wrapped exception - */ - public STORKSAMLEngineRuntimeException(final String message, - final Exception wrappedException) { - super(message, wrappedException); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 0c34528fc..000000000 --- a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Provides the classes for STORK exceptions management. - */ -package eu.stork.peps.exceptions; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/SAMLEngineException.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/SAMLEngineException.class deleted file mode 100644 index 9db600cf5..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/SAMLEngineException.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.class deleted file mode 100644 index dcda3167b..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.class deleted file mode 100644 index d3ad1ee3c..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/package-info.class b/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/package-info.class deleted file mode 100644 index 7edb99f3b..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/main/java/eu/stork/peps/exceptions/package-info.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/.svn/all-wcprops deleted file mode 100644 index ead80d4e8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 57 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test -END diff --git a/id/server/stork2-saml-engine/build/classes/test/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/.svn/entries deleted file mode 100644 index 1b6d0b3e1..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -resources -dir - -java -dir - diff --git a/id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops deleted file mode 100644 index 56c8ee113..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 62 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java -END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/.svn/entries deleted file mode 100644 index ca124ed28..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -eu -dir - diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/all-wcprops deleted file mode 100644 index e00b13d5a..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 65 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu -END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/entries deleted file mode 100644 index cc3e19816..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -stork -dir - diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/all-wcprops deleted file mode 100644 index ac0852630..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 71 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork -END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/entries deleted file mode 100644 index 66d2ea82a..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -peps -dir - diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/all-wcprops deleted file mode 100644 index 5555d11e2..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 76 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps -END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/entries deleted file mode 100644 index e20bc1c1d..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -test -dir - diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops deleted file mode 100644 index ee98ec5bd..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 81 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test -END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/entries deleted file mode 100644 index a7074362f..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -simple -dir - diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops deleted file mode 100644 index 063e2de18..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops +++ /dev/null @@ -1,47 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple -END -StorkResponseTest.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java -END -StorkAttrQueryResponseTest.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java -END -SimpleBaseTest.java -K 25 -svn:wc:ra_dav:version-url -V 107 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 105 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/package-info.java -END -SSETestUtils.java -K 25 -svn:wc:ra_dav:version-url -V 105 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java -END -StorkAttrQueryRequestTest.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java -END -StorkAuthRequestTest.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java -END diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries deleted file mode 100644 index 0fbc1b254..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries +++ /dev/null @@ -1,266 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -SSETestUtils.java -file - - - - -2013-12-20T12:27:57.274475Z -f9c51e04914afb9a99d52e642c8a6a42 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -5521 - -StorkAttrQueryRequestTest.java -file - - - - -2013-12-20T12:27:57.274475Z -66e336a173f22c2ba55b933157c703c8 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -25393 - -StorkAuthRequestTest.java -file - - - - -2013-12-20T12:27:57.274475Z -c1e89785bc4af791adb9760fd42b7d56 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -31301 - -StorkResponseTest.java -file - - - - -2013-12-20T12:27:57.274475Z -016c270fa1231e25cc1ccf67d0ebf6cf -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -39179 - -StorkAttrQueryResponseTest.java -file - - - - -2013-12-20T12:27:57.274475Z -44021c766949a57b10b61cd466a57b55 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -39559 - -SimpleBaseTest.java -file - - - - -2013-12-20T12:27:57.274475Z -6effea1d03de1bd17fd8d07d3778df58 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1871 - -package-info.java -file - - - - -2013-12-20T12:27:57.274475Z -3cd87d2f80f4a5a4f42ab5bc844dd2f3 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -811 - diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base deleted file mode 100644 index b1443bb0e..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; - -import javax.xml.XMLConstants; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.apache.commons.io.IOUtils; -import org.bouncycastle.util.encoders.Base64; -import org.opensaml.Configuration; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.Marshaller; -import org.opensaml.xml.io.MarshallerFactory; -import org.opensaml.xml.io.MarshallingException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * The Class SSETestUtils. - */ -public final class SSETestUtils { - - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(SSETestUtils.class.getName()); - - /** - * Instantiates a new sSE test utils. - */ - private SSETestUtils() { - } - - /** - * Prints the tree DOM. - * - * @param samlToken the SAML token - * @param isIndent the is indent - * - * @return the string - * @throws TransformerException the exception - */ - public static String printTreeDOM(final Element samlToken, final boolean isIndent) throws TransformerException { - // set up a transformer - final TransformerFactory transfac = TransformerFactory.newInstance(); - final Transformer trans = transfac.newTransformer(); - trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - trans.setOutputProperty(OutputKeys.INDENT, String.valueOf(isIndent)); - - // create string from XML tree - final StringWriter stringWriter = new StringWriter(); - final StreamResult result = new StreamResult(stringWriter); - final DOMSource source = new DOMSource(samlToken); - trans.transform(source, result); - final String xmlString = stringWriter.toString(); - - return xmlString; - } - - /** - * Marshall. - * - * @param samlToken the SAML token - * - * @return the byte[] - * - * @throws MarshallingException the marshalling exception - * @throws ParserConfigurationException the parser configuration exception - * @throws TransformerException the transformer exception - */ - public static byte[] marshall(final XMLObject samlToken) - throws MarshallingException, ParserConfigurationException, - TransformerException { - - final javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory - .newInstance(); - dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - dbf.setNamespaceAware(true); - dbf.setIgnoringComments(true); - final javax.xml.parsers.DocumentBuilder docBuild = dbf - .newDocumentBuilder(); - - // Get the marshaller factory - final MarshallerFactory marshallerFactory = Configuration - .getMarshallerFactory(); - - // Get the Subject marshaller - final Marshaller marshaller = marshallerFactory - .getMarshaller(samlToken); - - final Document doc = docBuild.newDocument(); - - // Marshall the SAML token - marshaller.marshall(samlToken, doc); - - // Obtain a byte array representation of the marshalled SAML object - final DOMSource domSource = new DOMSource(doc); - final StringWriter writer = new StringWriter(); - final StreamResult result = new StreamResult(writer); - final TransformerFactory transFact = TransformerFactory.newInstance(); - final Transformer transformer = transFact.newTransformer(); - transformer.transform(domSource, result); - - return writer.toString().getBytes(); - } - - /** - * Encode SAML token. - * - * @param samlToken the SAML token - * - * @return the string - */ - public static String encodeSAMLToken(final byte[] samlToken) { - return new String(Base64.encode(samlToken)); - } - - /** - * Read stork SAML from file. - * - * @param resource the resource - * - * @return the byte[] - * @throws IOException the exception - * - */ - public static byte[] readStorkSamlFromFile(final String resource) - throws IOException { - InputStream inputStream = null; - byte[] bytes; - - try { - inputStream = StorkAuthRequestTest.class - .getResourceAsStream(resource); - - // Create the byte array to hold the data - bytes = new byte[(int) inputStream.available()]; - inputStream.read(bytes); - } catch (IOException e) { - LOG.error("Error read from file: " + resource); - throw e; - } finally { - IOUtils.closeQuietly(inputStream); - } - return bytes; - - } -} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base deleted file mode 100644 index 97fa4b7cc..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import org.junit.Test; - -import junit.framework.Assert; -import junit.framework.TestCase; -import eu.stork.peps.auth.engine.STORKSAMLEngine; - -/** - * The Class SimpleBaseTest. Defines a set of test the initialization of the - * SAML engine. - */ -public class SimpleBaseTest extends TestCase { - - /** - * Test SAML engine correct configuration name. - */ - @Test - public final void testSamlEngineCorrectInit() { - Assert.assertNotNull(STORKSAMLEngine.getInstance("CONF1")); - } - - /** - * Test SAML engine error configuration name. - */ - @Test - public final void testSamlEngineErrorNameConf() { - Assert.assertNull(STORKSAMLEngine.getInstance("CONF_ERROR")); - } - - /** - * Test SAML engine error name null. - */ - @Test - public final void testSamlEngineErrorNameNull() { - Assert.assertNull(STORKSAMLEngine.getInstance(null)); - } - - /** - * Test SAML engine correct name configuration with spaces. - */ - @Test - public final void testSamlEngineErrorNameSpaces() { - Assert.assertNotNull(STORKSAMLEngine.getInstance(" CONF1 ")); - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base deleted file mode 100644 index 7fa305d3b..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base +++ /dev/null @@ -1,790 +0,0 @@ -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileOutputStream; -import java.util.ArrayList; -import java.util.Arrays; - -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAttrQueryRequest; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -public class StorkAttrQueryRequestTest { - - /** The engines. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0"); - private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); - private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); - - - /** - * Instantiates a new stork authentication request test. - */ - public StorkAttrQueryRequestTest() { - pal = new PersonalAttributeList(); - - final PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - final ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - final PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - final PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - eIDNumber.setValue(Arrays.asList("ES/IS/1234567890")); - pal.add(eIDNumber); - - final PersonalAttribute givenName = new PersonalAttribute(); - givenName.setName("givenName"); - givenName.setIsRequired(true); - givenName.setValue(Arrays.asList("Sveinbjorn")); - pal.add(givenName); - - destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest"; - //assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - - } - - /** The destination. */ - private String destination; - - /** The service provider sector. */ - private String spSector; - - /** The service provider institution. */ - private String spInstitution; - - /** The service provider application. */ - private String spApplication; - - /** The service provider country. */ - private String spCountry; - - /** The service provider id. */ - private String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The List of Personal Attributes. */ - private IPersonalAttributeList pal; - - /** The attribute query request. */ - private static byte[] attrRequest; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkAttrQueryRequestTest.class.getName()); - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - } - - /** - * Test generate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryRequest() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // new parameters - request.setEIDSectorShare(false); - request.setEIDCrossSectorShare(false); - request.setEIDCrossBorderShare(false); - - STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request); - byte[] reqByte = req1.getTokenSaml(); - FileOutputStream output = null; - - try { - output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml")); - output.write(reqByte); - } catch (Exception e) { - e.printStackTrace(); - throw new STORKSAMLEngineException(e); - } finally { - try { output.close(); } catch (Exception e) { throw new STORKSAMLEngineException(e); } - } - - - - - LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); - - request.setCitizenCountryCode("IS"); - LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); - } - - /** - * Test generate authentication request error personal attribute name error. - */ - @Test - public final void testGenerateAttrQueryRequestPALsErr1() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("attrNotValid"); - worngAttr.setIsRequired(true); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - - // news parameters - request.setEIDSectorShare(false); - request.setEIDCrossSectorShare(false); - request.setEIDCrossBorderShare(false); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - /** - * Test generate authentication request error personal attribute value error. - */ - @Test - public final void testGenerateAttrQueryRequestPALsErr2() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute attrNotValid = new PersonalAttribute(); - attrNotValid.setName("attrNotValid"); - attrNotValid.setIsRequired(true); - palWrong.add(attrNotValid); - - - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request authentication assurance level - * negative value. - */ - @Test - public final void testGenerateAttrQueryRequestQaalErr1() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(-1); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request service provider sector null. - */ - @Test - public final void testGenerateAttrQueryRequestSectorErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - - } - } - - /** - * Test generate authentication request service provider institution null. - */ - @Test - public final void testGenerateAttrQueryRequestInstitutionrErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(null); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAttrQueryRequestApplicationErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(null); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider country null. - */ - @Test - public final void testGenerateAttrQueryRequestCountryErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(null); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request error with quality authentication - * assurance level wrong. - */ - @Test - public final void testGenerateAttrQueryRequestQaalErr2() { - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(0); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request personal attribute list null value. - */ - @Test - public final void testGenerateAttrQueryRequestPALErr1() { - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(null); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request null parameter. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestNullParam() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAttrQueryRequest(null); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request error bytes encode. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestErrorEncode() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAttrQueryRequest("messageError".getBytes()); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequest() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - attrRequest = engine.generateSTORKAttrQueryRequest(request).getTokenSaml(); - - final STORKAttrQueryRequest validatedRequest = engine.validateSTORKAttrQueryRequest(attrRequest); - - assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); - - } - - /** - * Test validate data authenticate request. Verified parameters after - * validation. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateDataAttrQueryRequest() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = engine.validateSTORKAttrQueryRequest(attrRequest); - - assertEquals("Sestination incorrect: ", request.getDestination(), destination); - - assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); - - assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); - assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); - assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); - assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); - assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), null); - - } - - /** - * Test validate file attribute query request. Validate from XML file. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAttrQueryRequest() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml"); - - try { - engine.validateSTORKAttrQueryRequest(bytes); - fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - } - } - - /** - * Test validate file authentication request tag delete. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAttrRequestTagDelete() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml"); - - try { - engine.validateSTORKAttrQueryRequest(bytes); - fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - - } - } - - /** - * Test validate authentication request not trusted token. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestNotTrustedErr1() - throws STORKSAMLEngineException { - - try { - final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine - .getInstance("CONF2"); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineNotTrusted - .generateSTORKAttrQueryRequest(request).getTokenSaml(); - - engine.validateSTORKAttrQueryRequest(authReqNotTrust); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("validateSTORKAttrQueryRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test validate authentication request trusted. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestTrusted() - throws STORKSAMLEngineException { - - final STORKSAMLEngine engineTrusted = STORKSAMLEngine - .getInstance("CONF3"); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest( - request).getTokenSaml(); - - // engine ("CONF1") no have trust certificate from "CONF2" - engine.validateSTORKAttrQueryRequest(authReqNotTrust); - - } - - - - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAttrQueryRequestNADA() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(null); - request.setSpApplication(null); - request.setSpCountry(null); - - try { - - engine.validateSTORKAttrQueryRequest(attrRequest); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test validate authentication request with unknown elements. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestWithUnknownElements() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute unknown = new PersonalAttribute(); - unknown.setName("unknown"); - unknown.setIsRequired(true); - pAttList.add(unknown); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - STORKAttrQueryRequest req = new STORKAttrQueryRequest(); - - req = engine3.generateSTORKAttrQueryRequest(request); - - req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); - - assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); - assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); - - } - - /** - * Test generate Request with required elements by default - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - STORKAttrQueryRequest req = new STORKAttrQueryRequest(); - STORKAttrQueryRequest reqTrue = new STORKAttrQueryRequest(); - STORKAttrQueryRequest reqFalse = new STORKAttrQueryRequest(); - - reqTrue = engine.generateSTORKAttrQueryRequest(request); - reqFalse = engine2.generateSTORKAttrQueryRequest(request); - req = engine3.generateSTORKAttrQueryRequest(request); - - - String token = new String(req.getTokenSaml()); - String reqTrueToken = new String(reqTrue.getTokenSaml()); - String reqFalseToken = new String(reqFalse.getTokenSaml()); - - assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); - assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); - assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); - - } - - /** - * Test validating attribute query and getting alias used to save - * the saml trusted certificate into trustore - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAtrrQueryRequestGettingItsAlias() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - STORKAttrQueryRequest req = new STORKAttrQueryRequest(); - - req = engine3.generateSTORKAttrQueryRequest(request); - req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - - req = engine2.generateSTORKAttrQueryRequest(request); - req = engine2.validateSTORKAttrQueryRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base deleted file mode 100644 index 27c6cfe39..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base +++ /dev/null @@ -1,920 +0,0 @@ -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.junit.Ignore; -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PEPSUtil; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAttrQueryRequest; -import eu.stork.peps.auth.commons.STORKAttrQueryResponse; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.commons.STORKAuthnResponse; -import eu.stork.peps.auth.commons.STORKStatusCode; -import eu.stork.peps.auth.commons.STORKSubStatusCode; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -public class StorkAttrQueryResponseTest { - - /** The engine. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - - /** - * Gets the engine. - * - * @return the engine - */ - public static STORKSAMLEngine getEngine() { - return engine; - } - - /** - * Sets the engine. - * - * @param newEngine the new engine - */ - public static void setEngine(final STORKSAMLEngine newEngine) { - StorkAttrQueryResponseTest.engine = newEngine; - } - - /** The destination. */ - private static String destination; - - /** The service provider sector. */ - private static String spSector; - - /** The service provider institution. */ - private static String spInstitution; - - /** The service provider application. */ - private static String spApplication; - - /** The service provider country. */ - private static String spCountry; - - /** The service provider id. */ - private static String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The state. */ - private static String state = "IS"; - - /** The town. */ - private static String town = "Reykjavik"; - - /** The postal code. */ - private static String postalCode = "105"; - - /** The street name. */ - private static String streetName = "Gudrunartun"; - - /** The street number. */ - private static String streetNumber = "10"; - - /** The List of Personal Attributes. */ - private static IPersonalAttributeList pal; - - /** The assertion consumer URL. */ - private static String assertConsumerUrl; - - /** The attribute query request. */ - private static byte[] attrQueryRequest; - - /** The attribute query response. */ - private static byte[] attrQueryResponse; - - /** The attribute query request. */ - private static STORKAttrQueryRequest attrQueryenRequest; - - /** The attribute query response. */ - private static STORKAttrQueryResponse attrQeuryenResponse; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkAttrQueryResponseTest.class.getName()); - - /** - * Instantiates a new stork response test. - */ - public StorkAttrQueryResponseTest() { - super(); - } - - /** The IP address. */ - private static String ipAddress; - - /** The destination URL. */ - private static String destinationUrl; - - /** The is hashing. */ - private final boolean isHashing = Boolean.TRUE; - - /** The is not hashing. */ - private final boolean isNotHashing = Boolean.FALSE; - - /** The ERROR text. */ - private static final String ERROR_TXT = "generateAttrQueryResponse(...) should've thrown an STORKSAMLEngineException!"; - - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - - pal = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - pal.add(eIDNumber); - - final PersonalAttribute givenName = new PersonalAttribute(); - givenName.setName("givenName"); - givenName.setIsRequired(true); - pal.add(givenName); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - pal.add(canRessAddress); - - PersonalAttribute newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - pal.add(newAttribute); - - destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - spSector = "EDU001"; - spInstitution = "OXF001"; - spApplication = "APP001"; - spCountry = "EN"; - - spId = "EDU001-APP001-APP001"; - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - request.setDestination(destination); - //request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - //request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(request) - .getTokenSaml(); - - attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest); - - } catch (STORKSAMLEngineException e) { - fail("Error create STORKAuthnRequest"); - } - - ipAddress = "111.222.333.444"; - - destinationUrl = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - - pal = new PersonalAttributeList(); - - isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ages = new ArrayList(); - - ages.add("16"); - ages.add("18"); - - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(isAgeOver); - - dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(dateOfBirth); - - eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789IS"); - eIDNumber.setValue(idNumber); - eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(eIDNumber); - - canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - - canRessAddress.setComplexValue(address); - pal.add(canRessAddress); - - newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap values = new HashMap(); - - values.put("value1", "value1"); - values.put("value2", "value2"); - values.put("value3", "value3"); - values.put("value4", "value4"); - - newAttribute.setComplexValue(values); - pal.add(newAttribute); - - } - - /** - * Test generate attribute query request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryResponse() throws STORKSAMLEngineException { - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - final STORKAttrQueryResponse storkResponse = getEngine() - .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, - destinationUrl, isNotHashing); - - attrQueryResponse = storkResponse.getTokenSaml(); - - FileOutputStream output = null; - - try { - output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml")); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - try { - output.write(attrQueryResponse); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); - - - } - - /** - * Test validation id parameter mandatory. - */ - @Test - public final void testResponseMandatoryId() { - final String identifier = attrQueryenRequest.getSamlId(); - attrQueryenRequest.setSamlId(null); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, destinationUrl, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setSamlId(identifier); - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response in response to err1. - */ - @Test - public final void testResponseMandatoryIssuer() { - - final String issuer = attrQueryenRequest.getIssuer(); - attrQueryenRequest.setIssuer(null); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, destinationUrl, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setIssuer(issuer); - LOG.error("Error"); - } - } - - - /** - * Test generate attribute query response assertion consumer null. - */ - /*@Test - public final void testResponseMandatoryAssertionConsumerServiceURL() { - final String asserConsumerUrl = attrQueryenRequest - .getAssertionConsumerServiceURL(); - attrQueryenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response IP address null. - */ - @Test - public final void testResponseValidationIP() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, null, - destinationUrl, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response with personal attribute list null. - */ - @Test - public final void testResponseMandatoryPersonalAttributeList() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(null); - - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, destinationUrl, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate attribute query response token null. - */ - @Test - public final void testResponseInvalidParametersToken() { - try { - getEngine().validateSTORKAttrQueryResponse(null, ipAddress); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate attribute query response IP null. - */ - @Test - public final void STORKAttrQueryResponse() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response parameter name wrong. - */ - @Test - public final void testResponseInvalidParametersAttr() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("AttrWrong"); - wrongList.add(worngAttr); - - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrSimpleValue() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoValue() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoName() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null complex value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrComplexValue() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setComplexValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test validate attribute query response IP distinct and disabled validation - * IP. - */ - @Test - public final void testResponseInvalidParametersIPDistinct() { - try { - // ipAddress origin "111.222.333.444" - // ipAddrValidation = false - // Subject Confirmation Bearer. - - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, "127.0.0.1"); - } catch (STORKSAMLEngineException e) { - fail("validateAttributeQueryResponse(...) should've thrown an STORKSAMLEngineException!"); - LOG.error("Error"); - } - } - - /** - * Test response invalid parameters invalid token. - */ - @Test - public final void testResponseInvalidParametersTokenMsg() { - try { - // ipAddress origin "111.222.333.444" - // Subject Confirmation Bearer. - getEngine().validateSTORKAttrQueryResponse("errorMessage".getBytes(), - ipAddress); - fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate attribute query response is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - /*@Test - public final void testValidateAuthenticationResponseIsFail() - throws STORKSAMLEngineException { - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertFalse("Generate incorrect response: ", attrQeuryenResponse.isFail()); - } - - /** - * Test validate attribute query response destination. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseDestination() - throws STORKSAMLEngineException { - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertEquals("Destination incorrect: ", - attrQeuryenResponse.getInResponseTo(), attrQueryenRequest.getSamlId()); - } - - /** - * Test validate attribute query response values. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseValuesComplex() - throws STORKSAMLEngineException { - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertEquals("Country incorrect:", attrQeuryenResponse.getCountry(), "ES"); - - final Iterator iterator = attrQeuryenResponse - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - final PersonalAttribute attribute = iterator.next(); - if (attribute.getName().equalsIgnoreCase( - "canonicalResidenceAddress")) { - assertEquals("State incorrect: ", state, attribute - .getComplexValue().get("state")); - assertEquals("Town incorrect: ", town, attribute - .getComplexValue().get("town")); - assertEquals("Postal code incorrect: ", postalCode, attribute - .getComplexValue().get("postalCode")); - assertEquals("Street name incorrect: ", streetName, attribute - .getComplexValue().get("streetName")); - assertEquals("Street number incorrect: ", streetNumber, - attribute.getComplexValue().get("streetNumber")); - } - } - } - - /** - * Test generate attribute query response fail in response to it's null. - * @throws STORKSAMLEngineException - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test //( expected=STORKSAMLEngineException.class) - public final void testGenerateAttrQueryResponseFailInResponseToNull() throws STORKSAMLEngineException { - final String identifier = attrQueryenRequest.getSamlId(); - attrQueryenRequest.setSamlId(null); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setSamlId(identifier); - LOG.error("Error"); - //throw new STORKSAMLEngineException(e); - } - } - - /** - * Test generate attribute query response fail assertion consumer URL err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - /*@Test - public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() - throws STORKSAMLEngineException { - - final String assertConsumerUrl = attrQueryenRequest - .getAssertionConsumerServiceURL(); - attrQueryenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - attrQueryResponse = getEngine().generateSTORKAuthnResponseFail(attrQueryenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response fail code error err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryResponseFailCodeErrorNull() - throws STORKSAMLEngineException { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setStatusCode(null); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - fail("generateAttrQueryResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test generate attribute query request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryResponse() throws STORKSAMLEngineException { - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(dateOfBirth); - - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - complex.put("one", "two"); - - //eIDNumber.setValue(null); - //eIDNumber.setValue(idNumber); - //eIDNumber.setComplexValue(complex); - - eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); - palist.add(eIDNumber); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - - canRessAddress.setComplexValue(address); - palist.add(canRessAddress); - - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAttrQueryResponse storkResponse = getEngine() - .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, - destinationUrl, isNotHashing); - - attrQueryResponse = storkResponse.getTokenSaml(); - LOG.info("Request id: " + attrQueryenRequest.getSamlId()); - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); - - - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - LOG.info("RESPONSE ID: " + attrQeuryenResponse.getSamlId()); - LOG.info("RESPONSE IN_RESPONSE_TO: " + attrQeuryenResponse.getInResponseTo()); - LOG.info("RESPONSE COUNTRY: " + attrQeuryenResponse.getCountry()); - - } - - - - - - /** - * Test validate attribute query response fail is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryResponseFailIsFail() - throws STORKSAMLEngineException { - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage("message"); - - attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - - LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(attrQueryResponse)); - - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - LOG.info("COUNTRY: " + attrQeuryenResponse.getCountry()); - assertTrue("Generate incorrect response: ", attrQeuryenResponse.isFail()); - } - - /** - * Test generate/validate response with signedDoc - * - * @throws STORKSAMLEngineException - * the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryResponseWithSignedDoc() - throws STORKSAMLEngineException { - - String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - palist.add(isAgeOver); - - attrQueryenRequest.setPersonalAttributeList(palist); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAttrQueryResponse storkResponse = getEngine() - .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, - destinationUrl, isNotHashing); - - attrQueryResponse = storkResponse.getTokenSaml(); - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse - .getPersonalAttributeList().get("signedDoc").getValue().get(0) - .equals(signedDocResponse)); - - } -} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base deleted file mode 100644 index 7223ab483..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base +++ /dev/null @@ -1,966 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; - -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class StorkAuthRequestTest defines a class to . - */ -public class StorkAuthRequestTest { - - /** The engines. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); - private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); - - - /** - * Instantiates a new stork authentication request test. - */ - public StorkAuthRequestTest() { - pal = new PersonalAttributeList(); - - final PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - final ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - final PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - final PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - pal.add(eIDNumber); - - destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - - spName = "University of Oxford"; - spSector = "EDU001"; - spInstitution = "OXF001"; - spApplication = "APP001"; - spCountry = "EN"; - - spId = "EDU001-OXF001-APP001"; - - } - - /** The destination. */ - private String destination; - - /** The service provider name. */ - private String spName; - - /** The service provider sector. */ - private String spSector; - - /** The service provider institution. */ - private String spInstitution; - - /** The service provider application. */ - private String spApplication; - - /** The service provider country. */ - private String spCountry; - - /** The service provider id. */ - private String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The List of Personal Attributes. */ - private IPersonalAttributeList pal; - - /** The assertion consumer URL. */ - private String assertConsumerUrl; - - /** The authentication request. */ - private static byte[] authRequest; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkAuthRequestTest.class.getName()); - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - } - - /** - * Test generate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnRequest() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - //engine.generateSTORKAuthnRequest(request); - - LOG.info("STORKAuthnRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); - request.setCitizenCountryCode("ES"); - LOG.info("STORKAuthnRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); - } - - - /** - * Test generate authentication request error personal attribute name error. - */ - @Test - public final void testGenerateAuthnRequestPALsErr1() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("attrNotValid"); - worngAttr.setIsRequired(true); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - /** - * Test generate authentication request error personal attribute value error. - */ - @Test - public final void testGenerateAuthnRequestPALsErr2() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute attrNotValid = new PersonalAttribute(); - attrNotValid.setName("attrNotValid"); - attrNotValid.setIsRequired(true); - palWrong.add(attrNotValid); - - - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request error provider name null. - */ - @Test - public final void testGenerateAuthnRequestSPNAmeErr1() { - - - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(null); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try - { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - catch (STORKSAMLEngineException e) - { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request authentication assurance level - * negative value. - */ - @Test - public final void testGenerateAuthnRequestQaalErr1() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(-1); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request service provider sector null. - */ - @Test - public final void testGenerateAuthnRequestSectorErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - - } - } - - /** - * Test generate authentication request service provider institution null. - */ - @Test - public final void testGenerateAuthnRequestInstitutionrErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(null); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAuthnRequestApplicationErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(null); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider country null. - */ - @Test - public final void testGenerateAuthnRequestCountryErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(null); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request error with quality authentication - * assurance level wrong. - */ - @Test - public final void testGenerateAuthnRequestQaalErr2() { - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(0); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request personal attribute list null value. - */ - @Test - public final void testGenerateAuthnRequestPALErr1() { - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(null); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request error with assertion consumer URL - * null. - */ - @Test - public final void testGenerateAuthnRequestAssertionConsumerErr1() { - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(null); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request null parameter. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestNullParam() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAuthnRequest(null); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request error bytes encode. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestErrorEncode() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAuthnRequest("messageError".getBytes()); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequest() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - authRequest = engine.generateSTORKAuthnRequest(request).getTokenSaml(); - - final STORKAuthnRequest validatedRequest = engine.validateSTORKAuthnRequest(authRequest); - - assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); - - } - - /** - * Test validate data authenticate request. Verified parameters after - * validation. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateDataAuthnRequest() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = engine.validateSTORKAuthnRequest(authRequest); - - assertEquals("Sestination incorrect: ", request.getDestination(), destination); - - assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); - - assertEquals("Service provider incorrect: ", request.getProviderName(), spName); - assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); - assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); - assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); - assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); - assertEquals("Asserition consumer URL incorrect: ", request.getAssertionConsumerServiceURL(), assertConsumerUrl); - - assertEquals("SP Country incorrect: ", request.getSpCountry(), spCountry); - assertEquals("SP Id incorrect: ", request.getSPID(), spId); - assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), "ES"); - - } - - /** - * Test validate file authentication request. Validate from XML file. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAuthnRequest() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml"); - - try { - engine.validateSTORKAuthnRequest(bytes); - fail("testValidateFileAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - } - } - - /** - * Test validate file authentication request tag delete. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAuthnRequestTagDelete() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml"); - - try { - engine.validateSTORKAuthnRequest(bytes); - fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - - } - } - - /** - * Test validate authentication request not trusted token. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestNotTrustedErr1() - throws STORKSAMLEngineException { - - try { - final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine - .getInstance("CONF2"); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineNotTrusted - .generateSTORKAuthnRequest(request).getTokenSaml(); - - engine.validateSTORKAuthnRequest(authReqNotTrust); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("validateSTORKAuthnRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test validate authentication request trusted. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestTrusted() - throws STORKSAMLEngineException { - - final STORKSAMLEngine engineTrusted = STORKSAMLEngine - .getInstance("CONF3"); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineTrusted.generateSTORKAuthnRequest( - request).getTokenSaml(); - - // engine ("CONF1") no have trust certificate from "CONF2" - engine.validateSTORKAuthnRequest(authReqNotTrust); - - } - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAuthnRequestNADA() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(null); - request.setSpApplication(null); - request.setSpCountry(null); - - try { - engine.validateSTORKAuthnRequest(authRequest); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error: " + e.getMessage()); - } - } - - /** - * Test validate authentication request with unknown elements. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestWithUnknownElements() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute unknown = new PersonalAttribute(); - unknown.setName("unknown"); - unknown.setIsRequired(true); - pAttList.add(unknown); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - - req = engine3.generateSTORKAuthnRequest(request); - - req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); - - assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); - assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); - - } - - /** - * Test generate Request with required elements by default - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - STORKAuthnRequest reqTrue = new STORKAuthnRequest(); - STORKAuthnRequest reqFalse = new STORKAuthnRequest(); - - reqTrue = engine.generateSTORKAuthnRequest(request); - reqFalse = engine2.generateSTORKAuthnRequest(request); - req = engine3.generateSTORKAuthnRequest(request); - - - String token = new String(req.getTokenSaml()); - String reqTrueToken = new String(reqTrue.getTokenSaml()); - String reqFalseToken = new String(reqFalse.getTokenSaml()); - - assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); - assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); - assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); - - } - - /** - * Test validating request and getting alias used to save - * the saml trusted certificate into trustore - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestGettingItsAlias() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - - req = engine3.generateSTORKAuthnRequest(request); - req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - - req = engine2.generateSTORKAuthnRequest(request); - req = engine2.validateSTORKAuthnRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - - - - } - - /** - * Test generating/validating request with signedDoc - * - * @throws STORKSAMLEngineException - * the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnRequestWithSignedDoc() - throws STORKSAMLEngineException { - - String signedDocRequest = "VGVzdCB0ZXh0"; - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - PersonalAttributeList paler = new PersonalAttributeList(); - - final PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - paler.add(eIDNumber); - - final PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - final ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - paler.add(isAgeOver); - - final PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - final ArrayList signedDocs = new ArrayList(); - signedDocs.add(signedDocRequest); - signedDoc.setValue(signedDocs); - signedDoc.setIsRequired(false); - paler.add(signedDoc); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(paler); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - - req = engine.generateSTORKAuthnRequest(request); - req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); - - assertTrue("SignedDoc request should be the same: ", req - .getPersonalAttributeList().get("signedDoc").getValue().get(0) - .equals(signedDocRequest)); - - - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base deleted file mode 100644 index 481cbc28c..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base +++ /dev/null @@ -1,931 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PEPSUtil; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.commons.STORKAuthnResponse; -import eu.stork.peps.auth.commons.STORKStatusCode; -import eu.stork.peps.auth.commons.STORKSubStatusCode; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class AuthRequestTest. - */ -public class StorkResponseTest { - - /** The engine. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - - /** - * Gets the engine. - * - * @return the engine - */ - public static STORKSAMLEngine getEngine() { - return engine; - } - - /** - * Sets the engine. - * - * @param newEngine the new engine - */ - public static void setEngine(final STORKSAMLEngine newEngine) { - StorkResponseTest.engine = newEngine; - } - - /** The destination. */ - private static String destination; - - /** The service provider name. */ - private static String spName; - - /** The service provider sector. */ - private static String spSector; - - /** The service provider institution. */ - private static String spInstitution; - - /** The service provider application. */ - private static String spApplication; - - /** The service provider country. */ - private static String spCountry; - - /** The service provider id. */ - private static String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The state. */ - private static String state = "ES"; - - /** The town. */ - private static String town = "Madrid"; - - /** The municipality code. */ - private static String municipalityCode = "MA001"; - - /** The postal code. */ - private static String postalCode = "28038"; - - /** The street name. */ - private static String streetName = "Marchamalo"; - - /** The street number. */ - private static String streetNumber = "3"; - - /** The apartament number. */ - private static String apartamentNumber = "5º E"; - - /** The List of Personal Attributes. */ - private static IPersonalAttributeList pal; - - /** The assertion consumer URL. */ - private static String assertConsumerUrl; - - /** The authentication request. */ - private static byte[] authRequest; - - /** The authentication response. */ - private static byte[] authResponse; - - /** The authentication request. */ - private static STORKAuthnRequest authenRequest; - - /** The authentication response. */ - private static STORKAuthnResponse authnResponse; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkResponseTest.class.getName()); - - /** - * Instantiates a new stork response test. - */ - public StorkResponseTest() { - super(); - } - - /** The IP address. */ - private static String ipAddress; - - /** The is hashing. */ - private final boolean isHashing = Boolean.TRUE; - - /** The is not hashing. */ - private final boolean isNotHashing = Boolean.FALSE; - - /** The ERROR text. */ - private static final String ERROR_TXT = "generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"; - - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - - pal = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - pal.add(eIDNumber); - - final PersonalAttribute givenName = new PersonalAttribute(); - givenName.setName("givenName"); - givenName.setIsRequired(true); - pal.add(givenName); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - pal.add(canRessAddress); - - PersonalAttribute newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - pal.add(newAttribute); - - destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - spName = "University Oxford"; - - spName = "University of Oxford"; - spSector = "EDU001"; - spInstitution = "OXF001"; - spApplication = "APP001"; - spCountry = "EN"; - - spId = "EDU001-APP001-APP001"; - - final STORKAuthnRequest request = new STORKAuthnRequest(); - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - authRequest = getEngine().generateSTORKAuthnRequest(request) - .getTokenSaml(); - - authenRequest = getEngine().validateSTORKAuthnRequest(authRequest); - - } catch (STORKSAMLEngineException e) { - fail("Error create STORKAuthnRequest"); - } - - ipAddress = "111.222.333.444"; - - pal = new PersonalAttributeList(); - - isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ages = new ArrayList(); - - ages.add("16"); - ages.add("18"); - - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(isAgeOver); - - dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(dateOfBirth); - - eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - eIDNumber.setValue(idNumber); - eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(eIDNumber); - - canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("municipalityCode", municipalityCode); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - address.put("apartamentNumber", apartamentNumber); - - canRessAddress.setComplexValue(address); - pal.add(canRessAddress); - - newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap values = new HashMap(); - - values.put("value1", "value1"); - values.put("value2", "value2"); - values.put("value3", "value3"); - values.put("value4", "value4"); - - newAttribute.setComplexValue(values); - pal.add(newAttribute); - - } - - /** - * Test generate authentication request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnResponse() throws STORKSAMLEngineException { - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - final STORKAuthnResponse storkResponse = getEngine() - .generateSTORKAuthnResponse(authenRequest, response, ipAddress, - isNotHashing); - - authResponse = storkResponse.getTokenSaml(); - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); - } - - /** - * Test validation id parameter mandatory. - */ - @Test - public final void testResponseMandatoryId() { - final String identifier = authenRequest.getSamlId(); - authenRequest.setSamlId(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - authenRequest.setSamlId(identifier); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response in response to err1. - */ - @Test - public final void testResponseMandatoryIssuer() { - - final String issuer = authenRequest.getIssuer(); - authenRequest.setIssuer(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - authenRequest.setIssuer(issuer); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response assertion consumer null. - */ - @Test - public final void testResponseMandatoryAssertionConsumerServiceURL() { - final String asserConsumerUrl = authenRequest - .getAssertionConsumerServiceURL(); - authenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - authenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response IP address null. - */ - @Test - public final void testResponseValidationIP() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, null, - isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication response with personal attribute list null. - */ - @Test - public final void testResponseMandatoryPersonalAttributeList() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(null); - - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication response token null. - */ - @Test - public final void testResponseInvalidParametersToken() { - try { - getEngine().validateSTORKAuthnResponse(null, ipAddress); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication response IP null. - */ - @Test - public final void testResponseInvalidParametersIP() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response parameter name wrong. - */ - @Test - public final void testResponseInvalidParametersAttr() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("AttrWrong"); - wrongList.add(worngAttr); - - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrSimpleValue() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoValue() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoName() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null complex value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrComplexValue() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setComplexValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test validate authentication response IP distinct and disabled validation - * IP. - */ - @Test - public final void testResponseInvalidParametersIPDistinct() { - try { - // ipAddress origin "111.222.333.444" - // ipAddrValidation = false - // Subject Confirmation Bearer. - - getEngine().validateSTORKAuthnResponse(authResponse, "127.0.0.1"); - fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test response invalid parameters invalid token. - */ - @Test - public final void testResponseInvalidParametersTokenMsg() { - try { - // ipAddress origin "111.222.333.444" - // Subject Confirmation Bearer. - getEngine().validateSTORKAuthnResponse("errorMessage".getBytes(), - ipAddress); - fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication response is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseIsFail() - throws STORKSAMLEngineException { - try { - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - fail("Generate incorrect response"); - } catch (Exception e) { - LOG.error("ERROR: " + e.getMessage()); - } - } - - /** - * Test validate authentication response destination. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseDestination() - throws STORKSAMLEngineException { - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - assertEquals("Destination incorrect: ", - authnResponse.getInResponseTo(), authenRequest.getSamlId()); - } - - /** - * Test validate authentication response values. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public final void testValidateAuthenticationResponseValuesComplex() - throws STORKSAMLEngineException { - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - assertEquals("Country incorrect:", authnResponse.getCountry(), "EN"); - - final Iterator iterator = authnResponse - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - final PersonalAttribute attribute = iterator.next(); - if (attribute.getName().equalsIgnoreCase( - "canonicalResidenceAddress")) { - assertEquals("State incorrect: ", state, attribute - .getComplexValue().get("state")); - assertEquals("Municipality Code incorrect: ", municipalityCode, - attribute.getComplexValue().get("municipalityCode")); - assertEquals("Town incorrect: ", town, attribute - .getComplexValue().get("town")); - assertEquals("Postal code incorrect: ", postalCode, attribute - .getComplexValue().get("postalCode")); - assertEquals("Street name incorrect: ", streetName, attribute - .getComplexValue().get("streetName")); - assertEquals("Street number incorrect: ", streetNumber, - attribute.getComplexValue().get("streetNumber")); - assertEquals("Apartament number incorrect: ", apartamentNumber, - attribute.getComplexValue().get("apartamentNumber")); - } - } - } - - /** - * Test generate authenticate response fail in response to it's null. - * @throws STORKSAMLEngineException - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test //( expected=STORKSAMLEngineException.class) - public final void testGenerateAuthnResponseFailInResponseToNull() throws STORKSAMLEngineException { - final String identifier = authenRequest.getSamlId(); - authenRequest.setSamlId(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - authenRequest.setSamlId(identifier); - LOG.error("Error"); - //throw new STORKSAMLEngineException(e); - } - } - - /** - * Test generate authenticate response fail assertion consumer URL err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() - throws STORKSAMLEngineException { - - final String assertConsumerUrl = authenRequest - .getAssertionConsumerServiceURL(); - authenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - authenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response fail code error err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnResponseFailCodeErrorNull() - throws STORKSAMLEngineException { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(null); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test generate authentication request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnResponse() throws STORKSAMLEngineException { - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(dateOfBirth); - - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - complex.put("one", "two"); - - //eIDNumber.setValue(null); - //eIDNumber.setValue(idNumber); - //eIDNumber.setComplexValue(complex); - - eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); - palist.add(eIDNumber); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("municipalityCode", municipalityCode); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - address.put("apartamentNumber", apartamentNumber); - - canRessAddress.setComplexValue(address); - palist.add(canRessAddress); - - - final STORKAuthnResponse response = new STORKAuthnResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAuthnResponse storkResponse = getEngine() - .generateSTORKAuthnResponse(authenRequest, response, ipAddress, - isNotHashing); - - authResponse = storkResponse.getTokenSaml(); - LOG.info("Request id: " + authenRequest.getSamlId()); - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); - - - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - LOG.info("RESPONSE ID: " + authnResponse.getSamlId()); - LOG.info("RESPONSE IN_RESPONSE_TO: " + authnResponse.getInResponseTo()); - LOG.info("RESPONSE COUNTRY: " + authnResponse.getCountry()); - - } - - - - - - /** - * Test validate authentication response fail is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseFailIsFail() - throws STORKSAMLEngineException { - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage("message"); - - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - - LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(authResponse)); - - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - LOG.info("COUNTRY: " + authnResponse.getCountry()); - assertTrue("Generate incorrect response: ", authnResponse.isFail()); - } - - /** - * Test generate/validate response with signedDoc - * - * @throws STORKSAMLEngineException - * the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthenResponseWithSignedDoc() - throws STORKSAMLEngineException { - - String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - palist.add(isAgeOver); - - authenRequest.setPersonalAttributeList(palist); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAuthnResponse storkResponse = getEngine() - .generateSTORKAuthnResponse(authenRequest, response, ipAddress, - isNotHashing); - - authResponse = storkResponse.getTokenSaml(); - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - assertTrue("SignedDoc response should be the same: ", authnResponse - .getPersonalAttributeList().get("signedDoc").getValue().get(0) - .equals(signedDocResponse)); - - } - -} diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 34fed0e39..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Provides the classes necessary to create a SAML message. - * @since 1.0 - */ -package eu.stork.peps.test.simple; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class deleted file mode 100644 index 77bb2ca96..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class deleted file mode 100644 index 3bccdf89c..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class deleted file mode 100644 index ffaf0cf57..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class deleted file mode 100644 index 8737e0538..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class deleted file mode 100644 index 667bee6d3..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class deleted file mode 100644 index 4bce51cc6..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class deleted file mode 100644 index 1956264c7..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/all-wcprops deleted file mode 100644 index fe8b26f95..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/all-wcprops +++ /dev/null @@ -1,101 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 67 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources -END -keyStoreCountry1.jks -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry1.jks -END -keyStoreCountry2.jks -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry2.jks -END -keyStoreCountry3.jks -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry3.jks -END -p11Conf.cfg -K 25 -svn:wc:ra_dav:version-url -V 78 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/p11Conf.cfg -END -logback-test.xml -K 25 -svn:wc:ra_dav:version-url -V 83 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/logback-test.xml -END -SamlEngine.xml -K 25 -svn:wc:ra_dav:version-url -V 81 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/SamlEngine.xml -END -SignModule_P11.xml -K 25 -svn:wc:ra_dav:version-url -V 85 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/SignModule_P11.xml -END -StorkSamlEngine_Conf0.xml -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf0.xml -END -StorkSamlEngine_Conf1.xml -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf1.xml -END -SignModule_Conf0.xml -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf0.xml -END -StorkSamlEngine_Conf2.xml -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf2.xml -END -SignModule_Conf1.xml -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf1.xml -END -StorkSamlEngine_Conf3.xml -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf3.xml -END -SignModule_Conf2.xml -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf2.xml -END -SignModule_Conf3.xml -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf3.xml -END -keyStoreCountry0.jks -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry0.jks -END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/entries deleted file mode 100644 index 1afc5a426..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/entries +++ /dev/null @@ -1,575 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -data -dir - -logback-test.xml -file - - - - -2013-12-20T12:27:57.250475Z -9645eaa7005e2fd5856a650a46e58b75 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -530 - -SamlEngine.xml -file - - - - -2013-12-20T12:27:57.250475Z -e2a6926fe3dabd0b07ea0c7f61a5c9a9 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2236 - -SignModule_P11.xml -file - - - - -2013-12-20T12:27:57.254475Z -13d70d84e25f491976cbbd9a0e3edafe -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -436 - -StorkSamlEngine_Conf0.xml -file - - - - -2013-12-20T12:27:57.250475Z -4ec0bc5ac4fafef57b60184cded62f9f -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3912 - -StorkSamlEngine_Conf1.xml -file - - - - -2013-12-20T12:27:57.250475Z -4ec0bc5ac4fafef57b60184cded62f9f -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3912 - -SignModule_Conf0.xml -file - - - - -2013-12-20T12:27:57.250475Z -ad61baa5b5d5a0c648b2e4c05b637add -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -541 - -StorkSamlEngine_Conf2.xml -file - - - - -2013-12-20T12:27:57.250475Z -7092c091691b1862d989f856cdc57b82 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2827 - -SignModule_Conf1.xml -file - - - - -2013-12-20T12:27:57.250475Z -16be2497f59cbd9c57acc81b783ecff1 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -522 - -StorkSamlEngine_Conf3.xml -file - - - - -2013-12-20T12:27:57.250475Z -44066ee14d9b2a03f7ee2f72c965c287 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2774 - -SignModule_Conf2.xml -file - - - - -2013-12-20T12:27:57.250475Z -fb7a26c03ef7400fe296b7d60837dff0 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -522 - -SignModule_Conf3.xml -file - - - - -2013-12-20T12:27:57.250475Z -128795cf3937e23a2af256cc5db88b84 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -540 - -keyStoreCountry0.jks -file - - - - -2013-12-20T12:27:57.250475Z -241d66f1af1a3937dfbbcccc7b7432c8 -2013-12-16T15:04:09.136643Z -316 -emsomavmi -has-props - - - - - - - - - - - - - - - - - - - - -1376 - -keyStoreCountry1.jks -file - - - - -2013-12-20T12:27:57.250475Z -821660c55e39b47f7cd6c750e366531d -2013-12-16T15:04:09.136643Z -316 -emsomavmi -has-props - - - - - - - - - - - - - - - - - - - - -1313 - -keyStoreCountry2.jks -file - - - - -2013-12-20T12:27:57.250475Z -821660c55e39b47f7cd6c750e366531d -2013-12-16T15:04:09.136643Z -316 -emsomavmi -has-props - - - - - - - - - - - - - - - - - - - - -1313 - -keyStoreCountry3.jks -file - - - - -2013-12-20T12:27:57.250475Z -821660c55e39b47f7cd6c750e366531d -2013-12-16T15:04:09.136643Z -316 -emsomavmi -has-props - - - - - - - - - - - - - - - - - - - - -1313 - -p11Conf.cfg -file - - - - -2013-12-20T12:27:57.250475Z -d7154f1fb90d3edbad739f703a30ff3d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -510 - diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SamlEngine.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SamlEngine.xml.svn-base deleted file mode 100644 index 6bb61ae29..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SamlEngine.xml.svn-base +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base deleted file mode 100644 index eb9ed6f5d..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry0.jks - local-demo - local-demo - CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS - 529E05C8 - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base deleted file mode 100644 index af68d33aa..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry1.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base deleted file mode 100644 index b13cb390a..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry2.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base deleted file mode 100644 index ed933020a..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry3.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_P11.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_P11.xml.svn-base deleted file mode 100644 index 64eb426c8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/SignModule_P11.xml.svn-base +++ /dev/null @@ -1,11 +0,0 @@ - - - - - HWModule sign with interface PKCS11. - p11Config.cfg - ******* - CN=XXXXXXXXX - xxxxxxxxxxxxxx - PKCS11 - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base deleted file mode 100644 index 0a28a5de8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base +++ /dev/null @@ -1,91 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base deleted file mode 100644 index 0a28a5de8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base +++ /dev/null @@ -1,91 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base deleted file mode 100644 index 435ef4b82..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base +++ /dev/null @@ -1,64 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - obtained - - - entity - - - - HTTP-POST - - false - false - false - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base deleted file mode 100644 index bec8934f8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base +++ /dev/null @@ -1,61 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - obtained - - - entity - - - - HTTP-POST - - false - false - false - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - http://www.stork.gov.eu/1.0/unknown - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base deleted file mode 100644 index 289e952fe..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/logback-test.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/logback-test.xml.svn-base deleted file mode 100644 index ff900e124..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/logback-test.xml.svn-base +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/p11Conf.cfg.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/p11Conf.cfg.svn-base deleted file mode 100644 index b712219c1..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/.svn/text-base/p11Conf.cfg.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//ATTRIBUTE VALUE -//name name suffix of this provider instance -//library pathname of PKCS#11 implementation -//slotListIndex slot index - -//PREFIX DESCRIPTION -//CKO_ Object class -//CKA_ Attribute -//CKK_ Key type - -//attributes(operation, keytype, keyalgorithm) = { -// name1 = value1 -// [...] -//} - -name=nameProvider -library=library.dll -slotListIndex=0 -attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={ - CKA_VERIFY=true -} -attributes(*,CKO_PRIVATE_KEY,CKK_RSA)={ - CKA_SIGN=true -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SamlEngine.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SamlEngine.xml deleted file mode 100644 index 6bb61ae29..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/SamlEngine.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf0.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf0.xml deleted file mode 100644 index eb9ed6f5d..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry0.jks - local-demo - local-demo - CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS - 529E05C8 - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf1.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf1.xml deleted file mode 100644 index af68d33aa..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry1.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf2.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf2.xml deleted file mode 100644 index b13cb390a..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf2.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry2.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf3.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf3.xml deleted file mode 100644 index ed933020a..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_Conf3.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry3.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_P11.xml b/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_P11.xml deleted file mode 100644 index 64eb426c8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/SignModule_P11.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - HWModule sign with interface PKCS11. - p11Config.cfg - ******* - CN=XXXXXXXXX - xxxxxxxxxxxxxx - PKCS11 - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf0.xml b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf0.xml deleted file mode 100644 index 0a28a5de8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf0.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf1.xml b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf1.xml deleted file mode 100644 index 0a28a5de8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf1.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf2.xml b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf2.xml deleted file mode 100644 index 435ef4b82..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf2.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - obtained - - - entity - - - - HTTP-POST - - false - false - false - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf3.xml b/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf3.xml deleted file mode 100644 index bec8934f8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/StorkSamlEngine_Conf3.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - obtained - - - entity - - - - HTTP-POST - - false - false - false - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - http://www.stork.gov.eu/1.0/unknown - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/all-wcprops deleted file mode 100644 index 3843fc6b7..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 72 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data -END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/entries deleted file mode 100644 index 2eb50bbe8..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -eu -dir - diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/all-wcprops deleted file mode 100644 index 56d18dd28..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 75 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu -END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/entries deleted file mode 100644 index 798ea16b3..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -stork -dir - diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/all-wcprops deleted file mode 100644 index 16ec86311..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 81 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork -END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/entries deleted file mode 100644 index 8ec7f9903..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -STORKSAMLEngine -dir - diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops deleted file mode 100644 index 178273e8c..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops +++ /dev/null @@ -1,41 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 97 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine -END -AuthnRequestTagDelete.xml -K 25 -svn:wc:ra_dav:version-url -V 122 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml -END -AttrQueryRequestTagDelete.xml -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml -END -AuthnRequest.xml -K 25 -svn:wc:ra_dav:version-url -V 113 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml -END -AttrQueryRequest.xml -K 25 -svn:wc:ra_dav:version-url -V 118 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml -END -AuthnRequestTagDeleteEncoded.xml -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml -END -AttrQueryResponse.xml -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml -END diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries deleted file mode 100644 index 16e2ccd8d..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries +++ /dev/null @@ -1,232 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -AttrQueryResponse.xml -file - - - - -2013-12-20T12:27:57.242475Z -8f576c406bd8b2756899bbe1738e56d6 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -6092 - -AuthnRequestTagDelete.xml -file - - - - -2013-12-20T12:27:57.242475Z -13df3f7c9b0fb6e10ac782c43b8f3cdb -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2611 - -AttrQueryRequestTagDelete.xml -file - - - - -2013-12-20T12:27:57.242475Z -cd245752b96826be0c3b72e3428c6aac -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -4045 - -AuthnRequest.xml -file - - - - -2013-12-20T12:27:57.242475Z -e993b1b24f5abbfa974485b0cbbc0211 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3898 - -AttrQueryRequest.xml -file - - - - -2013-12-20T12:27:57.242475Z -d78d68c7f18dc10e7cd7343954388987 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -4253 - -AuthnRequestTagDeleteEncoded.xml -file - - - - -2013-12-20T12:27:57.242475Z -c5122af357fd2a8339239853479b4aed -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2612 - diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base deleted file mode 100644 index 852727dc5..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl -eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT -VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 -MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph -dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt -by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 -2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj -9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G -CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl -XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK -W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base deleted file mode 100644 index 9f9fe5156..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw -YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v -LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG -A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv -Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab -ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU -0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n -6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 -y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z -9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F -6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM -pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT -/NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq -yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 -Ppm8IFVTk8mYfX8/jw==3falsefalsefalse1618SveinbjörnES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base deleted file mode 100644 index b7e578c2d..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw -YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v -MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM -BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k -ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja -Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ -525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG -SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr -y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG -1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base deleted file mode 100644 index c822702df..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -http://S-PEPS.gov.xx - - - - - - - - - -yzsqaxBNicOrixBUno5cL0CBOpE= - - - -Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC -wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi -YIN/BUEtXkoYTjPtkmA= - -MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw -MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG -9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu -h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r -/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk -3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K -eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq -KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base deleted file mode 100644 index 2a54c7d59..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -http://S-PEPS.gov.xx - -S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR -Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC -Xt8p8tK3EoMocZse2hw= - -MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw -OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl -lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK -ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl -r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w -kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS -3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base deleted file mode 100644 index 3239cf6e7..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -http://S-PEPS.gov.xx - -S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR -Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC -Xt8p8tK3EoMocZse2hw= - -MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw -OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl -lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK -ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl -r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w -kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS -3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml deleted file mode 100644 index 852727dc5..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml +++ /dev/null @@ -1,11 +0,0 @@ -http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl -eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT -VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 -MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph -dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt -by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 -2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj -9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G -CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl -XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK -W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml deleted file mode 100644 index 9f9fe5156..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml +++ /dev/null @@ -1,15 +0,0 @@ -http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw -YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v -LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG -A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv -Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab -ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU -0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n -6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 -y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z -9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F -6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM -pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT -/NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq -yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 -Ppm8IFVTk8mYfX8/jw==3falsefalsefalse1618SveinbjörnES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml deleted file mode 100644 index b7e578c2d..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml +++ /dev/null @@ -1,10 +0,0 @@ -http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw -YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v -MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM -BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k -ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja -Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ -525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG -SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr -y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG -1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml deleted file mode 100644 index c822702df..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml +++ /dev/null @@ -1,26 +0,0 @@ -http://S-PEPS.gov.xx - - - - - - - - - -yzsqaxBNicOrixBUno5cL0CBOpE= - - - -Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC -wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi -YIN/BUEtXkoYTjPtkmA= - -MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw -MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG -9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu -h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r -/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk -3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K -eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq -KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml deleted file mode 100644 index 2a54c7d59..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml +++ /dev/null @@ -1,14 +0,0 @@ -http://S-PEPS.gov.xx - -S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR -Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC -Xt8p8tK3EoMocZse2hw= - -MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw -OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl -lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK -ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl -r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w -kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS -3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml b/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml deleted file mode 100644 index 3239cf6e7..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml +++ /dev/null @@ -1,14 +0,0 @@ -http://S-PEPS.gov.xx - -S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR -Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC -Xt8p8tK3EoMocZse2hw= - -MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw -OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl -lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK -ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl -r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w -kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS -3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry0.jks b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry0.jks deleted file mode 100644 index 289e952fe..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry0.jks and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry1.jks b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry1.jks deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry1.jks and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry2.jks b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry2.jks deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry2.jks and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry3.jks b/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry3.jks deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/build/classes/test/resources/keyStoreCountry3.jks and /dev/null differ diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/logback-test.xml b/id/server/stork2-saml-engine/build/classes/test/resources/logback-test.xml deleted file mode 100644 index ff900e124..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/logback-test.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/build/classes/test/resources/p11Conf.cfg b/id/server/stork2-saml-engine/build/classes/test/resources/p11Conf.cfg deleted file mode 100644 index b712219c1..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/resources/p11Conf.cfg +++ /dev/null @@ -1,24 +0,0 @@ -//ATTRIBUTE VALUE -//name name suffix of this provider instance -//library pathname of PKCS#11 implementation -//slotListIndex slot index - -//PREFIX DESCRIPTION -//CKO_ Object class -//CKA_ Attribute -//CKK_ Key type - -//attributes(operation, keytype, keyalgorithm) = { -// name1 = value1 -// [...] -//} - -name=nameProvider -library=library.dll -slotListIndex=0 -attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={ - CKA_VERIFY=true -} -attributes(*,CKO_PRIVATE_KEY,CKK_RSA)={ - CKA_SIGN=true -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/pom.xml b/id/server/stork2-saml-engine/pom.xml index 1fbc13b1e..6be0472a7 100644 --- a/id/server/stork2-saml-engine/pom.xml +++ b/id/server/stork2-saml-engine/pom.xml @@ -2,7 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 eu.stork - saml-engine + SamlEngine jar STORKSAMLEngine @@ -10,7 +10,7 @@ 1.1.0 0.5.2 0.5.1 - 1.1.0 + 1.2.0 2.6.0 ${maven.build.timestamp} @@ -19,7 +19,11 @@ The STORKSAMLEngine library provides tools to support developers working with the Security Assertion Markup Language (SAML). - + + + org.opensaml + https://build.shibboleth.net/nexus/content/repositories/releases + shibboleth-release @@ -36,7 +40,7 @@ eu.stork - stork-commons + Commons ${commons.version} @@ -131,7 +135,7 @@ org.apache.maven.plugins maven-surefire-plugin - false + true @@ -140,7 +144,6 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 attach-sources @@ -154,7 +157,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.4 diff --git a/id/server/stork2-saml-engine/src/.svn/all-wcprops b/id/server/stork2-saml-engine/src/.svn/all-wcprops deleted file mode 100644 index a663100ff..000000000 --- a/id/server/stork2-saml-engine/src/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 52 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src -END diff --git a/id/server/stork2-saml-engine/src/.svn/entries b/id/server/stork2-saml-engine/src/.svn/entries deleted file mode 100644 index 7c9d1968f..000000000 --- a/id/server/stork2-saml-engine/src/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -test -dir - -main -dir - diff --git a/id/server/stork2-saml-engine/src/main/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/.svn/all-wcprops deleted file mode 100644 index f9f3d279b..000000000 --- a/id/server/stork2-saml-engine/src/main/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 56 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main -END diff --git a/id/server/stork2-saml-engine/src/main/.svn/entries b/id/server/stork2-saml-engine/src/main/.svn/entries deleted file mode 100644 index dc9f007e9..000000000 --- a/id/server/stork2-saml-engine/src/main/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -java -dir - diff --git a/id/server/stork2-saml-engine/src/main/config/embedded/StorkSamlEngine_CPEPS.xml b/id/server/stork2-saml-engine/src/main/config/embedded/StorkSamlEngine_CPEPS.xml new file mode 100644 index 000000000..9a6086c74 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/config/embedded/StorkSamlEngine_CPEPS.xml @@ -0,0 +1,69 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + true + true + true + + + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizenQAALevel + http://www.stork.gov.eu/1.0/fiscalNumber + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/config/embedded/quartz.properties b/id/server/stork2-saml-engine/src/main/config/embedded/quartz.properties new file mode 100644 index 000000000..4e4de5cac --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/config/embedded/quartz.properties @@ -0,0 +1,5 @@ +org.quartz.scheduler.instanceName = UpdateScheduler +org.quartz.threadPool.threadCount = 1 +org.quartz.jobStore.class =org.quartz.simpl.RAMJobStore +org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin +org.quartz.plugin.shutdownhook.cleanShutdown = true \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/config/jBoss/context.xml b/id/server/stork2-saml-engine/src/main/config/jBoss/context.xml new file mode 100644 index 000000000..9520f2161 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/config/jBoss/context.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/config/jBoss/jboss-classloading.xml b/id/server/stork2-saml-engine/src/main/config/jBoss/jboss-classloading.xml new file mode 100644 index 000000000..20c6509de --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/config/jBoss/jboss-classloading.xml @@ -0,0 +1,4 @@ + + diff --git a/id/server/stork2-saml-engine/src/main/java/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/.svn/all-wcprops deleted file mode 100644 index 243067f06..000000000 --- a/id/server/stork2-saml-engine/src/main/java/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 61 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java -END diff --git a/id/server/stork2-saml-engine/src/main/java/.svn/entries b/id/server/stork2-saml-engine/src/main/java/.svn/entries deleted file mode 100644 index e4a01af0d..000000000 --- a/id/server/stork2-saml-engine/src/main/java/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -META-INF -dir - -eu -dir - diff --git a/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/all-wcprops deleted file mode 100644 index 8de21c7f2..000000000 --- a/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 70 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/META-INF -END -MANIFEST.MF -K 25 -svn:wc:ra_dav:version-url -V 82 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/META-INF/MANIFEST.MF -END diff --git a/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/entries b/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/entries deleted file mode 100644 index 7ba7a8b7d..000000000 --- a/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/META-INF -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -MANIFEST.MF -file - - - - -2013-12-20T12:27:57.282475Z -b10f37c8bb1803d98c127a01d1a71cc5 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -39 - diff --git a/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base b/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base deleted file mode 100644 index 5e9495128..000000000 --- a/id/server/stork2-saml-engine/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/.svn/all-wcprops deleted file mode 100644 index c2550210f..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 64 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/.svn/entries deleted file mode 100644 index 842aef3b7..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -stork -dir - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/all-wcprops deleted file mode 100644 index 4e9c9df08..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 70 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/entries deleted file mode 100644 index 15424fef8..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -peps -dir - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/all-wcprops deleted file mode 100644 index f6653073c..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 75 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/entries deleted file mode 100644 index e80eb4f1f..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/.svn/entries +++ /dev/null @@ -1,37 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -auth -dir - -exceptions -dir - -configuration -dir - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/all-wcprops deleted file mode 100644 index ea1d0ba15..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 80 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/entries deleted file mode 100644 index 274a429ea..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -engine -dir - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops deleted file mode 100644 index a5df7ea64..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/all-wcprops +++ /dev/null @@ -1,35 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 87 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine -END -SAMLEngine.java -K 25 -svn:wc:ra_dav:version-url -V 103 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java -END -SAMLEngineUtils.java -K 25 -svn:wc:ra_dav:version-url -V 108 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 105 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/package-info.java -END -STORKSAMLEngine.java -K 25 -svn:wc:ra_dav:version-url -V 108 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java -END -X509PrincipalUtil.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/entries deleted file mode 100644 index ee72945c7..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/entries +++ /dev/null @@ -1,201 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -SAMLEngine.java -file - - - - -2013-12-20T12:27:57.446475Z -06e800364af96f515b5e2b2e6da3c423 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -13855 - -SAMLEngineUtils.java -file - - - - -2013-12-20T12:27:57.446475Z -de13d8f36c3a8d7c25ed55f94f43a663 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -28573 - -package-info.java -file - - - - -2013-12-20T12:27:57.446475Z -db9d14c008d5504a156cfa955db13657 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -796 - -STORKSAMLEngine.java -file - - - - -2013-12-20T12:27:57.446475Z -4899e34f046f8a1ba1292c1e0c2f972f -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -106833 - -X509PrincipalUtil.java -file - - - - -2013-12-20T12:27:57.446475Z -5b1c22a27ba0a0bfd4c0bd4ef1890205 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2296 - -core -dir - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base deleted file mode 100644 index f8f50fc74..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngine.java.svn-base +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine; - -import java.io.ByteArrayInputStream; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import javax.xml.XMLConstants; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.opensaml.Configuration; -import org.opensaml.DefaultBootstrap; -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.xml.ConfigurationException; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.Marshaller; -import org.opensaml.xml.io.MarshallerFactory; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.io.Unmarshaller; -import org.opensaml.xml.io.UnmarshallerFactory; -import org.opensaml.xml.io.UnmarshallingException; -import org.opensaml.xml.parse.BasicParserPool; -import org.opensaml.xml.parse.XMLParserException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.auth.engine.core.STORKSAMLCore; -import eu.stork.peps.auth.engine.core.impl.SignModuleFactory; -import eu.stork.peps.configuration.ConfigurationCreator; -import eu.stork.peps.configuration.ConfigurationReader; -import eu.stork.peps.configuration.InstanceEngine; -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * Class that wraps the operations over SAML tokens, both generation and - * validation of SAML requests and SAML responses. Compliant with "OASIS Secure - * Assertion Markup Language (SAML) 2.0, May 2005", but taking into account - * STORK specific requirements. - * - * @author fjquevedo - * @author iinigo - */ - -public class SAMLEngine { - - /** The Document Builder Factory. */ - private static javax.xml.parsers.DocumentBuilderFactory dbf = null; - - /** The instance of every engine SAML. */ - private static Map instanceConfigs; - - /** The instances of SAML engine. */ - private static Map> instances; - - /** The logger. */ - private static final Logger LOG = LoggerFactory.getLogger(SAMLEngine.class - .getName()); - - /** The Constant MODULE_SIGN_CONF. */ - private static final String MODULE_SIGN_CONF = "SignatureConf"; - - /** The Constant SAML_ENGINE_SIGN_CLASS. */ - private static final String SAML_ENGINE_SIGN_CLASS = "class"; - - /** The Constant SAML_ENGINE_CONF. */ - private static final String SAML_ENGINE_CONF = "SamlEngineConf"; - - /** The Constant SAML_ENGINE_FILE_CONF. */ - private static final String SAML_ENGINE_FILE_CONF = "fileConfiguration"; - - /** The codification of characters. */ - private static final String CHARACTER_ENCODING = "UTF-8"; - - /** The SAML core. */ - private STORKSAMLCore samlCore; - - /** The Module of Signature. */ - private SAMLEngineSignI signer; - - - /** Initializes the SAML engine. */ - /** Configure Document Builder Factory. */ - - static { - startUp(); - loadDocumentFactory(); - } - - /** - * Load document factory. - */ - private static void loadDocumentFactory() { - - try { - dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance(); - dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - dbf.setNamespaceAware(true); - dbf.setIgnoringComments(true); - } catch (ParserConfigurationException e) { - LOG.error("Error parser configuration."); - throw new STORKSAMLEngineRuntimeException(e); - } - - } - - /** - * Method that initializes the basic services for the SAML Engine, like the - * OpenSAML library and the BouncyCastle provider. - */ - private static void startUp() { - - LOG.info("SAMLEngine: Initialize OpenSAML"); - - try { - DefaultBootstrap.bootstrap(); - } catch (ConfigurationException e) { - LOG.error("Problem initializing the OpenSAML library."); - throw new STORKSAMLEngineRuntimeException(e); - } - - LOG.debug("Read all file configurations. (instances of SAMLEngine)"); - try { - instanceConfigs = ConfigurationReader.readConfiguration(); - } catch (SAMLEngineException e) { - LOG.error("Error read configuration file."); - throw new STORKSAMLEngineRuntimeException(e); - } - - LOG.debug("Create all instaces of saml engine. (instances of SAMLEngine)"); - try { - instances = ConfigurationCreator - .createConfiguration(instanceConfigs); - } catch (STORKSAMLEngineException e) { - LOG.error("Error initializing instances from Stork SAML engine."); - throw new STORKSAMLEngineRuntimeException(e); - } - } - - /** - * Instantiates a new SAML engine. - */ - private SAMLEngine() { - - } - - /** - * Instantiates a new SAML engine. - * - * @param nameInstance the name instance - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - protected SAMLEngine(final String nameInstance) - throws STORKSAMLEngineException { - LOG.info("Loading Specific Configuration."); - - LOG.debug("Create intance of saml messages."); - - Map instance = instances.get(nameInstance); - - if (instance == null || instance.isEmpty()) { - LOG.error("Instance: " + nameInstance + " not exist."); - throw new STORKSAMLEngineException("Instance: " + nameInstance - + " not exist."); - } - - Properties properties = (Properties) instance.get(SAML_ENGINE_CONF); - - if (properties == null) { - LOG.error("SamlEngine.xml: not exist."); - throw new STORKSAMLEngineException("SamlEngine.xml: not exist."); - } - - samlCore = new STORKSAMLCore(properties); - - final HashMap propertiesSign = (HashMap) instance - .get(MODULE_SIGN_CONF); - - LOG.debug("Loading Module of sign."); - signer = SignModuleFactory.getInstance(propertiesSign - .get(SAML_ENGINE_SIGN_CLASS)); - - try { - LOG.info("Initialize module of sign."); - signer.init(propertiesSign.get(SAML_ENGINE_FILE_CONF)); - LOG.info("Load cryptographic service provider of module of sign."); - signer.loadCryptServiceProvider(); - } catch (SAMLEngineException e) { - LOG.error("Error create signature module: " - + propertiesSign.get(SAML_ENGINE_FILE_CONF)); - LOG.info("Exception" + e); - throw new STORKSAMLEngineException(e); - } - } - - /** - * Gets the Signer properties. - * - * @return the SAML Sign properties - */ - protected SAMLEngineSignI getSigner() { - return signer; - } - - /** - * Gets the SAML core properties. - * - * @return the SAML core properties - */ - protected final STORKSAMLCore getSamlCoreProperties() { - return samlCore; - } - - /** - * Method that transform the received SAML object into a byte array - * representation. - * - * @param samlToken the SAML token. - * - * @return the byte[] of the SAML token. - * - * @throws SAMLEngineException the SAML engine exception - */ - private byte[] marshall(final XMLObject samlToken) - throws SAMLEngineException { - - try { - javax.xml.parsers.DocumentBuilder docBuilder = null; - - final MarshallerFactory marshallerFactory = Configuration - .getMarshallerFactory(); - - final Marshaller marshaller = marshallerFactory - .getMarshaller(samlToken); - - docBuilder = dbf.newDocumentBuilder(); - - final Document doc = docBuilder.newDocument(); - - marshaller.marshall(samlToken, doc); - - // Obtain a byte array representation of the marshalled SAML object - final DOMSource domSource = new DOMSource(doc); - final StringWriter writer = new StringWriter(); - final StreamResult result = new StreamResult(writer); - final TransformerFactory transFactory = TransformerFactory - .newInstance(); - Transformer transformer; - - transformer = transFactory.newTransformer(); - transformer.transform(domSource, result); - LOG.debug("SAML request \n"+ writer.toString()); - return writer.toString().getBytes(CHARACTER_ENCODING); - - } catch (ParserConfigurationException e) { - LOG.error("ParserConfigurationException."); - throw new SAMLEngineException(e); - } catch (MarshallingException e) { - LOG.error("MarshallingException."); - throw new SAMLEngineException(e); - } catch (TransformerConfigurationException e) { - LOG.error("TransformerConfigurationException."); - throw new SAMLEngineException(e); - } catch (TransformerException e) { - LOG.error("TransformerException."); - throw new SAMLEngineException(e); - } catch (UnsupportedEncodingException e) { - LOG.error("UnsupportedEncodingException: " + CHARACTER_ENCODING); - throw new SAMLEngineException(e); - } - } - - /** - * Method that signs a SAML Token. - * - * @param tokenSaml the token SAML - * - * @return the SAML object sign - * - * @throws SAMLEngineException the SAML engine exception - */ - private SignableSAMLObject sign(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.debug("Sign SamlToken."); - signer.sign(tokenSaml); - return tokenSaml; - } - - /** - * Sign and transform to byte array. - * - * @param samlToken the SAML token - * - * @return the byte[] of the SAML token - * - * @throws SAMLEngineException the SAML engine exception - */ - protected final byte[] signAndMarshall(final SignableSAMLObject samlToken) - throws SAMLEngineException { - LOG.debug("Marshall Saml Token."); - SignableSAMLObject signElement = sign(samlToken); - return marshall(signElement); - } - - /** - * Method that unmarshalls a SAML Object from a byte array representation to - * an XML Object. - * - * @param samlToken Byte array representation of a SAML Object - * - * @return XML Object (superclass of SAMLObject) - * - * @throws SAMLEngineException the SAML engine exception - */ - protected final XMLObject unmarshall(final byte[] samlToken) - throws SAMLEngineException { - try { - // Get parser pool manager - final BasicParserPool ppMgr = new BasicParserPool(); - // Note: this is necessary due to an unresolved Xerces deferred DOM - // issue/bug - final HashMap features = new HashMap(); - features.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); - ppMgr.setBuilderFeatures(features); - - ppMgr.setNamespaceAware(true); - - // Parse SAMLToken - Document document = ppMgr.parse(new ByteArrayInputStream(samlToken)); - if (document != null){ - final Element root = document.getDocumentElement(); - // Get appropriate unmarshaller - final UnmarshallerFactory unmarshallerFact = Configuration.getUnmarshallerFactory(); - // Unmarshall using the SAML Token root element - if (unmarshallerFact != null && root != null){ - final Unmarshaller unmarshaller = unmarshallerFact.getUnmarshaller(root); - try { - return unmarshaller.unmarshall(root); - } catch (NullPointerException e){ - LOG.error("Error element tag incomplet or null."); - throw new SAMLEngineException("NullPointerException", e); - } - } else { - LOG.error("Error element tag incomplet or null."); - throw new SAMLEngineException("NullPointerException : unmarshallerFact or root is null"); - } - } else { - LOG.error("Error element tag incomplet or null."); - throw new SAMLEngineException("NullPointerException : document is null"); - } - } catch (XMLParserException e) { - LOG.error("XML Parsing Error.", e); - throw new SAMLEngineException(e); - } catch (UnmarshallingException e) { - LOG.error("TransformerException.", e); - throw new SAMLEngineException(e); - } catch (NullPointerException e) { - LOG.error("Error element tag incomplet or null.", e); - throw new SAMLEngineException(e); - } - } - - /** - * Method that validates an XML Signature contained in a SAML Token. - * - * @param samlToken the SAML token - * - * @return the SAML object - * - * @throws SAMLEngineException the SAML engine exception - */ - protected final SAMLObject validateSignature( - final SignableSAMLObject samlToken) throws SAMLEngineException { - - LOG.info("Validate Signature"); - signer.validateSignature(samlToken); - - return samlToken; - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base deleted file mode 100644 index 60f7c3091..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/SAMLEngineUtils.java.svn-base +++ /dev/null @@ -1,833 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.commons.lang.StringUtils; -import org.joda.time.DateTime; -import org.opensaml.Configuration; -import org.opensaml.common.SAMLVersion; -import org.opensaml.common.impl.SecureRandomIdentifierGenerator; -import org.opensaml.saml2.common.Extensions; -import org.opensaml.saml2.common.impl.ExtensionsBuilder; -import org.opensaml.saml2.core.Assertion; -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.core.AttributeQuery; -import org.opensaml.saml2.core.AttributeValue; -import org.opensaml.saml2.core.AuthnContext; -import org.opensaml.saml2.core.AuthnRequest; -import org.opensaml.saml2.core.AuthnStatement; -import org.opensaml.saml2.core.Issuer; -import org.opensaml.saml2.core.NameID; -import org.opensaml.saml2.core.Response; -import org.opensaml.saml2.core.Status; -import org.opensaml.saml2.core.StatusCode; -import org.opensaml.saml2.core.StatusMessage; -import org.opensaml.saml2.core.Subject; -import org.opensaml.saml2.core.SubjectConfirmation; -import org.opensaml.saml2.core.SubjectConfirmationData; -import org.opensaml.saml2.core.SubjectLocality; -import org.opensaml.saml2.core.impl.AssertionBuilder; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.schema.XSAny; -import org.opensaml.xml.schema.XSString; -import org.opensaml.xml.signature.KeyInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -import eu.stork.peps.auth.engine.core.QAAAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.SAMLCore; -import eu.stork.peps.auth.engine.core.SPApplication; -import eu.stork.peps.auth.engine.core.SPCountry; -import eu.stork.peps.auth.engine.core.SPInstitution; -import eu.stork.peps.auth.engine.core.SPSector; -import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * The Class SAMLEngineUtils. - * - * @author fjquevedo - * @author iinigo - */ -public final class SAMLEngineUtils { - - /** The Constant UTF_8. */ - public static final String UTF_8 = "UTF-8"; - - /** The Constant SHA_512. */ - public static final String SHA_512 = "SHA-512"; - - - /** The generator. */ - private static SecureRandomIdentifierGenerator generator; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(SAMLEngineUtils.class.getName()); - - /** - * Method that generates a random value according to NCName grammar. - * - * NCName ::= NCNameStartChar NCNameChar* NCNameChar ::= NameChar - ':' - * NCNameStartChar ::= Letter | '_' NameStartChar ::= ":" | [A-Z] | "_" | - * [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | - * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | - * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] - * NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | - * [#x203F-#x2040] Name ::= NameStartChar (NameChar)* Letter ::= BaseChar | - * Ideographic BaseChar ::= [#x0041-#x005A] | [#x0061-#x007A] | - * [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | - * [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | - * [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | - * [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | - * [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | - * [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | - * [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | - * [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | - * #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | - * [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | - * [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | - * [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | - * [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | - * [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | - * [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | - * [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | - * #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | - * [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | - * #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | - * [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | - * [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | - * [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | - * [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | - * [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | - * [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | - * [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | - * [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | - * [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | - * [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | - * [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | - * [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | - * #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | - * [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | - * [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | - * [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | - * [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | - * #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | - * #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | - * #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | - * [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | - * [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | - * [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | - * [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | - * [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | - * [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | - * [#xAC00-#xD7A3] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | - * [#x3021-#x3029] - * - * @return Random ID value - */ - - //Initialization of a generator of identifiers for all token SAML. - - static { - loadRandomIdentifierGenerator(); - } - - - /** - * Load random identifier generator. - * - *@throws STORKSAMLEngineRuntimeException the STORKSAML engine runtime exception - */ - private static void loadRandomIdentifierGenerator() { - - try { - generator = new SecureRandomIdentifierGenerator(); - } catch (NoSuchAlgorithmException ex) { - LOG.error("Error init SecureRandomIdentifierGenerator", ex); - throw new STORKSAMLEngineRuntimeException(ex); - } - - } - - /** - * Creates the SAML object. - * - * @param qname the QName - * - * @return the XML object - */ - public static XMLObject createSamlObject(final QName qname) { - return Configuration.getBuilderFactory().getBuilder(qname).buildObject( - qname); - } - - /** - * Creates the SAML object. - * - * @param qname the quality name - * @param qname1 the qname1 - * - * @return the xML object - */ - public static XMLObject createSamlObject(final QName qname, - final QName qname1) { - return Configuration.getBuilderFactory().getBuilder(qname1) - .buildObject(qname, qname1); - } - - /** - * Encode value with an specific algorithm. - * - * @param value the value - * @param alg the algorithm - * - * @return the string - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static String encode(final String value, final String alg) - throws STORKSAMLEngineException { - LOG.debug("Encode value with " + alg + " algorithm."); - byte[] buffer; - - final StringBuffer hash = new StringBuffer(""); - try { - buffer = value.getBytes(UTF_8); - MessageDigest msgDig; - msgDig = MessageDigest.getInstance(alg); - - - msgDig.update(buffer); - final byte[] digest = msgDig.digest(); - - final int signedByte = 0xff; - for (byte aux : digest) { - final int byt = aux & signedByte; - if (Integer.toHexString(byt).length() == 1) { - hash.append('0'); - } - hash.append(Integer.toHexString(byt)); - } - - } catch (UnsupportedEncodingException e1) { - LOG.error("UnsupportedEncodingException: " + UTF_8); - throw new STORKSAMLEngineException(e1); - } catch (NoSuchAlgorithmException e) { - LOG.error("NoSuchAlgorithmException: " + alg); - throw new STORKSAMLEngineException(e); - } - - return hash.toString(); - } - - /** - * Generate assertion. - * - * @param version the version - * @param identifier the identifier - * @param issueInstant the issue instant - * @param issuer the issuer - * - * @return the assertion - */ - public static Assertion generateAssertion(final SAMLVersion version, - final String identifier, final DateTime issueInstant, - final Issuer issuer) { - final AssertionBuilder assertionBuilder = new AssertionBuilder(); - final Assertion assertion = assertionBuilder.buildObject(); - assertion.setVersion(version); - assertion.setID(identifier); - assertion.setIssueInstant(issueInstant); - - // - assertion.setIssuer(issuer); - return assertion; - } - - /** - * Generate authentication statement. - * - * @param authnInstant the authentication instant - * @param authnContext the authentication context - * - * @return the authentication statement - */ - public static AuthnStatement generateAthnStatement(final DateTime authnInstant, - final AuthnContext authnContext) { - // - final AuthnStatement authnStatement = (AuthnStatement) SAMLEngineUtils - .createSamlObject(AuthnStatement.DEFAULT_ELEMENT_NAME); - - authnStatement.setAuthnInstant(authnInstant); - authnStatement.setAuthnContext(authnContext); - - return authnStatement; - } - - - - - - /** - * Generate attribute from a list of values. - * - * @param name the name of the attribute. - * @param status the status of the parameter: "Available", "NotAvailable" or - * "Withheld". - * @param values the value of the attribute. - * @param isHashing the is hashing with "SHA-512" algorithm. - * @return the attribute - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static Attribute generateAttrComplex(final String name, - final String status, final Map values, - final boolean isHashing) throws STORKSAMLEngineException { - LOG.debug("Generate attribute complex: " + name); - final Attribute attribute = (Attribute) SAMLEngineUtils - .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); - - attribute.setName(name); - attribute.setNameFormat(Attribute.URI_REFERENCE); - - attribute.getUnknownAttributes().put( - new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", - SAMLCore.STORK10_PREFIX.getValue()), status); - - if (!values.isEmpty()) { - LOG.debug("Add attribute values."); - - // Create an attribute that contains all XSAny elements. - final XSAny attrValue = (XSAny) SAMLEngineUtils.createSamlObject( - AttributeValue.DEFAULT_ELEMENT_NAME, XSAny.TYPE_NAME); - - final Iterator> iterator = values.entrySet() - .iterator(); - while (iterator.hasNext()) { - final Map.Entry pairs = iterator.next(); - - final String value = pairs.getValue(); - - if (StringUtils.isNotBlank(value)) { - // Create the attribute statement - final XSAny attrValueSimple = (XSAny) SAMLEngineUtils - .createSamlObject(new QName(SAMLCore.STORK10_NS.getValue(), - pairs.getKey().toString(), - SAMLCore.STORK10_PREFIX.getValue()), XSAny.TYPE_NAME); - - // if it's necessary encode the information. - if (isHashing) { - attrValueSimple - .setTextContent(encode(value, SHA_512)); - } else { - attrValueSimple.setTextContent(value); - } - - attrValue.getUnknownXMLObjects().add(attrValueSimple); - attribute.getAttributeValues().add(attrValue); - } - } - - } - return attribute; - } - - /** - * Generate extension. - * - * @return the extensions - */ - public static Extensions generateExtension() { - final ExtensionsBuilder extensionsBuilder = new ExtensionsBuilder(); - return extensionsBuilder.buildObject( - "urn:oasis:names:tc:SAML:2.0:protocol", "Extensions", "saml2p"); - } - - - - - /** - * Generate issuer. - * - * @return the issuer - */ - public static Issuer generateIssuer() { - return (Issuer) SAMLEngineUtils - .createSamlObject(Issuer.DEFAULT_ELEMENT_NAME); - } - - /** - * Generate key info. - * - * @return the key info - */ - public static KeyInfo generateKeyInfo() { - return (KeyInfo) SAMLEngineUtils - .createSamlObject(KeyInfo.DEFAULT_ELEMENT_NAME); - } - - /** - * Generate name id. - * - * @return the name id - */ - public static NameID generateNameID() { - return (NameID) SAMLEngineUtils - .createSamlObject(NameID.DEFAULT_ELEMENT_NAME); - } - - /** - * Generate name id. - * - * @param nameQualifier the name qualifier - * @param format the format - * @param spNameQualifier the sP name qualifier - * - * @return the name id - */ - public static NameID generateNameID(final String nameQualifier, - final String format, final String spNameQualifier) { - // - final NameID nameId = (NameID) Configuration.getBuilderFactory() - .getBuilder(NameID.DEFAULT_ELEMENT_NAME).buildObject( - NameID.DEFAULT_ELEMENT_NAME); - - // optional - nameId.setNameQualifier(nameQualifier); - - // optional - nameId.setFormat(format); - - // optional - nameId.setSPNameQualifier(spNameQualifier); - - return nameId; - } - - /** - * Generate NCName. - * - * @return the string - */ - public static String generateNCName() { - return generator.generateIdentifier(); - } - - - /** - * Generate the quality authentication assurance level. - * - * @param qaal the level of quality authentication assurance. - * - * @return the quality authentication assurance attribute - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static QAAAttribute generateQAAAttribute(final int qaal) - throws STORKSAMLEngineException { - LOG.debug("Generate QAAAttribute."); - - final QAAAttribute qaaAttribute = (QAAAttribute) SAMLEngineUtils - .createSamlObject(QAAAttribute.DEF_ELEMENT_NAME); - qaaAttribute.setQaaLevel(String.valueOf(qaal)); - return qaaAttribute; - } - - /** - * Generate requested attribute. - * - * @param name the name - * @param friendlyName the friendly name - * @param isRequired the is required - * @param value the value - * - * @return the requested attribute - */ - public static RequestedAttribute generateReqAuthnAttributeSimple( - final String name, final String friendlyName, - final String isRequired, final List value) { - LOG.debug("Generate the requested attribute."); - - final RequestedAttribute requested = (RequestedAttribute) SAMLEngineUtils - .createSamlObject(RequestedAttribute.DEF_ELEMENT_NAME); - requested.setName(name); - requested.setNameFormat(RequestedAttribute.URI_REFERENCE); - - requested.setFriendlyName(friendlyName); - - requested.setIsRequired(isRequired); - - // The value is optional in an authentication request. - if (!value.isEmpty()) { - for (int nextValue = 0; nextValue < value.size(); nextValue++) { - final String valor = value.get(nextValue); - if (StringUtils.isNotBlank(valor)) { - - if(!name.equals("http://www.stork.gov.eu/1.0/signedDoc")){ - - // Create the attribute statement - final XSAny attrValue = (XSAny) SAMLEngineUtils - .createSamlObject( - new QName(SAMLCore.STORK10_NS.getValue(), - "AttributeValue", - SAMLCore.STORK10_PREFIX.getValue()), - XSAny.TYPE_NAME); - - attrValue.setTextContent(valor.trim()); - requested.getAttributeValues().add(attrValue); - - }else{ - - DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); - domFactory.setNamespaceAware(true); - Document document = null; - DocumentBuilder builder; - - // Parse the signedDoc value into an XML DOM Document - try { - builder = domFactory.newDocumentBuilder(); - InputStream is; - is = new ByteArrayInputStream(valor.trim().getBytes("UTF-8")); - document = builder.parse(is); - is.close(); - } catch (SAXException e1) { - LOG.error("SAX Error while parsing signModule attribute", e1); - throw new STORKSAMLEngineRuntimeException(e1); - } catch (ParserConfigurationException e2) { - LOG.error("Parser Configuration Error while parsing signModule attribute", e2); - throw new STORKSAMLEngineRuntimeException(e2); - } catch (UnsupportedEncodingException e3) { - LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); - throw new STORKSAMLEngineRuntimeException(e3); - } catch (IOException e4) { - LOG.error("IO Error while parsing signModule attribute", e4); - throw new STORKSAMLEngineRuntimeException(e4); - } - - // Create the XML statement(this will be overwritten with the previous DOM structure) - final XSAny xmlValue = (XSAny) SAMLEngineUtils - .createSamlObject( - new QName(SAMLCore.STORK10_NS.getValue(), - "XMLValue", - SAMLCore.STORK10_PREFIX.getValue()), - XSAny.TYPE_NAME); - - //Set the signedDoc XML content to this element - xmlValue.setDOM(document.getDocumentElement()); - - // Create the attribute statement - final XSAny attrValue = (XSAny) SAMLEngineUtils - .createSamlObject( - new QName(SAMLCore.STORK10_NS.getValue(), - "AttributeValue", - SAMLCore.STORK10_PREFIX.getValue()), - XSAny.TYPE_NAME); - - //Add previous signedDocXML to the AttributeValue Element - attrValue.getUnknownXMLObjects().add(xmlValue); - - requested.getAttributeValues().add(attrValue); - } - - - } - } - } - - return requested; - } - - /** - * Generate response. - * - * @param version the version - * @param identifier the identifier - * @param issueInstant the issue instant - * @param status the status - * - * @return the response - */ - public static Response generateResponse(final SAMLVersion version, - final String identifier, final DateTime issueInstant, - final Status status) { - final Response response = (Response) SAMLEngineUtils - .createSamlObject(Response.DEFAULT_ELEMENT_NAME); - response.setID(identifier); - response.setIssueInstant(issueInstant); - response.setStatus(status); - return response; - } - - /** - * Method that generates a SAML Authentication Request basing on the - * provided information. - * - * @param identifier the identifier - * @param version the version - * @param issueInstant the issue instant - * - * @return the authentication request - */ - public static AuthnRequest generateSAMLAuthnRequest(final String identifier, - final SAMLVersion version, final DateTime issueInstant) { - LOG.debug("Generate basic authentication request."); - final AuthnRequest authnRequest = (AuthnRequest) SAMLEngineUtils - .createSamlObject(AuthnRequest.DEFAULT_ELEMENT_NAME); - - authnRequest.setID(identifier); - authnRequest.setVersion(version); - authnRequest.setIssueInstant(issueInstant); - return authnRequest; - } - - public static AttributeQuery generateSAMLAttrQueryRequest(final String identifier, - final SAMLVersion version, final DateTime issueInstant) { - LOG.debug("Generate attribute query request."); - final AttributeQuery attrQueryRequest = (AttributeQuery) SAMLEngineUtils - .createSamlObject(AttributeQuery.DEFAULT_ELEMENT_NAME); - - attrQueryRequest.setID(identifier); - attrQueryRequest.setVersion(version); - attrQueryRequest.setIssueInstant(issueInstant); - return attrQueryRequest; - } - - /** - * Generate service provider application. - * - * @param spApplication the service provider application - * - * @return the sP application - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SPApplication generateSPApplication(final String spApplication) - throws STORKSAMLEngineException { - LOG.debug("Generate SPApplication."); - - final SPApplication applicationAttr = (SPApplication) SAMLEngineUtils - .createSamlObject(SPApplication.DEF_ELEMENT_NAME); - applicationAttr.setSPApplication(spApplication); - return applicationAttr; - } - - /** - * Generate service provider country. - * - * @param spCountry the service provider country - * - * @return the service provider country - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SPCountry generateSPCountry(final String spCountry) - throws STORKSAMLEngineException { - LOG.debug("Generate SPApplication."); - - final SPCountry countryAttribute = (SPCountry) SAMLEngineUtils - .createSamlObject(SPCountry.DEF_ELEMENT_NAME); - countryAttribute.setSPCountry(spCountry); - return countryAttribute; - } - - /** - * Generate service provider institution. - * - * @param spInstitution the service provider institution - * - * @return the service provider institution - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SPInstitution generateSPInstitution(final String spInstitution) - throws STORKSAMLEngineException { - LOG.debug("Generate SPInstitution."); - - final SPInstitution institutionAttr = (SPInstitution) SAMLEngineUtils - .createSamlObject(SPInstitution.DEF_ELEMENT_NAME); - institutionAttr.setSPInstitution(spInstitution); - return institutionAttr; - } - - /** - * Generate service provider sector. - * - * @param spSector the service provider sector - * - * @return the service provider sector - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SPSector generateSPSector(final String spSector) - throws STORKSAMLEngineException { - LOG.debug("Generate SPSector."); - - final SPSector sectorAttribute = (SPSector) SAMLEngineUtils - .createSamlObject(SPSector.DEF_ELEMENT_NAME); - sectorAttribute.setSPSector(spSector); - return sectorAttribute; - } - - /** - * Generate status. - * - * @param statusCode the status code - * - * @return the status - */ - public static Status generateStatus(final StatusCode statusCode) { - final Status status = (Status) SAMLEngineUtils - .createSamlObject(Status.DEFAULT_ELEMENT_NAME); - status.setStatusCode(statusCode); - return status; - } - - /** - * Generate status code. - * - * @param value the value - * - * @return the status code - */ - public static StatusCode generateStatusCode(final String value) { - final StatusCode statusCode = (StatusCode) SAMLEngineUtils - .createSamlObject(StatusCode.DEFAULT_ELEMENT_NAME); - statusCode.setValue(value); - return statusCode; - } - - - /** - * Generate status message. - * - * @param message the message - * - * @return the status message - */ - public static StatusMessage generateStatusMessage(final String message) { - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .createSamlObject(StatusMessage.DEFAULT_ELEMENT_NAME); - statusMessage.setMessage(message); - return statusMessage; - } - - /** - * Generate subject. - * - * @return the subject - */ - public static Subject generateSubject() { - return (Subject) SAMLEngineUtils - .createSamlObject(Subject.DEFAULT_ELEMENT_NAME); - } - - /** - * Generate subject confirmation. - * - * @param method the method - * @param data the data - * - * @return the subject confirmation - */ - public static SubjectConfirmation generateSubjectConfirmation( - final String method, final SubjectConfirmationData data) { - final SubjectConfirmation subjectConf = (SubjectConfirmation) Configuration - .getBuilderFactory().getBuilder( - SubjectConfirmation.DEFAULT_ELEMENT_NAME).buildObject( - SubjectConfirmation.DEFAULT_ELEMENT_NAME); - - subjectConf.setMethod(method); - - subjectConf.setSubjectConfirmationData(data); - - return subjectConf; - } - - - /** - * Generate subject confirmation data. - * - * @param notOnOrAfter the not on or after - * @param recipient the recipient - * @param inResponseTo the in response to - * - * @return the subject confirmation data - */ - public static SubjectConfirmationData generateSubjectConfirmationData( - final DateTime notOnOrAfter, final String recipient, - final String inResponseTo) { - final SubjectConfirmationData subjectConfData = (SubjectConfirmationData) SAMLEngineUtils - .createSamlObject(SubjectConfirmationData.DEFAULT_ELEMENT_NAME); - subjectConfData.setNotOnOrAfter(notOnOrAfter); - subjectConfData.setRecipient(recipient); - subjectConfData.setInResponseTo(inResponseTo); - return subjectConfData; - } - - - /** - * Generate subject locality. - * - * @param address the address - * - * @return the subject locality - */ - public static SubjectLocality generateSubjectLocality(final String address) { - final SubjectLocality subjectLocality = (SubjectLocality) SAMLEngineUtils - .createSamlObject(SubjectLocality.DEFAULT_ELEMENT_NAME); - subjectLocality.setAddress(address); - return subjectLocality; - } - - - - - /** - * Method that returns the current time. - * - * @return the current time - */ - public static DateTime getCurrentTime() { - return new DateTime(); - } - - - /** - * Instantiates a new SAML engine utilities. - */ - private SAMLEngineUtils() { - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base deleted file mode 100644 index 3cac2f637..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/STORKSAMLEngine.java.svn-base +++ /dev/null @@ -1,2983 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.apache.commons.lang.StringUtils; -import org.bouncycastle.jce.X509Principal; -import org.joda.time.DateTime; -import org.opensaml.Configuration; -import org.opensaml.common.SAMLVersion; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.common.Extensions; -import org.opensaml.saml2.core.Assertion; -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.core.AttributeQuery; -import org.opensaml.saml2.core.AttributeStatement; -import org.opensaml.saml2.core.AttributeValue; -import org.opensaml.saml2.core.Audience; -import org.opensaml.saml2.core.AudienceRestriction; -import org.opensaml.saml2.core.AuthnContext; -import org.opensaml.saml2.core.AuthnContextDecl; -import org.opensaml.saml2.core.AuthnRequest; -import org.opensaml.saml2.core.AuthnStatement; -import org.opensaml.saml2.core.Conditions; -import org.opensaml.saml2.core.Issuer; -import org.opensaml.saml2.core.NameID; -import org.opensaml.saml2.core.OneTimeUse; -import org.opensaml.saml2.core.Response; -import org.opensaml.saml2.core.Status; -import org.opensaml.saml2.core.StatusCode; -import org.opensaml.saml2.core.StatusMessage; -import org.opensaml.saml2.core.Subject; -import org.opensaml.saml2.core.SubjectConfirmation; -import org.opensaml.saml2.core.SubjectConfirmationData; -import org.opensaml.saml2.core.SubjectLocality; -import org.opensaml.saml2.core.impl.SubjectConfirmationBuilder; -import org.opensaml.xml.Namespace; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.schema.XSAny; -import org.opensaml.xml.schema.impl.XSAnyBuilder; -import org.opensaml.xml.schema.impl.XSAnyImpl; -import org.opensaml.xml.schema.impl.XSAnyMarshaller; -import org.opensaml.xml.schema.impl.XSAnyUnmarshaller; -import org.opensaml.xml.schema.impl.XSStringImpl; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.util.Base64; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; -import org.opensaml.xml.validation.ValidatorSuite; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAttrQueryRequest; -import eu.stork.peps.auth.commons.STORKAttrQueryResponse; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.commons.STORKAuthnResponse; -import eu.stork.peps.auth.engine.core.AuthenticationAttributes; -import eu.stork.peps.auth.engine.core.CitizenCountryCode; -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; -import eu.stork.peps.auth.engine.core.EIDSectorShare; -import eu.stork.peps.auth.engine.core.QAAAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttributes; -import eu.stork.peps.auth.engine.core.SAMLCore; -import eu.stork.peps.auth.engine.core.SPApplication; -import eu.stork.peps.auth.engine.core.SPCountry; -import eu.stork.peps.auth.engine.core.SPID; -import eu.stork.peps.auth.engine.core.SPInformation; -import eu.stork.peps.auth.engine.core.SPInstitution; -import eu.stork.peps.auth.engine.core.SPSector; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; -import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesBuilder; -import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesMarshaller; -import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeBuilder; -import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeMarshaller; -import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareBuilder; -import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareMarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareBuilder; -import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareMarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDCrossSectorShareUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDSectorShareBuilder; -import eu.stork.peps.auth.engine.core.impl.EIDSectorShareMarshaller; -import eu.stork.peps.auth.engine.core.impl.EIDSectorShareUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.QAAAttributeBuilder; -import eu.stork.peps.auth.engine.core.impl.QAAAttributeMarshaller; -import eu.stork.peps.auth.engine.core.impl.QAAAttributeUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributeBuilder; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributeMarshaller; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributeUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributesBuilder; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributesMarshaller; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributesUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPApplicationBuilder; -import eu.stork.peps.auth.engine.core.impl.SPApplicationMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPApplicationUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPCountryBuilder; -import eu.stork.peps.auth.engine.core.impl.SPCountryMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPCountryUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPIDBuilder; -import eu.stork.peps.auth.engine.core.impl.SPIDMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPIDUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPInformationBuilder; -import eu.stork.peps.auth.engine.core.impl.SPInformationMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPInformationUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPInstitutionBuilder; -import eu.stork.peps.auth.engine.core.impl.SPInstitutionMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPInstitutionUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.SPSectorBuilder; -import eu.stork.peps.auth.engine.core.impl.SPSectorMarshaller; -import eu.stork.peps.auth.engine.core.impl.SPSectorUnmarshaller; -import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesBuilder; -import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesMarshaller; -import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesUnmarshaller; -import eu.stork.peps.auth.engine.core.validator.ExtensionsSchemaValidator; -import eu.stork.peps.auth.engine.core.validator.QAAAttributeSchemaValidator; -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * Class that wraps the operations over SAML tokens, both generation and - * validation of SAML STORK requests and SAML STORK responses. Complaint with - * "OASIS Secure Assertion Markup Language (SAML) 2.0, May 2005", but taking - * into account STORK specific requirements. - * - * @author fjquevedo - * @author iinigo - */ -public final class STORKSAMLEngine extends SAMLEngine { - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(STORKSAMLEngine.class.getName()); - - private static final String ATTRIBUTE_EMPTY_LITERAL = "Attribute name is null or empty."; - /** - * Gets the single instance of STORKSAMLEngine. - * - * @param nameInstance the name instance - * - * @return single instance of STORKSAMLEngine - */ - public static synchronized STORKSAMLEngine getInstance( - final String nameInstance) { - STORKSAMLEngine engine = null; - LOG.info("Get instance: " + nameInstance); - try { - engine = new STORKSAMLEngine(nameInstance.trim()); - } catch (Exception e) { - LOG.error("Error get instance: " + nameInstance); - } - return engine; - } - - /** - * Instantiate a new STORKSAML engine. - * - * @param nameInstance the name instance - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private STORKSAMLEngine(final String nameInstance) - throws STORKSAMLEngineException { - // Initialization OpenSAML. - super(nameInstance); - LOG.info("Register STORK objects provider."); - Configuration.registerObjectProvider(QAAAttribute.DEF_ELEMENT_NAME, - new QAAAttributeBuilder(), new QAAAttributeMarshaller(), - new QAAAttributeUnmarshaller()); - - Configuration.registerObjectProvider(EIDSectorShare.DEF_ELEMENT_NAME, - new EIDSectorShareBuilder(), new EIDSectorShareMarshaller(), - new EIDSectorShareUnmarshaller()); - - Configuration.registerObjectProvider( - EIDCrossSectorShare.DEF_ELEMENT_NAME, - new EIDCrossSectorShareBuilder(), - new EIDCrossSectorShareMarshaller(), - new EIDCrossSectorShareUnmarshaller()); - - Configuration.registerObjectProvider( - EIDCrossBorderShare.DEF_ELEMENT_NAME, - new EIDCrossBorderShareBuilder(), - new EIDCrossBorderShareMarshaller(), - new EIDCrossBorderShareUnmarshaller()); - - Configuration.registerObjectProvider(SPSector.DEF_ELEMENT_NAME, - new SPSectorBuilder(), new SPSectorMarshaller(), - new SPSectorUnmarshaller()); - - Configuration.registerObjectProvider(SPInstitution.DEF_ELEMENT_NAME, - new SPInstitutionBuilder(), new SPInstitutionMarshaller(), - new SPInstitutionUnmarshaller()); - - Configuration.registerObjectProvider(SPApplication.DEF_ELEMENT_NAME, - new SPApplicationBuilder(), new SPApplicationMarshaller(), - new SPApplicationUnmarshaller()); - - Configuration.registerObjectProvider(SPCountry.DEF_ELEMENT_NAME, - new SPCountryBuilder(), new SPCountryMarshaller(), - new SPCountryUnmarshaller()); - - Configuration.registerObjectProvider(XSAny.TYPE_NAME, - new XSAnyBuilder(), new XSAnyMarshaller(), - new XSAnyUnmarshaller()); - - Configuration.registerObjectProvider( - RequestedAttribute.DEF_ELEMENT_NAME, - new RequestedAttributeBuilder(), - new RequestedAttributeMarshaller(), - new RequestedAttributeUnmarshaller()); - - Configuration.registerObjectProvider( - RequestedAttributes.DEF_ELEMENT_NAME, - new RequestedAttributesBuilder(), - new RequestedAttributesMarshaller(), - new RequestedAttributesUnmarshaller()); - - Configuration.registerObjectProvider( - AuthenticationAttributes.DEF_ELEMENT_NAME, - new AuthenticationAttributesBuilder(), - new AuthenticationAttributesMarshaller(), - new AuthenticationAttributesUnmarshaller()); - - Configuration.registerObjectProvider( - VIDPAuthenticationAttributes.DEF_ELEMENT_NAME, - new VIDPAuthenticationAttributesBuilder(), - new VIDPAuthenticationAttributesMarshaller(), - new VIDPAuthenticationAttributesUnmarshaller()); - - Configuration.registerObjectProvider( - CitizenCountryCode.DEF_ELEMENT_NAME, - new CitizenCountryCodeBuilder(), - new CitizenCountryCodeMarshaller(), - new CitizenCountryCodeUnmarshaller()); - - Configuration.registerObjectProvider( - SPID.DEF_ELEMENT_NAME, - new SPIDBuilder(), - new SPIDMarshaller(), - new SPIDUnmarshaller()); - - Configuration.registerObjectProvider( - SPInformation.DEF_ELEMENT_NAME, - new SPInformationBuilder(), - new SPInformationMarshaller(), - new SPInformationUnmarshaller()); - - LOG.info("Register STORK object validators."); - final ValidatorSuite validatorSuite = new ValidatorSuite( - QAAAttribute.DEF_LOCAL_NAME); - - validatorSuite.registerValidator(QAAAttribute.DEF_ELEMENT_NAME, - new QAAAttributeSchemaValidator()); - final Extensions extensions = SAMLEngineUtils.generateExtension(); - validatorSuite.registerValidator(extensions.getElementQName(), - new ExtensionsSchemaValidator()); - - Configuration.registerValidatorSuite( - "stork:QualityAuthenticationAssuranceLevel", validatorSuite); - - } - - /** - * Generate authentication response base. - * - * @param status the status - * @param assertConsumerURL the assert consumer URL. - * @param inResponseTo the in response to - * - * @return the response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Response genAuthnRespBase(final Status status, - final String assertConsumerURL, final String inResponseTo) - throws STORKSAMLEngineException { - LOG.debug("Generate Authentication Response base."); - final Response response = SAMLEngineUtils.generateResponse( - SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), - SAMLEngineUtils.getCurrentTime(), status); - - // Set name Spaces - this.setNameSpaces(response); - - // Mandatory STORK - LOG.debug("Generate Issuer"); - final Issuer issuer = SAMLEngineUtils.generateIssuer(); - issuer.setValue(super.getSamlCoreProperties().getResponder()); - - // Format Entity Optional STORK - issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); - - response.setIssuer(issuer); - - // destination Mandatory Stork - response.setDestination(assertConsumerURL.trim()); - - // inResponseTo Mandatory Stork - response.setInResponseTo(inResponseTo.trim()); - - // Optional STORK - response.setConsent(super.getSamlCoreProperties() - .getConsentAuthnResponse()); - - return response; - } - - /** - * Generate attribute query response base. - * - * @param status the status - * @param destinationURL the assert consumer URL. - * @param inResponseTo the in response to - * - * @return the response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Response genAttrQueryRespBase(final Status status, - final String destinationURL, final String inResponseTo) - throws STORKSAMLEngineException { - LOG.debug("Generate Attribute query Response base."); - final Response response = SAMLEngineUtils.generateResponse( - SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), - SAMLEngineUtils.getCurrentTime(), status); - - // Set name Spaces - this.setNameSpaces(response); - - // Mandatory STORK - LOG.debug("Generate Issuer"); - final Issuer issuer = SAMLEngineUtils.generateIssuer(); - issuer.setValue(super.getSamlCoreProperties().getResponder()); - - // Format Entity Optional STORK - issuer.setFormat(super.getSamlCoreProperties().getFormatEntity()); - - response.setIssuer(issuer); - - // destination Mandatory Stork - response.setDestination(destinationURL.trim()); - - // inResponseTo Mandatory Stork - response.setInResponseTo(inResponseTo.trim()); - - // Optional STORK - response.setConsent(super.getSamlCoreProperties() - .getConsentAuthnResponse()); - - return response; - } - - /** - * Generate assertion. - * - * @param ipAddress the IP address. - * @param assertConsumerURL the assert consumer URL. - * @param inResponseTo the in response to - * @param issuer the issuer - * @param notOnOrAfter the not on or after - * - * @return the assertion - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Assertion generateAssertion(final String ipAddress, - final String assertConsumerURL, final String inResponseTo, - final String issuer, final DateTime notOnOrAfter) - throws STORKSAMLEngineException { - LOG.info("Generate Assertion."); - - // Mandatory STORK - LOG.debug("Generate Issuer to Assertion"); - final Issuer issuerAssertion = SAMLEngineUtils.generateIssuer(); - issuerAssertion.setValue(super.getSamlCoreProperties().getResponder()); - - // Format Entity Optional STORK - issuerAssertion.setFormat(super.getSamlCoreProperties() - .getFormatEntity()); - - final Assertion assertion = SAMLEngineUtils.generateAssertion( - SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), - SAMLEngineUtils.getCurrentTime(), issuerAssertion); - - final Subject subject = SAMLEngineUtils.generateSubject(); - - // Mandatory STORK verified - // String format = NameID.UNSPECIFIED - // specification: 'SAML:2.0' exist - // opensaml: "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" - // opensaml "urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified" - final String format = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"; - - final String nameQualifier = ""; - - LOG.debug("Generate NameID"); - final NameID nameId = SAMLEngineUtils.generateNameID(super - .getSamlCoreProperties().getResponder(), format, nameQualifier); - nameId.setValue(format); - subject.setNameID(nameId); - - // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. - // Optional in other case. - LOG.debug("Generate SubjectConfirmationData."); - final SubjectConfirmationData dataBearer = SAMLEngineUtils - .generateSubjectConfirmationData(SAMLEngineUtils - .getCurrentTime(), assertConsumerURL, inResponseTo); - - // Mandatory if urn:oasis:names:tc:SAML:2.0:cm:bearer. - // Optional in other case. - LOG.debug("Generate SubjectConfirmation"); - final SubjectConfirmation subjectConf = SAMLEngineUtils - .generateSubjectConfirmation(SubjectConfirmation.METHOD_BEARER, - dataBearer); - - final ArrayList listSubjectConf = new ArrayList(); - listSubjectConf.add(subjectConf); - - for (final Iterator iter = listSubjectConf - .iterator(); iter.hasNext();) { - final SubjectConfirmation element = iter.next(); - - if (SubjectConfirmation.METHOD_BEARER.equals(element.getMethod())) { - // ipAddress Mandatory if method is Bearer. - - if (StringUtils.isBlank(ipAddress)) { - throw new STORKSAMLEngineException( - "ipAddress is null or empty"); - } - element.getSubjectConfirmationData().setAddress( - ipAddress.trim()); - } - - element.getSubjectConfirmationData() - .setRecipient(assertConsumerURL); - element.getSubjectConfirmationData().setNotOnOrAfter(notOnOrAfter); - } - - // The SAML 2.0 specification allows multiple SubjectConfirmations - subject.getSubjectConfirmations().addAll(listSubjectConf); - - // Mandatory Stork - assertion.setSubject(subject); - - // Conditions that MUST be evaluated when assessing the validity of - // and/or when using the assertion. - final Conditions conditions = this.generateConditions(SAMLEngineUtils - .getCurrentTime(), notOnOrAfter, issuer); - - assertion.setConditions(conditions); - - LOG.debug("Generate stork Authentication Statement."); - final AuthnStatement storkAuthnStat = this - .generateStorkAuthStatement(ipAddress); - assertion.getAuthnStatements().add(storkAuthnStat); - - return assertion; - } - - private String getAttributeName(final PersonalAttribute attribute) throws STORKSAMLEngineException { - if (StringUtils.isBlank(attribute.getName())) { - LOG.error(ATTRIBUTE_EMPTY_LITERAL); - throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); - } - - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.error("Attribute name: {} it is not known.", attribute - .getName()); - throw new STORKSAMLEngineException("Attribute name: " - + attribute.getName() + " it is not known."); - } - return attributeName; - } - /** - * Generate attribute statement. - * - * @param personalAttrList the personal attribute list - * @param isHashing the is hashing - * - * @return the attribute statement - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - * @throws IOException - */ - private AttributeStatement generateAttributeStatement( - final IPersonalAttributeList personalAttrList, - final boolean isHashing) throws STORKSAMLEngineException { - LOG.debug("Generate attribute statement"); - - final AttributeStatement attrStatement = (AttributeStatement) SAMLEngineUtils - .createSamlObject(AttributeStatement.DEFAULT_ELEMENT_NAME); - - for (PersonalAttribute attribute : personalAttrList) { - - String attributeName = getAttributeName(attribute); - - // Verification that only one value it's permitted, simple or - // complex, not both. - - final boolean simpleNull = (attribute.getValue() == null); - final boolean simpleEmpty = (simpleNull || (!simpleNull && attribute - .getValue().isEmpty())); - - final boolean complexNull = (attribute.getComplexValue() == null); - final boolean complexEmpty = (complexNull || (!complexNull && attribute - .getComplexValue().isEmpty())); - - if ((!simpleEmpty && !complexEmpty)) { - throw new STORKSAMLEngineException( - "Attribute name: " - + attribute.getName() - + " must be contain one value, simple or complex value."); - } else { - - if (!simpleEmpty) { - attrStatement.getAttributes().add( - this.generateAttrSimple(attributeName, attribute - .getStatus(), attribute.getValue(), - isHashing)); - } else if (!complexEmpty) { - attrStatement.getAttributes().add( - SAMLEngineUtils.generateAttrComplex(attributeName, - attribute.getStatus(), attribute - .getComplexValue(), isHashing)); - } else if (!simpleNull) { - attrStatement.getAttributes().add( - this.generateAttrSimple(attributeName, attribute - .getStatus(), new ArrayList(), - isHashing)); - } else { - // Add attribute complex. - attrStatement.getAttributes().add( - SAMLEngineUtils.generateAttrComplex(attributeName, - attribute.getStatus(), - new HashMap(), isHashing)); - } - } - } - return attrStatement; - } - private XSAny createAttributeValueForSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { - DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); - domFactory.setNamespaceAware(true); - Document document = null; - DocumentBuilder builder; - - // Parse the signedDoc value into an XML DOM Document - try { - builder = domFactory.newDocumentBuilder(); - InputStream is; - is = new ByteArrayInputStream(value.trim().getBytes("UTF-8")); - document = builder.parse(is); - is.close(); - } catch (SAXException e1) { - LOG.error("SAX Error while parsing signModule attribute", e1); - throw new STORKSAMLEngineRuntimeException(e1); - } catch (ParserConfigurationException e2) { - LOG.error("Parser Configuration Error while parsing signModule attribute", e2); - throw new STORKSAMLEngineRuntimeException(e2); - } catch (UnsupportedEncodingException e3) { - LOG.error("Unsupported encoding Error while parsing signModule attribute", e3); - throw new STORKSAMLEngineRuntimeException(e3); - } catch (IOException e4) { - LOG.error("IO Error while parsing signModule attribute", e4); - throw new STORKSAMLEngineRuntimeException(e4); - } - - // Create the attribute statement - final XSAny xmlValue = (XSAny) SAMLEngineUtils - .createSamlObject( - AttributeValue.DEFAULT_ELEMENT_NAME, - XSAny.TYPE_NAME); - - //Set the signedDoc XML content to this element - xmlValue.setDOM(document.getDocumentElement()); - - // Create the attribute statement - final XSAny attrValue = (XSAny) SAMLEngineUtils - .createSamlObject( - AttributeValue.DEFAULT_ELEMENT_NAME, - XSAny.TYPE_NAME); - - //Add previous signedDocXML to the AttributeValue Element - - // if it's necessary encode the information. - if (!isHashing) { - attrValue.getUnknownXMLObjects().add(xmlValue); - } - return attrValue; - } - - private XSAny createAttributeValueForNonSignedDoc(final String value, final boolean isHashing) throws STORKSAMLEngineException { - // Create the attribute statement - final XSAny attrValue = (XSAny) SAMLEngineUtils - .createSamlObject( - AttributeValue.DEFAULT_ELEMENT_NAME, - XSAny.TYPE_NAME); - // if it's necessary encode the information. - if (isHashing) { - attrValue.setTextContent(SAMLEngineUtils.encode(value, SAMLEngineUtils.SHA_512)); - } else { - attrValue.setTextContent(value); - } - return attrValue; - } - - /** - * Generate attribute from a list of values. - * - * @param name the name of the attribute. - * @param values the value of the attribute. - * @param isHashing the is hashing with "SHA-512" algorithm. - * @param status the status of the parameter: "Available", "NotAvailable" or - * "Withheld". - * - * @return the attribute - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Attribute generateAttrSimple(final String name, - final String status, final List values, - final boolean isHashing) throws STORKSAMLEngineException { - LOG.debug("Generate attribute simple: " + name); - final Attribute attribute = (Attribute) SAMLEngineUtils - .createSamlObject(Attribute.DEFAULT_ELEMENT_NAME); - - attribute.setName(name); - attribute.setNameFormat(Attribute.URI_REFERENCE); - - attribute.getUnknownAttributes().put( - new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", - SAMLCore.STORK10_PREFIX.getValue()), status); - - if (values != null) { - LOG.debug("Add attribute values."); - for (int i = 0; i < values.size(); i++) { - final String value = values.get(i); - if (StringUtils.isNotBlank(value)) { - XSAny attrValue = null; - if (!name.equals("http://www.stork.gov.eu/1.0/signedDoc")) { - // Create the attribute statement - attrValue = createAttributeValueForNonSignedDoc(value, isHashing); - - } else { - attrValue = createAttributeValueForSignedDoc(value, isHashing); - attribute.getAttributeValues().add(attrValue); - } - attribute.getAttributeValues().add(attrValue); - } - } - } - return attribute; - } - - /** - * Generate conditions that MUST be evaluated when assessing the validity of - * and/or when using the assertion. - * - * @param notBefore the not before - * @param notOnOrAfter the not on or after - * @param audienceURI the audience URI. - * - * @return the conditions - */ - private Conditions generateConditions(final DateTime notBefore, - final DateTime notOnOrAfter, final String audienceURI) { - LOG.debug("Generate conditions."); - final Conditions conditions = (Conditions) SAMLEngineUtils - .createSamlObject(Conditions.DEFAULT_ELEMENT_NAME); - conditions.setNotBefore(notBefore); - conditions.setNotOnOrAfter(notOnOrAfter); - - final AudienceRestriction restrictions = (AudienceRestriction) SAMLEngineUtils - .createSamlObject(AudienceRestriction.DEFAULT_ELEMENT_NAME); - - final Audience audience = (Audience) SAMLEngineUtils - .createSamlObject(Audience.DEFAULT_ELEMENT_NAME); - audience.setAudienceURI(audienceURI); - - restrictions.getAudiences().add(audience); - conditions.getAudienceRestrictions().add(restrictions); - - if (super.getSamlCoreProperties().isOneTimeUse()) { - final OneTimeUse oneTimeUse = (OneTimeUse) SAMLEngineUtils - .createSamlObject(OneTimeUse.DEFAULT_ELEMENT_NAME); - conditions.getConditions().add(oneTimeUse); - } - return conditions; - } - - /** - * Generate personal attribute list. - * - * @param assertion the assertion - * - * @return the personal attribute list - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private IPersonalAttributeList generatePersonalAttributeList( - final Assertion assertion) throws STORKSAMLEngineException { - LOG.debug("Generate personal attribute list from XMLObject."); - final List listExtensions = assertion.getOrderedChildren(); - - boolean find = false; - AttributeStatement requestedAttr = null; - - // Search the attribute statement. - for (int i = 0; i < listExtensions.size() && !find; i++) { - final XMLObject xml = listExtensions.get(i); - if (xml instanceof AttributeStatement) { - requestedAttr = (AttributeStatement) xml; - find = true; - } - } - - if (!find) { - LOG.error("Error: AttributeStatement it's not present."); - throw new STORKSAMLEngineException( - "AttributeStatement it's not present."); - } - - final List reqAttrs = requestedAttr.getAttributes(); - - final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); - String attributeName; - - // Process the attributes. - for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { - final Attribute attribute = reqAttrs.get(nextAttribute); - - final PersonalAttribute personalAttribute = new PersonalAttribute(); - - attributeName = attribute.getName(); - personalAttribute.setName(attributeName.substring(attributeName - .lastIndexOf('/') + 1)); - - personalAttribute.setStatus(attribute.getUnknownAttributes().get( - new QName(SAMLCore.STORK10_NS.getValue(), - "AttributeStatus", SAMLCore.STORK10_PREFIX - .getValue()))); - - final ArrayList simpleValues = new ArrayList(); - final HashMap multiValues = new HashMap(); - - final List values = attribute.getOrderedChildren(); - - - // Process the values. - for (int nextValue = 0; nextValue < values.size(); nextValue++) { - - final XMLObject xmlObject = values.get(nextValue); - - if (xmlObject instanceof XSStringImpl) { - - // Process simple value. - simpleValues.add(((XSStringImpl) xmlObject).getValue()); - - } else if (xmlObject instanceof XSAnyImpl) { - - if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextValue); - - TransformerFactory transFactory = TransformerFactory - .newInstance(); - Transformer transformer = null; - try { - transformer = transFactory.newTransformer(); - transformer.setOutputProperty( - OutputKeys.OMIT_XML_DECLARATION, "yes"); - } catch (TransformerConfigurationException e) { - LOG.error("Error transformer configuration exception", e); - } - StringWriter buffer = new StringWriter(); - try { - if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ - transformer.transform(new DOMSource(xmlString - .getUnknownXMLObjects().get(0).getDOM()), - new StreamResult(buffer)); - } - } catch (TransformerException e) { - LOG.error("Error transformer exception", e); - } - String str = buffer.toString(); - - simpleValues.add(str); - - } else if (attributeName - .equals("http://www.stork.gov.eu/1.0/canonicalResidenceAddress")) - { - LOG.info("canonicalResidenceAddress found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - - } - else if (attributeName - .equals("http://www.stork.gov.eu/1.0/newAttribute2")) - { - LOG.info("newAttribute2 found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - } - else if (attributeName - .equals("http://www.stork.gov.eu/1.0/hasDegree")) - { - LOG.info("hasDegree found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - } - else if(attributeName - .equals("http://www.stork.gov.eu/1.0/mandateContent")) - { - LOG.info("mandateContent found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - } - else { - // Process simple value. - simpleValues.add(((XSAnyImpl) xmlObject) - .getTextContent()); - } - - } else { - LOG.error("Error: attribute value it's unknown."); - throw new STORKSAMLEngineException( - "Attribute value it's unknown."); - } - } - - personalAttribute.setValue(simpleValues); - personalAttribute.setComplexValue(multiValues); - personalAttrList.add(personalAttribute); - } - - return personalAttrList; - } - - /** - * Generate stork authentication request. - * - * @param request the request that contain all parameters for generate an - * authentication request. - * - * @return the STORK authentication request that has been processed. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnRequest generateSTORKAuthnRequest( - final STORKAuthnRequest request) throws STORKSAMLEngineException { - LOG.info("Generate SAMLAuthnRequest."); - - // Validate Parameters mandatories - validateParamAuthnReq(request); - - final AuthnRequest authnRequestAux = SAMLEngineUtils - .generateSAMLAuthnRequest(SAMLEngineUtils.generateNCName(), - SAMLVersion.VERSION_20, SAMLEngineUtils - .getCurrentTime()); - - // Set name spaces. - setNameSpaces(authnRequestAux); - - // Add parameter Mandatory STORK - authnRequestAux.setForceAuthn(Boolean.TRUE); - - // Add parameter Mandatory STORK - authnRequestAux.setIsPassive(Boolean.FALSE); - - authnRequestAux.setAssertionConsumerServiceURL(request - .getAssertionConsumerServiceURL()); - - authnRequestAux.setProviderName(request.getProviderName()); - - // Add protocol binding - authnRequestAux.setProtocolBinding(super.getSamlCoreProperties() - .getProtocolBinding()); - - // Add parameter optional STORK - // Destination is mandatory if the destination is a C-PEPS - // The application must to know if the destination is a C-PEPS. - if (StringUtils.isNotBlank(request.getDestination())) { - authnRequestAux.setDestination(request.getDestination()); - } - - // Consent is optional. Set from SAMLEngine.xml - consent. - authnRequestAux.setConsent(super.getSamlCoreProperties() - .getConsentAuthnRequest()); - - final Issuer issuer = SAMLEngineUtils.generateIssuer(); - - if(request.getIssuer()!=null){ - issuer.setValue(request.getIssuer()); - } else { - issuer.setValue(super.getSamlCoreProperties().getRequester()); - } - - // Optional STORK - final String formatEntity = super.getSamlCoreProperties() - .getFormatEntity(); - if (StringUtils.isNotBlank(formatEntity)) { - issuer.setFormat(formatEntity); - } - - authnRequestAux.setIssuer(issuer); - - // Generate stork extensions. - final Extensions storkExtensions = this - .generateSTORKExtensions(request); - // add the extensions to the SAMLAuthnRequest - authnRequestAux.setExtensions(storkExtensions); - - // the result contains an authentication request token (byte[]), - // identifier of the token, and all parameters from the request. - final STORKAuthnRequest authRequest = processExtensions(authnRequestAux - .getExtensions()); - - try { - authRequest.setTokenSaml(super.signAndMarshall(authnRequestAux)); - } catch (SAMLEngineException e) { - LOG.error("Sign and Marshall.", e); - throw new STORKSAMLEngineException(e); - } - - authRequest.setSamlId(authnRequestAux.getID()); - authRequest.setDestination(authnRequestAux.getDestination()); - authRequest.setAssertionConsumerServiceURL(authnRequestAux - .getAssertionConsumerServiceURL()); - - authRequest.setProviderName(authnRequestAux.getProviderName()); - authRequest.setIssuer(authnRequestAux.getIssuer().getValue()); - - return authRequest; - } - - /** - * Generate stork authentication response. - * - * @param request the request - * @param responseAuthReq the response authentication request - * @param ipAddress the IP address - * @param isHashing the is hashing - * - * @return the sTORK authentication response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnResponse generateSTORKAuthnResponse( - final STORKAuthnRequest request, - final STORKAuthnResponse responseAuthReq, final String ipAddress, - final boolean isHashing) throws STORKSAMLEngineException { - LOG.info("generateSTORKAuthnResponse"); - - // Validate parameters - validateParamResponse(request, responseAuthReq); - - // Mandatory SAML - LOG.debug("Generate StatusCode"); - final StatusCode statusCode = SAMLEngineUtils - .generateStatusCode(StatusCode.SUCCESS_URI); - - LOG.debug("Generate Status"); - final Status status = SAMLEngineUtils.generateStatus(statusCode); - - LOG.debug("Generate StatusMessage"); - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .generateStatusMessage(StatusCode.SUCCESS_URI); - - status.setStatusMessage(statusMessage); - - LOG.debug("Generate Response"); - - // RESPONSE - final Response response = genAuthnRespBase(status, request - .getAssertionConsumerServiceURL(), request.getSamlId()); - - DateTime notOnOrAfter = new DateTime(); - - notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() - .getTimeNotOnOrAfter()); - - final Assertion assertion = this.generateAssertion(ipAddress, request - .getAssertionConsumerServiceURL(), request.getSamlId(), request - .getIssuer(), notOnOrAfter); - - final AttributeStatement attrStatement = this - .generateAttributeStatement(responseAuthReq - .getPersonalAttributeList(), isHashing); - - assertion.getAttributeStatements().add(attrStatement); - - // Add assertions - response.getAssertions().add(assertion); - - final STORKAuthnResponse authresponse = new STORKAuthnResponse(); - - try { - authresponse.setTokenSaml(super.signAndMarshall(response)); - authresponse.setSamlId(response.getID()); - } catch (SAMLEngineException e) { - LOG.error("Sign and Marshall.", e); - throw new STORKSAMLEngineException(e); - } - return authresponse; - } - - /** - * Generate stork authentication response fail. - * - * @param request the request - * @param response the response - * @param ipAddress the IP address - * @param isHashing the is hashing - * - * @return the sTORK authentication response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnResponse generateSTORKAuthnResponseFail( - final STORKAuthnRequest request, final STORKAuthnResponse response, - final String ipAddress, final boolean isHashing) - throws STORKSAMLEngineException { - LOG.info("generateSTORKAuthnResponseFail"); - - validateParamResponseFail(request, response); - - // Mandatory - final StatusCode statusCode = SAMLEngineUtils - .generateStatusCode(response.getStatusCode()); - - // Mandatory SAML - LOG.debug("Generate StatusCode."); - // Subordinate code it's optional in case not covered into next codes: - // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed - // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue - // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy - // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied - // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported - - if (StringUtils.isNotBlank(response.getSubStatusCode())) { - final StatusCode newStatusCode = SAMLEngineUtils - .generateStatusCode(response.getSubStatusCode()); - statusCode.setStatusCode(newStatusCode); - } - - LOG.debug("Generate Status."); - final Status status = SAMLEngineUtils.generateStatus(statusCode); - - if (StringUtils.isNotBlank(response.getMessage())) { - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .generateStatusMessage(response.getMessage()); - - status.setStatusMessage(statusMessage); - } - - LOG.debug("Generate Response."); - // RESPONSE - final Response responseFail = genAuthnRespBase(status, request - .getAssertionConsumerServiceURL(), request.getSamlId()); - - DateTime notOnOrAfter = new DateTime(); - - notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() - .getTimeNotOnOrAfter()); - - final Assertion assertion = this.generateAssertion(ipAddress, request - .getAssertionConsumerServiceURL(), request.getSamlId(), request - .getIssuer(), notOnOrAfter); - - responseFail.getAssertions().add(assertion); - - LOG.debug("Sign and Marshall ResponseFail."); - - final STORKAuthnResponse storkResponse = new STORKAuthnResponse(); - - try { - storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); - storkResponse.setSamlId(responseFail.getID()); - } catch (SAMLEngineException e) { - LOG.error("SAMLEngineException.", e); - throw new STORKSAMLEngineException(e); - } - return storkResponse; - } - - /** - * Generate stork attribute query request. - * - * @param request the request that contain all parameters for generate an - * attribute query request. - * - * @return the STORK attribute query request that has been processed. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryRequest generateSTORKAttrQueryRequest( - final STORKAttrQueryRequest request) throws STORKSAMLEngineException { - LOG.info("Generate STORKAttrQueryRequest."); - - // Validate Parameters mandatories - validateParamAttrQueryReq(request); - - final AttributeQuery attrQueryRequestAux = SAMLEngineUtils - .generateSAMLAttrQueryRequest(SAMLEngineUtils.generateNCName(), - SAMLVersion.VERSION_20, SAMLEngineUtils - .getCurrentTime()); - - // Set name spaces. - setNameSpaces(attrQueryRequestAux); - - - // Add parameter optional STORK - // Destination is mandatory if the destination is a C-PEPS - // The application must to know if the destination is a C-PEPS. - if (StringUtils.isNotBlank(request.getDestination())) { - attrQueryRequestAux.setDestination(request.getDestination()); - } - - // Consent is optional. Set from SAMLEngine.xml - consent. - attrQueryRequestAux.setConsent(super.getSamlCoreProperties() - .getConsentAuthnRequest()); - - final Issuer issuer = SAMLEngineUtils.generateIssuer(); - - //Set the subject - needed for attribute query validation - Subject subject = SAMLEngineUtils.generateSubject(); - SubjectConfirmationBuilder builder = new SubjectConfirmationBuilder(); - SubjectConfirmation subjectConfirmation = builder.buildObject(); - subjectConfirmation.setMethod("urn:oasis:names:tc:SAML:2.0:cm:bearer"); - subject.getSubjectConfirmations().add(subjectConfirmation); - attrQueryRequestAux.setSubject(subject); - - if(request.getIssuer()!=null){ - issuer.setValue(request.getIssuer()); - } else { - issuer.setValue(super.getSamlCoreProperties().getRequester()); - } - - // Optional STORK - final String formatEntity = super.getSamlCoreProperties() - .getFormatEntity(); - if (StringUtils.isNotBlank(formatEntity)) { - issuer.setFormat(formatEntity); - } - - attrQueryRequestAux.setIssuer(issuer); - - // Generate stork extensions. - final Extensions storkExtensions = this - .generateSTORKAttrExtensions(request); - // add the extensions to the SAMLAuthnRequest - attrQueryRequestAux.setExtensions(storkExtensions); - - // the result contains an authentication request token (byte[]), - // identifier of the token, and all parameters from the request. - final STORKAttrQueryRequest attrQueryRequest = processAttrExtensions(attrQueryRequestAux - .getExtensions()); - - try { - attrQueryRequest.setTokenSaml(super.signAndMarshall(attrQueryRequestAux)); - } catch (SAMLEngineException e) { - LOG.error("Sign and Marshall.", e); - throw new STORKSAMLEngineException(e); - } - - attrQueryRequest.setSamlId(attrQueryRequestAux.getID()); - attrQueryRequest.setDestination(attrQueryRequestAux.getDestination()); - - attrQueryRequest.setIssuer(attrQueryRequestAux.getIssuer().getValue()); - - return attrQueryRequest; - } - - /** - * Generate stork attribute query response. - * - * @param request the request - * @param responseAttrQueryReq the response authentication request - * @param ipAddress the IP address - * @param isHashing the is hashing - * - * @return the sTORK authentication response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryResponse generateSTORKAttrQueryResponse( - final STORKAttrQueryRequest request, - final STORKAttrQueryResponse responseAttrQueryReq, final String ipAddress, - final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException { - LOG.info("generateSTORKAttrQueryResponse"); - - // Validate parameters - validateParamAttrQueryResponse(request, responseAttrQueryReq); - - // Mandatory SAML - LOG.debug("Generate StatusCode"); - final StatusCode statusCode = SAMLEngineUtils - .generateStatusCode(StatusCode.SUCCESS_URI); - - LOG.debug("Generate Status"); - final Status status = SAMLEngineUtils.generateStatus(statusCode); - - LOG.debug("Generate StatusMessage"); - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .generateStatusMessage(StatusCode.SUCCESS_URI); - - status.setStatusMessage(statusMessage); - - LOG.debug("Generate Response"); - - // RESPONSE - final Response response = genAuthnRespBase(status, destinationUrl, - request.getSamlId()); - - DateTime notOnOrAfter = new DateTime(); - - notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() - .getTimeNotOnOrAfter()); - - final Assertion assertion = this.generateAssertion(ipAddress, "" - ,request.getSamlId(), request.getIssuer(), notOnOrAfter); - - final AttributeStatement attrStatement = this - .generateAttributeStatement(responseAttrQueryReq - .getPersonalAttributeList(), isHashing); - - assertion.getAttributeStatements().add(attrStatement); - - // Add assertions - response.getAssertions().add(assertion); - - final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); - - try { - attrQueryResponse.setTokenSaml(super.signAndMarshall(response)); - attrQueryResponse.setSamlId(response.getID()); - } catch (SAMLEngineException e) { - LOG.error("Sign and Marshall.", e); - throw new STORKSAMLEngineException(e); - } - return attrQueryResponse; - } - - /** - * Generate stork attribute query response fail. - * - * @param request the request - * @param response the response - * @param ipAddress the IP address - * @param isHashing the is hashing - * - * @return the STORK attribute query response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryResponse generateSTORKAttrQueryResponseFail( - final STORKAttrQueryRequest request, final STORKAttrQueryResponse response, - final String ipAddress, final String destinationUrl, final boolean isHashing) - throws STORKSAMLEngineException { - LOG.info("generateSTORKAttrQueryResponseFail"); - - validateParamAttrQueryResponseFail(request, response); - - // Mandatory - final StatusCode statusCode = SAMLEngineUtils - .generateStatusCode(response.getStatusCode()); - - // Mandatory SAML - LOG.debug("Generate StatusCode."); - // Subordinate code it's optional in case not covered into next codes: - // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed - // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue - // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy - // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied - // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported - - if (StringUtils.isNotBlank(response.getSubStatusCode())) { - final StatusCode newStatusCode = SAMLEngineUtils - .generateStatusCode(response.getSubStatusCode()); - statusCode.setStatusCode(newStatusCode); - } - - LOG.debug("Generate Status."); - final Status status = SAMLEngineUtils.generateStatus(statusCode); - - if (StringUtils.isNotBlank(response.getMessage())) { - final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils - .generateStatusMessage(response.getMessage()); - - status.setStatusMessage(statusMessage); - } - - LOG.debug("Generate Response."); - // RESPONSE - final Response responseFail = genAuthnRespBase(status, destinationUrl, - request.getSamlId()); - - DateTime notOnOrAfter = new DateTime(); - - notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() - .getTimeNotOnOrAfter()); - - final Assertion assertion = this.generateAssertion(ipAddress, "", - request.getSamlId(), request - .getIssuer(), notOnOrAfter); - - responseFail.getAssertions().add(assertion); - - LOG.debug("Sign and Marshall ResponseFail."); - - final STORKAttrQueryResponse storkResponse = new STORKAttrQueryResponse(); - - try { - storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); - storkResponse.setSamlId(responseFail.getID()); - } catch (SAMLEngineException e) { - LOG.error("SAMLEngineException.", e); - throw new STORKSAMLEngineException(e); - } - return storkResponse; - } - - /** - * Generate stork authentication statement for the authentication statement. - * - * @param ipAddress the IP address - * - * @return the authentication statement - */ - private AuthnStatement generateStorkAuthStatement(final String ipAddress) { - LOG.debug("Generate stork authenticate statement."); - final SubjectLocality subjectLocality = SAMLEngineUtils - .generateSubjectLocality(ipAddress); - - final AuthnContext authnContext = (AuthnContext) SAMLEngineUtils - .createSamlObject(AuthnContext.DEFAULT_ELEMENT_NAME); - - final AuthnContextDecl authnContextDecl = (AuthnContextDecl) SAMLEngineUtils - .createSamlObject(AuthnContextDecl.DEFAULT_ELEMENT_NAME); - - authnContext.setAuthnContextDecl(authnContextDecl); - - final AuthnStatement authnStatement = SAMLEngineUtils - .generateAthnStatement(new DateTime(), authnContext); - - // Optional STORK - authnStatement.setSessionIndex(null); - authnStatement.setSubjectLocality(subjectLocality); - - return authnStatement; - } - - /** - * Generate stork extensions. - * - * @param request the request - * - * @return the extensions - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Extensions generateSTORKExtensions(final STORKAuthnRequest request) - throws STORKSAMLEngineException { - LOG.debug("Generate STORKExtensions"); - - final Extensions extensions = SAMLEngineUtils.generateExtension(); - - LOG.debug("Generate QAAAttribute"); - final QAAAttribute qaaAttribute = SAMLEngineUtils - .generateQAAAttribute(request.getQaa()); - extensions.getUnknownXMLObjects().add(qaaAttribute); - - - if (StringUtils.isNotEmpty(request - .getSpSector())) { - // Add information about service provider. - LOG.debug("Generate SPSector"); - final SPSector sector = SAMLEngineUtils.generateSPSector(request - .getSpSector()); - extensions.getUnknownXMLObjects().add(sector); - } - - //Delete from specification. Kept for compatibility with Provider Name value - LOG.debug("Generate SPInstitution"); - final SPInstitution institution = SAMLEngineUtils - .generateSPInstitution(request.getProviderName()); - extensions.getUnknownXMLObjects().add(institution); - - - if (StringUtils.isNotEmpty(request.getSpApplication())) { - LOG.debug("Generate SPApplication"); - final SPApplication application = SAMLEngineUtils - .generateSPApplication(request.getSpApplication()); - extensions.getUnknownXMLObjects().add(application); - } - - if (StringUtils.isNotEmpty(request.getSpCountry())) { - LOG.debug("Generate SPCountry"); - final SPCountry country = SAMLEngineUtils.generateSPCountry(request - .getSpCountry()); - extensions.getUnknownXMLObjects().add(country); - } - - //eIDSectorShare: optional; default value: false. - String valueSectorShare = super.getSamlCoreProperties() - .iseIDSectorShare(); - - if (StringUtils.isNotEmpty(valueSectorShare)) { - // Add information about the use of the SAML message. - LOG.debug("Generate EIDSectorShare"); - final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils - .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); - - eIdSectorShare.setEIDSectorShare(String.valueOf(Boolean.valueOf(valueSectorShare))); - - extensions.getUnknownXMLObjects().add(eIdSectorShare); - } - - String valueCrossSectorShare = super.getSamlCoreProperties() - .iseIDCrossSectorShare(); - - if (StringUtils.isNotEmpty(valueCrossSectorShare)) { - LOG.debug("Generate EIDCrossSectorShare"); - final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils - .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); - eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(Boolean.valueOf(valueCrossSectorShare))); - extensions.getUnknownXMLObjects().add(eIdCrossSecShare); - } - - - String valueCrossBorderShare = super.getSamlCoreProperties() - .iseIDCrossBorderShare(); - - if (StringUtils.isNotEmpty(valueCrossBorderShare)) { - LOG.debug("Generate EIDCrossBorderShare"); - final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils - .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); - eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(Boolean.valueOf(valueCrossBorderShare))); - extensions.getUnknownXMLObjects().add(eIdCrossBordShare); - } - - - // Add information about requested attributes. - LOG.debug("Generate RequestedAttributes."); - final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils - .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); - - LOG.debug("SAML Engine configuration properties load."); - final Iterator iterator = request - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - - final PersonalAttribute attribute = iterator.next(); - - if (attribute == null || StringUtils.isBlank(attribute.getName())) { - LOG.error(ATTRIBUTE_EMPTY_LITERAL); - throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); - } - - // Verified if exits the attribute name. - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.debug("Attribute name: {} was not found.", attribute - .getName()); - throw new STORKSAMLEngineException("Attribute name: " - + attribute.getName() + " was not found."); - } - - // Friendly name it's an optional attribute. - String friendlyName = null; - - if (super.getSamlCoreProperties().isFriendlyName()) { - friendlyName = attribute.getName(); - } - - - String isRequired = null; - if (super.getSamlCoreProperties().isRequired()) { - isRequired = String.valueOf(attribute.isRequired()); - } - - - LOG.debug("Generate requested attribute: " + attributeName); - final RequestedAttribute requestedAttr = SAMLEngineUtils - .generateReqAuthnAttributeSimple(attributeName, - friendlyName, isRequired, attribute - .getValue()); - - // Add requested attribute. - reqAttributes.getAttributes().add(requestedAttr); - } - - // Add requested attributes. - extensions.getUnknownXMLObjects().add(reqAttributes); - - CitizenCountryCode citizenCountryCode = null; - if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ - LOG.debug("Generate CitizenCountryCode"); - citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils - .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); - - citizenCountryCode.setCitizenCountryCode(request - .getCitizenCountryCode().toUpperCase()); - } - - SPID spid = null; - if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { - LOG.debug("Generate SPID"); - spid = (SPID) SAMLEngineUtils - .createSamlObject(SPID.DEF_ELEMENT_NAME); - - spid.setSPID(request.getSPID().toUpperCase()); - } - - AuthenticationAttributes authenticationAttr = (AuthenticationAttributes) SAMLEngineUtils - .createSamlObject(AuthenticationAttributes.DEF_ELEMENT_NAME); - - final VIDPAuthenticationAttributes vIDPauthenticationAttr = (VIDPAuthenticationAttributes) SAMLEngineUtils - .createSamlObject(VIDPAuthenticationAttributes.DEF_ELEMENT_NAME); - - final SPInformation spInformation = (SPInformation) SAMLEngineUtils - .createSamlObject(SPInformation.DEF_ELEMENT_NAME); - - if(citizenCountryCode!=null){ - vIDPauthenticationAttr.setCitizenCountryCode(citizenCountryCode); - } - - if(spid!=null){ - spInformation.setSPID(spid); - } - - vIDPauthenticationAttr.setSPInformation(spInformation); - - authenticationAttr - .setVIDPAuthenticationAttributes(vIDPauthenticationAttr); - extensions.getUnknownXMLObjects().add(authenticationAttr); - - - return extensions; - - } - - /** - * Generate stork extensions. - * - * @param request the attribute query request - * - * @return the extensions - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Extensions generateSTORKAttrExtensions(final STORKAttrQueryRequest request) - throws STORKSAMLEngineException { - LOG.debug("Generate STORKExtensions"); - - final Extensions extensions = SAMLEngineUtils.generateExtension(); - - LOG.debug("Generate QAAAttribute"); - final QAAAttribute qaaAttribute = SAMLEngineUtils - .generateQAAAttribute(request.getQaa()); - extensions.getUnknownXMLObjects().add(qaaAttribute); - - - if (StringUtils.isNotEmpty(request - .getSpSector())) { - // Add information about service provider. - LOG.debug("Generate SPSector"); - final SPSector sector = SAMLEngineUtils.generateSPSector(request - .getSpSector()); - extensions.getUnknownXMLObjects().add(sector); - } - - - if (StringUtils.isNotEmpty(request.getSpApplication())) { - LOG.debug("Generate SPApplication"); - final SPApplication application = SAMLEngineUtils - .generateSPApplication(request.getSpApplication()); - extensions.getUnknownXMLObjects().add(application); - } - - if (StringUtils.isNotEmpty(request.getSpCountry())) { - LOG.debug("Generate SPCountry"); - final SPCountry country = SAMLEngineUtils.generateSPCountry(request - .getSpCountry()); - extensions.getUnknownXMLObjects().add(country); - } - - final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils - .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME); - - eIdSectorShare.setEIDSectorShare(String.valueOf(request.isEIDSectorShare())); - - extensions.getUnknownXMLObjects().add(eIdSectorShare); - - final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils - .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); - eIdCrossSecShare.setEIDCrossSectorShare(String.valueOf(request.isEIDCrossSectorShare())); - extensions.getUnknownXMLObjects().add(eIdCrossSecShare); - - final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils - .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); - eIdCrossBordShare.setEIDCrossBorderShare(String.valueOf(request.isEIDCrossBorderShare())); - extensions.getUnknownXMLObjects().add(eIdCrossBordShare); - - - // Add information about requested attributes. - LOG.debug("Generate RequestedAttributes."); - final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils - .createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME); - - LOG.debug("SAML Engine configuration properties load."); - final Iterator iterator = request - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - - final PersonalAttribute attribute = iterator.next(); - - if (attribute == null || StringUtils.isBlank(attribute.getName())) { - LOG.error(ATTRIBUTE_EMPTY_LITERAL); - throw new STORKSAMLEngineException(ATTRIBUTE_EMPTY_LITERAL); - } - - // Verified if exits the attribute name. - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.debug("Attribute name: {} was not found.", attribute - .getName()); - throw new STORKSAMLEngineException("Attribute name: " - + attribute.getName() + " was not found."); - } - - // Friendly name it's an optional attribute. - String friendlyName = null; - - if (super.getSamlCoreProperties().isFriendlyName()) { - friendlyName = attribute.getName(); - } - - - String isRequired = null; - if (super.getSamlCoreProperties().isRequired()) { - isRequired = String.valueOf(attribute.isRequired()); - } - - - LOG.debug("Generate requested attribute: " + attributeName); - final RequestedAttribute requestedAttr = SAMLEngineUtils - .generateReqAuthnAttributeSimple(attributeName, - friendlyName, isRequired, attribute - .getValue()); - - // Add requested attribute. - reqAttributes.getAttributes().add(requestedAttr); - } - - // Add requested attributes. - extensions.getUnknownXMLObjects().add(reqAttributes); - - CitizenCountryCode citizenCountryCode = null; - if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){ - LOG.debug("Generate CitizenCountryCode"); - citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils - .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME); - - citizenCountryCode.setCitizenCountryCode(request - .getCitizenCountryCode().toUpperCase()); - } - - SPID spid = null; - if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) { - LOG.debug("Generate SPID"); - spid = (SPID) SAMLEngineUtils - .createSamlObject(SPID.DEF_ELEMENT_NAME); - - spid.setSPID(request.getSPID().toUpperCase()); - } - - - return extensions; - - } - - /** - * Gets the alias from X.509 Certificate at keystore. - * - * @param keyInfo the key info - * @param storkOwnKeyStore - * @param storkOwnKeyStore - * - * @return the alias - */ - private String getAlias(final KeyInfo keyInfo, KeyStore storkOwnKeyStore) { - - LOG.debug("Recover alias information"); - - String alias = null; - try { - final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo - .getX509Datas().get(0).getX509Certificates().get(0); - - // Transform the KeyInfo to X509Certificate. - CertificateFactory certFact; - certFact = CertificateFactory.getInstance("X.509"); - - final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 - .decode(xmlCert.getValue())); - - final X509Certificate cert = (X509Certificate) certFact - .generateCertificate(bis); - - final String tokenSerialNumber = cert.getSerialNumber().toString(16); - final X509Principal tokenIssuerDN = new X509Principal(cert.getIssuerDN().getName()); - - - String aliasCert; - X509Certificate certificate; - boolean find = false; - - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements() - && !find; ) { - aliasCert = e.nextElement(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - - final String serialNum = certificate.getSerialNumber() - .toString(16); - - X509Principal issuerDN = new X509Principal(certificate - .getIssuerDN().getName()); - - if(serialNum.equalsIgnoreCase(tokenSerialNumber) - && X509PrincipalUtil.equals2(issuerDN, tokenIssuerDN)){ - alias = aliasCert; - find = true; - } - - } - - } catch (KeyStoreException e) { - LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); - } catch (CertificateException e) { - LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); - } catch (RuntimeException e) { - LOG.error("Procces getAlias from certificate associated into the signing keystore..", e); - } - return alias; - } - - /** - * Gets the country from X.509 Certificate. - * - * @param keyInfo the key info - * - * @return the country - */ - private String getCountry(final KeyInfo keyInfo) { - LOG.debug("Recover country information."); - - String result = ""; - try { - final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo - .getX509Datas().get(0).getX509Certificates().get(0); - - // Transform the KeyInfo to X509Certificate. - CertificateFactory certFact; - certFact = CertificateFactory.getInstance("X.509"); - - final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 - .decode(xmlCert.getValue())); - - final X509Certificate cert = (X509Certificate) certFact - .generateCertificate(bis); - - String distName = cert.getSubjectDN().toString(); - - distName = StringUtils.deleteWhitespace(StringUtils - .upperCase(distName)); - - final String countryCode = "C="; - final int init = distName.indexOf(countryCode); - - if (init > StringUtils.INDEX_NOT_FOUND) { // Exist country code. - int end = distName.indexOf(',', init); - - if (end <= StringUtils.INDEX_NOT_FOUND) { - end = distName.length(); - } - - if (init < end && end > StringUtils.INDEX_NOT_FOUND) { - result = distName.substring(init + countryCode.length(), - end); - //It must be a two characters value - if(result.length()>2){ - result = result.substring(0, 2); - } - } - } - - } catch (CertificateException e) { - LOG.error("Procces getCountry from certificate."); - } - return result.trim(); - } - - /** - * Process all elements XMLObjects from the extensions. - * - * @param extensions the extensions from the authentication request. - * - * @return the STORK authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private STORKAuthnRequest processExtensions(final Extensions extensions) - throws STORKSAMLEngineException { - LOG.debug("Procces the extensions."); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - final QAAAttribute qaa = (QAAAttribute) extensions - .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); - request.setQaa(Integer.parseInt(qaa.getQaaLevel())); - - List optionalElements = extensions.getUnknownXMLObjects( - SPSector.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( - SPSector.DEF_ELEMENT_NAME).get(0); - request.setSpSector(sector.getSPSector()); - } - - optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPApplication application = (SPApplication) extensions - .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); - request.setSpApplication(application.getSPApplication()); - } - - optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPCountry application = (SPCountry) extensions - .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); - request.setSpCountry(application.getSPCountry()); - } - - - List listCrossBorderShare = extensions - .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); - - if (!listCrossBorderShare .isEmpty()) { - final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); - request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare - .getEIDCrossBorderShare())); - } - - - List listCrosSectorShare = extensions - .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); - - if (!listCrosSectorShare.isEmpty()) { - final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); - request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare - .getEIDCrossSectorShare())); - } - - List listSectorShareExtension = extensions - .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); - if (!listSectorShareExtension.isEmpty()) { - final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); - request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); - } - - - - List authAttrs = extensions - .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); - - if (authAttrs != null && !authAttrs.isEmpty()) { - - final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs - .get(0); - - VIDPAuthenticationAttributes vidpAuthnAttr = null; - if (authnAttr != null && !authAttrs.isEmpty()){ - vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); - } - - CitizenCountryCode citizenCountryCodeElement = null; - SPInformation spInformation = null; - if (vidpAuthnAttr != null){ - citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); - spInformation = vidpAuthnAttr.getSPInformation(); - } - - String citizenCountryCode = null; - if(citizenCountryCodeElement!=null){ - citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); - } - - if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ - request.setCitizenCountryCode(citizenCountryCode); - } - - SPID spidElement = null; - if (spInformation != null){ - spidElement = spInformation.getSPID(); - } - - String spid = null; - if(spidElement!=null){ - spid = spidElement.getSPID(); - } - - if (spid != null && StringUtils.isNotBlank(spid)) { - request.setSPID(spid); - } - } - - if (extensions - .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { - LOG.error("Extensions not contains any requested attribute."); - throw new STORKSAMLEngineException( - "Extensions not contains any requested attribute."); - } - - final RequestedAttributes requestedAttr = (RequestedAttributes) extensions - .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) - .get(0); - - final List reqAttrs = requestedAttr.getAttributes(); - - final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); - - String attributeName; - for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { - final RequestedAttribute attribute = reqAttrs.get(nextAttribute); - final PersonalAttribute personalAttribute = new PersonalAttribute(); - personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); - personalAttribute.setFriendlyName(attribute.getFriendlyName()); - attributeName = attribute.getName(); - - // recover the last name from the string. - personalAttribute.setName(attributeName.substring(attributeName - .lastIndexOf('/') + 1)); - - final ArrayList valores = new ArrayList(); - final List values = attribute.getOrderedChildren(); - - for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { - - // Process attributes simples. An AuthenticationRequest only - // must contains simple values. - - final XMLObject xmlObject = values.get(nextSimpleValue); - - if(xmlObject instanceof XSStringImpl){ - - final XSStringImpl xmlString = (XSStringImpl) values - .get(nextSimpleValue); - valores.add(xmlString.getValue()); - - }else{ - - if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextSimpleValue); - - TransformerFactory transFactory = TransformerFactory.newInstance(); - Transformer transformer = null; - try { - transformer = transFactory.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - } catch (TransformerConfigurationException e) { - LOG.error("Error transformer configuration exception", e); - } - StringWriter buffer = new StringWriter(); - try { - if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ - transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), - new StreamResult(buffer)); - } - } catch (TransformerException e) { - LOG.error("Error transformer exception", e); - } - String str = buffer.toString(); - - valores.add(str); - - }else{ - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextSimpleValue); - valores.add(xmlString.getTextContent()); - } - - - - } - } - personalAttribute.setValue(valores); - personalAttrList.add(personalAttribute); - } - - request.setPersonalAttributeList(personalAttrList); - - return request; - } - - - /** - * Process all elements XMLObjects from the extensions. - * - * @param extensions the extensions from the authentication request. - * - * @return the STORK authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private STORKAttrQueryRequest processAttrExtensions(final Extensions extensions) - throws STORKSAMLEngineException { - LOG.debug("Procces the atribute query extensions."); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - final QAAAttribute qaa = (QAAAttribute) extensions - .getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME).get(0); - request.setQaa(Integer.parseInt(qaa.getQaaLevel())); - - List optionalElements = extensions.getUnknownXMLObjects( - SPSector.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPSector sector = (SPSector) extensions.getUnknownXMLObjects( - SPSector.DEF_ELEMENT_NAME).get(0); - request.setSpSector(sector.getSPSector()); - } - - optionalElements = extensions.getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPApplication application = (SPApplication) extensions - .getUnknownXMLObjects(SPApplication.DEF_ELEMENT_NAME).get(0); - request.setSpApplication(application.getSPApplication()); - } - - optionalElements = extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME); - - if (!optionalElements.isEmpty()) { - final SPCountry application = (SPCountry) extensions - .getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0); - request.setSpCountry(application.getSPCountry()); - } - - - List listCrossBorderShare = extensions - .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME); - - if (!listCrossBorderShare .isEmpty()) { - final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0); - request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare - .getEIDCrossBorderShare())); - } - - - List listCrosSectorShare = extensions - .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME); - - if (!listCrosSectorShare.isEmpty()) { - final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0); - request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare - .getEIDCrossSectorShare())); - } - - List listSectorShareExtension = extensions - .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME); - if (!listSectorShareExtension.isEmpty()) { - final EIDSectorShare sectorShare = (EIDSectorShare) listSectorShareExtension.get(0); - request.setEIDSectorShare(Boolean.parseBoolean(sectorShare.getEIDSectorShare())); - } - - - - List authAttrs = extensions - .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME); - - if (authAttrs != null && !authAttrs.isEmpty()) { - - final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs - .get(0); - - VIDPAuthenticationAttributes vidpAuthnAttr = null; - if (authnAttr != null && !authAttrs.isEmpty()){ - vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes(); - } - - CitizenCountryCode citizenCountryCodeElement = null; - SPInformation spInformation = null; - if (vidpAuthnAttr != null){ - citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode(); - spInformation = vidpAuthnAttr.getSPInformation(); - } - - String citizenCountryCode = null; - if(citizenCountryCodeElement!=null){ - citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode(); - } - - if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){ - request.setCitizenCountryCode(citizenCountryCode); - } - - SPID spidElement = null; - if (spInformation != null){ - spidElement = spInformation.getSPID(); - } - - String spid = null; - if(spidElement!=null){ - spid = spidElement.getSPID(); - } - - if (spid != null && StringUtils.isNotBlank(spid)) { - request.setSPID(spid); - } - } - - if (extensions - .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) { - LOG.error("Extensions not contains any requested attribute."); - throw new STORKSAMLEngineException( - "Extensions not contains any requested attribute."); - } - - final RequestedAttributes requestedAttr = (RequestedAttributes) extensions - .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) - .get(0); - - final List reqAttrs = requestedAttr.getAttributes(); - - final IPersonalAttributeList personalAttrList = new PersonalAttributeList(); - - String attributeName; - for (int nextAttribute = 0; nextAttribute < reqAttrs.size(); nextAttribute++) { - final RequestedAttribute attribute = reqAttrs.get(nextAttribute); - final PersonalAttribute personalAttribute = new PersonalAttribute(); - personalAttribute.setIsRequired(Boolean.valueOf(attribute.isRequired())); - personalAttribute.setFriendlyName(attribute.getFriendlyName()); - attributeName = attribute.getName(); - - // recover the last name from the string. - personalAttribute.setName(attributeName.substring(attributeName - .lastIndexOf('/') + 1)); - - final ArrayList valores = new ArrayList(); - final List values = attribute.getOrderedChildren(); - - for (int nextSimpleValue = 0; nextSimpleValue < values.size(); nextSimpleValue++) { - - // Process attributes simples. An AuthenticationRequest only - // must contains simple values. - - final XMLObject xmlObject = values.get(nextSimpleValue); - - if(xmlObject instanceof XSStringImpl){ - - final XSStringImpl xmlString = (XSStringImpl) values - .get(nextSimpleValue); - valores.add(xmlString.getValue()); - - }else{ - - if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) { - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextSimpleValue); - - TransformerFactory transFactory = TransformerFactory.newInstance(); - Transformer transformer = null; - try { - transformer = transFactory.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - } catch (TransformerConfigurationException e) { - LOG.error("Error transformer configuration exception", e); - } - StringWriter buffer = new StringWriter(); - try { - if (xmlString != null && xmlString.getUnknownXMLObjects() != null && xmlString.getUnknownXMLObjects().size() > 0 ){ - transformer.transform(new DOMSource(xmlString.getUnknownXMLObjects().get(0).getDOM()), - new StreamResult(buffer)); - } - } catch (TransformerException e) { - LOG.error("Error transformer exception", e); - } - String str = buffer.toString(); - - valores.add(str); - - }else{ - - final XSAnyImpl xmlString = (XSAnyImpl) values - .get(nextSimpleValue); - valores.add(xmlString.getTextContent()); - } - - - - } - } - personalAttribute.setValue(valores); - personalAttrList.add(personalAttribute); - } - - request.setPersonalAttributeList(personalAttrList); - - return request; - } - - /** - * Sets the name spaces. - * - * @param tokenSaml the new name spaces - */ - private void setNameSpaces(final XMLObject tokenSaml) { - LOG.debug("Set namespaces."); - - final Namespace saml2 = new Namespace(SAMLConstants.SAML20_NS, - SAMLConstants.SAML20_PREFIX); - tokenSaml.addNamespace(saml2); - - final Namespace digSig = new Namespace( - "http://www.w3.org/2000/09/xmldsig#", "ds"); - tokenSaml.addNamespace(digSig); - - final Namespace storkp = new Namespace(SAMLCore.STORK10P_NS.getValue(), - SAMLCore.STORK10P_PREFIX.getValue()); - tokenSaml.addNamespace(storkp); - - final Namespace stork = new Namespace(SAMLCore.STORK10_NS.getValue(), - SAMLCore.STORK10_PREFIX.getValue()); - - tokenSaml.addNamespace(stork); - } - - /** - * Validate parameters from authentication request. - * - * @param request the request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamAuthnReq(final STORKAuthnRequest request) - throws STORKSAMLEngineException { - LOG.info("Validate parameters from authentication request."); - - // URL to which Authentication Response must be sent. - if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); - } - - // the name of the original service provider requesting the - // authentication. - if (StringUtils.isBlank(request.getProviderName())) { - throw new STORKSAMLEngineException( - "StorkSamlEngine: Service Provider it's mandatory."); - } - - // object that contain all attributes requesting. - if (request.getPersonalAttributeList() == null - || request.getPersonalAttributeList().isEmpty()) { - throw new STORKSAMLEngineException( - "attributeQueries is null or empty."); - } - - // Quality authentication assurance level. - if ((request.getQaa() < QAAAttribute.MIN_VALUE) - || (request.getQaa() > QAAAttribute.MAX_VALUE)) { - throw new STORKSAMLEngineException("Qaal: " + request.getQaa() - + ", is invalid."); - } - - } - - /** - * Validate parameters from authentication request. - * - * @param request the request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamAttrQueryReq(final STORKAttrQueryRequest request) - throws STORKSAMLEngineException { - LOG.info("Validate parameters from attribute query request."); - - // URL to which Authentication Response must be sent. - /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); - }*/ - - // the name of the original service provider requesting the - // authentication. - /*if (StringUtils.isBlank(request.getProviderName())) { - throw new STORKSAMLEngineException( - "StorkSamlEngine: Service Provider it's mandatory."); - }*/ - - // object that contain all attributes requesting. - if (request.getPersonalAttributeList() == null - || request.getPersonalAttributeList().isEmpty()) { - throw new STORKSAMLEngineException( - "attributeQueries is null or empty."); - } - - // Quality authentication assurance level. - if ((request.getQaa() < QAAAttribute.MIN_VALUE) - || (request.getQaa() > QAAAttribute.MAX_VALUE)) { - throw new STORKSAMLEngineException("Qaal: " + request.getQaa() - + ", is invalid."); - } - - } - - - /** - * Validate parameters from response. - * - * @param request the request - * @param responseAuthReq the response authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamResponse(final STORKAuthnRequest request, - final STORKAuthnResponse responseAuthReq) - throws STORKSAMLEngineException { - LOG.info("Validate parameters response."); - if (StringUtils.isBlank(request.getIssuer())) { - throw new STORKSAMLEngineException( - "Issuer must be not empty or null."); - } - - if (responseAuthReq.getPersonalAttributeList() == null - || responseAuthReq.getPersonalAttributeList().isEmpty()) { - LOG.error("PersonalAttributeList is null or empty."); - throw new STORKSAMLEngineException( - "PersonalAttributeList is null or empty."); - } - - if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "assertionConsumerServiceURL is null or empty."); - } - - if (StringUtils.isBlank(request.getSamlId())) { - throw new STORKSAMLEngineException("request ID is null or empty."); - } - } - - /** - * Validate parameters from response. - * - * @param request the request - * @param responseAttrQueryReq the response authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamAttrQueryResponse(final STORKAttrQueryRequest request, - final STORKAttrQueryResponse responseAttrQueryReq) - throws STORKSAMLEngineException { - LOG.info("Validate attribute querey parameters response."); - if (StringUtils.isBlank(request.getIssuer())) { - throw new STORKSAMLEngineException( - "Issuer must be not empty or null."); - } - - if (responseAttrQueryReq.getPersonalAttributeList() == null - || responseAttrQueryReq.getPersonalAttributeList().isEmpty()) { - LOG.error("PersonalAttributeList is null or empty."); - throw new STORKSAMLEngineException( - "PersonalAttributeList is null or empty."); - } - - /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "assertionConsumerServiceURL is null or empty."); - }*/ - - if (StringUtils.isBlank(request.getSamlId())) { - throw new STORKSAMLEngineException("request ID is null or empty."); - } - } - - /** - * Validate parameter from response fail. - * - * @param request the request - * @param response the response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamResponseFail(final STORKAuthnRequest request, - final STORKAuthnResponse response) throws STORKSAMLEngineException { - LOG.info("Validate parameters response fail."); - if (StringUtils.isBlank(response.getStatusCode())) { - throw new STORKSAMLEngineException("Code error it's null or empty."); - } - - if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { - throw new STORKSAMLEngineException( - "assertionConsumerServiceURL is null or empty."); - } - - if (StringUtils.isBlank(request.getSamlId())) { - throw new STORKSAMLEngineException("request ID is null or empty."); - } - } - - /** - * Validate parameter from response fail. - * - * @param request the request - * @param response the response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private void validateParamAttrQueryResponseFail(final STORKAttrQueryRequest request, - final STORKAttrQueryResponse response) throws STORKSAMLEngineException { - LOG.info("Validate parameters response fail."); - if (StringUtils.isBlank(response.getStatusCode())) { - throw new STORKSAMLEngineException("Code error it's null or empty."); - } - - if (StringUtils.isBlank(request.getSamlId())) { - throw new STORKSAMLEngineException("request ID is null or empty."); - } - } - - /** - * Validate stork authentication request. - * - * @param tokenSaml the token SAML - * - * @return the sTORK authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnRequest validateSTORKAuthnRequest(final byte[] tokenSaml) - throws STORKSAMLEngineException { - LOG.info("validateSTORKAuthnRequest"); - - final AuthnRequest samlRequest = (AuthnRequest) validateStorkSaml(tokenSaml); - - LOG.debug("Validate Extensions."); - final Validator validatorExt = new ExtensionsSchemaValidator(); - try { - validatorExt.validate(samlRequest.getExtensions()); - } catch (ValidationException e) { - LOG.error("ValidationException: validate Extensions.", e); - throw new STORKSAMLEngineException(e); - } - - LOG.debug("Generate STORKAuthnRequest."); - final STORKAuthnRequest authnRequest = processExtensions(samlRequest - .getExtensions()); - - authnRequest.setCountry(this.getCountry(samlRequest.getSignature() - .getKeyInfo())); - - authnRequest.setAlias(this.getAlias(samlRequest.getSignature() - .getKeyInfo(), super.getSigner().getTrustStore())); - - authnRequest.setSamlId(samlRequest.getID()); - authnRequest.setDestination(samlRequest.getDestination()); - authnRequest.setAssertionConsumerServiceURL(samlRequest - .getAssertionConsumerServiceURL()); - - authnRequest.setProviderName(samlRequest.getProviderName()); - authnRequest.setIssuer(samlRequest.getIssuer().getValue()); - - //Delete unknown elements from requested ones - final Iterator iterator = authnRequest.getPersonalAttributeList().iterator(); - IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) authnRequest.getPersonalAttributeList(); - while (iterator.hasNext()) { - - final PersonalAttribute attribute = iterator.next(); - - // Verify if the attribute name exits. - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); - cleanPerAttrList.remove(attribute.getName()); - } - - } - authnRequest.setPersonalAttributeList(cleanPerAttrList); - - return authnRequest; - - } - - /** - * Validate stork authentication request. - * - * @param tokenSaml the token SAML - * - * @return the sTORK authentication request - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryRequest validateSTORKAttrQueryRequest(final byte[] tokenSaml) - throws STORKSAMLEngineException { - LOG.info("validateSTORKAttrQueryRequest"); - - final AttributeQuery samlRequest = (AttributeQuery) validateStorkSaml(tokenSaml); - - LOG.debug("Validate Extensions."); - final Validator validatorExt = new ExtensionsSchemaValidator(); - try { - validatorExt.validate(samlRequest.getExtensions()); - } catch (ValidationException e) { - LOG.error("ValidationException: validate Extensions.", e); - throw new STORKSAMLEngineException(e); - } - - LOG.debug("Generate STORKAttrQueryRequest."); - final STORKAttrQueryRequest attrRequest = processAttrExtensions(samlRequest - .getExtensions()); - - attrRequest.setCountry(this.getCountry(samlRequest.getSignature() - .getKeyInfo())); - - attrRequest.setAlias(this.getAlias(samlRequest.getSignature() - .getKeyInfo(), super.getSigner().getTrustStore())); - - attrRequest.setSamlId(samlRequest.getID()); - attrRequest.setDestination(samlRequest.getDestination()); - /*attrRequest.setAssertionConsumerServiceURL(samlRequest - .getAssertionConsumerServiceURL()); - - authnRequest.setProviderName(samlRequest.getProviderName());*/ - attrRequest.setIssuer(samlRequest.getIssuer().getValue()); - - //Delete unknown elements from requested ones - final Iterator iterator = attrRequest.getPersonalAttributeList().iterator(); - IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) attrRequest.getPersonalAttributeList(); - while (iterator.hasNext()) { - - final PersonalAttribute attribute = iterator.next(); - - // Verify if the attribute name exits. - final String attributeName = super.getSamlCoreProperties() - .getProperty(attribute.getName()); - - if (StringUtils.isBlank(attributeName)) { - LOG.info("Attribute name: {} was not found. It will be removed from the request object", attribute.getName()); - cleanPerAttrList.remove(attribute.getName()); - } - - } - attrRequest.setPersonalAttributeList(cleanPerAttrList); - - return attrRequest; - - } - - /** - * Validate stork authentication response. - * - * @param tokenSaml the token SAML - * @param userIP the user IP - * - * @return the Stork authentication response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAuthnResponse validateSTORKAuthnResponse( - final byte[] tokenSaml, final String userIP) - throws STORKSAMLEngineException { - - LOG.info("validateSTORKAuthnResponse"); - final Response samlResponse = (Response) validateStorkSaml(tokenSaml); - - LOG.debug("Create StorkAuthResponse."); - final STORKAuthnResponse authnResponse = new STORKAuthnResponse(); - - authnResponse.setCountry(this.getCountry(samlResponse.getSignature() - .getKeyInfo())); - - LOG.debug("Set ID."); - authnResponse.setSamlId(samlResponse.getID()); - LOG.debug("Set InResponseTo."); - authnResponse.setInResponseTo(samlResponse.getInResponseTo()); - LOG.debug("Set statusCode."); - authnResponse.setStatusCode(samlResponse.getStatus().getStatusCode() - .getValue()); - - // Subordinate code. - if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { - authnResponse.setSubStatusCode(samlResponse.getStatus() - .getStatusCode().getStatusCode().getValue()); - } - - if (samlResponse.getStatus().getStatusMessage() != null) { - LOG.debug("Set statusMessage."); - authnResponse.setMessage(samlResponse.getStatus() - .getStatusMessage().getMessage()); - } - - LOG.debug("validateStorkResponse"); - final Assertion assertion = (Assertion) validateStorkResponse( - samlResponse, userIP); - - if(assertion!=null){ - final DateTime serverDate = new DateTime(); - - if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { - LOG.error("Token date expired (getNotOnOrAfter = " - + assertion.getConditions().getNotOnOrAfter() - + ", server_date: " + serverDate + ")"); - throw new STORKSAMLEngineException( - "Token date expired (getNotOnOrAfter = " - + assertion.getConditions().getNotOnOrAfter() - + " ), server_date: " + serverDate); - } - - LOG.debug("Set notOnOrAfter."); - authnResponse.setNotOnOrAfter(assertion.getConditions() - .getNotOnOrAfter()); - - LOG.debug("Set notBefore."); - authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); - - authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); - - authnResponse.setAudienceRestriction(((AudienceRestriction) assertion - .getConditions().getAudienceRestrictions().get(0)) - .getAudiences().get(0).getAudienceURI()); - } - - // Case no error. - if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(authnResponse - .getStatusCode())) { - LOG.debug("Status Success. Set PersonalAttributeList."); - authnResponse - .setPersonalAttributeList(generatePersonalAttributeList(assertion)); - authnResponse.setFail(false); - } else { - LOG.debug("Status Fail."); - authnResponse.setFail(true); - } - LOG.debug("Return result."); - return authnResponse; - - } - - /** - * Validate stork attribute query response. - * - * @param tokenSaml the token SAML - * @param userIP the user IP - * - * @return the Stork attribute query response - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public STORKAttrQueryResponse validateSTORKAttrQueryResponse( - final byte[] tokenSaml, final String userIP) - throws STORKSAMLEngineException { - - LOG.info("validateSTORKAttrQueryResponse"); - final Response samlResponse = (Response) validateStorkSaml(tokenSaml); - - LOG.debug("Create StorkAttrQueryResponse."); - final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); - - attrQueryResponse.setCountry(this.getCountry(samlResponse.getSignature() - .getKeyInfo())); - - LOG.debug("Set ID."); - attrQueryResponse.setSamlId(samlResponse.getID()); - LOG.debug("Set InResponseTo."); - attrQueryResponse.setInResponseTo(samlResponse.getInResponseTo()); - LOG.debug("Set statusCode."); - attrQueryResponse.setStatusCode(samlResponse.getStatus().getStatusCode() - .getValue()); - - // Subordinate code. - if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { - attrQueryResponse.setSubStatusCode(samlResponse.getStatus() - .getStatusCode().getStatusCode().getValue()); - } - - if (samlResponse.getStatus().getStatusMessage() != null) { - LOG.debug("Set statusMessage."); - attrQueryResponse.setMessage(samlResponse.getStatus() - .getStatusMessage().getMessage()); - } - - LOG.debug("validateStorkResponse"); - final Assertion assertion = (Assertion) validateStorkResponse( - samlResponse, userIP); - - if(assertion!=null){ - final DateTime serverDate = new DateTime(); - - if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { - LOG.error("Token date expired (getNotOnOrAfter = " - + assertion.getConditions().getNotOnOrAfter() - + ", server_date: " + serverDate + ")"); - throw new STORKSAMLEngineException( - "Token date expired (getNotOnOrAfter = " - + assertion.getConditions().getNotOnOrAfter() - + " ), server_date: " + serverDate); - } - - LOG.debug("Set notOnOrAfter."); - attrQueryResponse.setNotOnOrAfter(assertion.getConditions() - .getNotOnOrAfter()); - - LOG.debug("Set notBefore."); - attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); - - attrQueryResponse.setNotBefore(assertion.getConditions().getNotBefore()); - - attrQueryResponse.setAudienceRestriction(((AudienceRestriction) assertion - .getConditions().getAudienceRestrictions().get(0)) - .getAudiences().get(0).getAudienceURI()); - } - - // Case no error. - if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(attrQueryResponse - .getStatusCode())) { - LOG.debug("Status Success. Set PersonalAttributeList."); - attrQueryResponse - .setPersonalAttributeList(generatePersonalAttributeList(assertion)); - attrQueryResponse.setFail(false); - } else { - LOG.debug("Status Fail."); - attrQueryResponse.setFail(true); - } - LOG.debug("Return result."); - return attrQueryResponse; - - } - - /** - * Validate stork response. - * - * @param samlResponse the SAML response - * @param userIP the user IP - * - * @return the assertion - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private Assertion validateStorkResponse(final Response samlResponse, - final String userIP) throws STORKSAMLEngineException { - // Exist only one Assertion - - if (samlResponse.getAssertions() == null - || samlResponse.getAssertions().isEmpty()) { - LOG.info("Assertion is null or empty."); //in replace of throw new STORKSAMLEngineException("Assertion is null or empty.") - return null; - } - - final Assertion assertion = (Assertion) samlResponse.getAssertions() - .get(0); - - LOG.debug("Verified method Bearer"); - for (final Iterator iter = assertion.getSubject() - .getSubjectConfirmations().iterator(); iter.hasNext();) { - final SubjectConfirmation element = iter.next(); - final boolean isBearer = SubjectConfirmation.METHOD_BEARER - .equals(element.getMethod()); - - final boolean ipValidate = super.getSamlCoreProperties() - .isIpValidation(); - - if (ipValidate) { - if (isBearer) { - if (StringUtils.isBlank(userIP)) { - LOG.error("browser_ip is null or empty."); - throw new STORKSAMLEngineException( - "browser_ip is null or empty."); - } else if (StringUtils.isBlank(element - .getSubjectConfirmationData().getAddress())) { - LOG.error("token_ip attribute is null or empty."); - throw new STORKSAMLEngineException( - "token_ip attribute is null or empty."); - } - } - - final boolean ipEqual = element.getSubjectConfirmationData() - .getAddress().equals(userIP); - - // Validation ipUser - if (!ipEqual && ipValidate) { - LOG.error("SubjectConfirmation BEARER: "); - throw new STORKSAMLEngineException( - "IPs doesn't match : token_ip (" - + element.getSubjectConfirmationData() - .getAddress() + ") browser_ip (" - + userIP + ")"); - } - } - - } - return assertion; - } - - /** - * Validate stork SAML. - * - * @param tokenSaml the token SAML - * - * @return the signable SAML object - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - private SignableSAMLObject validateStorkSaml(final byte[] tokenSaml) - throws STORKSAMLEngineException { - - LOG.info("Validate StorkSaml message."); - - if (tokenSaml == null) { - LOG.error("Saml authentication request is null."); - throw new STORKSAMLEngineException( - "Saml authentication request is null."); - } - - LOG.debug("Generate AuthnRequest from request."); - SignableSAMLObject samlObject; - - try { - samlObject = (SignableSAMLObject) super.unmarshall(tokenSaml); - } catch (SAMLEngineException e) { - LOG.error("SAMLEngineException unmarshall.", e); - throw new STORKSAMLEngineException(e); - } - - boolean validateSign = true; - - if (StringUtils.isNotBlank(super.getSamlCoreProperties().getProperty( - "validateSignature"))) { - validateSign = Boolean.valueOf(super.getSamlCoreProperties() - .getProperty("validateSignature")); - } - - if (validateSign) { - LOG.debug("Validate Signature."); - try { - super.validateSignature(samlObject); - } catch (SAMLEngineException e) { - LOG.error("SAMLEngineException validateSignature.", e); - throw new STORKSAMLEngineException(e); - } - } - - LOG.debug("Validate Schema."); - final ValidatorSuite validatorSuite = Configuration - .getValidatorSuite("saml2-core-schema-validator"); - try { - validatorSuite.validate(samlObject); - } catch (ValidationException e) { - LOG.error("ValidationException.", e); - throw new STORKSAMLEngineException(e); - } - - return samlObject; - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base deleted file mode 100644 index e38cc5f0b..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/X509PrincipalUtil.java.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -package eu.stork.peps.auth.engine; - -import org.bouncycastle.asn1.DERObjectIdentifier; -import org.bouncycastle.jce.X509Principal; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Utility class used to decrease complexity of comparison of 2 X509principal - * - * @author vanegdi - * @version $Revision: 1.00 $, $Date: 2013-05-24 20:53:51 $ - */ -public final class X509PrincipalUtil{ - - private static final DERObjectIdentifier[] DER_OBJECT_IDENTIFIERS_ARRAY= { - X509Principal.CN, - X509Principal.OU, - X509Principal.O, - X509Principal.L, - X509Principal.ST, - X509Principal.C, - X509Principal.E - }; - - private static final Logger LOG = LoggerFactory.getLogger(eu.stork.peps.auth.engine.X509PrincipalUtil.class); - - /** - * Compares 2 X509Principals to detect if they equals - * @param principal1 - * @param principal2 - * @return true if arguments are not null and equals - */ - public static boolean equals(X509Principal principal1, X509Principal principal2) { - boolean continueProcess = true; - if (principal1 == null || principal2 == null){ - return false; - } - - int cpt = 0; - while(continueProcess && cpt < DER_OBJECT_IDENTIFIERS_ARRAY.length){ - continueProcess = continueProcess && x509ValuesByIdentifierEquals(principal1, principal2, DER_OBJECT_IDENTIFIERS_ARRAY[cpt]); - cpt++; - } - return continueProcess; - } - - public static boolean equals2(X509Principal principal1, X509Principal principal2) { - - if (principal1 == null || principal2 == null){ - return false; - } - - if (principal1.getName().equals(principal2.getName())) - return true; - else - return false; - - } - - private static boolean x509ValuesByIdentifierEquals(X509Principal principal1, X509Principal principal2, DERObjectIdentifier identifier){ - return principal1.getValues(identifier).equals(principal2.getValues(identifier)); - } - - private X509PrincipalUtil(){ - // default contructor - LOG.error("Fake X509PrincipalUtil : never be called"); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index d3e353e51..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Provides the classes necessary to create a SAML message. - */ -package eu.stork.peps.auth.engine; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java index f8f50fc74..48718242b 100644 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java @@ -50,8 +50,11 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; import eu.stork.peps.auth.engine.core.SAMLEngineSignI; import eu.stork.peps.auth.engine.core.STORKSAMLCore; +import eu.stork.peps.auth.engine.core.impl.CustomAttributeQueryMarshaller; +import eu.stork.peps.auth.engine.core.impl.CustomAttributeQueryUnmarshaller; import eu.stork.peps.auth.engine.core.impl.SignModuleFactory; import eu.stork.peps.configuration.ConfigurationCreator; import eu.stork.peps.configuration.ConfigurationReader; @@ -237,7 +240,7 @@ public class SAMLEngine { * @return the SAML core properties */ protected final STORKSAMLCore getSamlCoreProperties() { - return samlCore; + return samlCore; } /** @@ -259,7 +262,11 @@ public class SAMLEngine { final MarshallerFactory marshallerFactory = Configuration .getMarshallerFactory(); - final Marshaller marshaller = marshallerFactory + final Marshaller marshaller; + if (samlToken.getElementQName().toString().endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME)) + marshaller = new CustomAttributeQueryMarshaller(); + else + marshaller = marshallerFactory .getMarshaller(samlToken); docBuilder = dbf.newDocumentBuilder(); @@ -326,9 +333,9 @@ public class SAMLEngine { */ protected final byte[] signAndMarshall(final SignableSAMLObject samlToken) throws SAMLEngineException { - LOG.debug("Marshall Saml Token."); - SignableSAMLObject signElement = sign(samlToken); - return marshall(signElement); + LOG.debug("Marshall Saml Token."); + SignableSAMLObject signElement = sign(samlToken); + return marshall(signElement); } /** @@ -362,7 +369,11 @@ public class SAMLEngine { final UnmarshallerFactory unmarshallerFact = Configuration.getUnmarshallerFactory(); // Unmarshall using the SAML Token root element if (unmarshallerFact != null && root != null){ - final Unmarshaller unmarshaller = unmarshallerFact.getUnmarshaller(root); + final Unmarshaller unmarshaller; + if (root.getLocalName().equals(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME)) + unmarshaller = new CustomAttributeQueryUnmarshaller(); + else + unmarshaller = unmarshallerFact.getUnmarshaller(root); try { return unmarshaller.unmarshall(root); } catch (NullPointerException e){ diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java index 60f7c3091..c77cc700a 100644 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java @@ -46,6 +46,8 @@ import org.opensaml.saml2.core.AuthnContext; import org.opensaml.saml2.core.AuthnRequest; import org.opensaml.saml2.core.AuthnStatement; import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.LogoutRequest; +import org.opensaml.saml2.core.LogoutResponse; import org.opensaml.saml2.core.NameID; import org.opensaml.saml2.core.Response; import org.opensaml.saml2.core.Status; @@ -65,6 +67,7 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.xml.sax.SAXException; +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; import eu.stork.peps.auth.engine.core.QAAAttribute; import eu.stork.peps.auth.engine.core.RequestedAttribute; import eu.stork.peps.auth.engine.core.SAMLCore; @@ -72,6 +75,7 @@ import eu.stork.peps.auth.engine.core.SPApplication; import eu.stork.peps.auth.engine.core.SPCountry; import eu.stork.peps.auth.engine.core.SPInstitution; import eu.stork.peps.auth.engine.core.SPSector; +import eu.stork.peps.auth.engine.core.impl.CustomAttributeQueryBuilder; import eu.stork.peps.exceptions.STORKSAMLEngineException; import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; @@ -190,8 +194,16 @@ public final class SAMLEngineUtils { * @return the XML object */ public static XMLObject createSamlObject(final QName qname) { - return Configuration.getBuilderFactory().getBuilder(qname).buildObject( - qname); + if (qname.toString().endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME)) + { + CustomAttributeQueryBuilder builder = new CustomAttributeQueryBuilder(); + return builder.buildObject(qname); + } + else + { + return Configuration.getBuilderFactory().getBuilder(qname).buildObject( + qname); + } } /** @@ -612,17 +624,57 @@ public final class SAMLEngineUtils { return authnRequest; } - public static AttributeQuery generateSAMLAttrQueryRequest(final String identifier, + /*public static AttributeQuery generateSAMLAttrQueryRequest(final String identifier, final SAMLVersion version, final DateTime issueInstant) { LOG.debug("Generate attribute query request."); final AttributeQuery attrQueryRequest = (AttributeQuery) SAMLEngineUtils .createSamlObject(AttributeQuery.DEFAULT_ELEMENT_NAME); + attrQueryRequest.setID(identifier); + attrQueryRequest.setVersion(version); + attrQueryRequest.setIssueInstant(issueInstant); + return attrQueryRequest; + }*/ + + public static CustomAttributeQuery generateSAMLAttrQueryRequest(final String identifier, + final SAMLVersion version, final DateTime issueInstant) { + LOG.debug("Generate attribute query request."); + final CustomAttributeQuery attrQueryRequest = (CustomAttributeQuery) SAMLEngineUtils + .createSamlObject(CustomAttributeQuery.DEFAULT_ELEMENT_NAME); + attrQueryRequest.setID(identifier); attrQueryRequest.setVersion(version); attrQueryRequest.setIssueInstant(issueInstant); return attrQueryRequest; } + + public static LogoutRequest generateSAMLLogoutRequest(final String identifier, + final SAMLVersion version, final DateTime issueInstant) { + LOG.debug("Generate logout request."); + final LogoutRequest logoutRequest = (LogoutRequest)SAMLEngineUtils. + createSamlObject(LogoutRequest.DEFAULT_ELEMENT_NAME); + + + logoutRequest.setID(identifier); + logoutRequest.setVersion(version); + logoutRequest.setIssueInstant(issueInstant); + return logoutRequest; + } + + public static LogoutResponse generateSAMLLogoutResponse(final String identifier, + final SAMLVersion version, final DateTime issueInstant, + final Status status, final String inResponseTo) { + LOG.debug("Generate logout response."); + final LogoutResponse logoutResponse = (LogoutResponse)SAMLEngineUtils. + createSamlObject(LogoutResponse.DEFAULT_ELEMENT_NAME); + + logoutResponse.setInResponseTo(inResponseTo); + logoutResponse.setStatus(status); + logoutResponse.setID(identifier); + logoutResponse.setVersion(version); + logoutResponse.setIssueInstant(issueInstant); + return logoutResponse; + } /** * Generate service provider application. diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java index 3cac2f637..20ebb709d 100644 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java @@ -64,6 +64,8 @@ import org.opensaml.saml2.core.AuthnRequest; import org.opensaml.saml2.core.AuthnStatement; import org.opensaml.saml2.core.Conditions; import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.LogoutRequest; +import org.opensaml.saml2.core.LogoutResponse; import org.opensaml.saml2.core.NameID; import org.opensaml.saml2.core.OneTimeUse; import org.opensaml.saml2.core.Response; @@ -82,6 +84,7 @@ import org.opensaml.xml.schema.impl.XSAnyBuilder; import org.opensaml.xml.schema.impl.XSAnyImpl; import org.opensaml.xml.schema.impl.XSAnyMarshaller; import org.opensaml.xml.schema.impl.XSAnyUnmarshaller; +import org.opensaml.xml.schema.impl.XSDateTimeImpl; import org.opensaml.xml.schema.impl.XSStringImpl; import org.opensaml.xml.signature.KeyInfo; import org.opensaml.xml.util.Base64; @@ -100,8 +103,12 @@ import eu.stork.peps.auth.commons.STORKAttrQueryRequest; import eu.stork.peps.auth.commons.STORKAttrQueryResponse; import eu.stork.peps.auth.commons.STORKAuthnRequest; import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.commons.STORKLogoutRequest; +import eu.stork.peps.auth.commons.STORKLogoutResponse; import eu.stork.peps.auth.engine.core.AuthenticationAttributes; import eu.stork.peps.auth.engine.core.CitizenCountryCode; +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; +import eu.stork.peps.auth.engine.core.CustomRequestAbstractType; import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; import eu.stork.peps.auth.engine.core.EIDSectorShare; @@ -122,6 +129,7 @@ import eu.stork.peps.auth.engine.core.impl.AuthenticationAttributesUnmarshaller; import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeBuilder; import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeMarshaller; import eu.stork.peps.auth.engine.core.impl.CitizenCountryCodeUnmarshaller; +import eu.stork.peps.auth.engine.core.impl.CustomAttributeQueryUnmarshaller; import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareBuilder; import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareMarshaller; import eu.stork.peps.auth.engine.core.impl.EIDCrossBorderShareUnmarshaller; @@ -161,6 +169,7 @@ import eu.stork.peps.auth.engine.core.impl.SPSectorUnmarshaller; import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesBuilder; import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesMarshaller; import eu.stork.peps.auth.engine.core.impl.VIDPAuthenticationAttributesUnmarshaller; +import eu.stork.peps.auth.engine.core.validator.CustomAttributeQueryValidator; import eu.stork.peps.auth.engine.core.validator.ExtensionsSchemaValidator; import eu.stork.peps.auth.engine.core.validator.QAAAttributeSchemaValidator; import eu.stork.peps.exceptions.SAMLEngineException; @@ -806,8 +815,7 @@ public final class STORKSAMLEngine extends SAMLEngine { final XMLObject xmlObject = values.get(nextValue); if (xmlObject instanceof XSStringImpl) { - - // Process simple value. + simpleValues.add(((XSStringImpl) xmlObject).getValue()); } else if (xmlObject instanceof XSAnyImpl) { @@ -841,10 +849,9 @@ public final class STORKSAMLEngine extends SAMLEngine { simpleValues.add(str); - } else if (attributeName - .equals("http://www.stork.gov.eu/1.0/canonicalResidenceAddress")) + } else if (isComplex(xmlObject)) { - LOG.info("canonicalResidenceAddress found"); + LOG.info(attributeName + " found"); // Process complex value. final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; @@ -859,61 +866,7 @@ public final class STORKSAMLEngine extends SAMLEngine { .getLocalPart(), simple.getTextContent()); } - } - else if (attributeName - .equals("http://www.stork.gov.eu/1.0/newAttribute2")) - { - LOG.info("newAttribute2 found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - } - else if (attributeName - .equals("http://www.stork.gov.eu/1.0/hasDegree")) - { - LOG.info("hasDegree found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - } - else if(attributeName - .equals("http://www.stork.gov.eu/1.0/mandateContent")) - { - LOG.info("mandateContent found"); - // Process complex value. - final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; - - for (int nextComplexValue = 0; nextComplexValue < complexValue - .getUnknownXMLObjects().size(); nextComplexValue++) { - - final XSAnyImpl simple = (XSAnyImpl) complexValue - .getUnknownXMLObjects().get( - nextComplexValue); - - multiValues.put(simple.getElementQName() - .getLocalPart(), simple.getTextContent()); - } - } + } else { // Process simple value. simpleValues.add(((XSAnyImpl) xmlObject) @@ -1102,6 +1055,99 @@ public final class STORKSAMLEngine extends SAMLEngine { } return authresponse; } + + /** + * Generate stork authentication response. + * + * @param request the request + * @param responseAuthReq the response authentication request + * @param ipAddress the IP address + * @param isHashing the is hashing + * + * @return the sTORK authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse generateSTORKAuthnResponseAfterQuery( + final STORKAuthnRequest request, + final STORKAuthnResponse responseAuthReq, final String ipAddress, + final boolean isHashing, List res) throws STORKSAMLEngineException { + LOG.info("generateSTORKAuthnResponse"); + + // Validate parameters + validateParamResponse(request, responseAuthReq); + + // Mandatory SAML + LOG.debug("Generate StatusCode"); + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(StatusCode.SUCCESS_URI); + + LOG.debug("Generate Status"); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + LOG.debug("Generate StatusMessage"); + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(StatusCode.SUCCESS_URI); + + status.setStatusMessage(statusMessage); + + LOG.debug("Generate Response"); + + // RESPONSE + final Response response = genAuthnRespBase(status, request + .getAssertionConsumerServiceURL(), request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, request + .getAssertionConsumerServiceURL(), request.getSamlId(), request + .getIssuer(), notOnOrAfter); + + final AttributeStatement attrStatement = this + .generateAttributeStatement(responseAuthReq + .getPersonalAttributeList(), isHashing); + + assertion.getAttributeStatements().add(attrStatement); + + // Add assertions + response.getAssertions().add(assertion); + // Check for response queries + if (res != null && res.size() > 0) + { + //Iterate through them + for (int i = 0; i < res.size(); i++) + { + //If response contains multiple assertions iterate through them as well + if (res.get(i).getAssertions().size() > 1) + { + for (int j = 0; j < res.get(i).getAssertions().size(); j++) + { + Assertion tempAssertion = res.get(i).getAssertions().get(j); + tempAssertion.setParent(response); + response.getAssertions().add(tempAssertion); + } + } else { + Assertion tempAssertion = res.get(i).getAssertion(); + tempAssertion.setParent(response); + response.getAssertions().add(tempAssertion); + } + } + } + + final STORKAuthnResponse authresponse = new STORKAuthnResponse(); + + try { + authresponse.setTokenSaml(super.signAndMarshall(response)); + authresponse.setSamlId(response.getID()); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + return authresponse; + } /** * Generate stork authentication response fail. @@ -1199,7 +1245,8 @@ public final class STORKSAMLEngine extends SAMLEngine { // Validate Parameters mandatories validateParamAttrQueryReq(request); - final AttributeQuery attrQueryRequestAux = SAMLEngineUtils + //final AttributeQuery attrQueryRequestAux = SAMLEngineUtils + final CustomAttributeQuery attrQueryRequestAux = SAMLEngineUtils .generateSAMLAttrQueryRequest(SAMLEngineUtils.generateNCName(), SAMLVersion.VERSION_20, SAMLEngineUtils .getCurrentTime()); @@ -1214,6 +1261,12 @@ public final class STORKSAMLEngine extends SAMLEngine { if (StringUtils.isNotBlank(request.getDestination())) { attrQueryRequestAux.setDestination(request.getDestination()); } + + // Add parameter optional STORK + // Consumer URL is needed if using HTTP-Post + if (StringUtils.isNotBlank(request.getAssertionConsumerServiceURL())) { + attrQueryRequestAux.setAssertionConsumerServiceURL(request.getAssertionConsumerServiceURL()); + } // Consent is optional. Set from SAMLEngine.xml - consent. attrQueryRequestAux.setConsent(super.getSamlCoreProperties() @@ -1264,7 +1317,7 @@ public final class STORKSAMLEngine extends SAMLEngine { attrQueryRequest.setSamlId(attrQueryRequestAux.getID()); attrQueryRequest.setDestination(attrQueryRequestAux.getDestination()); - + attrQueryRequest.setAssertionConsumerServiceURL(attrQueryRequestAux.getAssertionConsumerServiceURL()); attrQueryRequest.setIssuer(attrQueryRequestAux.getIssuer().getValue()); return attrQueryRequest; @@ -1274,9 +1327,9 @@ public final class STORKSAMLEngine extends SAMLEngine { * Generate stork attribute query response. * * @param request the request - * @param responseAttrQueryReq the response authentication request + * @param responseAttrQueryRes the response authentication request * @param ipAddress the IP address - * @param isHashing the is hashing + * @param isHashing the hashing of values * * @return the sTORK authentication response * @@ -1284,12 +1337,12 @@ public final class STORKSAMLEngine extends SAMLEngine { */ public STORKAttrQueryResponse generateSTORKAttrQueryResponse( final STORKAttrQueryRequest request, - final STORKAttrQueryResponse responseAttrQueryReq, final String ipAddress, + final STORKAttrQueryResponse responseAttrQueryRes, final String ipAddress, final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException { LOG.info("generateSTORKAttrQueryResponse"); // Validate parameters - validateParamAttrQueryResponse(request, responseAttrQueryReq); + validateParamAttrQueryResponse(request, responseAttrQueryRes); // Mandatory SAML LOG.debug("Generate StatusCode"); @@ -1320,7 +1373,7 @@ public final class STORKSAMLEngine extends SAMLEngine { ,request.getSamlId(), request.getIssuer(), notOnOrAfter); final AttributeStatement attrStatement = this - .generateAttributeStatement(responseAttrQueryReq + .generateAttributeStatement(responseAttrQueryRes .getPersonalAttributeList(), isHashing); assertion.getAttributeStatements().add(attrStatement); @@ -1340,6 +1393,86 @@ public final class STORKSAMLEngine extends SAMLEngine { return attrQueryResponse; } + /** + * Generate stork attribute query response from multiple assertions + * + * @param request the request + * @param responseAttrQueryRes the response to the query request + * @param responses the responses to include in the response (aggregation) + * @param ipAddress the IP address + * @param isHashing the hashing of values + * + * @return the sTORK attribute query response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAttrQueryResponse generateSTORKAttrQueryResponseWithAssertions( + final STORKAttrQueryRequest request, final STORKAttrQueryResponse responseAttrQueryRes, + final List responses, final String ipAddress, + final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException { + LOG.info("generateSTORKAttrQueryResponse"); + + // Validate parameters + validateParamAttrQueryResponse(request, responseAttrQueryRes); + + // Mandatory SAML + LOG.debug("Generate StatusCode"); + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(StatusCode.SUCCESS_URI); + + LOG.debug("Generate Status"); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + LOG.debug("Generate StatusMessage"); + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(StatusCode.SUCCESS_URI); + + status.setStatusMessage(statusMessage); + + LOG.debug("Generate Response"); + + // RESPONSE + final Response response = genAuthnRespBase(status, destinationUrl, + request.getSamlId()); + + DateTime notOnOrAfter = new DateTime(); + + notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties() + .getTimeNotOnOrAfter()); + + final Assertion assertion = this.generateAssertion(ipAddress, "" + ,request.getSamlId(), request.getIssuer(), notOnOrAfter); + + final AttributeStatement attrStatement = this + .generateAttributeStatement(responseAttrQueryRes + .getPersonalAttributeList(), isHashing); + + assertion.getAttributeStatements().add(attrStatement); + + // Add the assertions from the former Query responses + response.getAssertions().add(assertion); + if (responses != null && responses.size() > 0) + { + for (int i = 0; i < responses.size(); i++) + { + Assertion tempAssertion = responses.get(i).getAssertion(); + tempAssertion.setParent(response); + response.getAssertions().add(tempAssertion); + } + } + + final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse(); + + try { + attrQueryResponse.setTokenSaml(super.signAndMarshall(response)); + attrQueryResponse.setSamlId(response.getID()); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + return attrQueryResponse; + } + /** * Generate stork attribute query response fail. * @@ -1403,20 +1536,298 @@ public final class STORKSAMLEngine extends SAMLEngine { request.getSamlId(), request .getIssuer(), notOnOrAfter); - responseFail.getAssertions().add(assertion); + responseFail.getAssertions().add(assertion); + + LOG.debug("Sign and Marshall ResponseFail."); + + final STORKAttrQueryResponse storkResponse = new STORKAttrQueryResponse(); + + try { + storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); + storkResponse.setSamlId(responseFail.getID()); + } catch (SAMLEngineException e) { + LOG.error("SAMLEngineException.", e); + throw new STORKSAMLEngineException(e); + } + return storkResponse; + } + + /** + * Generate stork logout request. + * + * @param request the request that contain all parameters for generate an + * logout request. + * + * @return the STORK logout request that has been processed. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKLogoutRequest generateSTORKLogoutRequest( + final STORKLogoutRequest request) throws STORKSAMLEngineException { + LOG.info("Generate STORKLogoutRequest."); + + // Validate Parameters mandatories + validateParamLogoutReq(request); + + final LogoutRequest logoutRequestAux = SAMLEngineUtils + .generateSAMLLogoutRequest(SAMLEngineUtils.generateNCName(), + SAMLVersion.VERSION_20, SAMLEngineUtils + .getCurrentTime()); + + // Set name spaces. + setNameSpaces(logoutRequestAux); + + + // Add parameter optional STORK + // Destination is mandatory if the destination is a C-PEPS + // The application must to know if the destination is a C-PEPS. + if (StringUtils.isNotBlank(request.getDestination())) { + logoutRequestAux.setDestination(request.getDestination()); + } + + // Consent is optional. Set from SAMLEngine.xml - consent. + logoutRequestAux.setConsent(super.getSamlCoreProperties() + .getConsentAuthnRequest()); + + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + + + if(request.getIssuer()!=null){ + issuer.setValue(request.getIssuer()); + } else { + issuer.setValue(super.getSamlCoreProperties().getRequester()); + } + + // Optional STORK + final String formatEntity = super.getSamlCoreProperties() + .getFormatEntity(); + if (StringUtils.isNotBlank(formatEntity)) { + issuer.setFormat(formatEntity); + } + + logoutRequestAux.setIssuer(issuer); + + // Set the name ID + final NameID newNameID = SAMLEngineUtils.generateNameID(); + newNameID.setValue(request.getSpProvidedId()); + logoutRequestAux.setNameID(newNameID); + + + // the result contains an authentication request token (byte[]), + // identifier of the token, and all parameters from the request. + final STORKLogoutRequest logoutRequest = new STORKLogoutRequest(); + + try { + logoutRequest.setTokenSaml(super.signAndMarshall(logoutRequestAux)); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + + logoutRequest.setSamlId(logoutRequestAux.getID()); + logoutRequest.setDestination(logoutRequestAux.getDestination()); + logoutRequest.setIssuer(logoutRequestAux.getIssuer().getValue()); + logoutRequest.setSpProvidedId(logoutRequestAux.getNameID().getValue()); + + return logoutRequest; + } + + + /** + * Generate stork logout response. + * @param request the request thats being responded to + * @param response the tesponse that contain all parameters for generate an + * logout request. + * + * @return the STORK logout response that has been processed. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKLogoutResponse generateSTORKLogoutResponse( + final STORKLogoutRequest request, + final STORKLogoutResponse response) throws STORKSAMLEngineException { + LOG.info("Generate STORKLogoutResponse."); + + // Validate Parameters mandatories + validateParamLogoutRes(request, response); + + // Mandatory SAML + LOG.debug("Generate StatusCode"); + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(StatusCode.SUCCESS_URI); + + LOG.debug("Generate Status"); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + LOG.debug("Generate StatusMessage"); + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(StatusCode.SUCCESS_URI); + + status.setStatusMessage(statusMessage); + + final LogoutResponse logoutResponseAux= SAMLEngineUtils + .generateSAMLLogoutResponse(SAMLEngineUtils.generateNCName(), + SAMLVersion.VERSION_20, SAMLEngineUtils + .getCurrentTime(), status, request.getSamlId()); + + // Set name spaces. + setNameSpaces(logoutResponseAux); + + + // Add parameter optional STORK + // Destination is mandatory if the destination is a C-PEPS + // The application must to know if the destination is a C-PEPS. + if (StringUtils.isNotBlank(response.getDestination())) { + logoutResponseAux.setDestination(response.getDestination()); + } + + // Consent is optional. Set from SAMLEngine.xml - consent. + logoutResponseAux.setConsent(super.getSamlCoreProperties() + .getConsentAuthnRequest()); + + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + + + if(response.getIssuer()!=null){ + issuer.setValue(response.getIssuer()); + } else { + issuer.setValue(super.getSamlCoreProperties().getRequester()); + } + + // Optional STORK + final String formatEntity = super.getSamlCoreProperties() + .getFormatEntity(); + if (StringUtils.isNotBlank(formatEntity)) { + issuer.setFormat(formatEntity); + } + + logoutResponseAux.setIssuer(issuer); + + + // the result contains an authentication request token (byte[]), + // identifier of the token, and all parameters from the request. + final STORKLogoutResponse logoutResponse = new STORKLogoutResponse(); + + try { + logoutResponse.setTokenSaml(super.signAndMarshall(logoutResponseAux)); + } catch (SAMLEngineException e) { + LOG.error("Sign and Marshall.", e); + throw new STORKSAMLEngineException(e); + } + + logoutResponse.setSamlId(logoutResponseAux.getID()); + logoutResponse.setDestination(logoutResponseAux.getDestination()); + logoutResponse.setIssuer(logoutResponseAux.getIssuer().getValue()); + logoutResponse.setStatusCode(logoutResponseAux.getStatus().getStatusCode().toString()); + logoutResponse.setStatusMessage(logoutResponseAux.getStatus().getStatusMessage().toString()); + + return logoutResponse; + } + + /** + * Generate failed stork logout response. + * + * @param response the response that contain all parameters for generate an + * logout request. + * + * @return the STORK logout response that has been processed. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKLogoutResponse generateSTORKLogoutResponseFail( + final STORKLogoutRequest request, + final STORKLogoutResponse response ) throws STORKSAMLEngineException { + LOG.info("Generate STORKLogoutResponse."); + + // Validate Parameters mandatories + validateParamLogoutResFail(request, response); + + // Mandatory + final StatusCode statusCode = SAMLEngineUtils + .generateStatusCode(response.getStatusCode()); + + // Mandatory SAML + LOG.debug("Generate StatusCode."); + // Subordinate code it's optional in case not covered into next codes: + // - urn:oasis:names:tc:SAML:2.0:status:AuthnFailed + // - urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue + // - urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy + // - urn:oasis:names:tc:SAML:2.0:status:RequestDenied + // - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported + + if (StringUtils.isNotBlank(response.getSubStatusCode())) { + final StatusCode newStatusCode = SAMLEngineUtils + .generateStatusCode(response.getSubStatusCode()); + statusCode.setStatusCode(newStatusCode); + } + + LOG.debug("Generate Status."); + final Status status = SAMLEngineUtils.generateStatus(statusCode); + + if (StringUtils.isNotBlank(response.getStatusMessage())) { + final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils + .generateStatusMessage(response.getStatusMessage()); + + status.setStatusMessage(statusMessage); + } + + final LogoutResponse logoutResponseAux= SAMLEngineUtils + .generateSAMLLogoutResponse(SAMLEngineUtils.generateNCName(), + SAMLVersion.VERSION_20, SAMLEngineUtils + .getCurrentTime(), status, request.getSamlId()); + + // Set name spaces. + setNameSpaces(logoutResponseAux); + + + // Add parameter optional STORK + // Destination is mandatory if the destination is a C-PEPS + // The application must to know if the destination is a C-PEPS. + if (StringUtils.isNotBlank(response.getDestination())) { + logoutResponseAux.setDestination(response.getDestination()); + } + + // Consent is optional. Set from SAMLEngine.xml - consent. + logoutResponseAux.setConsent(super.getSamlCoreProperties() + .getConsentAuthnRequest()); - LOG.debug("Sign and Marshall ResponseFail."); + final Issuer issuer = SAMLEngineUtils.generateIssuer(); + + + if(response.getIssuer()!=null){ + issuer.setValue(response.getIssuer()); + } else { + issuer.setValue(super.getSamlCoreProperties().getRequester()); + } - final STORKAttrQueryResponse storkResponse = new STORKAttrQueryResponse(); + // Optional STORK + final String formatEntity = super.getSamlCoreProperties() + .getFormatEntity(); + if (StringUtils.isNotBlank(formatEntity)) { + issuer.setFormat(formatEntity); + } + + logoutResponseAux.setIssuer(issuer); + + + // the result contains an authentication request token (byte[]), + // identifier of the token, and all parameters from the request. + final STORKLogoutResponse logoutResponse = new STORKLogoutResponse(); try { - storkResponse.setTokenSaml(super.signAndMarshall(responseFail)); - storkResponse.setSamlId(responseFail.getID()); + logoutResponse.setTokenSaml(super.signAndMarshall(logoutResponseAux)); } catch (SAMLEngineException e) { - LOG.error("SAMLEngineException.", e); + LOG.error("Sign and Marshall.", e); throw new STORKSAMLEngineException(e); } - return storkResponse; + + logoutResponse.setSamlId(logoutResponseAux.getID()); + logoutResponse.setDestination(logoutResponseAux.getDestination()); + logoutResponse.setIssuer(logoutResponseAux.getIssuer().getValue()); + logoutResponse.setStatusCode(logoutResponseAux.getStatus().getStatusCode().toString()); + logoutResponse.setStatusMessage(logoutResponseAux.getStatus().getStatusMessage().toString()); + + return logoutResponse; } /** @@ -2392,7 +2803,7 @@ public final class STORKSAMLEngine extends SAMLEngine { } /** - * Validate parameters from authentication request. + * Validate parameters from attribute query request. * * @param request the request. * @@ -2402,18 +2813,23 @@ public final class STORKSAMLEngine extends SAMLEngine { throws STORKSAMLEngineException { LOG.info("Validate parameters from attribute query request."); - // URL to which Authentication Response must be sent. - /*if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { + // URL to which AP Response must be sent. + if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) { throw new STORKSAMLEngineException( "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); - }*/ + } - // the name of the original service provider requesting the - // authentication. - /*if (StringUtils.isBlank(request.getProviderName())) { + // Destination of the request - not mandatory + /*if (StringUtils.isBlank(request.getDestination())) { throw new STORKSAMLEngineException( - "StorkSamlEngine: Service Provider it's mandatory."); + "StorkSamlEngine: Destination is mandatory."); }*/ + + // SP country is empty + if (StringUtils.isBlank(request.getSpCountry())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: SP country is mandatory."); + } // object that contain all attributes requesting. if (request.getPersonalAttributeList() == null @@ -2428,7 +2844,70 @@ public final class STORKSAMLEngine extends SAMLEngine { throw new STORKSAMLEngineException("Qaal: " + request.getQaa() + ", is invalid."); } + } + + /** + * Validate parameters from logout request. + * + * @param request the request. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamLogoutReq(final STORKLogoutRequest request) + throws STORKSAMLEngineException { + LOG.info("Validate parameters from logout request."); + + // URL to which AP Response must be sent. + /*if (StringUtils.isBlank(request.get())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Assertion Consumer Service URL it's mandatory."); + }*/ + + // Destination of the request + if (StringUtils.isBlank(request.getDestination())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Destination is mandatory."); + } + + // SP Provided Id + if (StringUtils.isBlank(request.getSpProvidedId())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: SP provided Id is mandatory."); + } + } + + /** + * Validate parameters from logout response. + * + * @param response the response. + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamLogoutRes(final STORKLogoutRequest request, + final STORKLogoutResponse response) throws STORKSAMLEngineException { + LOG.info("Validate parameters from logout request."); + + // Issuer is mandatory + if (StringUtils.isBlank(request.getIssuer())) { + throw new STORKSAMLEngineException( + "Issuer must be not empty or null."); + } + // Destination of the request + if (StringUtils.isBlank(response.getDestination())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: Destination is mandatory."); + } + + // SP Provided Id + if (StringUtils.isBlank(request.getSpProvidedId())) { + throw new STORKSAMLEngineException( + "StorkSamlEngine: SP provided Id is mandatory."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } } @@ -2544,6 +3023,32 @@ public final class STORKSAMLEngine extends SAMLEngine { throw new STORKSAMLEngineException("request ID is null or empty."); } } + + /** + * Validate parameter from response fail. + * + * @param request the request + * @param response the response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + private void validateParamLogoutResFail(final STORKLogoutRequest request, + final STORKLogoutResponse response) throws STORKSAMLEngineException { + LOG.info("Validate parameters response fail."); + + if (StringUtils.isBlank(request.getIssuer())) { + throw new STORKSAMLEngineException( + "Issuer must be not empty or null."); + } + + if (StringUtils.isBlank(response.getStatusCode())) { + throw new STORKSAMLEngineException("Code error it's null or empty."); + } + + if (StringUtils.isBlank(request.getSamlId())) { + throw new STORKSAMLEngineException("request ID is null or empty."); + } + } /** * Validate stork authentication request. @@ -2611,11 +3116,11 @@ public final class STORKSAMLEngine extends SAMLEngine { } /** - * Validate stork authentication request. + * Validate stork attribute query request. * * @param tokenSaml the token SAML * - * @return the sTORK authentication request + * @return the STORK attribute query request * * @throws STORKSAMLEngineException the STORKSAML engine exception */ @@ -2623,7 +3128,8 @@ public final class STORKSAMLEngine extends SAMLEngine { throws STORKSAMLEngineException { LOG.info("validateSTORKAttrQueryRequest"); - final AttributeQuery samlRequest = (AttributeQuery) validateStorkSaml(tokenSaml); + //final AttributeQuery samlRequest = (AttributeQuery) validateStorkSaml(tokenSaml); + final CustomRequestAbstractType samlRequest = (CustomRequestAbstractType) validateStorkSaml(tokenSaml); LOG.debug("Validate Extensions."); final Validator validatorExt = new ExtensionsSchemaValidator(); @@ -2646,10 +3152,10 @@ public final class STORKSAMLEngine extends SAMLEngine { attrRequest.setSamlId(samlRequest.getID()); attrRequest.setDestination(samlRequest.getDestination()); - /*attrRequest.setAssertionConsumerServiceURL(samlRequest + attrRequest.setAssertionConsumerServiceURL(samlRequest .getAssertionConsumerServiceURL()); - authnRequest.setProviderName(samlRequest.getProviderName());*/ + /*authnRequest.setProviderName(samlRequest.getProviderName());*/ attrRequest.setIssuer(samlRequest.getIssuer().getValue()); //Delete unknown elements from requested ones @@ -2674,6 +3180,50 @@ public final class STORKSAMLEngine extends SAMLEngine { return attrRequest; } + + /** + * Validate stork logout request. + * + * @param tokenSaml the token SAML + * + * @return the STORK logout request + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKLogoutRequest validateSTORKLogoutRequest(final byte[] tokenSaml) + throws STORKSAMLEngineException { + LOG.info("validateSTORKLogoutRequest"); + + final LogoutRequest samlRequest = (LogoutRequest)validateStorkSaml(tokenSaml); + + LOG.debug("Validate Extensions."); + final Validator validatorExt = new ExtensionsSchemaValidator(); + try { + validatorExt.validate(samlRequest.getExtensions()); + } catch (ValidationException e) { + LOG.error("ValidationException: validate Extensions.", e); + throw new STORKSAMLEngineException(e); + } + + LOG.debug("Generate STORKLogoutRequest."); + final STORKLogoutRequest logoutRequest = new STORKLogoutRequest(); + + logoutRequest.setCountry(this.getCountry(samlRequest.getSignature() + .getKeyInfo())); + + logoutRequest.setAlias(this.getAlias(samlRequest.getSignature() + .getKeyInfo(), super.getSigner().getTrustStore())); + + logoutRequest.setSamlId(samlRequest.getID()); + logoutRequest.setDestination(samlRequest.getDestination()); + + logoutRequest.setIssuer(samlRequest.getIssuer().getValue()); + + logoutRequest.setSpProvidedId(samlRequest.getNameID().getValue()); + + return logoutRequest; + + } /** * Validate stork authentication response. @@ -2718,6 +3268,97 @@ public final class STORKSAMLEngine extends SAMLEngine { .getStatusMessage().getMessage()); } + LOG.debug("validateStorkResponse"); + final Assertion assertion = (Assertion) validateStorkResponse( + samlResponse, userIP); + + if(assertion!=null){ + final DateTime serverDate = new DateTime(); + + if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { + LOG.error("Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + ", server_date: " + serverDate + ")"); + throw new STORKSAMLEngineException( + "Token date expired (getNotOnOrAfter = " + + assertion.getConditions().getNotOnOrAfter() + + " ), server_date: " + serverDate); + } + + LOG.debug("Set notOnOrAfter."); + authnResponse.setNotOnOrAfter(assertion.getConditions() + .getNotOnOrAfter()); + + LOG.debug("Set notBefore."); + authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + authnResponse.setNotBefore(assertion.getConditions().getNotBefore()); + + authnResponse.setAudienceRestriction(((AudienceRestriction) assertion + .getConditions().getAudienceRestrictions().get(0)) + .getAudiences().get(0).getAudienceURI()); + authnResponse.setAssertions(samlResponse.getAssertions()); + } + + // Case no error. + if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(authnResponse + .getStatusCode())) { + LOG.debug("Status Success. Set PersonalAttributeList."); + authnResponse + .setPersonalAttributeList(generatePersonalAttributeList(assertion)); + authnResponse.setFail(false); + } else { + LOG.debug("Status Fail."); + authnResponse.setFail(true); + } + LOG.debug("Return result."); + return authnResponse; + + } + + /** + * Validate stork authentication response. + * + * @param tokenSaml the token SAML + * @param userIP the user IP + * + * @return the Stork authentication response + * + * @throws STORKSAMLEngineException the STORKSAML engine exception + */ + public STORKAuthnResponse validateSTORKAuthnResponseWithQuery( + final byte[] tokenSaml, final String userIP) + throws STORKSAMLEngineException { + + LOG.info("validateSTORKAuthnResponse"); + final Response samlResponse = (Response) validateStorkSaml(tokenSaml); + + LOG.debug("Create StorkAuthResponse."); + final STORKAuthnResponse authnResponse = new STORKAuthnResponse(); + + authnResponse.setCountry(this.getCountry(samlResponse.getSignature() + .getKeyInfo())); + + LOG.debug("Set ID."); + authnResponse.setSamlId(samlResponse.getID()); + LOG.debug("Set InResponseTo."); + authnResponse.setInResponseTo(samlResponse.getInResponseTo()); + LOG.debug("Set statusCode."); + authnResponse.setStatusCode(samlResponse.getStatus().getStatusCode() + .getValue()); + + // Subordinate code. + if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { + authnResponse.setSubStatusCode(samlResponse.getStatus() + .getStatusCode().getStatusCode().getValue()); + } + + if (samlResponse.getStatus().getStatusMessage() != null) { + LOG.debug("Set statusMessage."); + authnResponse.setMessage(samlResponse.getStatus() + .getStatusMessage().getMessage()); + } + LOG.debug("validateStorkResponse"); final Assertion assertion = (Assertion) validateStorkResponse( samlResponse, userIP); @@ -2760,6 +3401,30 @@ public final class STORKSAMLEngine extends SAMLEngine { LOG.debug("Status Fail."); authnResponse.setFail(true); } + + authnResponse.setAssertions(samlResponse.getAssertions()); + if (samlResponse.getAssertions().size() > 1) + { + PersonalAttributeList total = new PersonalAttributeList(); + List attrList = new ArrayList(); + for (int i = 0; i < samlResponse.getAssertions().size(); i++) + { + Assertion tempAssertion = (Assertion)samlResponse.getAssertions().get(i); + IPersonalAttributeList temp = generatePersonalAttributeList(tempAssertion); + if (temp != null) + { + attrList.add(temp); + for (PersonalAttribute attribute : temp) { + PersonalAttribute attr = (PersonalAttribute)attribute.clone(); + attr.setName(attr.getName()+tempAssertion.getID()); + total.add(attr); + } + } + } + authnResponse.setPersonalAttributeLists(attrList); + authnResponse.setTotalPersonalAttributeList(total); + } + LOG.debug("Return result."); return authnResponse; @@ -2795,6 +3460,7 @@ public final class STORKSAMLEngine extends SAMLEngine { LOG.debug("Set statusCode."); attrQueryResponse.setStatusCode(samlResponse.getStatus().getStatusCode() .getValue()); + // Subordinate code. if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) { @@ -2815,6 +3481,8 @@ public final class STORKSAMLEngine extends SAMLEngine { if(assertion!=null){ final DateTime serverDate = new DateTime(); + attrQueryResponse.setAssertion(assertion); + if (assertion.getConditions().getNotOnOrAfter().isBefore(serverDate)) { LOG.error("Token date expired (getNotOnOrAfter = " + assertion.getConditions().getNotOnOrAfter() @@ -2850,6 +3518,30 @@ public final class STORKSAMLEngine extends SAMLEngine { LOG.debug("Status Fail."); attrQueryResponse.setFail(true); } + + attrQueryResponse.setAssertions(samlResponse.getAssertions()); + if (samlResponse.getAssertions().size() > 1) + { + PersonalAttributeList total = new PersonalAttributeList(); + List attrList = new ArrayList(); + for (int i = 0; i < samlResponse.getAssertions().size(); i++) + { + Assertion tempAssertion = (Assertion)samlResponse.getAssertions().get(i); + IPersonalAttributeList temp = generatePersonalAttributeList(tempAssertion); + if (temp != null) + { + attrList.add(temp); + for (PersonalAttribute attribute : temp) { + PersonalAttribute attr = (PersonalAttribute)attribute.clone(); + attr.setName(attr.getName()+tempAssertion.getID()); + total.add(attr); + } + } + } + attrQueryResponse.setPersonalAttributeLists(attrList); + attrQueryResponse.setTotalPersonalAttributeList(total); + } + LOG.debug("Return result."); return attrQueryResponse; @@ -2943,7 +3635,7 @@ public final class STORKSAMLEngine extends SAMLEngine { LOG.debug("Generate AuthnRequest from request."); SignableSAMLObject samlObject; - try { + try { samlObject = (SignableSAMLObject) super.unmarshall(tokenSaml); } catch (SAMLEngineException e) { LOG.error("SAMLEngineException unmarshall.", e); @@ -2972,7 +3664,14 @@ public final class STORKSAMLEngine extends SAMLEngine { final ValidatorSuite validatorSuite = Configuration .getValidatorSuite("saml2-core-schema-validator"); try { - validatorSuite.validate(samlObject); + if (samlObject.getElementQName().toString().endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME)) + { + CustomAttributeQueryValidator val = + new CustomAttributeQueryValidator(); + val.validate((CustomAttributeQuery)samlObject); + } + else + validatorSuite.validate(samlObject); } catch (ValidationException e) { LOG.error("ValidationException.", e); throw new STORKSAMLEngineException(e); @@ -2980,4 +3679,27 @@ public final class STORKSAMLEngine extends SAMLEngine { return samlObject; } + + private boolean isComplex(XMLObject xmlObject) + { + boolean isComplex = false; + + final XSAnyImpl complexValue = (XSAnyImpl) xmlObject; + + for (int nextComplexValue = 0; nextComplexValue < complexValue + .getUnknownXMLObjects().size(); nextComplexValue++) { + + final XSAnyImpl simple = (XSAnyImpl) complexValue + .getUnknownXMLObjects().get( + nextComplexValue); + + if (simple.getElementQName().getLocalPart() != null) + { + isComplex = true; + break; + } + } + + return isComplex; + } } diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops deleted file mode 100644 index 5bda1b07b..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/all-wcprops +++ /dev/null @@ -1,119 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/package-info.java -END -CitizenCountryCode.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.java -END -RequestedAttribute.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.java -END -AuthenticationAttributes.java -K 25 -svn:wc:ra_dav:version-url -V 122 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java -END -QAAAttribute.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.java -END -STORKSAMLCore.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.java -END -SPInformation.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPInformation.java -END -SPInstitution.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPInstitution.java -END -EIDCrossBorderShare.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java -END -SPID.java -K 25 -svn:wc:ra_dav:version-url -V 102 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPID.java -END -SPSector.java -K 25 -svn:wc:ra_dav:version-url -V 106 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPSector.java -END -EIDSectorShare.java -K 25 -svn:wc:ra_dav:version-url -V 112 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.java -END -SAMLCore.java -K 25 -svn:wc:ra_dav:version-url -V 106 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SAMLCore.java -END -SPApplication.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPApplication.java -END -SPCountry.java -K 25 -svn:wc:ra_dav:version-url -V 107 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SPCountry.java -END -RequestedAttributes.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.java -END -VIDPAuthenticationAttributes.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.java -END -SAMLEngineSignI.java -K 25 -svn:wc:ra_dav:version-url -V 113 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.java -END -EIDCrossSectorShare.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.java -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/entries deleted file mode 100644 index 72f16fa28..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/entries +++ /dev/null @@ -1,680 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -SPID.java -file - - - - -2013-12-20T12:27:57.446475Z -5befd7eed677372d2acb48b3f66e9f02 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1679 - -SPSector.java -file - - - - -2013-12-20T12:27:57.442475Z -00956c4124a9c9062fd408ab886d0a29 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1767 - -EIDSectorShare.java -file - - - - -2013-12-20T12:27:57.442475Z -4277603e70eeeea24e59449136fee007 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1788 - -SAMLCore.java -file - - - - -2013-12-20T12:27:57.442475Z -3ef05a16db7f280124687fbebbd0ca37 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2633 - -validator -dir - -SPApplication.java -file - - - - -2013-12-20T12:27:57.442475Z -97dc9337dfb28ca32ffb50a3b5329651 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1827 - -SPCountry.java -file - - - - -2013-12-20T12:27:57.442475Z -e955976114b4fa9dba61ebc3fdf3c267 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1779 - -RequestedAttributes.java -file - - - - -2013-12-20T12:27:57.442475Z -d93c2c38f6dec952d22f60827b24ee9e -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1652 - -VIDPAuthenticationAttributes.java -file - - - - -2013-12-20T12:27:57.442475Z -b3a8f3746ce11111d80d9e942339a54e -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2224 - -SAMLEngineSignI.java -file - - - - -2013-12-20T12:27:57.442475Z -fb834797256e1ed6873be19ebe860092 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2429 - -EIDCrossSectorShare.java -file - - - - -2013-12-20T12:27:57.442475Z -a693707c2bb3a43e62d8e3ed20e8844d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1856 - -impl -dir - -package-info.java -file - - - - -2013-12-20T12:27:57.446475Z -34cf10993955447fa31dd616aa4978c9 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -808 - -CitizenCountryCode.java -file - - - - -2013-12-20T12:27:57.442475Z -a741f6d7c36860e65f64186ef5cd8610 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1817 - -RequestedAttribute.java -file - - - - -2013-12-20T12:27:57.446475Z -9707a0f5bdad6888a2e021182f80b245 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3828 - -QAAAttribute.java -file - - - - -2013-12-20T12:27:57.446475Z -f0d7a0516989582d342d5ce2a3f08c9d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1917 - -AuthenticationAttributes.java -file - - - - -2013-12-20T12:27:57.446475Z -86b9b4aebe1ca7ca90ce818785374ea7 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1948 - -SPInformation.java -file - - - - -2013-12-20T12:27:57.446475Z -0159e00cdec105564bb6ac394355533b -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1705 - -STORKSAMLCore.java -file - - - - -2013-12-20T12:27:57.446475Z -0e02e7a4c0f208fd5f05191fca5ba91a -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -14229 - -SPInstitution.java -file - - - - -2013-12-20T12:27:57.446475Z -21eda2ef1cb604ce4f952fc608e7772f -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1833 - -EIDCrossBorderShare.java -file - - - - -2013-12-20T12:27:57.446475Z -17d390896e4f96f24df0da4ec83321ec -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1861 - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base deleted file mode 100644 index 07157073c..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/AuthenticationAttributes.java.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface AuthenticationAttributes. - * @author fjquevedo - */ -public interface AuthenticationAttributes extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "AuthenticationAttributes"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "AuthenticationAttributesType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - - /** - * Gets the citizen country code. - * - * @return the citizen country code - */ - VIDPAuthenticationAttributes getVIDPAuthenticationAttributes(); - - - /** - * Sets the vIDP authentication attributes. - * - * @param newVIDPAuthenticationAttr the new vIDP authentication attributes - */ - void setVIDPAuthenticationAttributes(VIDPAuthenticationAttributes newVIDPAuthenticationAttr); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base deleted file mode 100644 index 859d37feb..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/CitizenCountryCode.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * @author fjquevedo - */ -public interface CitizenCountryCode extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "CitizenCountryCode"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "CitizenCountryCodeType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the SP country. - * - * @return the sP country - */ - String getCitizenCountryCode(); - - - /** - * Sets the citizen country code. - * - * @param citizenCountryCode the new citizen country code - */ - void setCitizenCountryCode(String citizenCountryCode); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base deleted file mode 100644 index c892eae78..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossBorderShare.java.svn-base +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * @author fjquevedo - */ -public interface EIDCrossBorderShare extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "eIDCrossBorderShare"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "eIDCrossBorderShareType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - - /** - * Gets the eID cross border share. - * - * @return the eID cross border share - */ - String getEIDCrossBorderShare(); - - - /** - * Sets the eID cross border share. - * - * @param eIDCrossBorderShare the new eID cross border share - */ - void setEIDCrossBorderShare(String eIDCrossBorderShare); - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base deleted file mode 100644 index f879914f9..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDCrossSectorShare.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossSectorShare. - * @author fjquevedo - */ -public interface EIDCrossSectorShare extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String ELEM_LOCAL_NAME = "eIDCrossSectorShare"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), ELEM_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "eIDCrossSectorShareType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the eID cross sector share. - * - * @return the eID cross sector share - */ - String getEIDCrossSectorShare(); - - /** - * Sets the eID cross sector share. - * - * @param eIDCrossSectorShare the new eID cross sector share - */ - void setEIDCrossSectorShare(String eIDCrossSectorShare); - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base deleted file mode 100644 index dc88f3318..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/EIDSectorShare.java.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDSectorShare. - * @author fjquevedo - */ -public interface EIDSectorShare extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "eIDSectorShare"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "eIDSectorShare"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - - /** - * Gets the eID sector share. - * - * @return the eID sector share - */ - String getEIDSectorShare(); - - /** - * Sets the eID sector share. - * - * @param eIDSectorShare the new eID sector share - */ - void setEIDSectorShare(String eIDSectorShare); - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base deleted file mode 100644 index 2c09cf85b..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/QAAAttribute.java.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * STORK Quality Authentication Assurance Level Attribute Interface. - * - * @author fjquevedo - */ -public interface QAAAttribute extends SAMLObject { - - /** Element local name. */ - String DEF_LOCAL_NAME = "QualityAuthenticationAssuranceLevel"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "QualityAuthenticationAssuranceLevelAbstractType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The minimum value allowed. */ - int MIN_VALUE = 1; - - /** The Max value allowed. */ - int MAX_VALUE = 4; - - /** - * Gets the qAA level. - * - * @return the qAA level - */ - String getQaaLevel(); - - /** - * Sets the qAA level. - * - * @param qaaLevel the new qAA level - * - */ - void setQaaLevel(String qaaLevel); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base deleted file mode 100644 index 02be9e104..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttribute.java.svn-base +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; -import org.opensaml.xml.AttributeExtensibleXMLObject; -import org.opensaml.xml.schema.XSBooleanValue; -import org.opensaml.xml.XMLObject; - -/** - * The Interface RequestedAttribute. - * - * @author fjquevedo - */ -public interface RequestedAttribute extends SAMLObject, - AttributeExtensibleXMLObject { - - /** Element local name. */ - String DEF_LOCAL_NAME = "RequestedAttribute"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "RequestedAttributeAbstractType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** NAME_ATTRIB_NAME attribute name. */ - String NAME_ATTRIB_NAME = "Name"; - - /** NAME_FORMAT_ATTRIB_NAME attribute name. */ - String NAME_FORMAT_ATTR = "NameFormat"; - - /** IS_REQUIRED_ATTRIB_NAME attribute name. */ - String IS_REQUIRED_ATTR = "isRequired"; - - /** FRIENDLY_NAME_ATTRIB_NAME attribute name. */ - String FRIENDLY_NAME_ATT = "FriendlyName"; - - /** Unspecified attribute format ID. */ - String UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"; - - /** URI reference attribute format ID. */ - String URI_REFERENCE = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"; - - /** Basic attribute format ID. */ - String BASIC = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"; - - /** - * Gets the name. - * - * @return the name - */ - String getName(); - - /** - * Sets the name. - * - * @param name the new name - */ - void setName(String name); - - /** - * Gets the name format. - * - * @return the name format - */ - String getNameFormat(); - - /** - * Sets the name format. - * - * @param nameFormat the new name format - */ - void setNameFormat(String nameFormat); - - /** - * Gets the friendly name. - * - * @return the friendly name - */ - String getFriendlyName(); - - /** - * Sets the friendly name. - * - * @param friendlyName the new friendly name - */ - void setFriendlyName(String friendlyName); - - /** - * Gets the checks if is required. - * - * @return the checks if is required - */ - String isRequired(); - - /** - * Gets the checks if is required xs boolean. - * - * @return the checks if is required xs boolean - */ - String getIsRequiredXSBoolean(); - - /** - * Sets the checks if is required. - * - * @param newIsRequired the new checks if is required - */ - void setIsRequired(String newIsRequired); - - /** - * Gets the attribute values. - * - * @return the attribute values - */ - List getAttributeValues(); - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base deleted file mode 100644 index 9004b10f4..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/RequestedAttributes.java.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface RequestedAttributes. - * - * @author fjquevedo - */ -public interface RequestedAttributes extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "RequestedAttributes"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "RequestedAttributesType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the attributes. - * - * @return the attributes - */ - List getAttributes(); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base deleted file mode 100644 index e511bbaeb..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLCore.java.svn-base +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -/** - * The Enumeration SAMLCore. - * - * @author fjquevedo - */ - -public enum SAMLCore { - - /** The consent authentication request. */ - CONSENT_AUTHN_REQ("consentAuthnRequest"), - - /** The consent authentication response. */ - CONSENT_AUTHN_RES("consentAuthnResponse"), - - /** The FORC e_ auth n_ tag. */ - FORCE_AUTHN_TAG("forceAuthN"), - - /** The I s_ passiv e_ tag. */ - IS_PASSIVE_TAG("isPassive"), - - /** The FORMA t_ entity. */ - FORMAT_ENTITY("formatEntity"), - - /** The FRIENDLY name. */ - FRIENDLY_NAME("friendlyName"), - - /** The IS_REQUIRED AN ATTRIBUTE */ - IS_REQUIRED("isRequired"), - - /** The PRO t_ bindin g_ tag. */ - PROT_BINDING_TAG("protocolBinding"), - - /** The ASSER t_ con s_ tag. */ - ASSERT_CONS_TAG("assertionConsumerServiceURL"), - - /** The REQUESTE r_ tag. */ - REQUESTER_TAG("requester"), - - /** The RESPONDE r_ tag. */ - RESPONDER_TAG("responder"), - - /** The STOR k10_ ns. */ - STORK10_NS("urn:eu:stork:names:tc:STORK:1.0:assertion"), - - /** The STOR k10 p_ ns. */ - STORK10P_NS("urn:eu:stork:names:tc:STORK:1.0:protocol"), - - /** The STOR k10_ prefix. */ - STORK10_PREFIX("stork"), - - /** The STOR k10 p_ prefix. */ - STORK10P_PREFIX("storkp"), - - /** The STOR k10_ bas e_ uri. */ - STORK10_BASE_URI("http://www.stork.gov.eu/1.0/"), - - /** The ON e_ tim e_ use. */ - ONE_TIME_USE("oneTimeUse"); - - /** The value. */ - private String value; - - /** - * Instantiates a new sAML core. - * - * @param fullName the full name - */ - private SAMLCore(final String fullName) { - this.value = fullName; - } - - /** - * Gets the value. - * - * @return the value - */ - public String getValue() { - return value; - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base deleted file mode 100644 index b382646be..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SAMLEngineSignI.java.svn-base +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import java.security.KeyStore; -import java.security.cert.X509Certificate; - -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; - -import eu.stork.peps.exceptions.SAMLEngineException; - -/** - * The Interface SAMLEngineSignI. - * - * @author fjquevedo - */ -public interface SAMLEngineSignI { - - /** - * Sign. - * - * @param tokenSaml the token SAML - * - * @return the sAML object - * - * @throws SAMLEngineException the SAML engine exception - */ - SAMLObject sign(SignableSAMLObject tokenSaml) throws SAMLEngineException; - - /** - * Gets the certificate. - * - * @return the certificate - */ - X509Certificate getCertificate(); - - /** - * Gets the trustStore used when validating SAMLTokens - * - * @return the trustStore - * - */ - KeyStore getTrustStore(); - - /** - * Validate signature. - * - * @param tokenSaml the token SAML - * - * @return the sAML object - * - * @throws SAMLEngineException the SAML engine exception - */ - SAMLObject validateSignature(SignableSAMLObject tokenSaml) - throws SAMLEngineException; - - /** - * Initialize the signature module. - * - * @param fileConf the configuration file. - * - * @throws SAMLEngineException the STORKSAML engine runtime - * exception - */ - void init(String fileConf) throws SAMLEngineException; - - /** - * Load cryptographic service provider. - * - * @throws SAMLEngineException the SAML engine exception - */ - void loadCryptServiceProvider() throws SAMLEngineException; - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base deleted file mode 100644 index 9ace6d37c..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPApplication.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface SPApplication. - * - * @author fjquevedo - */ -public interface SPApplication extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "spApplication"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "spApplicationType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** - * Gets the service provider application. - * - * @return the service provider application - */ - String getSPApplication(); - - /** - * Sets the service provider application. - * - * @param spApplication the new service provider application - */ - void setSPApplication(String spApplication); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base deleted file mode 100644 index 569ea48c2..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPCountry.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface SPCountry. - * - * @author fjquevedo - */ -public interface SPCountry extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "spCountry"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "spCountryType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** - * Gets the service provider country. - * - * @return the service provider country - */ - String getSPCountry(); - - /** - * Sets the service provider country. - * - * @param spCountry the new service provider country - */ - void setSPCountry(String spCountry); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base deleted file mode 100644 index c0cf02ad0..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPID.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * @author iinigo - */ -public interface SPID extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "SPID"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "SPIDType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the SP ID. - * - * @return the SP ID - */ - String getSPID(); - - - /** - * Sets the SP ID. - * - * @param SPID the new SP ID - */ - void setSPID(String newSPID); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base deleted file mode 100644 index 34ba9c9c5..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInformation.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * @author iinigo - */ -public interface SPInformation extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "SPInformation"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "SPInformationType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** - * Gets the SP Id. - * - * @return the SP Id - */ - SPID getSPID(); - - - /** - * Sets the SP Id. - * - * @param newSPId the new SP Id - */ - void setSPID(SPID newSPID); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base deleted file mode 100644 index 33dad474b..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPInstitution.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface EIDCrossBorderShare. - * - * @author fjquevedo - */ -public interface SPInstitution extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "spInstitution"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "spInstitutionType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** - * Gets the service provider institution. - * - * @return the service provider institution - */ - String getSPInstitution(); - - /** - * Sets the service provider institution. - * - * @param spInstitution the new service provider institution - */ - void setSPInstitution(String spInstitution); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base deleted file mode 100644 index 1f49a4015..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/SPSector.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface SPSector. - * - * @author fjquevedo - */ -public interface SPSector extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "spSector"; - - /** The Constant DEFAULT_ELEMENT_NAME. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** The Constant TYPE_LOCAL_NAME. */ - String TYPE_LOCAL_NAME = "spSectorType"; - - /** The Constant TYPE_NAME. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10_PREFIX.getValue()); - - /** - * Gets the service provider sector. - * - * @return the service provider sector - */ - String getSPSector(); - - /** - * Sets the service provider sector. - * - * @param spSector the new service provider sector - */ - void setSPSector(String spSector); -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base deleted file mode 100644 index 19c71dd74..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/STORKSAMLCore.java.svn-base +++ /dev/null @@ -1,508 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import java.util.Properties; - -import org.apache.commons.lang.StringUtils; -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.core.NameIDType; -import org.opensaml.saml2.core.RequestAbstractType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * The Class SAMLCore. - * - * @author fjquevedo - */ -public final class STORKSAMLCore { - - /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(STORKSAMLCore.class.getName()); - - /** The consent authentication request. */ - private String consentAuthnReq = null; - - /** The consent authentication response. */ - private String consentAuthnResp = null; - - /** The id cross border share. */ - private String eIDCrossBordShare = null; - - /** The e id cross sect share. */ - private String eIDCrossSectShare = null; - - /** The e id sector share. */ - private String eIDSectorShare = null; - - /** The format entity. */ - private String formatEntity = null; - - /** The friendly name. */ - private boolean friendlyName = false; - - /** The IP validation. */ - private boolean ipValidation = false; - - /** The one time use. */ - private boolean oneTimeUse = true; - - /** The protocol binding. */ - private String protocolBinding = null; - - /** The requester. */ - private String requester = null; - - - /** The responder. */ - private String responder = null; - - /** The SAML core properties. */ - private Properties samlCoreProp = null; - - /** The time not on or after. */ - private Integer timeNotOnOrAfter = null; - - /** The is required parameter. */ - private boolean isRequired = true; - - private static final String SAML_ENGINE_LITERAL = "SamlEngine.xml: "; - - /** - * Gets the isRequired. - * - * @return the isRequired - */ - public boolean isRequired() { - return isRequired; - } - - /** - * Sets the isRequired. - * - * @param isRequired the required. - */ - public void setRequired(boolean isRequired) { - this.isRequired = isRequired; - } - - /** - * Instantiates a new sAML core. - * - * @param instance the instance - */ - public STORKSAMLCore(final Properties instance) { - loadConfiguration(instance); - } - - /** - * Gets the consent. - * - * @return the consent - */ - public String getConsentAuthnRequest() { - return consentAuthnReq; - } - - /** - * Gets the consent authentication response. - * - * @return the consent authentication response. - */ - public String getConsentAuthnResp() { - return consentAuthnResp; - } - - /** - * Gets the consent authentication response. - * - * @return the consent authentication response - */ - public String getConsentAuthnResponse() { - return consentAuthnResp; - } - - /** - * Gets the format entity. - * - * @return the format entity - */ - public String getFormatEntity() { - return formatEntity; - } - - /** - * Gets the property. - * - * @param key the key - * - * @return the property - */ - public String getProperty(final String key) { - return samlCoreProp.getProperty(key); - } - - /** - * Gets the protocol binding. - * - * @return the protocol binding - */ - public String getProtocolBinding() { - return protocolBinding; - } - - /** - * Gets the requester. - * - * @return the requester - */ - public String getRequester() { - return requester; - } - - /** - * Gets the responder. - * - * @return the responder - */ - public String getResponder() { - return responder; - } - - /** - * Gets the time not on or after. - * - * @return the time not on or after - */ - public Integer getTimeNotOnOrAfter() { - return timeNotOnOrAfter; - } - - /** - * Checks if is e id cross border share. - * - * @return true, if is e id cross border share - */ - public String iseIDCrossBorderShare() { - return eIDCrossBordShare; - } - - /** - * Checks if is e id cross border share. - * - * @return true, if is e id cross border share - */ - public String iseIDCrossBordShare() { - return eIDCrossBordShare; - } - - /** - * Checks if is e id cross sector share. - * - * @return true, if is e id cross sector share - */ - public String iseIDCrossSectorShare() { - return eIDCrossSectShare; - } - - /** - * Checks if is e id cross sect share. - * - * @return true, if is e id cross sect share - */ - public String iseIDCrossSectShare() { - return eIDCrossSectShare; - } - - /** - * Checks if is e id sector share. - * - * @return true, if is e id sector share - */ - public String iseIDSectorShare() { - return eIDSectorShare; - } - - /** - * Checks if is friendly name. - * - * @return true, if checks if is friendly name - */ - public boolean isFriendlyName() { - return friendlyName; - } - - /** - * Checks if is IP validation. - * - * @return true, if is IP validation - */ - public boolean isIpValidation() { - return ipValidation; - } - - /** - * Checks if is one time use. - * - * @return true, if is one time use - */ - public boolean isOneTimeUse() { - return oneTimeUse; - } - - /** - * Method that loads the configuration file for the SAML Engine. - * - * @param instance the instance of the Engine properties. - */ - private void loadConfiguration(final Properties instance) { - - try { - LOGGER.info("SAMLCore: Loading SAMLEngine properties."); - - samlCoreProp = instance; - - final String parameter = samlCoreProp - .getProperty(SAMLCore.FORMAT_ENTITY.getValue()); - - if ("entity".equalsIgnoreCase(parameter)) { - formatEntity = NameIDType.ENTITY; - } - - friendlyName = Boolean.valueOf(samlCoreProp - .getProperty(SAMLCore.FRIENDLY_NAME.getValue())); - - String isRequiredValue = samlCoreProp. - getProperty(SAMLCore.IS_REQUIRED.getValue()); - if (isRequiredValue != null) { - isRequired = Boolean.valueOf(isRequiredValue); - } - - eIDSectorShare = samlCoreProp - .getProperty("eIDSectorShare"); - eIDCrossSectShare = samlCoreProp - .getProperty("eIDCrossSectorShare"); - eIDCrossBordShare = samlCoreProp - .getProperty("eIDCrossBorderShare"); - - ipValidation = Boolean.valueOf(samlCoreProp - .getProperty("ipAddrValidation")); - - final String oneTimeUseProp = samlCoreProp - .getProperty(SAMLCore.ONE_TIME_USE.getValue()); - - if (StringUtils.isNotBlank(oneTimeUseProp)) { - oneTimeUse = Boolean.valueOf(oneTimeUseProp); - } - - // Protocol Binding - loadProtocolBiding(); - - // Consent Authentication Request - consentAuthnReq = samlCoreProp - .getProperty(SAMLCore.CONSENT_AUTHN_REQ.getValue()); - - if ("unspecified".equalsIgnoreCase(consentAuthnReq)) { - consentAuthnReq = RequestAbstractType.UNSPECIFIED_CONSENT; - } - - loadConsentAuthResp(); - - timeNotOnOrAfter = Integer.valueOf(samlCoreProp - .getProperty("timeNotOnOrAfter")); - - if (timeNotOnOrAfter.intValue() < 0) { - LOGGER.error(SAML_ENGINE_LITERAL + "timeNotOnOrAfter" - + " is negative number."); - - throw new SAMLEngineException(SAML_ENGINE_LITERAL - + "timeNotOnOrAfter" + " is negative number."); - } - - requester = samlCoreProp.getProperty(SAMLCore.REQUESTER_TAG.getValue()); - responder = samlCoreProp.getProperty(SAMLCore.RESPONDER_TAG.getValue()); - - } catch (SAMLEngineException e) { - LOGGER.error("SAMLCore: error loadConfiguration. ", e); - throw new STORKSAMLEngineRuntimeException(e); - } catch (RuntimeException e) { - LOGGER.error("SAMLCore: error loadConfiguration. ", e); - throw new STORKSAMLEngineRuntimeException(e); - } - } - - /** - * Load consent authentication response. - */ - private void loadConsentAuthResp() { - // Consent Authentication Response - consentAuthnResp = samlCoreProp - .getProperty(SAMLCore.CONSENT_AUTHN_RES.getValue()); - - if ("obtained".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = RequestAbstractType.OBTAINED_CONSENT; - } else if ("prior".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = RequestAbstractType.PRIOR_CONSENT; - } else if ("curent-implicit".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = - "urn:oasis:names:tc:SAML:2.0:consent:current-implicit"; - } else if ("curent-explicit".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = - "urn:oasis:names:tc:SAML:2.0:consent:current-explicit"; - } else if ("unspecified".equalsIgnoreCase(consentAuthnResp)) { - consentAuthnResp = RequestAbstractType.UNSPECIFIED_CONSENT; - } - } - - /** - * Load protocol biding. - * - * @throws SAMLEngineException the SAML engine exception - */ - private void loadProtocolBiding() throws SAMLEngineException { - // Protocol Binding - protocolBinding = samlCoreProp.getProperty(SAMLCore.PROT_BINDING_TAG.getValue()); - - if (StringUtils.isBlank(protocolBinding)) { - LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG - + " it's mandatory."); - throw new SAMLEngineException(SAML_ENGINE_LITERAL - + SAMLCore.PROT_BINDING_TAG + " it's mandatory."); - } else if (protocolBinding.equalsIgnoreCase("HTTP-POST")) { - protocolBinding = SAMLConstants.SAML2_POST_BINDING_URI; - } else { - LOGGER.error(SAML_ENGINE_LITERAL + SAMLCore.PROT_BINDING_TAG - + " it's not supporting."); - - throw new SAMLEngineException(SAML_ENGINE_LITERAL - + SAMLCore.PROT_BINDING_TAG + " it's not supporting."); - } - } - - /** - * Sets the consent authentication response. - * - * @param newConsAuthnResp the new consent authentication response - */ - public void setConsentAuthnResp(final String newConsAuthnResp) { - this.consentAuthnResp = newConsAuthnResp; - } - - /** - * Sets an eID that can be shared outside of the Service Provider’s member state. - * - * @param newEIDCrossBord the new eid cross border share - */ - public void setEIDCrossBordShare(final String newEIDCrossBord) { - this.eIDCrossBordShare = newEIDCrossBord; - } - - /** - * Sets an eID that can be shared outside of the Service Provider’s sector. - * - * @param newEIDCrossSect the new eid cross sect share - */ - public void setEIDCrossSectShare(final String newEIDCrossSect) { - this.eIDCrossSectShare = newEIDCrossSect; - } - - /** - * Sets an eID that can be shared within the Service Provider’s sector. - * - * @param newEIDSectorShare the new eid sector share - */ - public void seteIDSectorShare(final String newEIDSectorShare) { - this.eIDSectorShare = newEIDSectorShare; - } - - /** - * Sets the format entity. - * - * @param newFormatEntity the new format entity - */ - public void setFormatEntity(final String newFormatEntity) { - this.formatEntity = newFormatEntity; - } - - /** - * Sets the friendly name. - * - * @param newFriendlyName the new friendly name - */ - public void setFriendlyName(final boolean newFriendlyName) { - this.friendlyName = newFriendlyName; - } - - /** - * Sets the IP validation. - * - * @param newIpValidation the new IP validation - */ - public void setIpValidation(final boolean newIpValidation) { - this.ipValidation = newIpValidation; - } - - /** - * Sets the one time use. - * - * @param newOneTimeUse the new one time use - */ - public void setOneTimeUse(final boolean newOneTimeUse) { - this.oneTimeUse = newOneTimeUse; - } - - /** - * Sets the protocol binding. - * - * @param newProtBinding the new protocol binding - */ - public void setProtocolBinding(final String newProtBinding) { - this.protocolBinding = newProtBinding; - } - - /** - * Sets the requester. - * - * @param newRequester the new requester - */ - public void setRequester(final String newRequester) { - this.requester = newRequester; - } - - /** - * Sets the responder. - * - * @param newResponder the new responder - */ - public void setResponder(final String newResponder) { - this.responder = newResponder; - } - - /** - * Sets the time not on or after. - * - * @param newTimeNotOnOrAft the new time not on or after - */ - public void setTimeNotOnOrAfter(final Integer newTimeNotOnOrAft) { - this.timeNotOnOrAfter = newTimeNotOnOrAft; - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base deleted file mode 100644 index 3f812393e..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/VIDPAuthenticationAttributes.java.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core; - -import javax.xml.namespace.QName; - -import org.opensaml.common.SAMLObject; - -/** - * The Interface VIDPAuthenticationAttributes. - * - * @author fjquevedo - */ -public interface VIDPAuthenticationAttributes extends SAMLObject { - - /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */ - String DEF_LOCAL_NAME = "VIDPAuthenticationAttributes"; - - /** Default element name. */ - QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - /** Local name of the XSI type. */ - String TYPE_LOCAL_NAME = "VIDPAuthenticationAttributesType"; - - /** QName of the XSI type. */ - QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME, - SAMLCore.STORK10P_PREFIX.getValue()); - - - /** - * Gets the citizen country code. - * - * @return the citizen country code - */ - CitizenCountryCode getCitizenCountryCode(); - - /** - * Sets the citizen country code. - * - * @param newCitizenCountryCode the new citizen country code - */ - void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode); - - /** - * Gets the SP information - * - * @return the SP information - */ - SPInformation getSPInformation(); - - /** - * Sets the SP information - * - * @param newSPInformation the new SPInformation - */ - void setSPInformation(SPInformation newSPInformation); - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 3393dcf78..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Interfaces for STORK 1.0 core specification types and elements. - */ -package eu.stork.peps.auth.engine.core; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomAttributeQuery.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomAttributeQuery.java new file mode 100644 index 000000000..c326ae8d9 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomAttributeQuery.java @@ -0,0 +1,51 @@ +package eu.stork.peps.auth.engine.core; + +import java.util.List; +import javax.xml.namespace.QName; + +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.Subject; +import org.opensaml.saml2.core.SubjectQuery; + +public interface CustomAttributeQuery extends CustomRequestAbstractType { + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "AttributeQuery"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(SAMLConstants.SAML20P_NS, DEFAULT_ELEMENT_LOCAL_NAME, + SAMLConstants.SAML20P_PREFIX); + + /** Local name of the XSI type. */ + public static final String TYPE_LOCAL_NAME = "CustomAttributeQueryType"; + + /** QName of the XSI type. */ + public static final QName TYPE_NAME = new QName(SAMLConstants.SAML20P_NS, TYPE_LOCAL_NAME, + SAMLConstants.SAML20P_PREFIX); + + /** AssertionConsumerServiceURL attribute name. */ + public static final String ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME + = "AssertionConsumerServiceURL"; + + /** + * Gets the Attributes of this query. + * + * @return the list of Attributes of this query + */ + public List getAttributes(); + + /** + * Gets the Subject of this request. + * + * @return the Subject of this request + */ + public Subject getSubject(); + + /** + * Sets the Subject of this request. + * + * @param newSubject the Subject of this request + */ + public void setSubject(Subject newSubject); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomRequestAbstractType.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomRequestAbstractType.java new file mode 100644 index 000000000..fa847378b --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomRequestAbstractType.java @@ -0,0 +1,176 @@ +package eu.stork.peps.auth.engine.core; + +import javax.xml.namespace.QName; + +import org.joda.time.DateTime; +import org.opensaml.common.SAMLVersion; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.common.Extensions; +import org.opensaml.saml2.core.Issuer; + +public interface CustomRequestAbstractType extends SignableSAMLObject { + + /** Local name of the XSI type. */ + public static final String TYPE_LOCAL_NAME = "RequestAbstractType"; + + /** QName of the XSI type. */ + public static final QName TYPE_NAME = new QName(SAMLConstants.SAML20P_NS, TYPE_LOCAL_NAME, + SAMLConstants.SAML20P_PREFIX); + + /** ID attribute name. */ + public static final String ID_ATTRIB_NAME = "ID"; + + /** Version attribute name. */ + public static final String VERSION_ATTRIB_NAME = "Version"; + + /** IssueInstant attribute name. */ + public static final String ISSUE_INSTANT_ATTRIB_NAME = "IssueInstant"; + + /** Destination attribute name. */ + public static final String DESTINATION_ATTRIB_NAME = "Destination"; + + /** Destination attribute name. */ + public static final String ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME = "AssertionConsumerServiceURL"; + + /** Consent attribute name. */ + public static final String CONSENT_ATTRIB_NAME = "Consent"; + + /** Unspecified consent URI. */ + public static final String UNSPECIFIED_CONSENT = "urn:oasis:names:tc:SAML:2.0:consent:unspecified"; + + /** Obtained consent URI. */ + public static final String OBTAINED_CONSENT = "urn:oasis:names:tc:SAML:2.0:consent:obtained"; + + /** Prior consent URI. */ + public static final String PRIOR_CONSENT = "urn:oasis:names:tc:SAML:2.0:consent:prior"; + + /** Implicit consent URI. */ + public static final String IMPLICIT_CONSENT = "urn:oasis:names:tc:SAML:2.0:consent:current-implicit"; + + /** Explicit consent URI. */ + public static final String EXPLICIT_CONSENT = "urn:oasis:names:tc:SAML:2.0:consent:current-explicit"; + + /** Unavailable consent URI. */ + public static final String UNAVAILABLE_CONSENT = "urn:oasis:names:tc:SAML:2.0:consent:unavailable"; + + /** Inapplicable consent URI. */ + public static final String INAPPLICABLE_CONSENT = "urn:oasis:names:tc:SAML:2.0:consent:inapplicable"; + + /** + * Gets the SAML Version of this request. + * + * @return the SAML Version of this request. + */ + public SAMLVersion getVersion(); + + /** + * Sets the SAML Version of this request. + * + * @param newVersion the SAML Version of this request + */ + public void setVersion(SAMLVersion newVersion); + + /** + * Gets the unique identifier of the request. + * + * @return the unique identifier of the request + */ + public String getID(); + + /** + * Sets the unique identifier of the request. + * + * @param newID the unique identifier of the request + */ + + public void setID(String newID); + + /** + * Gets the date/time the request was issued. + * + * @return the date/time the request was issued + */ + + public DateTime getIssueInstant(); + + /** + * Sets the date/time the request was issued. + * + * @param newIssueInstant the date/time the request was issued + */ + public void setIssueInstant(DateTime newIssueInstant); + + /** + * Gets the URI of the destination of the request. + * + * @return the URI of the destination of the request + */ + public String getDestination(); + + /** + * Sets the URI of the destination of the request. + * + * @param newDestination the URI of the destination of the request + */ + public void setDestination(String newDestination); + + /** + * Sets the index of the particular Assertion Consumer Service to which the response to this request should be + * delivered. + * + * @param newAssertionConsumerServiceIndex the new value of the AssertionConsumerServiceIndex attribute + */ + public void setAssertionConsumerServiceURL(String newServiceUrl); + + /** + * Gets the URL of the particular Assertion Consumer Service to which the response to this request should be + * delivered. + * + * @return the value of the AssertionConsumerServiceURL attribute + */ + public String getAssertionConsumerServiceURL(); + + /** + * Gets the consent obtained from the principal for sending this request. + * + * @return the consent obtained from the principal for sending this request + */ + public String getConsent(); + + /** + * Sets the consent obtained from the principal for sending this request. + * + * @param newConsent the new consent obtained from the principal for sending this request + */ + public void setConsent(String newConsent); + + /** + * Gets the issuer of this request. + * + * @return the issuer of this request + */ + public Issuer getIssuer(); + + /** + * Sets the issuer of this request. + * + * @param newIssuer the issuer of this request + */ + public void setIssuer(Issuer newIssuer); + + /** + * Gets the Extensions of this request. + * + * @return the Status of this request + */ + public Extensions getExtensions(); + + /** + * Sets the Extensions of this request. + * + * @param newExtensions the Extensions of this request + */ + public void setExtensions(Extensions newExtensions); + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops deleted file mode 100644 index 7eb0de6e7..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/all-wcprops +++ /dev/null @@ -1,395 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 97 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl -END -RequestedAttributeImpl.java -K 25 -svn:wc:ra_dav:version-url -V 125 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.java -END -EIDCrossBorderShareMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 132 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.java -END -SPIDMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.java -END -SPInformationImpl.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.java -END -SPInstitutionUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.java -END -EIDSectorShareBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 124 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.java -END -SPCountryBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.java -END -EIDCrossBorderShareImpl.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.java -END -EIDSectorShareUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.java -END -RequestedAttributesMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 132 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.java -END -RequestedAttributesImpl.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.java -END -SignHW.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java -END -QAAAttributeUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 127 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.java -END -SPInstitutionMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.java -END -SPIDUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.java -END -SPInstitutionImpl.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.java -END -EIDSectorShareMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 127 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.java -END -SPSectorUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.java -END -VIDPAuthenticationAttributesBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 138 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 115 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/package-info.java -END -VIDPAuthenticationAttributesMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 141 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.java -END -SPApplicationUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.java -END -EIDSectorShareImpl.java -K 25 -svn:wc:ra_dav:version-url -V 121 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.java -END -CitizenCountryCodeBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.java -END -EIDCrossSectorShareUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 134 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.java -END -RequestedAttributeBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.java -END -SignModuleFactory.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.java -END -RequestedAttributeMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 131 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.java -END -QAAAttributeMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 125 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.java -END -CitizenCountryCodeUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 133 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.java -END -AuthenticationAttributesUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 139 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java -END -SPIDBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.java -END -QAAAttributeImpl.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.java -END -SPSectorMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 121 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.java -END -SPApplicationMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.java -END -SPIDImpl.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.java -END -SPCountryUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 124 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.java -END -SPSectorImpl.java -K 25 -svn:wc:ra_dav:version-url -V 115 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.java -END -VIDPAuthenticationAttributesUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 143 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.java -END -SPApplicationImpl.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.java -END -EIDCrossSectorShareMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 132 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.java -END -QAAAttributeBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 122 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.java -END -CitizenCountryCodeMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 131 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.java -END -SPInformationBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.java -END -EIDCrossSectorShareImpl.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.java -END -AuthenticationAttributesMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 137 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesMarshaller.java -END -EIDCrossBorderShareBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java -END -RequestedAttributeUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 133 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.java -END -SPInformationUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 128 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.java -END -CitizenCountryCodeImpl.java -K 25 -svn:wc:ra_dav:version-url -V 125 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.java -END -AuthenticationAttributesImpl.java -K 25 -svn:wc:ra_dav:version-url -V 131 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.java -END -SPSectorBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 118 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.java -END -EIDCrossBorderShareUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 134 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.java -END -SignSW.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java -END -SPApplicationBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.java -END -RequestedAttributesBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.java -END -SPCountryMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 122 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.java -END -SignP12.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java -END -EIDCrossSectorShareBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.java -END -RequestedAttributesUnmarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 134 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.java -END -SPCountryImpl.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.java -END -VIDPAuthenticationAttributesImpl.java -K 25 -svn:wc:ra_dav:version-url -V 135 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.java -END -AuthenticationAttributesBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 134 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java -END -SPInformationMarshaller.java -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.java -END -SPInstitutionBuilder.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.java -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries deleted file mode 100644 index 1c6a5c2a8..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/entries +++ /dev/null @@ -1,2238 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/impl -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -VIDPAuthenticationAttributesUnmarshaller.java -file - - - - -2013-12-20T12:27:57.414475Z -379336b4e33025428a27f1cec8b44056 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2104 - -RequestedAttributesImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -27cbdb6010cc87d0da987d980e933181 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2964 - -CitizenCountryCodeMarshaller.java -file - - - - -2013-12-20T12:27:57.418475Z -d5237a27554ddbe26fd86e0b10800274 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1655 - -SPInformationBuilder.java -file - - - - -2013-12-20T12:27:57.414475Z -225f5a1c91da42fbcd3a0cb68318b32c -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1477 - -AuthenticationAttributesMarshaller.java -file - - - - -2013-12-20T12:27:57.418475Z -7c4410da9e4b223a39e8cfe7fe8baca8 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -986 - -EIDCrossBorderShareBuilder.java -file - - - - -2013-12-20T12:27:57.418475Z -87ddac844ca24e090fd90e8cd258c462 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1682 - -RequestedAttributeUnmarshaller.java -file - - - - -2013-12-20T12:27:57.418475Z -757de668eb8faac10e3d467a6fb75d8b -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3435 - -CitizenCountryCodeImpl.java -file - - - - -2013-12-20T12:27:57.418475Z -e823785bbced34f6d08bea9998975575 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2642 - -SPInstitutionMarshaller.java -file - - - - -2013-12-20T12:27:57.418475Z -cc15a0beeb86be9ca8ee405fb46e2bdb -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1627 - -AuthenticationAttributesImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -fa84458a078738803e160f1fd3ff6210 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3348 - -SignSW.java -file - - - - -2013-12-20T12:27:57.422475Z -1f905fe296e2dfb66e02ea925d3a7761 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -14730 - -SPApplicationBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -03f6145382be5dc9dbf50a09172d40ba -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1638 - -SPInstitutionImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -debba0c2baa76483e40e62a5de0e1123 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2618 - -RequestedAttributesBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -8516fe8723cb2405475a0fca0909e338 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1729 - -VIDPAuthenticationAttributesBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -60bafffa1fb9223231f49a0c12109ccd -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1607 - -SPApplicationUnmarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -143466710186caf840584c038fc365d4 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1408 - -EIDCrossSectorShareBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -95a940a01539d754a0f2d5fbc58dced2 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1746 - -VIDPAuthenticationAttributesImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -71986c6390a88c027fb622f342dda7dd -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3928 - -CitizenCountryCodeBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -d6adb4dcf3f02a2115e03e197f71e7d0 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1661 - -EIDCrossSectorShareUnmarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -8b7d6524324bf334695470c97a5ae8e9 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1636 - -RequestedAttributeBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -8e01d40d3d5d57e76e68335c4dfa33fd -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1719 - -SignModuleFactory.java -file - - - - -2013-12-20T12:27:57.422475Z -ca27edd3b64fe3994d694668441242c0 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1904 - -SPInstitutionBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -c154c661d7cf09d5deeb12ddf66b69a1 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1652 - -SPIDBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -081af3337ceb54c3a8e8c3fdbdd07757 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1531 - -RequestedAttributeImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -2b0a40b8c2b3640929adb2c1500ecfa8 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -5576 - -SPIDMarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -1f25673e4ed1a76ed9763d06e73942bf -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1549 - -SPCountryBuilder.java -file - - - - -2013-12-20T12:27:57.422475Z -a6e6d09f79e112c96d03f1dff4506843 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1627 - -SPApplicationMarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -d3053090b75974af918b25e32b3c16cb -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1627 - -EIDSectorShareUnmarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -e003885ad4f424b731178f3de53a9934 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1596 - -SPCountryUnmarshaller.java -file - - - - -2013-12-20T12:27:57.422475Z -e01b8f80dbcec3c100d563b8da6c206d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1376 - -SPApplicationImpl.java -file - - - - -2013-12-20T12:27:57.422475Z -0df0bd3dc6acdf706be767ba9e5ca6fc -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2617 - -EIDCrossSectorShareMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -e80eee7bbdb571f5a481ea66fc6b047d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1687 - -QAAAttributeBuilder.java -file - - - - -2013-12-20T12:27:57.426475Z -965b74882dfafe06f391804601049c48 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1653 - -SignHW.java -file - - - - -2013-12-20T12:27:57.426475Z -7896afe7f189a7db5835e120aa6b6037 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -13749 - -EIDCrossSectorShareImpl.java -file - - - - -2013-12-20T12:27:57.426475Z -08ad1682d1f146a114625a1dc1626f6c -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2703 - -QAAAttributeUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -b5eede63027f8b9638f905d3e905046f -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1387 - -SPInformationUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -b504aef9588b7817e1e1d37fd157076e -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1775 - -SPSectorBuilder.java -file - - - - -2013-12-20T12:27:57.426475Z -4725ddc6ef146afbe0a3cca1a97a0102 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1606 - -EIDCrossBorderShareUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -c7cd8600b386369e011a2a7f4c5f0d9c -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1472 - -SPIDUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -7090a9ec17d610025260f1af3495044d -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -1332 - -EIDSectorShareMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -ded11a8620d93cbb7fe703385583827a -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1712 - -SPSectorUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -16ec587f7357a4896411cc80a10f6523 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1372 - -SPCountryMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -f03343df1d204b3f461c7a54a1e6ed35 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1592 - -SignP12.java -file - - - - -2013-12-20T12:27:57.426475Z -2d6ec5552f62f50e8eb579e11def48f7 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -15576 - -package-info.java -file - - - - -2013-12-20T12:27:57.426475Z -76a0f72a61ed971b95da33c1c8b8aa69 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -817 - -VIDPAuthenticationAttributesMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -c099f28cf58fbc0f1db727b22f3a0d5a -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1120 - -RequestedAttributesUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -d18788d30b80c2a020dded672c9d937d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1844 - -EIDSectorShareImpl.java -file - - - - -2013-12-20T12:27:57.426475Z -eb771b1a638ae3751a0f90b187748495 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2622 - -SPCountryImpl.java -file - - - - -2013-12-20T12:27:57.426475Z -a2ddffd67762f74d21509471a2e1663c -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2528 - -AuthenticationAttributesBuilder.java -file - - - - -2013-12-20T12:27:57.426475Z -99840afca17ae5400257a49dd15c3d4f -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1792 - -RequestedAttributeMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -f4b4ab1af9ecd9aaf7230786ab73f6d7 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2969 - -QAAAttributeMarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -9a0f0dd3957d29547adf15ae519b1ad4 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1612 - -CitizenCountryCodeUnmarshaller.java -file - - - - -2013-12-20T12:27:57.426475Z -ff6f71c1e4e7a3d58f8696ae9080588e -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1447 - -SPInformationMarshaller.java -file - - - - -2013-12-20T12:27:57.430475Z -126729a7293d478709678748ec47277f -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1055 - -AuthenticationAttributesUnmarshaller.java -file - - - - -2013-12-20T12:27:57.430475Z -4f9cbca52f62feb055986ed1d6cc45ed -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1929 - -EIDCrossBorderShareMarshaller.java -file - - - - -2013-12-20T12:27:57.410475Z -0334c19bff0e6bfd196de52e7f1d1547 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1689 - -QAAAttributeImpl.java -file - - - - -2013-12-20T12:27:57.410475Z -bee5948d710cfab6256be7f47bb70096 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2647 - -SPInformationImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -93e4dc0e3432b0a6f355b70230f59edd -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2979 - -SPInstitutionUnmarshaller.java -file - - - - -2013-12-20T12:27:57.410475Z -11e598b7cc89fdea183e3f4f7c2019b3 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1407 - -EIDSectorShareBuilder.java -file - - - - -2013-12-20T12:27:57.414475Z -eef58e0f54cd2c89b3ccb73dbbaf4b24 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1672 - -SPSectorMarshaller.java -file - - - - -2013-12-20T12:27:57.414475Z -1d5f1bf8fa1b6170804abc1a64ad52c4 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1584 - -EIDCrossBorderShareImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -9514676b0d03b2288c82db3d46ef150a -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2722 - -SPIDImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -17b9d0d330854aa4aaa855345c09e9c0 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2381 - -RequestedAttributesMarshaller.java -file - - - - -2013-12-20T12:27:57.414475Z -84d34f73f399fdecde91f58068f2fcd0 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1116 - -SPSectorImpl.java -file - - - - -2013-12-20T12:27:57.414475Z -1751902990706e32763e3e931b70622e -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2411 - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base deleted file mode 100644 index 74840e135..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesBuilder.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.AuthenticationAttributes; - -/** - * The Class AuthenticationAttributesBuilder. - * - * @author fjquevedo - */ -public class AuthenticationAttributesBuilder extends - AbstractSAMLObjectBuilder { - - - - /** - * Builds the object. - * - * @return the authentication attributes - */ - public final AuthenticationAttributes buildObject() { - return buildObject(AuthenticationAttributes.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace URI - * @param localName the local name - * @param namespacePrefix the namespace prefix - * - * @return the authentication attributes - */ - public final AuthenticationAttributes buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new AuthenticationAttributesImpl(namespaceURI, localName, - namespacePrefix); - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base deleted file mode 100644 index 1e43e7ec3..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesImpl.java.svn-base +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSignableSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.AuthenticationAttributes; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class AuthenticationAttributesImpl. - * - * @author fjquevedo - */ -public final class AuthenticationAttributesImpl extends AbstractSignableSAMLObject implements -AuthenticationAttributes { - - private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticationAttributesImpl.class.getName()); - - /** The indexed children. */ - private VIDPAuthenticationAttributes vIDPAuthenAttr; - - /** - * Instantiates a new authentication attributes implementation. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected AuthenticationAttributesImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - * - */ - public List getOrderedChildren() { - final ArrayList children = new ArrayList(); - - children.add(vIDPAuthenAttr); - - if (getSignature() != null) { - children.add(getSignature()); - } - - return Collections.unmodifiableList(children); - } - - /** - * Gets the signature reference id. - * - * @return the signature reference id - * - */ - public String getSignatureReferenceID() { - return null; - } - - /** - * Gets the vidp authentication attributes. - * - * @return the VIDP authentication attributes - * - */ - public VIDPAuthenticationAttributes getVIDPAuthenticationAttributes() { - return vIDPAuthenAttr; - } - - /** - * Sets the vidp authentication attributes. - * - * @param newVIDPAuthenAttr the new vidp authen attr - * - */ - public void setVIDPAuthenticationAttributes( - final VIDPAuthenticationAttributes newVIDPAuthenAttr) { - vIDPAuthenAttr = prepareForAssignment(this.vIDPAuthenAttr, newVIDPAuthenAttr); - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base deleted file mode 100644 index 698bf56b9..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesMarshaller.java.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; - -/** - * The Class AuthenticationAttributesMarshaller. - * - * @author fjquevedo - */ -public class AuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { - - - - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base deleted file mode 100644 index af3e5c234..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/AuthenticationAttributesUnmarshaller.java.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; - -import eu.stork.peps.auth.engine.core.AuthenticationAttributes; - -/** - * The Class AuthenticationAttributesUnmarshaller. - * - * @author fjquevedo - */ -public class AuthenticationAttributesUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentObject the parent object - * @param childObject the child object - * - * @throws UnmarshallingException the unmarshalling exception - * - */ - protected final void processChildElement(final XMLObject parentObject, - final XMLObject childObject) throws UnmarshallingException { - final AuthenticationAttributes attrStatement = (AuthenticationAttributes) parentObject; - - if (childObject instanceof VIDPAuthenticationAttributes) { - attrStatement.setVIDPAuthenticationAttributes((VIDPAuthenticationAttributes) childObject); - } else { - super.processChildElement(parentObject, childObject); - } - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base deleted file mode 100644 index 64651691f..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeBuilder.java.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; - -/** - * The Class CitizenCountryCodeBuilder. - * - * @author fjquevedo - */ -public class CitizenCountryCodeBuilder extends AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the citizen country code - */ - public final CitizenCountryCode buildObject() { - return buildObject(CitizenCountryCode.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the citizen country code - */ - public final CitizenCountryCode buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new CitizenCountryCodeImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base deleted file mode 100644 index 4df8084a9..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeImpl.java.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class CitizenCountryCodeImpl. - * - * @author fjquevedo - */ -public class CitizenCountryCodeImpl extends AbstractSAMLObject implements CitizenCountryCode { - - private static final Logger LOGGER = LoggerFactory.getLogger(CitizenCountryCodeImpl.class.getName()); - /** The citizen country code. */ - private String citizenCountryCode; - - /** - * Instantiates a new sP country impl. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected CitizenCountryCodeImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the citizen country code. - * - * @return the citizen country code - */ - public final String getCitizenCountryCode() { - return citizenCountryCode; - } - - /** - * Sets the citizen country code. - * - * @param newCitizenCountryCode the new citizen country code - */ - public final void setCitizenCountryCode(final String newCitizenCountryCode) { - this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base deleted file mode 100644 index decae04c5..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; - -/** - * The Class SPCountryMarshaller. - * - * @author fjquevedo - */ -public class CitizenCountryCodeMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; - XMLHelper.appendTextContent(domElement, citizenCountryCode.getCitizenCountryCode()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base deleted file mode 100644 index 93132b508..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/CitizenCountryCodeUnmarshaller.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; - -/** - * The Class CitizenCountryCodeUnmarshaller. - * - * @author fjquevedo - */ -public class CitizenCountryCodeUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final CitizenCountryCode citizenCountryCode = (CitizenCountryCode) samlObject; - citizenCountryCode.setCitizenCountryCode(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base deleted file mode 100644 index b939da776..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareBuilder.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; - -/** - * The Class EIDCrossBorderShareBuilder. - * - * @author fjquevedo - */ -public class EIDCrossBorderShareBuilder extends AbstractSAMLObjectBuilder { - - - /** - * Builds the object. - * - * @return the identifier cross border share - */ - public final EIDCrossBorderShare buildObject() { - return buildObject(EIDCrossBorderShare.DEF_ELEMENT_NAME); - } - - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the eID cross border share - */ - public final EIDCrossBorderShare buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new EIDCrossBorderShareImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base deleted file mode 100644 index 50a997031..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareImpl.java.svn-base +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class EIDCrossBorderShareImpl. - * - * @author fjquevedo - */ -public class EIDCrossBorderShareImpl extends AbstractSAMLObject implements - EIDCrossBorderShare { - - private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossBorderShareImpl.class.getName()); - /** The citizen country code. */ - private String eIDCrossBorderShare; - - /** - * Instantiates a new eID cross border share implementation. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected EIDCrossBorderShareImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - - /** - * Gets the eID cross border share. - * - * @return the eID cross border share - */ - public final String getEIDCrossBorderShare() { - return eIDCrossBorderShare; - } - - - /** - * Sets the eID cross border share. - * - * @param newEIDCrossBorderShare the new eID cross border share - */ - public final void setEIDCrossBorderShare(String newEIDCrossBorderShare) { - this.eIDCrossBorderShare = prepareForAssignment(this.eIDCrossBorderShare, newEIDCrossBorderShare); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - * {@inheritDoc} - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base deleted file mode 100644 index 58fa8af65..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareMarshaller.java.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; - - -/** - * The Class EIDCrossBorderShareMarshaller. - * - * @author fjquevedo - */ -public class EIDCrossBorderShareMarshaller extends AbstractSAMLObjectMarshaller { - - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; - XMLHelper.appendTextContent(domElement, crossBorderShare.getEIDCrossBorderShare()); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base deleted file mode 100644 index 457e70c23..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossBorderShareUnmarshaller.java.svn-base +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.EIDCrossBorderShare; - -/** - * The Class EIDCrossBorderShareUnmarshaller. - * - * @author fjquevedo - */ -public class EIDCrossBorderShareUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) samlObject; - crossBorderShare.setEIDCrossBorderShare(elementContent); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base deleted file mode 100644 index 9683d2ad8..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareBuilder.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; - -/** - * The Class EIDCrossSectorShareBuilder. - * - * @author fjquevedo - */ -public class EIDCrossSectorShareBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the eID cross sector share - */ - public final EIDCrossSectorShare buildObject() { - return buildObject(EIDCrossSectorShare.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the eID cross sector share implementation - */ - public final EIDCrossSectorShareImpl buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new EIDCrossSectorShareImpl(namespaceURI, localName, - namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base deleted file mode 100644 index 30502f429..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareImpl.java.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; - -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * The Class EIDCrossSectorShareImpl. - * - * @author fjquevedo - */ -public class EIDCrossSectorShareImpl extends AbstractSAMLObject implements - EIDCrossSectorShare { - - private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossSectorShareImpl.class.getName()); - /** The citizen country code. */ - private String eIDCrossSectorShare; - - - /** - * Instantiates a new eID cross sector share implementation. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected EIDCrossSectorShareImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - - /** - * Gets the eID cross sector share. - * - * @return the eID cross sector share - */ - public final String getEIDCrossSectorShare() { - return eIDCrossSectorShare; - } - - - /** - * Sets the eID cross sector share. - * - * @param newEIDCrossSectorShare the new eID cross sector share - */ - public final void setEIDCrossSectorShare(String newEIDCrossSectorShare) { - this.eIDCrossSectorShare = prepareForAssignment(this.eIDCrossSectorShare, newEIDCrossSectorShare); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base deleted file mode 100644 index dfd2b81dc..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareMarshaller.java.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; - - -/** - * The Class EIDCrossSectorShareMarshaller. - * - * @author fjquevedo - */ -public class EIDCrossSectorShareMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; - XMLHelper.appendTextContent(domElement, crossSectorShare.getEIDCrossSectorShare()); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base deleted file mode 100644 index 6a9711ca2..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDCrossSectorShareUnmarshaller.java.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDCrossSectorShare; - -/** - * The Class EIDCrossSectorShareUnmarshaller. - * - * @author fjquevedo - */ -public class EIDCrossSectorShareUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void processElementContent(final XMLObject samlObject, - final String domElement) { - - final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) samlObject; - crossSectorShare.setEIDCrossSectorShare(domElement); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base deleted file mode 100644 index 75062dc69..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareBuilder.java.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.EIDSectorShare; - -/** - * The Class EIDSectorShareBuilder. - * - * @author fjquevedo - */ -public class EIDSectorShareBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the eID sector share - */ - public final EIDSectorShare buildObject() { - return buildObject(EIDSectorShare.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the eID sector share - */ - public final EIDSectorShare buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new EIDSectorShareImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base deleted file mode 100644 index c548841f7..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareImpl.java.svn-base +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.EIDSectorShare; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -// TODO: Auto-generated Javadoc -/** - * The Class EIDSectorShareImpl. - * - * @author fjquevedo - */ -public class EIDSectorShareImpl extends AbstractSAMLObject implements - EIDSectorShare { - - private static final Logger LOGGER = LoggerFactory.getLogger(EIDSectorShareImpl.class.getName()); - - /** The e id sector share. */ - private String eIDSectorShare; - /** - * Instantiates a new eID sector share implementation. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected EIDSectorShareImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - /** - * Gets the eID sector share. - * - * @return the eID sector share - */ - public final String getEIDSectorShare() { - return eIDSectorShare; - } - - /** - * Sets the eID sector share. - * - * @param newEIDSectorShare the new eID sector share - */ - public final void setEIDSectorShare(String newEIDSectorShare) { - this.eIDSectorShare = prepareForAssignment(this.eIDSectorShare, newEIDSectorShare); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base deleted file mode 100644 index 87ab23660..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareMarshaller.java.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.saml2.core.impl.AbstractNameIDTypeMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDSectorShare; - -/** - * The Class EIDSectorShareMarshaller. - * - * @author fjquevedo - */ -public class EIDSectorShareMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; - XMLHelper.appendTextContent(domElement, sectorShare.getEIDSectorShare()); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base deleted file mode 100644 index 9c661813f..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/EIDSectorShareUnmarshaller.java.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.EIDSectorShare; - - -/** - * The Class EIDSectorShareUnmarshaller. - * - * @author fjquevedo - */ -public class EIDSectorShareUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void processElementContent(final XMLObject samlObject, - final String domElement) { - final EIDSectorShare sectorShare = (EIDSectorShare) samlObject; - sectorShare.setEIDSectorShare(domElement); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base deleted file mode 100644 index 41676931b..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeBuilder.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class QAAAttributeBuilder. - * - * @author fjquevedo - */ -public class QAAAttributeBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the quality authentication assurance object - */ - public final QAAAttribute buildObject() { - return buildObject(QAAAttribute.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the quality authentication assurance object - - */ - public final QAAAttribute buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new QAAAttributeImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base deleted file mode 100644 index c08986026..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeImpl.java.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.QAAAttribute; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class QAAAttributeImpl. - * - * @author fjquevedo - */ -public class QAAAttributeImpl extends AbstractSAMLObject implements - QAAAttribute { - - private static final Logger LOGGER = LoggerFactory.getLogger(QAAAttributeImpl.class.getName()); - /** The quality authentication assurance level. */ - private String qaaLevel; - - /** - * Constructor. - * - * @param namespaceURI the namespace the element is in - * @param elementLocalName the local name of the XML element this Object - * represents - * @param namespacePrefix the prefix for the given namespace - */ - protected QAAAttributeImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the quality authentication assurance level. - * - * @return the quality authentication assurance level - */ - public final String getQaaLevel() { - return qaaLevel; - } - - /** - * Sets the quality authentication assurance level. - * - * @param newQaaLevel the new quality authentication assurance level - */ - public final void setQaaLevel(final String newQaaLevel) { - this.qaaLevel = prepareForAssignment(this.qaaLevel, newQaaLevel); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base deleted file mode 100644 index 000879368..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class QAAAttributeMarshaller. - * - * @author fjquevedo - */ -public class QAAAttributeMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final QAAAttribute qaaAttribute = (QAAAttribute) samlObject; - XMLHelper.appendTextContent(domElement, qaaAttribute.getQaaLevel()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base deleted file mode 100644 index 8445e4eeb..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/QAAAttributeUnmarshaller.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class QAAAttributeUnmarshaller. - * - * @author fjquevedo - */ -public class QAAAttributeUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final QAAAttribute qaaLevel = (QAAAttribute) samlObject; - qaaLevel.setQaaLevel(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base deleted file mode 100644 index 70bd6ac1f..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeBuilder.java.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; - -/** - * The Class RequestedAttributeBuilder. - * - * @author fjquevedo - */ -public class RequestedAttributeBuilder extends - AbstractSAMLObjectBuilder { - - - /** - * Builds the object. - * - * @return the requested attribute - */ - public final RequestedAttribute buildObject() { - return buildObject(RequestedAttribute.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the requested attribute - */ - public final RequestedAttribute buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new RequestedAttributeImpl(namespaceURI, localName, - namespacePrefix); - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base deleted file mode 100644 index ad759230a..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeImpl.java.svn-base +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.schema.XSBooleanValue; -import org.opensaml.xml.util.AttributeMap; -import org.opensaml.xml.util.XMLObjectChildrenList; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -// TODO: Auto-generated Javadoc -/** - * The Class RequestedAttributeImpl. - * - * @author fjquevedo - */ -public class RequestedAttributeImpl extends AbstractSAMLObject implements - RequestedAttribute { - - private static final Logger LOGGER = LoggerFactory.getLogger(RequestedAttributeImpl.class.getName()); - /** - * The attribute values. - */ - private final XMLObjectChildrenList attributeValues; - - /** - * The friendly name. - * - */ - private String friendlyName; - - /** - * The is required. - */ - private String isRequired; - - /** - * The name. - * - */ - private String name; - - /** - * The name format. - * - */ - private String nameFormat; - - /** - * The unknown attributes. - * - */ - private AttributeMap unknownAttributes; - - /** - * Instantiates a new requested attribute impl. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected RequestedAttributeImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - unknownAttributes = new AttributeMap(this); - attributeValues = new XMLObjectChildrenList(this); - } - - - /** - * Gets the attribute values. - * - * @return the attribute values - */ - public final List getAttributeValues() { - return attributeValues; - } - - /** - * Gets the friendly name. - * - * @return the friendly name. - */ - public final String getFriendlyName() { - return friendlyName; - } - - - /** - * Gets the checks if is required. - * - * @return the boolean if it's required. - */ - public final String isRequired() { - return isRequired; - } - - - /** - * Gets the is required xs boolean. - * - * @return the XSBoolean if it's required. - */ - public final String getIsRequiredXSBoolean() { - return isRequired; - } - - - /** - * Gets the name. - * - * @return the name - */ - public final String getName() { - return name; - } - - - /** - * Gets the name format. - * - * @return the name format. - */ - public final String getNameFormat() { - return nameFormat; - } - - /** - * Gets the ordered children. - * - * @return the list of XMLObject. - */ - public final List getOrderedChildren() { - final ArrayList children = new ArrayList(); - children.addAll(attributeValues); - return Collections.unmodifiableList(children); - } - - /** - * Gets the unknown attributes. - * - * @return the attribute map - */ - public final AttributeMap getUnknownAttributes() { - return unknownAttributes; - } - - /** - * Sets the friendly name. - * - * @param newFriendlyName the new friendly name format - */ - public final void setFriendlyName(final String newFriendlyName) { - this.friendlyName = prepareForAssignment(this.friendlyName, - newFriendlyName); - } - - /** - * Set new boolean value isRequired. - * @param newIsRequired then new value - */ - public final void setIsRequired(final String newIsRequired) { - isRequired = prepareForAssignment(this.isRequired, newIsRequired); - - } - - /** - * Sets the name. - * - * @param newName the new name - */ - public final void setName(final String newName) { - this.name = prepareForAssignment(this.name, newName); - } - - /** - * Sets the name format. - * - * @param newNameFormat the new name format - */ - public final void setNameFormat(final String newNameFormat) { - this.nameFormat = prepareForAssignment(this.nameFormat, newNameFormat); - } - - /** - * Sets the unknown attributes. - * - * @param newUnknownAttr the new unknown attributes - */ - public final void setUnknownAttributes(final AttributeMap newUnknownAttr) { - this.unknownAttributes = newUnknownAttr; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base deleted file mode 100644 index 6d0669241..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeMarshaller.java.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.Map.Entry; - -import javax.xml.namespace.QName; - -import org.opensaml.Configuration; -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; - -/** - * The Class RequestedAttributeMarshaller. - * - * @author fjquevedo - */ -public class RequestedAttributeMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall attributes. - * - * @param samlElement the SAML element - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallAttributes(final XMLObject samlElement, - final Element domElement) throws MarshallingException { - final RequestedAttribute requestedAttr = (RequestedAttribute) samlElement; - - if (requestedAttr.getName() != null) { - domElement.setAttributeNS(null, - RequestedAttribute.NAME_ATTRIB_NAME, requestedAttr - .getName()); - } - - if (requestedAttr.getNameFormat() != null) { - domElement.setAttributeNS(null, - RequestedAttribute.NAME_FORMAT_ATTR, requestedAttr - .getNameFormat()); - } - - if (requestedAttr.getFriendlyName() != null) { - domElement.setAttributeNS(null, - RequestedAttribute.FRIENDLY_NAME_ATT, requestedAttr - .getFriendlyName()); - } - - if (requestedAttr.getIsRequiredXSBoolean() != null) { - domElement.setAttributeNS(null, - RequestedAttribute.IS_REQUIRED_ATTR, requestedAttr - .getIsRequiredXSBoolean().toString()); - } - - Attr attr; - for (Entry entry : requestedAttr.getUnknownAttributes() - .entrySet()) { - attr = XMLHelper.constructAttribute(domElement.getOwnerDocument(), - entry.getKey()); - attr.setValue(entry.getValue()); - domElement.setAttributeNodeNS(attr); - if (Configuration.isIDAttribute(entry.getKey()) - || requestedAttr.getUnknownAttributes().isIDAttribute( - entry.getKey())) { - attr.getOwnerElement().setIdAttributeNode(attr, true); - } - } - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base deleted file mode 100644 index 551f4239d..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributeUnmarshaller.java.svn-base +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import javax.xml.namespace.QName; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; -import org.opensaml.xml.schema.XSBooleanValue; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Attr; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.SAMLCore; - -/** - * The Class RequestedAttributeUnmarshaller. - * - * @author fjquevedo - */ -public class RequestedAttributeUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentSAMLObject parent SAMLObject - * @param childSAMLObject child SAMLObject - * - * @throws UnmarshallingException error at unmarshall XML object - */ - protected final void processChildElement(final XMLObject parentSAMLObject, - final XMLObject childSAMLObject) throws UnmarshallingException { - - final RequestedAttribute requestedAttr = (RequestedAttribute) parentSAMLObject; - - final QName childQName = childSAMLObject.getElementQName(); - if (childQName.getLocalPart().equals("AttributeValue") - && childQName.getNamespaceURI().equals(SAMLCore.STORK10_NS.getValue())) { - requestedAttr.getAttributeValues().add(childSAMLObject); - } else { - super.processChildElement(parentSAMLObject, childSAMLObject); - } - } - - /** - * Process attribute. - * - * @param samlObject the SAML object - * @param attribute the attribute - * @throws UnmarshallingException the unmarshalling exception - */ - protected final void processAttribute(final XMLObject samlObject, - final Attr attribute) throws UnmarshallingException { - - final RequestedAttribute requestedAttr = (RequestedAttribute) samlObject; - - if (attribute.getLocalName() - .equals(RequestedAttribute.NAME_ATTRIB_NAME)) { - requestedAttr.setName(attribute.getValue()); - } else if (attribute.getLocalName().equals( - RequestedAttribute.NAME_FORMAT_ATTR)) { - requestedAttr.setNameFormat(attribute.getValue()); - } else if (attribute.getLocalName().equals( - RequestedAttribute.FRIENDLY_NAME_ATT)) { - requestedAttr.setFriendlyName(attribute.getValue()); - } else if (attribute.getLocalName().equals( - RequestedAttribute.IS_REQUIRED_ATTR)) { - requestedAttr.setIsRequired(attribute - .getValue()); - - } else { - final QName attribQName = XMLHelper.getNodeQName(attribute); - if (attribute.isId()) { - requestedAttr.getUnknownAttributes().registerID(attribQName); - } - requestedAttr.getUnknownAttributes().put(attribQName, - attribute.getValue()); - } - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base deleted file mode 100644 index 138177995..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesBuilder.java.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.RequestedAttributes; - -/** - * The Class RequestedAttributesBuilder. - * - * @author fjquevedo - */ -public class RequestedAttributesBuilder extends - AbstractSAMLObjectBuilder { - - - /** - * Builds the object. - * - * @return the requested attributes - */ - public final RequestedAttributes buildObject() { - return buildObject(RequestedAttributes.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the requested attributes - */ - public final RequestedAttributes buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new RequestedAttributesImpl(namespaceURI, localName, - namespacePrefix); - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base deleted file mode 100644 index a58a08a05..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesImpl.java.svn-base +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.util.IndexedXMLObjectChildrenList; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttributes; - -/** - * The Class RequestedAttributesImpl. - * - * @author fjquevedo - */ -public class RequestedAttributesImpl extends AbstractSAMLObject implements - RequestedAttributes { - - /** - * Instantiates a new requested attributes implement. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected RequestedAttributesImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - indexedChildren = new IndexedXMLObjectChildrenList(this); - } - - /** The indexed children. */ - private final IndexedXMLObjectChildrenList indexedChildren; - - /** - * Gets the indexed children. - * - * @return the indexed children - */ - public final IndexedXMLObjectChildrenList getIndexedChildren() { - return indexedChildren; - } - - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - - final ArrayList children = new ArrayList(); - - children.addAll(indexedChildren); - - return Collections.unmodifiableList(children); - - } - - /** - * Gets the attributes. - * - * @return the attributes - * - * @see eu.stork.peps.auth.engine.core.RequestedAttributes#getAttributes() - */ - @SuppressWarnings("unchecked") - public final List getAttributes() { - return (List) indexedChildren - .subList(RequestedAttribute.DEF_ELEMENT_NAME); - } - - @Override - public int hashCode() { - throw new UnsupportedOperationException("hashCode method not implemented"); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base deleted file mode 100644 index 955fe0318..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesMarshaller.java.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; - -/** - * The Class RequestedAttributesMarshaller. - * - * @author fjquevedo - */ -public class RequestedAttributesMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Instantiates a new requested attributes marshaller. - */ - public RequestedAttributesMarshaller() { - super(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base deleted file mode 100644 index 132d6cc59..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/RequestedAttributesUnmarshaller.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttributes; - -/** - * The Class RequestedAttributesUnmarshaller. - * - * @author fjquevedo - */ -public class RequestedAttributesUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentObject the parent object - * @param childObject the child object - * - * @throws UnmarshallingException error in unmarshall - */ - protected final void processChildElement(final XMLObject parentObject, - final XMLObject childObject) throws UnmarshallingException { - final RequestedAttributes attrStatement = (RequestedAttributes) parentObject; - - if (childObject instanceof RequestedAttribute) { - attrStatement.getAttributes().add((RequestedAttribute) childObject); - } else { - super.processChildElement(parentObject, childObject); - } - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base deleted file mode 100644 index a35c77936..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationBuilder.java.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPApplication; - -/** - * The Class SPApplicationBuilder. - * - * @author fjquevedo - */ -public class SPApplicationBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the service provider application - */ - public final SPApplication buildObject() { - return buildObject(SPApplication.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the service provider application - */ - public final SPApplication buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPApplicationImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base deleted file mode 100644 index 6bb631a74..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationImpl.java.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPApplication; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class SPApplicationImpl. - * - * @author fjquevedo - */ -public class SPApplicationImpl extends AbstractSAMLObject implements - SPApplication { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPApplicationImpl.class.getName()); - /** The service provider application. */ - private String spApplication; - - /** - * Instantiates a new service provider application. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPApplicationImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the service provider application. - * - * @return the service provider application - */ - public final String getSPApplication() { - return spApplication; - } - - /** - * Sets the service provider application. - * - * @param newSpApplication the new service provider application - */ - public final void setSPApplication(final String newSpApplication) { - this.spApplication = prepareForAssignment(this.spApplication, - newSpApplication); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base deleted file mode 100644 index 4866c3535..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationMarshaller.java.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPApplication; - -/** - * The Class SPApplicationMarshaller. - * - * @author fjquevedo - */ -public class SPApplicationMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPApplication spApplication = (SPApplication) samlObject; - XMLHelper.appendTextContent(domElement, spApplication - .getSPApplication()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base deleted file mode 100644 index a28432a13..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPApplicationUnmarshaller.java.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPApplication; - - -/** - * The Class SPApplicationUnmarshaller. - * - * @author fjquevedo - */ -public class SPApplicationUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPApplication spApplication = (SPApplication) samlObject; - spApplication.setSPApplication(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base deleted file mode 100644 index 48ec92f49..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryBuilder.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPCountry; - -/** - * The Class SPCountryBuilder. - * - * @author fjquevedo - */ -public class SPCountryBuilder extends AbstractSAMLObjectBuilder { - - - /** - * Builds the object SPCountry. - * - * @return the service provider country - */ - public final SPCountry buildObject() { - return buildObject(SPCountry.DEF_ELEMENT_NAME); - } - - - /** - * Builds the object SPCountry. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the service provider country - */ - public final SPCountry buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPCountryImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base deleted file mode 100644 index db58fb8be..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryImpl.java.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPCountry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class SPCountryImpl. - * - * @author fjquevedo - */ -public class SPCountryImpl extends AbstractSAMLObject implements SPCountry { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPCountryImpl.class.getName()); - /** The service provider country. */ - private String spCountry; - - /** - * Instantiates a new service provider country. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPCountryImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the service provider country. - * - * @return the service provider country - */ - public final String getSPCountry() { - return spCountry; - } - - /** - * Sets the service provider country. - * - * @param newSpCountry the new service provider country - */ - public final void setSPCountry(final String newSpCountry) { - this.spCountry = prepareForAssignment(this.spCountry, newSpCountry); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base deleted file mode 100644 index e82634749..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPCountry; - -/** - * The Class SPCountryMarshaller. - * - * @author fjquevedo - */ -public class SPCountryMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPCountry spCountry = (SPCountry) samlObject; - XMLHelper.appendTextContent(domElement, spCountry.getSPCountry()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base deleted file mode 100644 index deb695ac6..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPCountryUnmarshaller.java.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPCountry; - - -/** - * The Class SPCountryUnmarshaller. - * - * @author fjquevedo - */ -public class SPCountryUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPCountry spCountry = (SPCountry) samlObject; - spCountry.setSPCountry(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base deleted file mode 100644 index b3640947b..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDBuilder.java.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPID; - -/** - * The Class SPIDBuilder. - * - * @author iinigo - */ -public class SPIDBuilder extends AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the SP ID - */ - public final SPID buildObject() { - return buildObject(SPID.DEF_ELEMENT_NAME); - } - - /** - * Builds the object. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the citizen country code - */ - public final SPID buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPIDImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base deleted file mode 100644 index 0c7127273..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDImpl.java.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPID; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class SPIDImpl. - * - * @author iinigo - */ -public class SPIDImpl extends AbstractSAMLObject implements SPID { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPIDImpl.class.getName()); - /** The citizen country code. */ - private String spId; - - /** - * Instantiates a new sP country impl. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPIDImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the SP ID. - * - * @return the SP ID - */ - public final String getSPID() { - return spId; - } - - /** - * Sets the SP ID. - * - * @param newSPID the new SP ID - */ - public final void setSPID(final String newSPID) { - this.spId = prepareForAssignment(this.spId, newSPID); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base deleted file mode 100644 index 24389522e..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPID; - -/** - * The Class SPIDMarshaller. - * - * @author iinigo - */ -public class SPIDMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPID spid = (SPID) samlObject; - XMLHelper.appendTextContent(domElement, spid.getSPID()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base deleted file mode 100644 index e4d230b94..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPIDUnmarshaller.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPID; - -/** - * The Class SPIDUnmarshaller. - * - * @author iinigo - */ -public class SPIDUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPID spid = (SPID) samlObject; - spid.setSPID(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base deleted file mode 100644 index a6e1fe686..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationBuilder.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SAMLCore; -import eu.stork.peps.auth.engine.core.SPInformation; - -/** - * The Class SPInformation. - * - * @author iinigo - */ -public final class SPInformationBuilder extends AbstractSAMLObjectBuilder { - - - /** {@inheritDoc} */ - public SPInformation buildObject() { - return buildObject(SAMLCore.STORK10P_NS.getValue(), SPInformation.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); - } - - /** {@inheritDoc} */ - public SPInformation buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { - return new SPInformationImpl(namespaceURI, localName, namespacePrefix); - } - -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base deleted file mode 100644 index b5609600d..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationImpl.java.svn-base +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSignableSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPID; -import eu.stork.peps.auth.engine.core.SPInformation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * The Class SPInformationImpl. - * - * @author iinigo - */ -public final class SPInformationImpl extends AbstractSignableSAMLObject implements -SPInformation { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPInformationImpl.class.getName()); - /** The citizen country code. */ - private SPID spId; - - - /** - * Instantiates a new requested attributes implement. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPInformationImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - /** - * getSPId. - * - * @return the SP ID - */ - public SPID getSPID() { - return spId; - } - - /** - * Gets the ordered children. - * - * @return the ordered children - * - */ - public List getOrderedChildren() { - final ArrayList children = new ArrayList(); - - children.add(spId); - - if (getSignature() != null) { - children.add(getSignature()); - } - - return Collections.unmodifiableList(children); - - } - - /** - * Gets the signature reference id. - * - * @return the signature reference id - * - */ - public String getSignatureReferenceID() { - return null; - } - - /** - * Sets the SP Id. - * - * @param newSPId the new SP Id - * - */ - public void setSPID(SPID newSPId) { - this.spId = prepareForAssignment(this.spId, newSPId); - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base deleted file mode 100644 index 44845948c..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationMarshaller.java.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; - -/** - * The Class SPInformationMarshaller. - * - * @author iinigo - */ -public class SPInformationMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Instantiates a new SP Information marshaller. - */ - public SPInformationMarshaller() { - super(); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base deleted file mode 100644 index 79b0b0f35..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInformationUnmarshaller.java.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.peps.auth.engine.core.SPID; -import eu.stork.peps.auth.engine.core.SPInformation; - -/** - * The Class SPInformationUnmarshaller. - * - * @author iinigo - */ -public class SPInformationUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentObject the parent object - * @param childObject the child object - * - * @throws UnmarshallingException the unmarshalling exception - * - */ - protected final void processChildElement(final XMLObject parentObject, - final XMLObject childObject) throws UnmarshallingException { - final SPInformation spInformation = (SPInformation) parentObject; - - if (childObject instanceof SPID) { - spInformation.setSPID((SPID) childObject); - } else { - super.processChildElement(parentObject, childObject); - } - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base deleted file mode 100644 index fe47cf99c..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionBuilder.java.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPInstitution; - -/** - * The Class SPInstitutionBuilder. - * - * @author fjquevedo - */ -public class SPInstitutionBuilder extends - AbstractSAMLObjectBuilder { - - /** - * Builds the object. - * - * @return the service provider institution - */ - public final SPInstitution buildObject() { - return buildObject(SPInstitution.DEF_ELEMENT_NAME); - } - - /** - * Builds the object SPInstitution. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the service provider institution - */ - public final SPInstitution buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPInstitutionImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base deleted file mode 100644 index cf1760446..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionImpl.java.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPInstitution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class SPInstitutionImpl. - * - * @author fjquevedo - */ -public class SPInstitutionImpl extends AbstractSAMLObject implements - SPInstitution { - - private static final Logger LOGGER = LoggerFactory.getLogger(SPInstitutionImpl.class.getName()); - /** The service provider institution. */ - private String spInstitution; - - /** - * Instantiates a new service provider institution. - * - * @param namespaceURI the namespace uri - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPInstitutionImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** - * Gets the service provider institution. - * - * @return the service provider institution - */ - public final String getSPInstitution() { - return spInstitution; - } - - /** - * Sets the service provider institution. - * - * @param newSpInstitution the new service provider institution - */ - public final void setSPInstitution(final String newSpInstitution) { - this.spInstitution = prepareForAssignment(this.spInstitution, - newSpInstitution); - } - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } - } diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base deleted file mode 100644 index 504a1f035..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionMarshaller.java.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPInstitution; - -/** - * The Class SPInstitutionMarshaller. - * - * @author fjquevedo - */ -public class SPInstitutionMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPInstitution spInstitution = (SPInstitution) samlObject; - XMLHelper.appendTextContent(domElement, spInstitution - .getSPInstitution()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base deleted file mode 100644 index 103d5f2b2..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPInstitutionUnmarshaller.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPInstitution; - -/** - * The Class SPInstitutionUnmarshaller. - * - * @author fjquevedo - */ -public class SPInstitutionUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPInstitution spInstitution = (SPInstitution) samlObject; - spInstitution.setSPInstitution(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base deleted file mode 100644 index a691b9008..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorBuilder.java.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SPSector; - -/** - * The Class SPSectorBuilder. - * - * @author fjquevedo - */ -public class SPSectorBuilder extends AbstractSAMLObjectBuilder { - - /** - * Builds the object SPSector. - * - * @return the service provider sector. - */ - public final SPSector buildObject() { - return buildObject(SPSector.DEF_ELEMENT_NAME); - } - - /** - * Builds the object SPSector. - * - * @param namespaceURI the namespace uri - * @param localName the local name - * @param namespacePrefix the namespace prefix - * @return the service provider sector - */ - public final SPSector buildObject(final String namespaceURI, - final String localName, final String namespacePrefix) { - return new SPSectorImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base deleted file mode 100644 index a29810dd4..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorImpl.java.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.List; - -import org.opensaml.common.impl.AbstractSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPSector; - - -/** - * The Class SPSectorImpl. - * - * @author fjquevedo - */ -public class SPSectorImpl extends AbstractSAMLObject implements SPSector { - - /** The service provider sector. */ - private String spSector; - - /** - * Instantiates a new Service provider sector implementation. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected SPSectorImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - /** - * Gets the service provider sector. - * - * @return the SP sector - * - * @see eu.stork.peps.auth.engine.core.SPSector#getSPSector() - */ - public final String getSPSector() { - return spSector; - } - - - /** - * Sets the service provider sector. - * - * @param newSpSector the new service provider sector - */ - public final void setSPSector(final String newSpSector) { - this.spSector = prepareForAssignment(this.spSector, newSpSector); - } - - - /** - * Gets the ordered children. - * - * @return the ordered children - */ - public final List getOrderedChildren() { - return null; - } - - @Override - public int hashCode() { - throw new UnsupportedOperationException("hashCode method not implemented"); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base deleted file mode 100644 index c5331e8f4..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorMarshaller.java.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.peps.auth.engine.core.SPSector; - -/** - * The Class SPSectorMarshaller. - * - * @author fjquevedo - */ -public class SPSectorMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Marshall element content. - * - * @param samlObject the SAML object - * @param domElement the DOM element - * @throws MarshallingException the marshalling exception - */ - protected final void marshallElementContent(final XMLObject samlObject, - final Element domElement) throws MarshallingException { - final SPSector spSector = (SPSector) samlObject; - XMLHelper.appendTextContent(domElement, spSector.getSPSector()); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base deleted file mode 100644 index cbb05c6e5..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SPSectorUnmarshaller.java.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.SPSector; - -/** - * The Class SPSectorUnmarshaller. - * - * @author fjquevedo - */ -public class SPSectorUnmarshaller extends AbstractSAMLObjectUnmarshaller { - - - /** - * Process element content. - * - * @param samlObject the SAML object - * @param elementContent the element content - */ - protected final void processElementContent(final XMLObject samlObject, - final String elementContent) { - final SPSector spSector = (SPSector) samlObject; - spSector.setSPSector(elementContent); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base deleted file mode 100644 index 2db14f543..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignHW.java.svn-base +++ /dev/null @@ -1,399 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.io.IOException; -import java.io.InputStream; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.Provider; -import java.security.Security; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.InvalidPropertiesFormatException; -import java.util.List; -import java.util.Properties; - -import eu.stork.peps.auth.engine.X509PrincipalUtil; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.NotImplementedException; -import org.bouncycastle.jce.X509Principal; -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.security.SAMLSignatureProfileValidator; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.security.SecurityConfiguration; -import org.opensaml.xml.security.SecurityException; -import org.opensaml.xml.security.credential.Credential; -import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; -import org.opensaml.xml.security.keyinfo.KeyInfoHelper; -import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; -import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; -import org.opensaml.xml.security.x509.BasicX509Credential; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.signature.Signature; -import org.opensaml.xml.signature.SignatureConstants; -import org.opensaml.xml.signature.SignatureException; -import org.opensaml.xml.signature.SignatureValidator; -import org.opensaml.xml.signature.Signer; -import org.opensaml.xml.validation.ValidationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.exceptions.SAMLEngineException; - -/** - * The Class HWSign. Module of sign. - * - * @author fjquevedo - */ -public final class SignHW implements SAMLEngineSignI { - - /** The Constant CONFIGURATION_FILE. */ - private static final String CONF_FILE = "configurationFile"; - - /** The Constant KEYSTORE_TYPE. - private static final String KEYSTORE_TYPE = "keystoreType" */ - - /** The logger. */ - private static final Logger LOG = LoggerFactory.getLogger(SignHW.class - .getName()); - - /** The stork own key store. */ - private KeyStore storkOwnKeyStore = null; - - /** - * Gets the stork own key store. - * - * @return the stork own key store - */ - public KeyStore getStorkOwnKeyStore() { - return storkOwnKeyStore; - } - - /** - * Gets the stork trustStore. - * - * @return the stork own key store - */ - public KeyStore getTrustStore() { - return storkOwnKeyStore; - } - - /** - * Sets the stork own key store. - * - * @param newkOwnKeyStore the new stork own key store - */ - public void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { - this.storkOwnKeyStore = newkOwnKeyStore; - } - - /** - * Gets the properties. - * - * @return the properties - */ - public Properties getProperties() { - return properties; - } - - /** - * Sets the properties. - * - * @param newProperties the new properties - */ - public void setProperties(final Properties newProperties) { - this.properties = newProperties; - } - - /** The HW sign prop. */ - private Properties properties = null; - - /** - * @see - * eu.stork.peps.auth.engine.core.SAMLEngineSignI#init(java.lang.String) - * @param fileConf file of configuration - * @throws SAMLEngineException error in read file - */ - public void init(final String fileConf) - throws SAMLEngineException { - InputStream inputStr = null; - try { - inputStr = SignHW.class.getResourceAsStream("/" - + fileConf); - properties = new Properties(); - - properties.loadFromXML(inputStr); - } catch (final InvalidPropertiesFormatException e) { - LOG.info("Exception: invalid properties format."); - throw new SAMLEngineException(e); - } catch (IOException e) { - LOG.info("Exception: invalid file: " + fileConf); - throw new SAMLEngineException(e); - } finally { - IOUtils.closeQuietly(inputStr); - } - } - - - /** - * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() - * @return the X509Certificate. - */ - public X509Certificate getCertificate() { - throw new NotImplementedException(); - } - - /** - * @see - * eu.stork.peps.auth.engine.core.SAMLEngineSignI#sign(SignableSAMLObject tokenSaml) - * @param tokenSaml signable SAML Object - * @return the SAMLObject signed. - * @throws SAMLEngineException error in sign token saml - */ - public SAMLObject sign(final SignableSAMLObject tokenSaml) throws SAMLEngineException { - - try { - LOG.info("Star procces of sign"); - final char[] pin = properties.getProperty("keyPassword") - .toCharArray(); - - storkOwnKeyStore.load(null, pin); - - final String serialNumber = properties.getProperty("serialNumber"); - final String issuer = properties.getProperty("issuer"); - - String alias = null; - String aliasCert; - X509Certificate certificate; - - boolean find = false; - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements() && !find;) { - aliasCert = e.nextElement(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - // Verified serial number, issuer - - final String serialNum = certificate.getSerialNumber() - .toString(16); - X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); - X509Principal issuerDNConf = new X509Principal(issuer); - - if(serialNum.equalsIgnoreCase(serialNumber) - && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ - alias = aliasCert; - find = true; - } - - } - - if (!find) { - throw new SAMLEngineException("Certificate cannot be found in keystore "); - } - certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); - final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( - alias, pin); - - LOG.info("Recover BasicX509Credential."); - final BasicX509Credential credential = new BasicX509Credential(); - - LOG.debug("Load certificate"); - credential.setEntityCertificate(certificate); - - LOG.debug("Load privateKey"); - credential.setPrivateKey(privateKey); - - LOG.info("Star procces of sign"); - final Signature signature = (Signature) org.opensaml.xml.Configuration - .getBuilderFactory().getBuilder( - Signature.DEFAULT_ELEMENT_NAME).buildObject( - Signature.DEFAULT_ELEMENT_NAME); - - LOG.debug("Begin signature with openSaml"); - signature.setSigningCredential(credential); - - signature.setSignatureAlgorithm( - SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); - - - - final SecurityConfiguration securityConf = - org.opensaml.xml.Configuration.getGlobalSecurityConfiguration(); - final NamedKeyInfoGeneratorManager keyInfoManager = securityConf - .getKeyInfoGeneratorManager(); - final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager - .getDefaultManager(); - final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager - .getFactory(credential); - final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac - .newInstance(); - - final KeyInfo keyInfo = keyInfoGenerator.generate(credential); - - signature.setKeyInfo(keyInfo); - - LOG.debug("Set Canonicalization Algorithm"); - signature.setCanonicalizationAlgorithm( - SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - - tokenSaml.setSignature(signature); - - LOG.debug("Marshall samlToken."); - org.opensaml.xml.Configuration.getMarshallerFactory() - .getMarshaller(tokenSaml).marshall(tokenSaml); - - LOG.info("Sign samlToken."); - Signer.signObject(signature); - - } catch (final MarshallingException e) { - LOG.error("MarshallingException"); - throw new SAMLEngineException(e); - } catch (final NoSuchAlgorithmException e) { - LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); - throw new SAMLEngineException(e); - } catch (final KeyStoreException e) { - LOG.error("Generic KeyStore exception."); - throw new SAMLEngineException(e); - } catch (final SignatureException e) { - LOG.error("Signature exception."); - throw new SAMLEngineException(e); - } catch (final SecurityException e) { - LOG.error("Security exception."); - throw new SAMLEngineException(e); - } catch (final CertificateException e) { - LOG.error("Certificate exception."); - throw new SAMLEngineException(e); - } catch (final IOException e) { - LOG.error("IO exception."); - throw new SAMLEngineException(e); - } catch (final UnrecoverableKeyException e) { - LOG.error("UnrecoverableKeyException exception."); - throw new SAMLEngineException(e); - } - - return tokenSaml; - } - - /** - * @see - * eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(SignableSAMLObject) - * @param tokenSaml the token saml - * @return the SAMLObject validated. - * @throws SAMLEngineException exception in validate signature - */ - public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start signature validation."); - try { - - // Validate structure signature - final SAMLSignatureProfileValidator signProfValidator = - new SAMLSignatureProfileValidator(); - - // Indicates signature id conform to SAML Signature profile - signProfValidator.validate(tokenSaml.getSignature()); - - String aliasCert; - X509Certificate certificate; - - final List trustedCred = new ArrayList(); - - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements();) { - aliasCert = e.nextElement(); - final BasicX509Credential credential = new BasicX509Credential(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - credential.setEntityCertificate(certificate); - trustedCred.add(credential); - } - - final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); - final List listCertificates = KeyInfoHelper - .getCertificates(keyInfo); - - if (listCertificates.size() != 1) { - throw new SAMLEngineException("Only must be one certificate"); - } - - // Exist only one certificate - final BasicX509Credential entityX509Cred = new BasicX509Credential(); - entityX509Cred.setEntityCertificate(listCertificates.get(0)); - - final ExplicitKeyTrustEvaluator keyTrustEvaluator = - new ExplicitKeyTrustEvaluator(); - if (!keyTrustEvaluator.validate(entityX509Cred, trustedCred)) { - throw new SAMLEngineException("Certificate it is not trusted."); - } - - final SignatureValidator sigValidator = new SignatureValidator( - entityX509Cred); - - sigValidator.validate(tokenSaml.getSignature()); - - } catch (final ValidationException e) { - LOG.error("ValidationException.", e); - throw new SAMLEngineException(e); - } catch (final KeyStoreException e) { - LOG.error("ValidationException.", e); - throw new SAMLEngineException(e); - } catch (final CertificateException e) { - LOG.error("CertificateException.", e); - throw new SAMLEngineException(e); - } - return tokenSaml; - } - - /** - * load cryptographic service provider. - * - * @throws SAMLEngineException the SAML engine exception - * Note this class was using pkcs11Provider - * final Provider pkcs11Provider = new sun.security.pkcs11.SunPKCS11(inputStream) - * if (Security.getProperty(pkcs11Provider.getName()) == null) { - * Security.insertProviderAt(pkcs11Provider, Security .getProviders().length) - * } - * storkOwnKeyStore = KeyStore.getInstance(properties.getProperty(KEYSTORE_TYPE)) - */ - public void loadCryptServiceProvider() throws SAMLEngineException { - LOG.info("Load Cryptographic Service Provider"); - InputStream inputStream = null; - - try { - inputStream = SignHW.class.getResourceAsStream("/" - + properties.getProperty(CONF_FILE)); - - } catch (final Exception e) { - throw new SAMLEngineException( - "Error loading CryptographicServiceProvider", e); - } finally { - IOUtils.closeQuietly(inputStream); - } - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base deleted file mode 100644 index 2adefddbd..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignModuleFactory.java.svn-base +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class ModuleSignFactory. - * - * @author fjquevedo - * - */ - -public final class SignModuleFactory { - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(SignModuleFactory.class.getName()); - - /** - * Instantiates a new module sign factory. - */ - private SignModuleFactory() { - - } - - /** - * Gets the single instance of SignModuleFactory. - * - * @param className the class name - * - * @return single instance of SignModuleFactory - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static SAMLEngineSignI getInstance(final String className) - throws STORKSAMLEngineException { - LOG.info("[START]SignModuleFactory static"); - try { - final Class cls = Class.forName(className); - return (SAMLEngineSignI) cls.newInstance(); - } catch (Exception e) { - throw new STORKSAMLEngineException(e); - } - - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base deleted file mode 100644 index 33ed05515..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignP12.java.svn-base +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.Provider; -import java.security.Security; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.InvalidPropertiesFormatException; -import java.util.List; -import java.util.Properties; - -import eu.stork.peps.auth.engine.X509PrincipalUtil; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.NotImplementedException; -import org.bouncycastle.jce.X509Principal; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.opensaml.Configuration; -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.security.SAMLSignatureProfileValidator; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.security.SecurityConfiguration; -import org.opensaml.xml.security.SecurityException; -import org.opensaml.xml.security.credential.Credential; -import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; -import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; -import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; -import org.opensaml.xml.security.x509.BasicX509Credential; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.signature.Signature; -import org.opensaml.xml.signature.SignatureConstants; -import org.opensaml.xml.signature.SignatureException; -import org.opensaml.xml.signature.SignatureValidator; -import org.opensaml.xml.signature.Signer; -import org.opensaml.xml.util.Base64; -import org.opensaml.xml.validation.ValidationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.exceptions.SAMLEngineException; - -/** - * The Class SWSign. Class responsible for signing and validating of messages - * SAML with a certificate store software. - * - * @author fjquevedo - */ -public final class SignP12 implements SAMLEngineSignI { - - /** The logger. */ - private static final Logger LOG = LoggerFactory.getLogger(SignP12.class - .getName()); - - - /** The p12 store. */ - private KeyStore p12Store = null; - - - /** The trust store. */ - private KeyStore trustStore = null; - - - /** - * Gets the trust store. - * - * @return the trust store - */ - public KeyStore getTrustStore() { - return trustStore; - } - - /** - * Sets the trust store. - * - * @param newTrustStore the new trust store - */ - public void setTrustStore(final KeyStore newTrustStore) { - this.trustStore = newTrustStore; - } - - /** - * The instance. - * - * @return the properties - */ - - public Properties getProperties() { - return properties; - } - - - - /** - * Gets the p12 store. - * - * @return the p12 store - */ - public KeyStore getP12Store() { - return p12Store; - } - - - - /** - * Sets the p12 store. - * - * @param newP12Store the new p12 store - */ - public void setP12Store(final KeyStore newP12Store) { - this.p12Store = newP12Store; - } - - - - /** - * Sets the properties. - * - * @param newProperties the new properties - */ - public void setProperties(final Properties newProperties) { - this.properties = newProperties; - } - - /** The SW sign prop. */ - private Properties properties = null; - - - /** - * Initialize the file configuration. - * - * @param fileConf name of the file configuration - * - * @throws SAMLEngineException error at the load from file configuration - */ - public void init(final String fileConf) throws SAMLEngineException { - InputStream fileProperties = null; - properties = new Properties(); - try { - try { - LOG.debug("Fichero a cargar " + fileConf); - fileProperties = new FileInputStream(fileConf); - properties.loadFromXML(fileProperties); - } catch (Exception e) { - LOG.error("Fallo al cargar el recurso externo. Se reintenta como fichero interno."); - fileProperties = SignP12.class.getResourceAsStream("/" + fileConf); - if (fileProperties == null) { - fileProperties = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileConf); - if (fileProperties == null) { - Enumeration files = ClassLoader.getSystemClassLoader().getResources(fileConf); - if (files != null && files.hasMoreElements()) { - LOG.info("Se han encontrado recurso/s. Se toma el primero."); - fileProperties = ClassLoader.getSystemClassLoader().getResourceAsStream(files.nextElement().getFile()); - } else { - throw new IOException("No se pudo recuperar el fichero: " + fileConf, e); - } - } - } - LOG.debug("Recuperados " + fileProperties.available() + " bytes"); - properties.loadFromXML(fileProperties); - } - } catch (InvalidPropertiesFormatException e) { - LOG.info("Exception: invalid properties format."); - throw new SAMLEngineException(e); - } catch (IOException e) { - LOG.info("Exception: invalid file: " + fileConf); - throw new SAMLEngineException(e); - } finally { - IOUtils.closeQuietly(fileProperties); - } - } - - /** - * Gets the certificate. - * - * @return the X509Certificate - * - */ - public X509Certificate getCertificate() { - throw new NotImplementedException(); - } - - /** - * Sign the token SAML. - * - * @param tokenSaml token SAML - * - * @return the X509Certificate signed. - * - * @throws SAMLEngineException error at sign SAML token - * - */ - public SAMLObject sign(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start Sign process"); - try { - - final String serialNumber = properties.getProperty("serialNumber"); - final String issuer = properties.getProperty("issuer"); - - String alias = null; - String aliasCert; - X509Certificate certificate; - - boolean find = false; - for (final Enumeration e = p12Store.aliases(); e - .hasMoreElements() && !find;) { - aliasCert = e.nextElement(); - certificate = (X509Certificate) p12Store - .getCertificate(aliasCert); - - final String serialNum = certificate.getSerialNumber() - .toString(16); - - X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); - X509Principal issuerDNConf = new X509Principal(issuer); - - if(serialNum.equalsIgnoreCase(serialNumber) - && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ - alias = aliasCert; - find = true; - } - - } - - certificate = (X509Certificate) p12Store - .getCertificate(alias); - final PrivateKey privateKey = (PrivateKey) p12Store.getKey( - alias, properties.getProperty("keyPassword").toCharArray()); - - LOG.info("Recover BasicX509Credential."); - final BasicX509Credential credential = new BasicX509Credential(); - - LOG.debug("Load certificate"); - credential.setEntityCertificate(certificate); - - LOG.debug("Load privateKey"); - credential.setPrivateKey(privateKey); - - LOG.debug("Begin signature with openSaml"); - final Signature signature = (Signature) Configuration - .getBuilderFactory().getBuilder( - Signature.DEFAULT_ELEMENT_NAME).buildObject( - Signature.DEFAULT_ELEMENT_NAME); - - signature.setSigningCredential(credential); - - signature.setSignatureAlgorithm( - SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); - - final SecurityConfiguration secConfiguration = Configuration - .getGlobalSecurityConfiguration(); - final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration - .getKeyInfoGeneratorManager(); - final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager - .getDefaultManager(); - final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager - .getFactory(credential); - final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac - .newInstance(); - - final KeyInfo keyInfo = keyInfoGenerator.generate(credential); - - signature.setKeyInfo(keyInfo); - signature.setCanonicalizationAlgorithm( - SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - - tokenSaml.setSignature(signature); - - LOG.info("Marshall samlToken."); - Configuration.getMarshallerFactory().getMarshaller(tokenSaml) - .marshall(tokenSaml); - - LOG.info("Sign samlToken."); - Signer.signObject(signature); - - } catch (MarshallingException e) { - LOG.error("MarshallingException"); - throw new SAMLEngineException(e); - } catch (NoSuchAlgorithmException e) { - LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); - throw new SAMLEngineException(e); - } catch (KeyStoreException e) { - LOG.error("Generic KeyStore exception."); - throw new SAMLEngineException(e); - } catch (SignatureException e) { - LOG.error("Signature exception."); - throw new SAMLEngineException(e); - } catch (SecurityException e) { - LOG.error("Security exception."); - throw new SAMLEngineException(e); - } catch (UnrecoverableKeyException e) { - LOG.error("UnrecoverableKey exception."); - throw new SAMLEngineException(e); - } - - return tokenSaml; - } - - /** - * Validate signature. - * - * @param tokenSaml token SAML - * - * @return the SAMLObject validated. - * - * @throws SAMLEngineException error validate signature - * - */ - public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start signature validation."); - try { - - // Validate structure signature - final SAMLSignatureProfileValidator sigProfValidator = - new SAMLSignatureProfileValidator(); - try { - // Indicates signature id conform to SAML Signature profile - sigProfValidator.validate(tokenSaml.getSignature()); - } catch (ValidationException e) { - LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); - throw new SAMLEngineException(e); - } - - String aliasCert = null; - X509Certificate certificate; - - final List trustCred = new ArrayList(); - - for (final Enumeration e = trustStore.aliases(); e - .hasMoreElements();) { - aliasCert = e.nextElement(); - final BasicX509Credential credential = new BasicX509Credential(); - certificate = (X509Certificate) trustStore - .getCertificate(aliasCert); - credential.setEntityCertificate(certificate); - trustCred.add(credential); - } - - final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); - - final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo - .getX509Datas().get(0).getX509Certificates().get(0); - - final CertificateFactory certFact = CertificateFactory - .getInstance("X.509"); - final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 - .decode(xmlCert.getValue())); - final X509Certificate cert = (X509Certificate) certFact - .generateCertificate(bis); - - // Exist only one certificate - final BasicX509Credential entityX509Cred = new BasicX509Credential(); - entityX509Cred.setEntityCertificate(cert); - - // Validate trust certificates - final ExplicitKeyTrustEvaluator keyTrustEvaluator = - new ExplicitKeyTrustEvaluator(); - if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { - throw new SAMLEngineException("Certificate it is not trusted."); - } - - // Validate signature - final SignatureValidator sigValidator = new SignatureValidator( - entityX509Cred); - sigValidator.validate(tokenSaml.getSignature()); - - } catch (ValidationException e) { - LOG.error("ValidationException."); - throw new SAMLEngineException(e); - } catch (KeyStoreException e) { - LOG.error("KeyStoreException.", e); - throw new SAMLEngineException(e); - } catch (GeneralSecurityException e) { - LOG.error("GeneralSecurityException.", e); - throw new SAMLEngineException(e); - } - return tokenSaml; - } - - - /** - * Load cryptographic service provider. - * - * @throws SAMLEngineException the SAML engine exception - */ - public void loadCryptServiceProvider() throws SAMLEngineException { - LOG.info("Load Cryptographic Service Provider"); - - FileInputStream fis = null; - FileInputStream fisTrustStore = null; - - try { - // Dynamically register Bouncy Castle provider. - boolean found = false; - // Check if BouncyCastle is already registered as a provider - final Provider[] providers = Security.getProviders(); - for (int i = 0; i < providers.length; i++) { - if (providers[i].getName().equals( - BouncyCastleProvider.PROVIDER_NAME)) { - found = true; - } - } - - // Register only if the provider has not been previously registered - if (!found) { - LOG.debug("SAMLCore: Register Bouncy Castle provider."); - Security.insertProviderAt(new BouncyCastleProvider(), Security - .getProviders().length); - } - - p12Store = KeyStore.getInstance(properties - .getProperty("keystoreType")); - - fis = new FileInputStream(properties - .getProperty("keystorePath")); - - p12Store.load(fis, properties.getProperty( - "keyStorePassword").toCharArray()); - - - trustStore = KeyStore.getInstance(properties - .getProperty("trustStoreType")); - - fisTrustStore = new FileInputStream(properties - .getProperty("trustStorePath")); - trustStore.load(fisTrustStore, properties.getProperty( - "trustStorePassword").toCharArray()); - - } catch (Exception e) { - throw new SAMLEngineException( - "Error loading CryptographicServiceProvider", e); - } finally { - IOUtils.closeQuietly(fis); - IOUtils.closeQuietly(fisTrustStore); - } - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base deleted file mode 100644 index 4c7bb18a3..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/SignSW.java.svn-base +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.Provider; -import java.security.Security; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.InvalidPropertiesFormatException; -import java.util.List; -import java.util.Properties; - -import eu.stork.peps.auth.engine.X509PrincipalUtil; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.NotImplementedException; -import org.bouncycastle.jce.X509Principal; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.opensaml.Configuration; -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.security.SAMLSignatureProfileValidator; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.security.SecurityConfiguration; -import org.opensaml.xml.security.SecurityException; -import org.opensaml.xml.security.credential.Credential; -import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; -import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; -import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; -import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; -import org.opensaml.xml.security.x509.BasicX509Credential; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.signature.Signature; -import org.opensaml.xml.signature.SignatureConstants; -import org.opensaml.xml.signature.SignatureException; -import org.opensaml.xml.signature.SignatureValidator; -import org.opensaml.xml.signature.Signer; -import org.opensaml.xml.util.Base64; -import org.opensaml.xml.validation.ValidationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.engine.core.SAMLEngineSignI; -import eu.stork.peps.exceptions.SAMLEngineException; - - -/** - * The Class SWSign. Class responsible for signing and validating of messages - * SAML with a certificate store software. - * - * @author fjquevedo - */ -public class SignSW implements SAMLEngineSignI { - - /** The Constant KEYSTORE_TYPE. */ - private static final String KEYSTORE_TYPE = "keystoreType"; - - /** The Constant KEY_STORE_PASSWORD. */ - private static final String KEY_STORE_PASS = "keyStorePassword"; - - /** The logger. */ - private static final Logger LOG = LoggerFactory.getLogger(SignSW.class - .getName()); - - /** The stork own key store. */ - private KeyStore storkOwnKeyStore = null; - - /** - * The instance. - * - * @return the properties - */ - - public final Properties getProperties() { - return properties; - } - - /** - * Gets the stork own key store. - * - * @return the stork own key store - */ - public final KeyStore getStorkOwnKeyStore() { - return storkOwnKeyStore; - } - - /** - * Gets the stork trustStore. - * - * @return the stork own key store - */ - public KeyStore getTrustStore() { - return storkOwnKeyStore; - } - - /** - * Sets the stork own key store. - * - * @param newkOwnKeyStore the new stork own key store - */ - public final void setStorkOwnKeyStore(final KeyStore newkOwnKeyStore) { - this.storkOwnKeyStore = newkOwnKeyStore; - } - - /** - * Sets the properties. - * - * @param newProperties the new properties - */ - public final void setProperties(final Properties newProperties) { - this.properties = newProperties; - } - - /** The SW sign prop. */ - private Properties properties = null; - - - /** - * Inits the file configuration. - * - * @param fileConf name of the file configuration - * - * @throws SAMLEngineException error at the load from file configuration - */ - public final void init(final String fileConf) - throws SAMLEngineException { - InputStream fileProperties = null; - try { - fileProperties = SignSW.class.getResourceAsStream("/" - + fileConf); - properties = new Properties(); - - properties.loadFromXML(fileProperties); - fileProperties.close(); - } catch (InvalidPropertiesFormatException e) { - LOG.info("Exception: invalid properties format."); - throw new SAMLEngineException(e); - } catch (IOException e) { - LOG.info("Exception: invalid file: " + fileConf); - throw new SAMLEngineException(e); - } finally { - IOUtils.closeQuietly(fileProperties); - } - } - - /** - * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate() - * @return the X509Certificate - */ - public final X509Certificate getCertificate() { - throw new NotImplementedException(); - } - - - /** - * Sign the token SAML. - * - * @param tokenSaml the token SAML. - * - * @return the SAML object - * - * @throws SAMLEngineException the SAML engine exception - * - */ - public final SAMLObject sign(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start Sign process."); - try { - final String serialNumber = properties.getProperty("serialNumber"); - final String issuer = properties.getProperty("issuer"); - - String alias = null; - String aliasCert; - X509Certificate certificate; - boolean find = false; - - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements() && !find; ) { - aliasCert = e.nextElement(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - - final String serialNum = certificate.getSerialNumber() - .toString(16); - - X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName()); - X509Principal issuerDNConf = new X509Principal(issuer); - - if(serialNum.equalsIgnoreCase(serialNumber) - && X509PrincipalUtil.equals(issuerDN, issuerDNConf)){ - alias = aliasCert; - find = true; - } - } - if (!find) { - throw new SAMLEngineException("Certificate cannot be found in keystore "); - } - certificate = (X509Certificate) storkOwnKeyStore.getCertificate(alias); - final PrivateKey privateKey = (PrivateKey) storkOwnKeyStore.getKey( - alias, properties.getProperty("keyPassword").toCharArray()); - - LOG.info("Recover BasicX509Credential."); - final BasicX509Credential credential = new BasicX509Credential(); - - LOG.debug("Load certificate"); - credential.setEntityCertificate(certificate); - - LOG.debug("Load privateKey"); - credential.setPrivateKey(privateKey); - - LOG.debug("Begin signature with openSaml"); - final Signature signature = (Signature) Configuration - .getBuilderFactory().getBuilder( - Signature.DEFAULT_ELEMENT_NAME).buildObject( - Signature.DEFAULT_ELEMENT_NAME); - - signature.setSigningCredential(credential); - - signature.setSignatureAlgorithm( - SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); - - - final SecurityConfiguration secConfiguration = Configuration - .getGlobalSecurityConfiguration(); - final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration - .getKeyInfoGeneratorManager(); - final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager - .getDefaultManager(); - final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager - .getFactory(credential); - final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac - .newInstance(); - - KeyInfo keyInfo = keyInfoGenerator.generate(credential); - - signature.setKeyInfo(keyInfo); - signature.setCanonicalizationAlgorithm( - SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - - tokenSaml.setSignature(signature); - - LOG.info("Marshall samlToken."); - Configuration.getMarshallerFactory().getMarshaller(tokenSaml) - .marshall(tokenSaml); - - LOG.info("Sign samlToken."); - Signer.signObject(signature); - - } catch (MarshallingException e) { - LOG.error("MarshallingException"); - throw new SAMLEngineException(e); - } catch (NoSuchAlgorithmException e) { - LOG.error("A 'xmldsig#rsa-sha1' cryptographic algorithm is requested but is not available in the environment."); - throw new SAMLEngineException(e); - } catch (KeyStoreException e) { - LOG.error("Generic KeyStore exception."); - throw new SAMLEngineException(e); - } catch (SignatureException e) { - LOG.error("Signature exception."); - throw new SAMLEngineException(e); - } catch (SecurityException e) { - LOG.error("Security exception."); - throw new SAMLEngineException(e); - } catch (UnrecoverableKeyException e) { - LOG.error("UnrecoverableKey exception."); - throw new SAMLEngineException(e); - } - - return tokenSaml; - } - - /** - * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(org.opensaml.common.SignableSAMLObject) - * @param tokenSaml token SAML - * @return the SAMLObject validated. - * @throws SAMLEngineException error validate signature - */ - public final SAMLObject validateSignature(final SignableSAMLObject tokenSaml) - throws SAMLEngineException { - LOG.info("Start signature validation."); - try { - - // Validate structure signature - final SAMLSignatureProfileValidator sigProfValidator = - new SAMLSignatureProfileValidator(); - try { - // Indicates signature id conform to SAML Signature profile - sigProfValidator.validate(tokenSaml.getSignature()); - } catch (ValidationException e) { - LOG.error("ValidationException: signature isn't conform to SAML Signature profile."); - throw new SAMLEngineException(e); - } - - String aliasCert = null; - X509Certificate certificate; - - final List trustCred = new ArrayList(); - - for (final Enumeration e = storkOwnKeyStore.aliases(); e - .hasMoreElements();) { - aliasCert = e.nextElement(); - final BasicX509Credential credential = new BasicX509Credential(); - certificate = (X509Certificate) storkOwnKeyStore - .getCertificate(aliasCert); - credential.setEntityCertificate(certificate); - trustCred.add(credential); - } - - final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); - - final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo - .getX509Datas().get(0).getX509Certificates().get(0); - - final CertificateFactory certFact = CertificateFactory - .getInstance("X.509"); - final ByteArrayInputStream bis = new ByteArrayInputStream(Base64 - .decode(xmlCert.getValue())); - final X509Certificate cert = (X509Certificate) certFact - .generateCertificate(bis); - - // Exist only one certificate - final BasicX509Credential entityX509Cred = new BasicX509Credential(); - entityX509Cred.setEntityCertificate(cert); - - // Validate trust certificates - final ExplicitKeyTrustEvaluator keyTrustEvaluator = - new ExplicitKeyTrustEvaluator(); - if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { - throw new SAMLEngineException("Certificate is not trusted."); - } - - // Validate signature - final SignatureValidator sigValidator = new SignatureValidator( - entityX509Cred); - sigValidator.validate(tokenSaml.getSignature()); - - } catch (ValidationException e) { - LOG.error("ValidationException."); - throw new SAMLEngineException(e); - } catch (KeyStoreException e) { - LOG.error("KeyStoreException.", e); - throw new SAMLEngineException(e); - } catch (GeneralSecurityException e) { - LOG.error("GeneralSecurityException.", e); - throw new SAMLEngineException(e); - } - LOG.info(tokenSaml.getSignatureReferenceID()); - LOG.info("Start signature validation - END." ); - return tokenSaml; - } - - - /** - * Load cryptographic service provider. - * - * @throws SAMLEngineException the SAML engine exception - */ - public final void loadCryptServiceProvider() throws SAMLEngineException { - LOG.info("Load Cryptographic Service Provider"); - FileInputStream fis = null; - try { - // Dynamically register Bouncy Castle provider. - boolean found = false; - // Check if BouncyCastle is already registered as a provider - final Provider[] providers = Security.getProviders(); - for (int i = 0; i < providers.length; i++) { - if (providers[i].getName().equals( - BouncyCastleProvider.PROVIDER_NAME)) { - found = true; - } - } - - // Register only if the provider has not been previously registered - if (!found) { - LOG.info("SAMLCore: Register Bouncy Castle provider."); - Security.insertProviderAt(new BouncyCastleProvider(), Security - .getProviders().length); - } - - storkOwnKeyStore = KeyStore.getInstance(properties - .getProperty(KEYSTORE_TYPE)); - - LOG.info("Loading KeyInfo from keystore file " + properties.getProperty("keystorePath")); - fis = new FileInputStream(properties - .getProperty("keystorePath")); - - storkOwnKeyStore.load(fis, properties.getProperty( - KEY_STORE_PASS).toCharArray()); - - } catch (Exception e) { - LOG.error("Error loading CryptographicServiceProvider", e); - throw new SAMLEngineException( - "Error loading CryptographicServiceProvider", e); - } finally { - IOUtils.closeQuietly(fis); - } - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base deleted file mode 100644 index a60515593..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesBuilder.java.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; - -import eu.stork.peps.auth.engine.core.SAMLCore; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; - -/** - * The Class VIDPAuthenticationAttributesBuilder. - * - * @author fjquevedo - */ -public final class VIDPAuthenticationAttributesBuilder extends AbstractSAMLObjectBuilder { - - - /** {@inheritDoc} */ - public VIDPAuthenticationAttributes buildObject() { - return buildObject(SAMLCore.STORK10P_NS.getValue(), VIDPAuthenticationAttributes.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue()); - } - - /** {@inheritDoc} */ - public VIDPAuthenticationAttributes buildObject(final String namespaceURI, final String localName, final String namespacePrefix) { - return new VIDPAuthenticationAttributesImpl(namespaceURI, localName, namespacePrefix); - } - -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base deleted file mode 100644 index a6e7e7f60..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesImpl.java.svn-base +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.common.impl.AbstractSignableSAMLObject; -import org.opensaml.xml.XMLObject; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; -import eu.stork.peps.auth.engine.core.SPInformation; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class VIDPAuthenticationAttributesImpl. - * - * @author fjquevedo - */ -public final class VIDPAuthenticationAttributesImpl extends AbstractSignableSAMLObject implements -VIDPAuthenticationAttributes { - - private static final Logger LOGGER = LoggerFactory.getLogger(VIDPAuthenticationAttributesImpl.class.getName()); - /** The citizen country code. */ - private CitizenCountryCode citizenCountryCode; - - /** The SP information. */ - private SPInformation spInformation; - - /** - * Instantiates a new requested attributes implement. - * - * @param namespaceURI the namespace URI - * @param elementLocalName the element local name - * @param namespacePrefix the namespace prefix - */ - protected VIDPAuthenticationAttributesImpl(final String namespaceURI, - final String elementLocalName, final String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - /** - * getCitizenCountryCode. - * - * @return the citizen country code - */ - public CitizenCountryCode getCitizenCountryCode() { - return citizenCountryCode; - } - - /** - * getSPInformation - * - * @return the SP information - */ - public SPInformation getSPInformation() { - return spInformation; - } - - /** - * Gets the ordered children. - * - * @return the ordered children - * - */ - public List getOrderedChildren() { - final ArrayList children = new ArrayList(); - - children.add(citizenCountryCode); - children.add(spInformation); - - if (getSignature() != null) { - children.add(getSignature()); - } - - return Collections.unmodifiableList(children); - - } - - /** - * Gets the signature reference id. - * - * @return the signature reference id - * - */ - public String getSignatureReferenceID() { - return null; - } - - /** - * Sets the citizen country code. - * - * @param newCitizenCountryCode the new citizen country code - * - */ - public void setCitizenCountryCode(CitizenCountryCode newCitizenCountryCode) { - this.citizenCountryCode = prepareForAssignment(this.citizenCountryCode, newCitizenCountryCode); - } - - /** - * Sets the SP information. - * - * @param newSPInformation the new SP information - * - */ - public void setSPInformation(SPInformation newSPInformation) { - this.spInformation = prepareForAssignment(this.spInformation, newSPInformation); - } - - @Override - public int hashCode() { - LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here"); - return super.hashCode(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base deleted file mode 100644 index 5635ddd6b..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesMarshaller.java.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectMarshaller; - -/** - * The Class VIDPAuthenticationAttributesMarshaller. - * - * @author fjquevedo - */ -public class VIDPAuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller { - - /** - * Instantiates a new vIDP authentication attributes marshaller. - */ - public VIDPAuthenticationAttributesMarshaller() { - super(); - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base deleted file mode 100644 index 1de300c03..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/VIDPAuthenticationAttributesUnmarshaller.java.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.peps.auth.engine.core.CitizenCountryCode; -import eu.stork.peps.auth.engine.core.SPInformation; -import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes; - -/** - * The Class VIDPAuthenticationAttributesUnmarshaller. - * - * @author fjquevedo - */ -public class VIDPAuthenticationAttributesUnmarshaller extends - AbstractSAMLObjectUnmarshaller { - - /** - * Process child element. - * - * @param parentObject the parent object - * @param childObject the child object - * - * @throws UnmarshallingException the unmarshalling exception - * - */ - protected final void processChildElement(final XMLObject parentObject, - final XMLObject childObject) throws UnmarshallingException { - final VIDPAuthenticationAttributes vIDPAuthenticationAttr = (VIDPAuthenticationAttributes) parentObject; - - if (childObject instanceof CitizenCountryCode) { - vIDPAuthenticationAttr.setCitizenCountryCode((CitizenCountryCode) childObject); - } else if (childObject instanceof SPInformation) { - vIDPAuthenticationAttr.setSPInformation((SPInformation) childObject); - } else { - super.processChildElement(parentObject, childObject); - } - } -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index e26da6d04..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Implementations of STORK 1.0 core specification types and elements. - */ -package eu.stork.peps.auth.engine.core.impl; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryBuilder.java new file mode 100644 index 000000000..ca529d283 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryBuilder.java @@ -0,0 +1,26 @@ +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; +import org.opensaml.common.xml.SAMLConstants; +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; + +public class CustomAttributeQueryBuilder extends AbstractSAMLObjectBuilder { + /** + * Constructor. + */ + public CustomAttributeQueryBuilder() { + + } + + /** {@inheritDoc} */ + public CustomAttributeQuery buildObject() { + return buildObject(SAMLConstants.SAML20P_NS, CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME, + SAMLConstants.SAML20P_PREFIX); + } + + /** {@inheritDoc} */ + public CustomAttributeQuery buildObject(String namespaceURI, String localName, String namespacePrefix) { + return new CustomAttributeQueryImpl(namespaceURI, localName, namespacePrefix); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryImpl.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryImpl.java new file mode 100644 index 000000000..e485827c8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryImpl.java @@ -0,0 +1,65 @@ +package eu.stork.peps.auth.engine.core.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.impl.SubjectQueryImpl; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.util.XMLObjectChildrenList; + +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; + + +public class CustomAttributeQueryImpl extends SubjectQueryImpl implements CustomAttributeQuery { + /** Attribute child elements. */ + private final XMLObjectChildrenList attributes; + private String serviceURL; + + /** + * Constructor. + * + * @param namespaceURI the namespace the element is in + * @param elementLocalName the local name of the XML element this Object represents + * @param namespacePrefix the prefix for the given namespace + */ + protected CustomAttributeQueryImpl(String namespaceURI, String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + attributes = new XMLObjectChildrenList(this); + } + + /** {@inheritDoc} */ + public List getAttributes() { + return attributes; + } + + /** {@inheritDoc} */ + public List getOrderedChildren() { + ArrayList children = new ArrayList(); + + if (super.getOrderedChildren() != null) { + children.addAll(super.getOrderedChildren()); + } + children.addAll(attributes); + + if (children.size() == 0) { + return null; + } + + return Collections.unmodifiableList(children); + } + + @Override + public String getAssertionConsumerServiceURL() { + // TODO Auto-generated method stub + return this.serviceURL; + } + + @Override + public void setAssertionConsumerServiceURL(String newServiceUrl) { + // TODO Auto-generated method stub + this.serviceURL = newServiceUrl; + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java new file mode 100644 index 000000000..51b6a20f8 --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java @@ -0,0 +1,50 @@ +package eu.stork.peps.auth.engine.core.impl; + +import org.opensaml.Configuration; +import org.opensaml.saml2.core.RequestAbstractType; +import org.opensaml.saml2.core.impl.SubjectQueryMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.w3c.dom.Element; + +import eu.stork.peps.auth.engine.core.CustomRequestAbstractType; + +public class CustomAttributeQueryMarshaller extends SubjectQueryMarshaller { + + /** {@inheritDoc} */ + protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException { + CustomRequestAbstractType req = (CustomRequestAbstractType) samlObject; + + if (req.getVersion() != null) { + domElement.setAttributeNS(null, RequestAbstractType.VERSION_ATTRIB_NAME, req.getVersion().toString()); + } + + if (req.getID() != null) { + domElement.setAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, req.getID()); + domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true); + } + + if (req.getVersion() != null) { + domElement.setAttributeNS(null, RequestAbstractType.VERSION_ATTRIB_NAME, req.getVersion().toString()); + } + + if (req.getIssueInstant() != null) { + String iiStr = Configuration.getSAMLDateFormatter().print(req.getIssueInstant()); + domElement.setAttributeNS(null, RequestAbstractType.ISSUE_INSTANT_ATTRIB_NAME, iiStr); + } + + if (req.getDestination() != null) { + domElement.setAttributeNS(null, RequestAbstractType.DESTINATION_ATTRIB_NAME, req.getDestination()); + } + + if (req.getAssertionConsumerServiceURL() != null) { + domElement.setAttributeNS(null, CustomRequestAbstractType.ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME, req.getAssertionConsumerServiceURL()); + } + + if (req.getConsent() != null) { + domElement.setAttributeNS(null, RequestAbstractType.CONSENT_ATTRIB_NAME, req.getConsent()); + } + } + + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryUnmarshaller.java new file mode 100644 index 000000000..f28ec1fef --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryUnmarshaller.java @@ -0,0 +1,114 @@ +package eu.stork.peps.auth.engine.core.impl; + +import org.joda.time.DateTime; +import org.joda.time.chrono.ISOChronology; +import org.opensaml.common.SAMLVersion; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.RequestAbstractType; +import org.opensaml.saml2.core.impl.SubjectQueryUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.AbstractXMLObjectUnmarshaller; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.util.DatatypeHelper; +import org.opensaml.xml.util.XMLHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; +import eu.stork.peps.auth.engine.core.CustomRequestAbstractType; + +public class CustomAttributeQueryUnmarshaller extends SubjectQueryUnmarshaller { + + private final Logger log = LoggerFactory.getLogger(AbstractXMLObjectUnmarshaller.class); + /** {@inheritDoc} */ + protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) + throws UnmarshallingException { + CustomAttributeQuery query = (CustomAttributeQuery) parentSAMLObject; + + if (childSAMLObject instanceof Attribute) { + query.getAttributes().add((Attribute) childSAMLObject); + } else { + super.processChildElement(parentSAMLObject, childSAMLObject); + } + } + + /** {@inheritDoc} */ + public XMLObject unmarshall(Element domElement) throws UnmarshallingException { + if (log.isTraceEnabled()) { + log.trace("Starting to unmarshall DOM element {}", XMLHelper.getNodeQName(domElement)); + } + + checkElementIsTarget(domElement); + + //String namespaceURI, String elementLocalName, String namespacePrefix + XMLObject xmlObject = new CustomAttributeQueryImpl(SAMLConstants.SAML20P_NS, CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME, + SAMLConstants.SAML20P_PREFIX); + + if (log.isTraceEnabled()) { + log.trace("Unmarshalling attributes of DOM Element {}", XMLHelper.getNodeQName(domElement)); + } + + NamedNodeMap attributes = domElement.getAttributes(); + Node attribute; + for (int i = 0; i < attributes.getLength(); i++) { + attribute = attributes.item(i); + + // These should allows be attribute nodes, but just in case... + if (attribute.getNodeType() == Node.ATTRIBUTE_NODE) { + unmarshallAttribute(xmlObject, (Attr) attribute); + } + } + + if (log.isTraceEnabled()) { + log.trace("Unmarshalling other child nodes of DOM Element {}", XMLHelper.getNodeQName(domElement)); + } + + Node childNode = domElement.getFirstChild(); + while (childNode != null) { + + if (childNode.getNodeType() == Node.ATTRIBUTE_NODE) { + unmarshallAttribute(xmlObject, (Attr) childNode); + } else if (childNode.getNodeType() == Node.ELEMENT_NODE) { + unmarshallChildElement(xmlObject, (Element) childNode); + } else if (childNode.getNodeType() == Node.TEXT_NODE + || childNode.getNodeType() == Node.CDATA_SECTION_NODE) { + unmarshallTextContent(xmlObject, (Text) childNode); + } + + childNode = childNode.getNextSibling(); + } + + xmlObject.setDOM(domElement); + return xmlObject; + } + + /** {@inheritDoc} */ + protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { + CustomRequestAbstractType req = (CustomRequestAbstractType) samlObject; + + if (attribute.getLocalName().equals(RequestAbstractType.VERSION_ATTRIB_NAME)) { + req.setVersion(SAMLVersion.valueOf(attribute.getValue())); + } else if (attribute.getLocalName().equals(RequestAbstractType.ID_ATTRIB_NAME)) { + req.setID(attribute.getValue()); + attribute.getOwnerElement().setIdAttributeNode(attribute, true); + } else if (attribute.getLocalName().equals(RequestAbstractType.ISSUE_INSTANT_ATTRIB_NAME) + && !DatatypeHelper.isEmpty(attribute.getValue())) { + req.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC())); + } else if (attribute.getLocalName().equals(RequestAbstractType.DESTINATION_ATTRIB_NAME)) { + req.setDestination(attribute.getValue()); + } else if (attribute.getLocalName().equals(RequestAbstractType.CONSENT_ATTRIB_NAME)) { + req.setConsent(attribute.getValue()); + } else if (attribute.getLocalName().equals(CustomRequestAbstractType.ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME)) { + req.setAssertionConsumerServiceURL(attribute.getValue()); + }else { + super.processAttribute(samlObject, attribute); + } + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java index 2db14f543..5e9c753ae 100644 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java @@ -36,8 +36,12 @@ import eu.stork.peps.auth.engine.X509PrincipalUtil; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.NotImplementedException; import org.bouncycastle.jce.X509Principal; +import org.opensaml.Configuration; import org.opensaml.common.SAMLObject; import org.opensaml.common.SignableSAMLObject; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.LogoutResponse; +import org.opensaml.saml2.core.Response; import org.opensaml.security.SAMLSignatureProfileValidator; import org.opensaml.xml.io.MarshallingException; import org.opensaml.xml.security.SecurityConfiguration; @@ -62,6 +66,7 @@ import org.slf4j.LoggerFactory; +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; import eu.stork.peps.auth.engine.core.SAMLEngineSignI; import eu.stork.peps.exceptions.SAMLEngineException; @@ -237,8 +242,10 @@ public final class SignHW implements SAMLEngineSignI { LOG.debug("Begin signature with openSaml"); signature.setSigningCredential(credential); + /*signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);*/ signature.setSignatureAlgorithm( - SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256); @@ -261,14 +268,76 @@ public final class SignHW implements SAMLEngineSignI { signature.setCanonicalizationAlgorithm( SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - tokenSaml.setSignature(signature); - - LOG.debug("Marshall samlToken."); - org.opensaml.xml.Configuration.getMarshallerFactory() - .getMarshaller(tokenSaml).marshall(tokenSaml); + //Create a second signature which will be used when signing assertion and response + final Signature signature2 = (Signature) Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + final SecurityConfiguration secConfiguration2 = Configuration + .getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager2 = secConfiguration2 + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager2 = keyInfoManager2 + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac2 = keyInfoGenManager2 + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator2 = keyInfoGenFac2 + .newInstance(); + + KeyInfo keyInfo2 = keyInfoGenerator2.generate(credential); + signature2.setSigningCredential(credential); + signature2.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256); + signature2.setKeyInfo(keyInfo2); + signature2.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + - LOG.info("Sign samlToken."); - Signer.signObject(signature); + LOG.info("Marshall samlToken."); + String qn = tokenSaml.getElementQName().toString(); + + if (qn.endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME)) + { + tokenSaml.setSignature(signature); + CustomAttributeQueryMarshaller mars = new CustomAttributeQueryMarshaller(); + mars.marshall(tokenSaml); + Signer.signObject(signature); + } + else if (qn.endsWith(Response.DEFAULT_ELEMENT_LOCAL_NAME) && !qn.contains(LogoutResponse.DEFAULT_ELEMENT_LOCAL_NAME)) + { + Response res = (Response)tokenSaml; + List asserts = res.getAssertions(); + //If multiple assertions we just sign the response and not the assertion + if (asserts.size() > 1) + { + tokenSaml.setSignature(signature); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + LOG.info("Sign samlToken."); + Signer.signObject(signature); + } + //If single assertion we sign the assertion and response + else + { + Assertion assertion = (Assertion)asserts.get(0); + assertion.setSignature(signature); + tokenSaml.setSignature(signature2); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + LOG.info("Sign samlToken."); + Signer.signObject(signature); + Signer.signObject(signature2); + } + } + //Normally we just sign the total saml response + else + { + tokenSaml.setSignature(signature); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + LOG.info("Sign samlToken."); + Signer.signObject(signature); + } } catch (final MarshallingException e) { LOG.error("MarshallingException"); diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java index 33ed05515..50ad9936d 100644 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java @@ -44,6 +44,9 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.opensaml.Configuration; import org.opensaml.common.SAMLObject; import org.opensaml.common.SignableSAMLObject; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.LogoutResponse; +import org.opensaml.saml2.core.Response; import org.opensaml.security.SAMLSignatureProfileValidator; import org.opensaml.xml.io.MarshallingException; import org.opensaml.xml.security.SecurityConfiguration; @@ -66,6 +69,7 @@ import org.opensaml.xml.validation.ValidationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; import eu.stork.peps.auth.engine.core.SAMLEngineSignI; import eu.stork.peps.exceptions.SAMLEngineException; @@ -274,8 +278,10 @@ public final class SignP12 implements SAMLEngineSignI { signature.setSigningCredential(credential); + /*signature.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);*/ signature.setSignatureAlgorithm( - SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256); final SecurityConfiguration secConfiguration = Configuration .getGlobalSecurityConfiguration(); @@ -294,14 +300,76 @@ public final class SignP12 implements SAMLEngineSignI { signature.setCanonicalizationAlgorithm( SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - tokenSaml.setSignature(signature); + //Create a second signature which will be used when signing assertion and response + final Signature signature2 = (Signature) Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + final SecurityConfiguration secConfiguration2 = Configuration + .getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager2 = secConfiguration2 + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager2 = keyInfoManager2 + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac2 = keyInfoGenManager2 + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator2 = keyInfoGenFac2 + .newInstance(); + + KeyInfo keyInfo2 = keyInfoGenerator2.generate(credential); + signature2.setSigningCredential(credential); + signature2.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256); + signature2.setKeyInfo(keyInfo2); + signature2.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + LOG.info("Marshall samlToken."); - Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + String qn = tokenSaml.getElementQName().toString(); + + if (qn.endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME)) + { + tokenSaml.setSignature(signature); + CustomAttributeQueryMarshaller mars = new CustomAttributeQueryMarshaller(); + mars.marshall(tokenSaml); + Signer.signObject(signature); + } + else if (qn.endsWith(Response.DEFAULT_ELEMENT_LOCAL_NAME) && !qn.contains(LogoutResponse.DEFAULT_ELEMENT_LOCAL_NAME)) + { + Response res = (Response)tokenSaml; + List asserts = res.getAssertions(); + //If multiple assertions we just sign the response and not the assertion + if (asserts.size() > 1) + { + tokenSaml.setSignature(signature); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + LOG.info("Sign samlToken."); + Signer.signObject(signature); + } + //If single assertion we sign the assertion and response + else + { + Assertion assertion = (Assertion)asserts.get(0); + assertion.setSignature(signature); + tokenSaml.setSignature(signature2); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + LOG.info("Sign samlToken."); + Signer.signObject(signature); + Signer.signObject(signature2); + } + } + //Normally we just sign the total saml response + else + { + tokenSaml.setSignature(signature); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) .marshall(tokenSaml); - - LOG.info("Sign samlToken."); - Signer.signObject(signature); + LOG.info("Sign samlToken."); + Signer.signObject(signature); + } } catch (MarshallingException e) { LOG.error("MarshallingException"); @@ -355,7 +423,7 @@ public final class SignP12 implements SAMLEngineSignI { String aliasCert = null; X509Certificate certificate; - final List trustCred = new ArrayList(); + /*final List trustCred = new ArrayList(); for (final Enumeration e = trustStore.aliases(); e .hasMoreElements();) { @@ -365,7 +433,7 @@ public final class SignP12 implements SAMLEngineSignI { .getCertificate(aliasCert); credential.setEntityCertificate(certificate); trustCred.add(credential); - } + }*/ final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); @@ -382,13 +450,33 @@ public final class SignP12 implements SAMLEngineSignI { // Exist only one certificate final BasicX509Credential entityX509Cred = new BasicX509Credential(); entityX509Cred.setEntityCertificate(cert); + + boolean trusted = false; + + for (final Enumeration e = trustStore.aliases(); e.hasMoreElements();) + { + aliasCert = e.nextElement(); + certificate = (X509Certificate) trustStore.getCertificate(aliasCert); + try { + cert.verify(certificate.getPublicKey()); + trusted = true; + break; + } + catch (Exception ex) { + //Do nothing - cert not trusted yet + } + } + + if (!trusted) + throw new SAMLEngineException("Certificate is not trusted."); + /* // Validate trust certificates final ExplicitKeyTrustEvaluator keyTrustEvaluator = new ExplicitKeyTrustEvaluator(); if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { throw new SAMLEngineException("Certificate it is not trusted."); - } + }*/ // Validate signature final SignatureValidator sigValidator = new SignatureValidator( diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java index 4c7bb18a3..9f0a88c84 100644 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java @@ -27,7 +27,9 @@ import java.security.PrivateKey; import java.security.Provider; import java.security.Security; import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateExpiredException; import java.security.cert.CertificateFactory; +import java.security.cert.CertificateNotYetValidException; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Enumeration; @@ -35,6 +37,7 @@ import java.util.InvalidPropertiesFormatException; import java.util.List; import java.util.Properties; +import eu.stork.peps.auth.engine.SAMLEngineUtils; import eu.stork.peps.auth.engine.X509PrincipalUtil; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.NotImplementedException; @@ -43,6 +46,9 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.opensaml.Configuration; import org.opensaml.common.SAMLObject; import org.opensaml.common.SignableSAMLObject; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.LogoutResponse; +import org.opensaml.saml2.core.Response; import org.opensaml.security.SAMLSignatureProfileValidator; import org.opensaml.xml.io.MarshallingException; import org.opensaml.xml.security.SecurityConfiguration; @@ -53,6 +59,7 @@ import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory; import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorManager; import org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager; import org.opensaml.xml.security.trust.ExplicitKeyTrustEvaluator; +import org.opensaml.xml.security.trust.ExplicitX509CertificateTrustEvaluator; import org.opensaml.xml.security.x509.BasicX509Credential; import org.opensaml.xml.signature.KeyInfo; import org.opensaml.xml.signature.Signature; @@ -65,6 +72,7 @@ import org.opensaml.xml.validation.ValidationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; import eu.stork.peps.auth.engine.core.SAMLEngineSignI; import eu.stork.peps.exceptions.SAMLEngineException; @@ -235,14 +243,13 @@ public class SignSW implements SAMLEngineSignI { LOG.debug("Begin signature with openSaml"); final Signature signature = (Signature) Configuration - .getBuilderFactory().getBuilder( - Signature.DEFAULT_ELEMENT_NAME).buildObject( - Signature.DEFAULT_ELEMENT_NAME); + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); signature.setSigningCredential(credential); - signature.setSignatureAlgorithm( - SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256); final SecurityConfiguration secConfiguration = Configuration @@ -261,15 +268,78 @@ public class SignSW implements SAMLEngineSignI { signature.setKeyInfo(keyInfo); signature.setCanonicalizationAlgorithm( SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - - tokenSaml.setSignature(signature); + + //Create a second signature which will be used when signing assertion and response + final Signature signature2 = (Signature) Configuration + .getBuilderFactory().getBuilder( + Signature.DEFAULT_ELEMENT_NAME).buildObject( + Signature.DEFAULT_ELEMENT_NAME); + final SecurityConfiguration secConfiguration2 = Configuration + .getGlobalSecurityConfiguration(); + final NamedKeyInfoGeneratorManager keyInfoManager2 = secConfiguration2 + .getKeyInfoGeneratorManager(); + final KeyInfoGeneratorManager keyInfoGenManager2 = keyInfoManager2 + .getDefaultManager(); + final KeyInfoGeneratorFactory keyInfoGenFac2 = keyInfoGenManager2 + .getFactory(credential); + final KeyInfoGenerator keyInfoGenerator2 = keyInfoGenFac2 + .newInstance(); + + KeyInfo keyInfo2 = keyInfoGenerator2.generate(credential); + signature2.setSigningCredential(credential); + signature2.setSignatureAlgorithm( + SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256); + signature2.setKeyInfo(keyInfo2); + signature2.setCanonicalizationAlgorithm( + SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + LOG.info("Marshall samlToken."); - Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + String qn = tokenSaml.getElementQName().toString(); + + if (qn.endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME)) + { + tokenSaml.setSignature(signature); + CustomAttributeQueryMarshaller mars = new CustomAttributeQueryMarshaller(); + mars.marshall(tokenSaml); + Signer.signObject(signature); + } + else if (qn.endsWith(Response.DEFAULT_ELEMENT_LOCAL_NAME) && !qn.contains(LogoutResponse.DEFAULT_ELEMENT_LOCAL_NAME)) + { + Response res = (Response)tokenSaml; + List asserts = res.getAssertions(); + //If multiple assertions we just sign the response and not the assertion + if (asserts.size() > 1) + { + tokenSaml.setSignature(signature); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + LOG.info("Sign samlToken."); + Signer.signObject(signature); + } + //If single assertion we sign the assertion and response + else + { + Assertion assertion = (Assertion)asserts.get(0); + assertion.setSignature(signature); + tokenSaml.setSignature(signature2); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) + .marshall(tokenSaml); + LOG.info("Sign samlToken."); + Signer.signObject(signature); + Signer.signObject(signature2); + } + } + //Normally we just sign the total saml response + else + { + tokenSaml.setSignature(signature); + Configuration.getMarshallerFactory().getMarshaller(tokenSaml) .marshall(tokenSaml); - - LOG.info("Sign samlToken."); - Signer.signObject(signature); + LOG.info("Sign samlToken."); + Signer.signObject(signature); + } + } catch (MarshallingException e) { LOG.error("MarshallingException"); @@ -319,7 +389,7 @@ public class SignSW implements SAMLEngineSignI { String aliasCert = null; X509Certificate certificate; - final List trustCred = new ArrayList(); + /*final List trustCred = new ArrayList(); for (final Enumeration e = storkOwnKeyStore.aliases(); e .hasMoreElements();) { @@ -329,8 +399,8 @@ public class SignSW implements SAMLEngineSignI { .getCertificate(aliasCert); credential.setEntityCertificate(certificate); trustCred.add(credential); - } - + }*/ + final KeyInfo keyInfo = tokenSaml.getSignature().getKeyInfo(); final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo @@ -342,17 +412,53 @@ public class SignSW implements SAMLEngineSignI { .decode(xmlCert.getValue())); final X509Certificate cert = (X509Certificate) certFact .generateCertificate(bis); - + // Exist only one certificate final BasicX509Credential entityX509Cred = new BasicX509Credential(); - entityX509Cred.setEntityCertificate(cert); - + entityX509Cred.setEntityCertificate(cert); + + try { + cert.checkValidity(); + } + catch (CertificateExpiredException exp) { + throw new SAMLEngineException("Certificate expired."); + } + catch (CertificateNotYetValidException exp) { + throw new SAMLEngineException("Certificate not yet valid."); + } + + boolean trusted = false; + + for (final Enumeration e = storkOwnKeyStore.aliases(); e.hasMoreElements();) + { + aliasCert = e.nextElement(); + certificate = (X509Certificate) storkOwnKeyStore.getCertificate(aliasCert); + try { + cert.verify(certificate.getPublicKey()); + trusted = true; + break; + } + catch (Exception ex) { + //Do nothing - cert not trusted yet + } + } + + if (!trusted) + throw new SAMLEngineException("Certificate is not trusted."); + + /* // Validate trust certificates - final ExplicitKeyTrustEvaluator keyTrustEvaluator = + final ExplicitX509CertificateTrustEvaluator chainTrustEvaluator = new ExplicitX509CertificateTrustEvaluator(); + + if (!chainTrustEvaluator.validate(entityX509Cred, trustCred)) { + throw new SAMLEngineException("Certificate is not trusted."); + } + /*final ExplicitKeyTrustEvaluator keyTrustEvaluator = new ExplicitKeyTrustEvaluator(); + if (!keyTrustEvaluator.validate(entityX509Cred, trustCred)) { throw new SAMLEngineException("Certificate is not trusted."); - } + }*/ // Validate signature final SignatureValidator sigValidator = new SignatureValidator( diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops deleted file mode 100644 index d5bd68d13..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/all-wcprops +++ /dev/null @@ -1,23 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 102 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 120 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/package-info.java -END -ExtensionsSchemaValidator.java -K 25 -svn:wc:ra_dav:version-url -V 133 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.java -END -QAAAttributeSchemaValidator.java -K 25 -svn:wc:ra_dav:version-url -V 135 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.java -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries deleted file mode 100644 index abba3b480..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/entries +++ /dev/null @@ -1,130 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/auth/engine/core/validator -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -package-info.java -file - - - - -2013-12-20T12:27:57.310475Z -cf18b043ca5fc2869360c23c2f78c37c -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -810 - -ExtensionsSchemaValidator.java -file - - - - -2013-12-20T12:27:57.310475Z -88793567b50e1817e8b534b99b7fd40e -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2003 - -QAAAttributeSchemaValidator.java -file - - - - -2013-12-20T12:27:57.310475Z -126bf77d5e22d5609d042e0445160382 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2061 - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base deleted file mode 100644 index 760d9c188..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/ExtensionsSchemaValidator.java.svn-base +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.validator; - -import java.util.List; - -import org.opensaml.saml2.common.Extensions; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class ExtensionsSchemaValidator. - * - * @author fjquevedo - */ -public class ExtensionsSchemaValidator implements Validator { - - - /** - * validate the extensions. - * - * @param extensions the extensions - * - * @throws ValidationException the validation exception - */ - public final void validate(final Extensions extensions) - throws ValidationException { - if (extensions.getUnknownXMLObjects() == null - || extensions.getUnknownXMLObjects().size() <= 0) { - throw new ValidationException("Extension element is empty or not exist."); - } - - List qaa = extensions.getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME); - - if (qaa.size() == 1) { - final Validator validatorQaa = new QAAAttributeSchemaValidator(); - validatorQaa.validate((QAAAttribute) qaa.get(0)); - } else { - throw new ValidationException( - "Extensions must contain only one element QAALevel."); - } - - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base deleted file mode 100644 index be5dc8c34..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/QAAAttributeSchemaValidator.java.svn-base +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.auth.engine.core.validator; - -import org.opensaml.xml.util.DatatypeHelper; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.peps.auth.engine.core.QAAAttribute; - -/** - * The Class QAAAttributeSchemaValidator. - * - * @author fjquevedo - */ -public class QAAAttributeSchemaValidator implements Validator { - - - /** - * Validate action. - * - * @param qaa the quality authentication assurance level attribute - * - * @throws ValidationException the validation exception - */ - public final void validate(final QAAAttribute qaa) throws ValidationException { - validateAction(qaa); - } - - - /** - * Validate action. - * - * @param qaaAttribute the quality authentication assurance level attribute. - * - * @throws ValidationException the validation exception - */ - protected final void validateAction(final QAAAttribute qaaAttribute) - throws ValidationException { - if (DatatypeHelper.isEmpty(qaaAttribute.getQaaLevel())) { - throw new ValidationException("QAALevel label must be specified."); - } - - final int qaa = Integer.valueOf(qaaAttribute.getQaaLevel()); - - if (qaa < QAAAttribute.MIN_VALUE || qaa > QAAAttribute.MAX_VALUE) { - throw new ValidationException( - "QAALevel label must be greater than 0."); - } - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index b98cf7157..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Validation rules for STORK 1.0 core types and elements. - */ -package eu.stork.peps.auth.engine.core.validator; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/CustomAttributeQueryValidator.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/CustomAttributeQueryValidator.java new file mode 100644 index 000000000..beceac57f --- /dev/null +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/CustomAttributeQueryValidator.java @@ -0,0 +1,57 @@ +package eu.stork.peps.auth.engine.core.validator; + +import java.util.List; + +import org.opensaml.saml2.common.Extensions; +import org.opensaml.saml2.core.SubjectQuery; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.util.DatatypeHelper; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.peps.auth.engine.core.CustomAttributeQuery; +import eu.stork.peps.auth.engine.core.QAAAttribute; + +public class CustomAttributeQueryValidator implements Validator { + + /* + * Validate action. + * + * @param qaa the quality authentication assurance level attribute + * + * @throws ValidationException the validation exception + */ + public final void validate(final CustomAttributeQuery attrQuery) throws ValidationException { + validateAssertion(attrQuery); + validateSubject(attrQuery); + validateDestination(attrQuery); + } + + + /** + * Validate assertion. + * + * @param attrQuery the attribute query + * + * @throws ValidationException the validation exception + */ + protected final void validateAssertion(final CustomAttributeQuery attrQuery) + throws ValidationException { + if (DatatypeHelper.isEmpty(attrQuery.getAssertionConsumerServiceURL())) { + throw new ValidationException("Consumer Service URL must be specified."); + } + } + + //Validate subject + protected void validateSubject(CustomAttributeQuery query) throws ValidationException { + if (query.getSubject() == null) + throw new ValidationException("Subject is required"); + } + + //Validate destination + protected void validateDestination(CustomAttributeQuery query) throws ValidationException { + if (query.getDestination() == null) + throw new ValidationException("Destination is required"); + } + +} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/all-wcprops deleted file mode 100644 index 96b3f2328..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/all-wcprops +++ /dev/null @@ -1,41 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 89 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 107 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/package-info.java -END -ConfigurationCreator.java -K 25 -svn:wc:ra_dav:version-url -V 115 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java -END -ConfigurationReader.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java -END -ConfigurationSingleton.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationSingleton.java -END -InstanceEngine.java -K 25 -svn:wc:ra_dav:version-url -V 109 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/InstanceEngine.java -END -ConfigurationEngine.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration/ConfigurationEngine.java -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/entries deleted file mode 100644 index b811dc64b..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/entries +++ /dev/null @@ -1,232 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/configuration -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -ConfigurationReader.java -file - - - - -2013-12-20T12:27:57.462475Z -31bb8b4c7e74e039c561bf974dea7c33 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -6979 - -ConfigurationSingleton.java -file - - - - -2013-12-20T12:27:57.466475Z -4350e34e9ec48ce7ad03db6a130559f2 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2367 - -InstanceEngine.java -file - - - - -2013-12-20T12:27:57.466475Z -36fb20db43ded05922bf0bbf785e5d48 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1820 - -ConfigurationEngine.java -file - - - - -2013-12-20T12:27:57.466475Z -99eae7ae70fa5bf4667edfb7912696c2 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1726 - -package-info.java -file - - - - -2013-12-20T12:27:57.462475Z -36f3c0e11d20c8f980d3115b21a23df0 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -806 - -ConfigurationCreator.java -file - - - - -2013-12-20T12:27:57.462475Z -4c130e8c9749dd63e58d57d4d699b7ee -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -4114 - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base deleted file mode 100644 index 2fabff7d6..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationCreator.java.svn-base +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.InvalidPropertiesFormatException; -import java.util.Map; -import java.util.Properties; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class InstanceCreator. - * - * @author fjquevedo - */ -public final class ConfigurationCreator { - - /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(ConfigurationCreator.class.getName()); - - /** - * Creates the configuration. - * - * @param instanceConfs the instance configuration - * - * @return the map< string, map< string, object>> - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public static Map> createConfiguration( - final Map instanceConfs) throws STORKSAMLEngineException { - - final HashMap> instances = - new HashMap>(); - - LOGGER.info("Create configuration."); - try { - // Only create instances for SAMLEngine configuration. - // INSTANCE - for (Map.Entry entry : instanceConfs - .entrySet()) { - final InstanceEngine iEngine = entry.getValue(); - - final Map intance = new HashMap(); - - // CONFIGURATION - for (ConfigurationEngine configuration : iEngine - .getConfiguration()) { - // Properties only for configuration SamlEngine. - if (configuration.getName().equalsIgnoreCase( - "SamlEngineConf")) { - intance.put(configuration.getName(), - getNewInstance(configuration.getParameters() - .get("fileConfiguration"))); - } else { - intance.put(configuration.getName(), configuration - .getParameters()); - } - } - instances.put(entry.getKey(), intance); - } - } catch (STORKSAMLEngineException ex) { - LOGGER.error("Can not create instance from file configuration."); - throw new STORKSAMLEngineException(ex); - } - return instances; - } - - - /** - * Gets the new instance. - * - * @param fileName the file name - * - * @return the properties from the new instance - * - * @throws STORKSAMLEngineException the STORKSAML engine - * runtime exception - */ - private static Properties getNewInstance(final String fileName) - throws STORKSAMLEngineException { - LOGGER.info("Create file configuration properties to Stork Saml Engine."); - InputStream fileEngineProp = null; - try { - fileEngineProp = ConfigurationCreator.class - .getResourceAsStream("/" + fileName); - final Properties configuration = new Properties(); - configuration.loadFromXML(fileEngineProp); - return configuration; - } catch (InvalidPropertiesFormatException e) { - LOGGER.error("Invalid properties format."); - throw new STORKSAMLEngineException(e); - } catch (IOException e) { - LOGGER.error("Error read file: " + fileName); - throw new STORKSAMLEngineException(e); - } finally { - IOUtils.closeQuietly(fileEngineProp); - } - } - - /** - * Instantiates a new instance creator. - */ - private ConfigurationCreator() { - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base deleted file mode 100644 index 910f4398e..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationEngine.java.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.util.Map; - -/** - * The Class ConfigurationEngine. - * - * @author fjquevedo - */ -public class ConfigurationEngine { - - /** The name of the configuration file. */ - private String name; - - /** The parameters. */ - private Map parameters; - - /** - * Gets the name. - * - * @return the name - */ - public final String getName() { - return name; - } - - /** - * Gets the parameters. - * - * @return the parameters - */ - public final Map getParameters() { - return parameters; - } - - /** - * Sets the name. - * - * @param newName the new name - */ - public final void setName(final String newName) { - this.name = newName; - } - - /** - * Sets the parameters. - * - * @param newParameters the parameters - */ - public final void setParameters(final Map newParameters) { - this.parameters = newParameters; - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base deleted file mode 100644 index 374cf3fc3..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationReader.java.svn-base +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * The Class ConfigurationReader. - * - * @author fjquevedo - */ -public final class ConfigurationReader { - - /** The Constant SAML_ENGINE_CONFIGURATION_FILE. */ - private static final String ENGINE_CONF_FILE = "SamlEngine.xml"; - - /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(ConfigurationReader.class.getName()); - - /** The Constant NODE_CONFIGURATION. */ - private static final String NODE_CONF = "configuration"; - - /** The Constant NODE_CONFIGURATION_NAME. */ - private static final String NODE_CONF_NAME = "name"; - - /** The Constant NODE_INSTANCE_NAME. */ - private static final String NODE_INST_NAME = "name"; - - /** The Constant NODE_INSTANCE. */ - private static final String NODE_INSTANCE = "instance"; - - /** The Constant NODE_CONFIGURATION_NAME. */ - private static final String NODE_PARAM_NAME = "name"; - - /** The Constant NODE_CONFIGURATION_NAME. */ - private static final String NODE_PARAM_VALUE = "value"; - - /** The Constant NODE_CONFIGURATION_NAME. */ - private static final String NODE_PARAMETER = "parameter"; - - /** - * Generate parameters. - * - * @param configurationNode the configuration node - * - * @return the map< string, string> - */ - private static Map generateParam( - final Element configurationNode) { - - final HashMap parameters = new HashMap(); - - final NodeList parameterNodes = configurationNode - .getElementsByTagName(NODE_PARAMETER); - - String parameterName; - String parameterValue; - - for (int k = 0; k < parameterNodes.getLength(); ++k) { - // for every parameter find, process. - final Element parameterNode = (Element) parameterNodes.item(k); - parameterName = parameterNode.getAttribute(NODE_PARAM_NAME); - parameterValue = parameterNode.getAttribute(NODE_PARAM_VALUE); - - // verified the content. - if (StringUtils.isBlank(parameterName) - || StringUtils.isBlank(parameterValue)) { - throw new STORKSAMLEngineRuntimeException( - "Error reader parameters (name - value)."); - } else { - parameters.put(parameterName.trim(), parameterValue.trim()); - } - } - return parameters; - } - - /** - * Read configuration. - * - * @return the map< string, instance engine> - * - * @throws SAMLEngineException the STORKSAML engine runtime - * exception - */ - public static Map readConfiguration() - throws SAMLEngineException { - - LOGGER.info("Init reader: " + ENGINE_CONF_FILE); - final Map instanceConfs = - new HashMap(); - - Document document = null; - // Load configuration file - final DocumentBuilderFactory factory = DocumentBuilderFactory - .newInstance(); - DocumentBuilder builder; - - InputStream engineConf = null; - try { - - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - - builder = factory.newDocumentBuilder(); - - engineConf = ConfigurationReader.class - .getResourceAsStream("/" + ENGINE_CONF_FILE); - - document = builder.parse(engineConf); - - // Read instance - final NodeList list = document.getElementsByTagName(NODE_INSTANCE); - - for (int indexElem = 0; indexElem < list.getLength(); ++indexElem) { - final Element element = (Element) list.item(indexElem); - - final InstanceEngine instanceConf = new InstanceEngine(); - - // read every configuration. - final String instanceName = element - .getAttribute(NODE_INST_NAME); - - if (StringUtils.isBlank(instanceName)) { - throw new STORKSAMLEngineRuntimeException( - "Error reader instance name."); - } - instanceConf.setName(instanceName.trim()); - - final NodeList confNodes = element - .getElementsByTagName(NODE_CONF); - - for (int indexNode = 0; indexNode < confNodes.getLength(); ++indexNode) { - - final Element configurationNode = (Element) confNodes - .item(indexNode); - - final String configurationName = configurationNode - .getAttribute(NODE_CONF_NAME); - - if (StringUtils.isBlank(configurationName)) { - throw new STORKSAMLEngineRuntimeException( - "Error reader configuration name."); - } - - final ConfigurationEngine confSamlEngine = - new ConfigurationEngine(); - - // Set configuration name. - confSamlEngine.setName(configurationName.trim()); - - // Read every parameter for this configuration. - final Map parameters = - generateParam(configurationNode); - - // Set parameters - confSamlEngine.setParameters(parameters); - - // Add parameters to the configuration. - instanceConf.getConfiguration().add(confSamlEngine); - } - - // Add to the list of configurations. - instanceConfs.put(element.getAttribute(NODE_INST_NAME), - instanceConf); - } - - } catch (SAXException e) { - LOGGER.error("Error: init library parser."); - throw new SAMLEngineException(e); - } catch (ParserConfigurationException e) { - LOGGER.error("Error: parser configuration file xml."); - throw new SAMLEngineException(e); - } catch (IOException e) { - LOGGER.error("Error: read configuration file."); - throw new SAMLEngineException(e); - } finally { - IOUtils.closeQuietly(engineConf); - } - - return instanceConfs; - } - - /** - * Instantiates a new configuration reader. - */ - private ConfigurationReader() { - - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base deleted file mode 100644 index 53cea621d..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/ConfigurationSingleton.java.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.exceptions.SAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException; - -/** - * The Class InstanceCreator. - * - * @author fjquevedo - */ -public final class ConfigurationSingleton { - - /** The instance of every engine SAML. */ - private static Map instanceConfigs; - - /** The instances of SAML engine. */ - private static Map> instances; - - /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(ConfigurationSingleton.class.getName()); - - static { - LOGGER.debug("Read all file configurations. (instances of SAMLEngine)"); - try { - instanceConfigs = ConfigurationReader.readConfiguration(); - } catch (SAMLEngineException e) { - LOGGER.error("Error read configuration file."); - throw new STORKSAMLEngineRuntimeException(e); - } - } - - /** - * Gets the new instance. - * - * @param fileName the file name - * - * @return the properties from the new instance - * - * @throws STORKSAMLEngineException the STORKSAML engine runtime exception - */ - private static Map> getInstance( - final String fileName) throws STORKSAMLEngineException { - return ConfigurationCreator.createConfiguration(instanceConfigs); - } - - /** - * Instantiates a new instance creator. - */ - private ConfigurationSingleton() { - } - -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base deleted file mode 100644 index e0e2d1965..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/InstanceEngine.java.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.configuration; - -import java.util.ArrayList; -import java.util.List; - -/** - * The Class InstanceConfiguration. - * - * @author fjquevedo - */ -public class InstanceEngine { - - /** The configuration. */ - private List configuration = new ArrayList(); - - /** The name. */ - private String name; - - /** - * Gets the parameters. - * - * @return the parameters - */ - public final List getConfiguration() { - return this.configuration; - } - - /** - * Gets the name. - * - * @return the name - */ - public final String getName() { - return name; - } - - /** - * Sets the parameters. - * - * @param newConfiguration the new parameters - */ - public final void setConfiguration(final List newConfiguration) { - this.configuration = newConfiguration; - } - - /** - * Sets the name. - * - * @param newName the new name - */ - public final void setName(final String newName) { - this.name = newName; - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 6d0b54297..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Provides the classes necessary to create a SAML message instance. - */ -package eu.stork.peps.configuration; diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/all-wcprops b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/all-wcprops deleted file mode 100644 index d4b9b9008..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/all-wcprops +++ /dev/null @@ -1,29 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 86 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions -END -SAMLEngineException.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java -END -STORKSAMLEngineException.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 104 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/package-info.java -END -STORKSAMLEngineRuntimeException.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.java -END diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/entries b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/entries deleted file mode 100644 index 6493ed6e8..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/entries +++ /dev/null @@ -1,164 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/main/java/eu/stork/peps/exceptions -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -STORKSAMLEngineRuntimeException.java -file - - - - -2013-12-20T12:27:57.454475Z -aebe4e4afb2f11cf42448486970a5d85 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1812 - -SAMLEngineException.java -file - - - - -2013-12-20T12:27:57.454475Z -38d2d1ec4d590abab4bb36d845d9f86b -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1710 - -STORKSAMLEngineException.java -file - - - - -2013-12-20T12:27:57.454475Z -622c95d2e770b38dafe815bcfaae8994 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3460 - -package-info.java -file - - - - -2013-12-20T12:27:57.454475Z -56145f85c2084454a3c223dd9e103846 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -792 - diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base deleted file mode 100644 index 366379ad0..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/SAMLEngineException.java.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.exceptions; - -/** - * The Class SAMLEngineException. - * - * @author fjquevedo - */ -public class SAMLEngineException extends Exception { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = 2611361164977849837L; - - /** - * Instantiates a new SAMLEngine exception. - * - * @param wrappedException the wrapped exception - */ - public SAMLEngineException(final Exception wrappedException) { - super(wrappedException); - } - - /** - * Instantiates a new SAMLEngine exception. - * - * @param message the message - */ - public SAMLEngineException(final String message) { - super(message); - } - - /** - * Instantiates a new SAMLEngine exception. - * - * @param message the message - * @param wrappedException the wrapped exception - */ - public SAMLEngineException(final String message, - final Exception wrappedException) { - super(message, wrappedException); - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base deleted file mode 100644 index bddcbd1b3..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineException.java.svn-base +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.exceptions; - -/** - * The Class STORKSAMLEngineException. - * - * @author fjquevedo - */ -public class STORKSAMLEngineException extends Exception { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = -8319723167019122930L; - - /** The error code. */ - private String errorCode; - - /** The error detail. */ - private String errorDetail; - - /** - * Instantiates a new sTORKSAML engine exception. - * - * @param wrappedException the wrapped exception - */ - public STORKSAMLEngineException(final Exception wrappedException) { - super(wrappedException); - } - - /** - * Instantiates a new sTORKSAML engine exception. - * - * @param errorMessage the error message - */ - public STORKSAMLEngineException(final String errorMessage) { - super(errorMessage); - } - - /** - * Instantiates a new sTORKSAML engine exception. - * - * @param message the message - * @param wrappedException the wrapped exception - */ - public STORKSAMLEngineException(final String message, - final Exception wrappedException) { - super(message, wrappedException); - } - - /** - * Instantiates a new sTORKSAML engine exception. - * - * @param newErrorCode the error code - * @param errorMessage the error message - * @param newErrorDetail the error detail - */ - public STORKSAMLEngineException(final String newErrorCode, - final String errorMessage, final String newErrorDetail) { - super(errorMessage); - this.errorCode = newErrorCode; - this.errorDetail = newErrorDetail; - } - - /** - * Gets the error code. - * - * @return the error code - */ - public final String getErrorCode() { - return this.errorCode; - } - - /** - * Gets the error detail. - * - * @return the error detail - */ - public final String getErrorDetail() { - return errorDetail; - } - - /** - * Gets the error message. - * - * @return the error message - */ - public final String getErrorMessage() { - return super.getMessage(); - } - - - /** - * Gets the message. - * - * @return the message of the exception. - * - * @see java.lang.Throwable#getMessage() - */ - public final String getMessage() { - return "Error (no. " + errorCode + ") processing request : " - + super.getMessage(); - } - - /** - * Sets the error code. - * - * @param newErrorCode the new error code - */ - public final void setErrorCode(final String newErrorCode) { - this.errorCode = newErrorCode; - } - - /** - * Sets the error detail. - * - * @param newErrorDetail the new error detail - */ - public final void setErrorDetail(final String newErrorDetail) { - this.errorDetail = newErrorDetail; - } - -} diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base deleted file mode 100644 index 30b9b49b4..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/STORKSAMLEngineRuntimeException.java.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.exceptions; - -/** - * The Class STORKSAMLEngineRuntimeException. - * - * @author fjquevedo - */ -public class STORKSAMLEngineRuntimeException extends RuntimeException { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = 5829810358581493517L; - - /** - * Instantiates a new sTORKSAML engine runtime exception. - * - * @param wrappedException the wrapped exception - */ - public STORKSAMLEngineRuntimeException(final Exception wrappedException) { - super(wrappedException); - } - - /** - * Creates a new instance of application exception. - * - * @param cause the exception cause. - */ - public STORKSAMLEngineRuntimeException(final String cause) { - super(cause); - } - - /** - * Instantiates a new sTORKSAML engine runtime exception. - * - * @param message the message - * @param wrappedException the wrapped exception - */ - public STORKSAMLEngineRuntimeException(final String message, - final Exception wrappedException) { - super(message, wrappedException); - } -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 0c34528fc..000000000 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Provides the classes for STORK exceptions management. - */ -package eu.stork.peps.exceptions; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/.svn/all-wcprops deleted file mode 100644 index ead80d4e8..000000000 --- a/id/server/stork2-saml-engine/src/test/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 57 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test -END diff --git a/id/server/stork2-saml-engine/src/test/.svn/entries b/id/server/stork2-saml-engine/src/test/.svn/entries deleted file mode 100644 index 1b6d0b3e1..000000000 --- a/id/server/stork2-saml-engine/src/test/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -resources -dir - -java -dir - diff --git a/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops deleted file mode 100644 index 56c8ee113..000000000 --- a/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 62 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java -END diff --git a/id/server/stork2-saml-engine/src/test/java/.svn/entries b/id/server/stork2-saml-engine/src/test/java/.svn/entries deleted file mode 100644 index ca124ed28..000000000 --- a/id/server/stork2-saml-engine/src/test/java/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -eu -dir - diff --git a/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF b/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF deleted file mode 100644 index 5e9495128..000000000 --- a/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops deleted file mode 100644 index e00b13d5a..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 65 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu -END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries deleted file mode 100644 index cc3e19816..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -stork -dir - diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops deleted file mode 100644 index ac0852630..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 71 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork -END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries deleted file mode 100644 index 66d2ea82a..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -peps -dir - diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops deleted file mode 100644 index 5555d11e2..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 76 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps -END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries deleted file mode 100644 index e20bc1c1d..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -test -dir - diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops deleted file mode 100644 index ee98ec5bd..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 81 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test -END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries deleted file mode 100644 index a7074362f..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -simple -dir - diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops deleted file mode 100644 index 063e2de18..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops +++ /dev/null @@ -1,47 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple -END -StorkResponseTest.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java -END -StorkAttrQueryResponseTest.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java -END -SimpleBaseTest.java -K 25 -svn:wc:ra_dav:version-url -V 107 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java -END -package-info.java -K 25 -svn:wc:ra_dav:version-url -V 105 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/package-info.java -END -SSETestUtils.java -K 25 -svn:wc:ra_dav:version-url -V 105 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java -END -StorkAttrQueryRequestTest.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java -END -StorkAuthRequestTest.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java -END diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries deleted file mode 100644 index 0fbc1b254..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries +++ /dev/null @@ -1,266 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -SSETestUtils.java -file - - - - -2013-12-20T12:27:57.274475Z -f9c51e04914afb9a99d52e642c8a6a42 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -5521 - -StorkAttrQueryRequestTest.java -file - - - - -2013-12-20T12:27:57.274475Z -66e336a173f22c2ba55b933157c703c8 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -25393 - -StorkAuthRequestTest.java -file - - - - -2013-12-20T12:27:57.274475Z -c1e89785bc4af791adb9760fd42b7d56 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -31301 - -StorkResponseTest.java -file - - - - -2013-12-20T12:27:57.274475Z -016c270fa1231e25cc1ccf67d0ebf6cf -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -39179 - -StorkAttrQueryResponseTest.java -file - - - - -2013-12-20T12:27:57.274475Z -44021c766949a57b10b61cd466a57b55 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -39559 - -SimpleBaseTest.java -file - - - - -2013-12-20T12:27:57.274475Z -6effea1d03de1bd17fd8d07d3778df58 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -1871 - -package-info.java -file - - - - -2013-12-20T12:27:57.274475Z -3cd87d2f80f4a5a4f42ab5bc844dd2f3 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -811 - diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base deleted file mode 100644 index b1443bb0e..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; - -import javax.xml.XMLConstants; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.apache.commons.io.IOUtils; -import org.bouncycastle.util.encoders.Base64; -import org.opensaml.Configuration; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.Marshaller; -import org.opensaml.xml.io.MarshallerFactory; -import org.opensaml.xml.io.MarshallingException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * The Class SSETestUtils. - */ -public final class SSETestUtils { - - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(SSETestUtils.class.getName()); - - /** - * Instantiates a new sSE test utils. - */ - private SSETestUtils() { - } - - /** - * Prints the tree DOM. - * - * @param samlToken the SAML token - * @param isIndent the is indent - * - * @return the string - * @throws TransformerException the exception - */ - public static String printTreeDOM(final Element samlToken, final boolean isIndent) throws TransformerException { - // set up a transformer - final TransformerFactory transfac = TransformerFactory.newInstance(); - final Transformer trans = transfac.newTransformer(); - trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - trans.setOutputProperty(OutputKeys.INDENT, String.valueOf(isIndent)); - - // create string from XML tree - final StringWriter stringWriter = new StringWriter(); - final StreamResult result = new StreamResult(stringWriter); - final DOMSource source = new DOMSource(samlToken); - trans.transform(source, result); - final String xmlString = stringWriter.toString(); - - return xmlString; - } - - /** - * Marshall. - * - * @param samlToken the SAML token - * - * @return the byte[] - * - * @throws MarshallingException the marshalling exception - * @throws ParserConfigurationException the parser configuration exception - * @throws TransformerException the transformer exception - */ - public static byte[] marshall(final XMLObject samlToken) - throws MarshallingException, ParserConfigurationException, - TransformerException { - - final javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory - .newInstance(); - dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - dbf.setNamespaceAware(true); - dbf.setIgnoringComments(true); - final javax.xml.parsers.DocumentBuilder docBuild = dbf - .newDocumentBuilder(); - - // Get the marshaller factory - final MarshallerFactory marshallerFactory = Configuration - .getMarshallerFactory(); - - // Get the Subject marshaller - final Marshaller marshaller = marshallerFactory - .getMarshaller(samlToken); - - final Document doc = docBuild.newDocument(); - - // Marshall the SAML token - marshaller.marshall(samlToken, doc); - - // Obtain a byte array representation of the marshalled SAML object - final DOMSource domSource = new DOMSource(doc); - final StringWriter writer = new StringWriter(); - final StreamResult result = new StreamResult(writer); - final TransformerFactory transFact = TransformerFactory.newInstance(); - final Transformer transformer = transFact.newTransformer(); - transformer.transform(domSource, result); - - return writer.toString().getBytes(); - } - - /** - * Encode SAML token. - * - * @param samlToken the SAML token - * - * @return the string - */ - public static String encodeSAMLToken(final byte[] samlToken) { - return new String(Base64.encode(samlToken)); - } - - /** - * Read stork SAML from file. - * - * @param resource the resource - * - * @return the byte[] - * @throws IOException the exception - * - */ - public static byte[] readStorkSamlFromFile(final String resource) - throws IOException { - InputStream inputStream = null; - byte[] bytes; - - try { - inputStream = StorkAuthRequestTest.class - .getResourceAsStream(resource); - - // Create the byte array to hold the data - bytes = new byte[(int) inputStream.available()]; - inputStream.read(bytes); - } catch (IOException e) { - LOG.error("Error read from file: " + resource); - throw e; - } finally { - IOUtils.closeQuietly(inputStream); - } - return bytes; - - } -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base deleted file mode 100644 index 97fa4b7cc..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import org.junit.Test; - -import junit.framework.Assert; -import junit.framework.TestCase; -import eu.stork.peps.auth.engine.STORKSAMLEngine; - -/** - * The Class SimpleBaseTest. Defines a set of test the initialization of the - * SAML engine. - */ -public class SimpleBaseTest extends TestCase { - - /** - * Test SAML engine correct configuration name. - */ - @Test - public final void testSamlEngineCorrectInit() { - Assert.assertNotNull(STORKSAMLEngine.getInstance("CONF1")); - } - - /** - * Test SAML engine error configuration name. - */ - @Test - public final void testSamlEngineErrorNameConf() { - Assert.assertNull(STORKSAMLEngine.getInstance("CONF_ERROR")); - } - - /** - * Test SAML engine error name null. - */ - @Test - public final void testSamlEngineErrorNameNull() { - Assert.assertNull(STORKSAMLEngine.getInstance(null)); - } - - /** - * Test SAML engine correct name configuration with spaces. - */ - @Test - public final void testSamlEngineErrorNameSpaces() { - Assert.assertNotNull(STORKSAMLEngine.getInstance(" CONF1 ")); - } - -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base deleted file mode 100644 index 7fa305d3b..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base +++ /dev/null @@ -1,790 +0,0 @@ -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileOutputStream; -import java.util.ArrayList; -import java.util.Arrays; - -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAttrQueryRequest; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -public class StorkAttrQueryRequestTest { - - /** The engines. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0"); - private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); - private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); - - - /** - * Instantiates a new stork authentication request test. - */ - public StorkAttrQueryRequestTest() { - pal = new PersonalAttributeList(); - - final PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - final ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - final PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - final PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - eIDNumber.setValue(Arrays.asList("ES/IS/1234567890")); - pal.add(eIDNumber); - - final PersonalAttribute givenName = new PersonalAttribute(); - givenName.setName("givenName"); - givenName.setIsRequired(true); - givenName.setValue(Arrays.asList("Sveinbjorn")); - pal.add(givenName); - - destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest"; - //assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - - } - - /** The destination. */ - private String destination; - - /** The service provider sector. */ - private String spSector; - - /** The service provider institution. */ - private String spInstitution; - - /** The service provider application. */ - private String spApplication; - - /** The service provider country. */ - private String spCountry; - - /** The service provider id. */ - private String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The List of Personal Attributes. */ - private IPersonalAttributeList pal; - - /** The attribute query request. */ - private static byte[] attrRequest; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkAttrQueryRequestTest.class.getName()); - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - } - - /** - * Test generate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryRequest() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // new parameters - request.setEIDSectorShare(false); - request.setEIDCrossSectorShare(false); - request.setEIDCrossBorderShare(false); - - STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request); - byte[] reqByte = req1.getTokenSaml(); - FileOutputStream output = null; - - try { - output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml")); - output.write(reqByte); - } catch (Exception e) { - e.printStackTrace(); - throw new STORKSAMLEngineException(e); - } finally { - try { output.close(); } catch (Exception e) { throw new STORKSAMLEngineException(e); } - } - - - - - LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); - - request.setCitizenCountryCode("IS"); - LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); - } - - /** - * Test generate authentication request error personal attribute name error. - */ - @Test - public final void testGenerateAttrQueryRequestPALsErr1() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("attrNotValid"); - worngAttr.setIsRequired(true); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - - // news parameters - request.setEIDSectorShare(false); - request.setEIDCrossSectorShare(false); - request.setEIDCrossBorderShare(false); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - /** - * Test generate authentication request error personal attribute value error. - */ - @Test - public final void testGenerateAttrQueryRequestPALsErr2() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute attrNotValid = new PersonalAttribute(); - attrNotValid.setName("attrNotValid"); - attrNotValid.setIsRequired(true); - palWrong.add(attrNotValid); - - - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request authentication assurance level - * negative value. - */ - @Test - public final void testGenerateAttrQueryRequestQaalErr1() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(-1); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request service provider sector null. - */ - @Test - public final void testGenerateAttrQueryRequestSectorErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - - } - } - - /** - * Test generate authentication request service provider institution null. - */ - @Test - public final void testGenerateAttrQueryRequestInstitutionrErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(null); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAttrQueryRequestApplicationErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(null); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider country null. - */ - @Test - public final void testGenerateAttrQueryRequestCountryErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(null); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request error with quality authentication - * assurance level wrong. - */ - @Test - public final void testGenerateAttrQueryRequestQaalErr2() { - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(0); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request personal attribute list null value. - */ - @Test - public final void testGenerateAttrQueryRequestPALErr1() { - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(null); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request null parameter. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestNullParam() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAttrQueryRequest(null); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request error bytes encode. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestErrorEncode() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAttrQueryRequest("messageError".getBytes()); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequest() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - attrRequest = engine.generateSTORKAttrQueryRequest(request).getTokenSaml(); - - final STORKAttrQueryRequest validatedRequest = engine.validateSTORKAttrQueryRequest(attrRequest); - - assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); - - } - - /** - * Test validate data authenticate request. Verified parameters after - * validation. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateDataAttrQueryRequest() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = engine.validateSTORKAttrQueryRequest(attrRequest); - - assertEquals("Sestination incorrect: ", request.getDestination(), destination); - - assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); - - assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); - assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); - assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); - assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); - assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), null); - - } - - /** - * Test validate file attribute query request. Validate from XML file. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAttrQueryRequest() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml"); - - try { - engine.validateSTORKAttrQueryRequest(bytes); - fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - } - } - - /** - * Test validate file authentication request tag delete. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAttrRequestTagDelete() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml"); - - try { - engine.validateSTORKAttrQueryRequest(bytes); - fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - - } - } - - /** - * Test validate authentication request not trusted token. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestNotTrustedErr1() - throws STORKSAMLEngineException { - - try { - final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine - .getInstance("CONF2"); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineNotTrusted - .generateSTORKAttrQueryRequest(request).getTokenSaml(); - - engine.validateSTORKAttrQueryRequest(authReqNotTrust); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("validateSTORKAttrQueryRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test validate authentication request trusted. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestTrusted() - throws STORKSAMLEngineException { - - final STORKSAMLEngine engineTrusted = STORKSAMLEngine - .getInstance("CONF3"); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest( - request).getTokenSaml(); - - // engine ("CONF1") no have trust certificate from "CONF2" - engine.validateSTORKAttrQueryRequest(authReqNotTrust); - - } - - - - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAttrQueryRequestNADA() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(null); - request.setSpApplication(null); - request.setSpCountry(null); - - try { - - engine.validateSTORKAttrQueryRequest(attrRequest); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test validate authentication request with unknown elements. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestWithUnknownElements() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute unknown = new PersonalAttribute(); - unknown.setName("unknown"); - unknown.setIsRequired(true); - pAttList.add(unknown); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - STORKAttrQueryRequest req = new STORKAttrQueryRequest(); - - req = engine3.generateSTORKAttrQueryRequest(request); - - req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); - - assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); - assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); - - } - - /** - * Test generate Request with required elements by default - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - STORKAttrQueryRequest req = new STORKAttrQueryRequest(); - STORKAttrQueryRequest reqTrue = new STORKAttrQueryRequest(); - STORKAttrQueryRequest reqFalse = new STORKAttrQueryRequest(); - - reqTrue = engine.generateSTORKAttrQueryRequest(request); - reqFalse = engine2.generateSTORKAttrQueryRequest(request); - req = engine3.generateSTORKAttrQueryRequest(request); - - - String token = new String(req.getTokenSaml()); - String reqTrueToken = new String(reqTrue.getTokenSaml()); - String reqFalseToken = new String(reqFalse.getTokenSaml()); - - assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); - assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); - assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); - - } - - /** - * Test validating attribute query and getting alias used to save - * the saml trusted certificate into trustore - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAtrrQueryRequestGettingItsAlias() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - STORKAttrQueryRequest req = new STORKAttrQueryRequest(); - - req = engine3.generateSTORKAttrQueryRequest(request); - req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - - req = engine2.generateSTORKAttrQueryRequest(request); - req = engine2.validateSTORKAttrQueryRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - } - -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base deleted file mode 100644 index 27c6cfe39..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base +++ /dev/null @@ -1,920 +0,0 @@ -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.junit.Ignore; -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PEPSUtil; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAttrQueryRequest; -import eu.stork.peps.auth.commons.STORKAttrQueryResponse; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.commons.STORKAuthnResponse; -import eu.stork.peps.auth.commons.STORKStatusCode; -import eu.stork.peps.auth.commons.STORKSubStatusCode; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -public class StorkAttrQueryResponseTest { - - /** The engine. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - - /** - * Gets the engine. - * - * @return the engine - */ - public static STORKSAMLEngine getEngine() { - return engine; - } - - /** - * Sets the engine. - * - * @param newEngine the new engine - */ - public static void setEngine(final STORKSAMLEngine newEngine) { - StorkAttrQueryResponseTest.engine = newEngine; - } - - /** The destination. */ - private static String destination; - - /** The service provider sector. */ - private static String spSector; - - /** The service provider institution. */ - private static String spInstitution; - - /** The service provider application. */ - private static String spApplication; - - /** The service provider country. */ - private static String spCountry; - - /** The service provider id. */ - private static String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The state. */ - private static String state = "IS"; - - /** The town. */ - private static String town = "Reykjavik"; - - /** The postal code. */ - private static String postalCode = "105"; - - /** The street name. */ - private static String streetName = "Gudrunartun"; - - /** The street number. */ - private static String streetNumber = "10"; - - /** The List of Personal Attributes. */ - private static IPersonalAttributeList pal; - - /** The assertion consumer URL. */ - private static String assertConsumerUrl; - - /** The attribute query request. */ - private static byte[] attrQueryRequest; - - /** The attribute query response. */ - private static byte[] attrQueryResponse; - - /** The attribute query request. */ - private static STORKAttrQueryRequest attrQueryenRequest; - - /** The attribute query response. */ - private static STORKAttrQueryResponse attrQeuryenResponse; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkAttrQueryResponseTest.class.getName()); - - /** - * Instantiates a new stork response test. - */ - public StorkAttrQueryResponseTest() { - super(); - } - - /** The IP address. */ - private static String ipAddress; - - /** The destination URL. */ - private static String destinationUrl; - - /** The is hashing. */ - private final boolean isHashing = Boolean.TRUE; - - /** The is not hashing. */ - private final boolean isNotHashing = Boolean.FALSE; - - /** The ERROR text. */ - private static final String ERROR_TXT = "generateAttrQueryResponse(...) should've thrown an STORKSAMLEngineException!"; - - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - - pal = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - pal.add(eIDNumber); - - final PersonalAttribute givenName = new PersonalAttribute(); - givenName.setName("givenName"); - givenName.setIsRequired(true); - pal.add(givenName); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - pal.add(canRessAddress); - - PersonalAttribute newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - pal.add(newAttribute); - - destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - spSector = "EDU001"; - spInstitution = "OXF001"; - spApplication = "APP001"; - spCountry = "EN"; - - spId = "EDU001-APP001-APP001"; - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - request.setDestination(destination); - //request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - //request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(request) - .getTokenSaml(); - - attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest); - - } catch (STORKSAMLEngineException e) { - fail("Error create STORKAuthnRequest"); - } - - ipAddress = "111.222.333.444"; - - destinationUrl = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - - pal = new PersonalAttributeList(); - - isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ages = new ArrayList(); - - ages.add("16"); - ages.add("18"); - - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(isAgeOver); - - dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(dateOfBirth); - - eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789IS"); - eIDNumber.setValue(idNumber); - eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(eIDNumber); - - canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - - canRessAddress.setComplexValue(address); - pal.add(canRessAddress); - - newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap values = new HashMap(); - - values.put("value1", "value1"); - values.put("value2", "value2"); - values.put("value3", "value3"); - values.put("value4", "value4"); - - newAttribute.setComplexValue(values); - pal.add(newAttribute); - - } - - /** - * Test generate attribute query request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryResponse() throws STORKSAMLEngineException { - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - final STORKAttrQueryResponse storkResponse = getEngine() - .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, - destinationUrl, isNotHashing); - - attrQueryResponse = storkResponse.getTokenSaml(); - - FileOutputStream output = null; - - try { - output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml")); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - try { - output.write(attrQueryResponse); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); - - - } - - /** - * Test validation id parameter mandatory. - */ - @Test - public final void testResponseMandatoryId() { - final String identifier = attrQueryenRequest.getSamlId(); - attrQueryenRequest.setSamlId(null); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, destinationUrl, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setSamlId(identifier); - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response in response to err1. - */ - @Test - public final void testResponseMandatoryIssuer() { - - final String issuer = attrQueryenRequest.getIssuer(); - attrQueryenRequest.setIssuer(null); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, destinationUrl, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setIssuer(issuer); - LOG.error("Error"); - } - } - - - /** - * Test generate attribute query response assertion consumer null. - */ - /*@Test - public final void testResponseMandatoryAssertionConsumerServiceURL() { - final String asserConsumerUrl = attrQueryenRequest - .getAssertionConsumerServiceURL(); - attrQueryenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response IP address null. - */ - @Test - public final void testResponseValidationIP() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, null, - destinationUrl, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response with personal attribute list null. - */ - @Test - public final void testResponseMandatoryPersonalAttributeList() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(null); - - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, destinationUrl, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate attribute query response token null. - */ - @Test - public final void testResponseInvalidParametersToken() { - try { - getEngine().validateSTORKAttrQueryResponse(null, ipAddress); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate attribute query response IP null. - */ - @Test - public final void STORKAttrQueryResponse() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response parameter name wrong. - */ - @Test - public final void testResponseInvalidParametersAttr() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("AttrWrong"); - wrongList.add(worngAttr); - - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrSimpleValue() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoValue() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoName() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null complex value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrComplexValue() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setComplexValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test validate attribute query response IP distinct and disabled validation - * IP. - */ - @Test - public final void testResponseInvalidParametersIPDistinct() { - try { - // ipAddress origin "111.222.333.444" - // ipAddrValidation = false - // Subject Confirmation Bearer. - - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, "127.0.0.1"); - } catch (STORKSAMLEngineException e) { - fail("validateAttributeQueryResponse(...) should've thrown an STORKSAMLEngineException!"); - LOG.error("Error"); - } - } - - /** - * Test response invalid parameters invalid token. - */ - @Test - public final void testResponseInvalidParametersTokenMsg() { - try { - // ipAddress origin "111.222.333.444" - // Subject Confirmation Bearer. - getEngine().validateSTORKAttrQueryResponse("errorMessage".getBytes(), - ipAddress); - fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate attribute query response is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - /*@Test - public final void testValidateAuthenticationResponseIsFail() - throws STORKSAMLEngineException { - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertFalse("Generate incorrect response: ", attrQeuryenResponse.isFail()); - } - - /** - * Test validate attribute query response destination. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseDestination() - throws STORKSAMLEngineException { - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertEquals("Destination incorrect: ", - attrQeuryenResponse.getInResponseTo(), attrQueryenRequest.getSamlId()); - } - - /** - * Test validate attribute query response values. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseValuesComplex() - throws STORKSAMLEngineException { - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertEquals("Country incorrect:", attrQeuryenResponse.getCountry(), "ES"); - - final Iterator iterator = attrQeuryenResponse - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - final PersonalAttribute attribute = iterator.next(); - if (attribute.getName().equalsIgnoreCase( - "canonicalResidenceAddress")) { - assertEquals("State incorrect: ", state, attribute - .getComplexValue().get("state")); - assertEquals("Town incorrect: ", town, attribute - .getComplexValue().get("town")); - assertEquals("Postal code incorrect: ", postalCode, attribute - .getComplexValue().get("postalCode")); - assertEquals("Street name incorrect: ", streetName, attribute - .getComplexValue().get("streetName")); - assertEquals("Street number incorrect: ", streetNumber, - attribute.getComplexValue().get("streetNumber")); - } - } - } - - /** - * Test generate attribute query response fail in response to it's null. - * @throws STORKSAMLEngineException - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test //( expected=STORKSAMLEngineException.class) - public final void testGenerateAttrQueryResponseFailInResponseToNull() throws STORKSAMLEngineException { - final String identifier = attrQueryenRequest.getSamlId(); - attrQueryenRequest.setSamlId(null); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setSamlId(identifier); - LOG.error("Error"); - //throw new STORKSAMLEngineException(e); - } - } - - /** - * Test generate attribute query response fail assertion consumer URL err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - /*@Test - public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() - throws STORKSAMLEngineException { - - final String assertConsumerUrl = attrQueryenRequest - .getAssertionConsumerServiceURL(); - attrQueryenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - attrQueryResponse = getEngine().generateSTORKAuthnResponseFail(attrQueryenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response fail code error err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryResponseFailCodeErrorNull() - throws STORKSAMLEngineException { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setStatusCode(null); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - fail("generateAttrQueryResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test generate attribute query request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryResponse() throws STORKSAMLEngineException { - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(dateOfBirth); - - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - complex.put("one", "two"); - - //eIDNumber.setValue(null); - //eIDNumber.setValue(idNumber); - //eIDNumber.setComplexValue(complex); - - eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); - palist.add(eIDNumber); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - - canRessAddress.setComplexValue(address); - palist.add(canRessAddress); - - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAttrQueryResponse storkResponse = getEngine() - .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, - destinationUrl, isNotHashing); - - attrQueryResponse = storkResponse.getTokenSaml(); - LOG.info("Request id: " + attrQueryenRequest.getSamlId()); - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); - - - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - LOG.info("RESPONSE ID: " + attrQeuryenResponse.getSamlId()); - LOG.info("RESPONSE IN_RESPONSE_TO: " + attrQeuryenResponse.getInResponseTo()); - LOG.info("RESPONSE COUNTRY: " + attrQeuryenResponse.getCountry()); - - } - - - - - - /** - * Test validate attribute query response fail is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryResponseFailIsFail() - throws STORKSAMLEngineException { - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage("message"); - - attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - - LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(attrQueryResponse)); - - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - LOG.info("COUNTRY: " + attrQeuryenResponse.getCountry()); - assertTrue("Generate incorrect response: ", attrQeuryenResponse.isFail()); - } - - /** - * Test generate/validate response with signedDoc - * - * @throws STORKSAMLEngineException - * the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryResponseWithSignedDoc() - throws STORKSAMLEngineException { - - String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - palist.add(isAgeOver); - - attrQueryenRequest.setPersonalAttributeList(palist); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAttrQueryResponse storkResponse = getEngine() - .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, - destinationUrl, isNotHashing); - - attrQueryResponse = storkResponse.getTokenSaml(); - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse - .getPersonalAttributeList().get("signedDoc").getValue().get(0) - .equals(signedDocResponse)); - - } -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base deleted file mode 100644 index 7223ab483..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base +++ /dev/null @@ -1,966 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; - -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class StorkAuthRequestTest defines a class to . - */ -public class StorkAuthRequestTest { - - /** The engines. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); - private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); - - - /** - * Instantiates a new stork authentication request test. - */ - public StorkAuthRequestTest() { - pal = new PersonalAttributeList(); - - final PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - final ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - final PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - final PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - pal.add(eIDNumber); - - destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - - spName = "University of Oxford"; - spSector = "EDU001"; - spInstitution = "OXF001"; - spApplication = "APP001"; - spCountry = "EN"; - - spId = "EDU001-OXF001-APP001"; - - } - - /** The destination. */ - private String destination; - - /** The service provider name. */ - private String spName; - - /** The service provider sector. */ - private String spSector; - - /** The service provider institution. */ - private String spInstitution; - - /** The service provider application. */ - private String spApplication; - - /** The service provider country. */ - private String spCountry; - - /** The service provider id. */ - private String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The List of Personal Attributes. */ - private IPersonalAttributeList pal; - - /** The assertion consumer URL. */ - private String assertConsumerUrl; - - /** The authentication request. */ - private static byte[] authRequest; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkAuthRequestTest.class.getName()); - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - } - - /** - * Test generate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnRequest() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - //engine.generateSTORKAuthnRequest(request); - - LOG.info("STORKAuthnRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); - request.setCitizenCountryCode("ES"); - LOG.info("STORKAuthnRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); - } - - - /** - * Test generate authentication request error personal attribute name error. - */ - @Test - public final void testGenerateAuthnRequestPALsErr1() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("attrNotValid"); - worngAttr.setIsRequired(true); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - /** - * Test generate authentication request error personal attribute value error. - */ - @Test - public final void testGenerateAuthnRequestPALsErr2() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute attrNotValid = new PersonalAttribute(); - attrNotValid.setName("attrNotValid"); - attrNotValid.setIsRequired(true); - palWrong.add(attrNotValid); - - - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request error provider name null. - */ - @Test - public final void testGenerateAuthnRequestSPNAmeErr1() { - - - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(null); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try - { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - catch (STORKSAMLEngineException e) - { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request authentication assurance level - * negative value. - */ - @Test - public final void testGenerateAuthnRequestQaalErr1() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(-1); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request service provider sector null. - */ - @Test - public final void testGenerateAuthnRequestSectorErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - - } - } - - /** - * Test generate authentication request service provider institution null. - */ - @Test - public final void testGenerateAuthnRequestInstitutionrErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(null); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAuthnRequestApplicationErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(null); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider country null. - */ - @Test - public final void testGenerateAuthnRequestCountryErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(null); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request error with quality authentication - * assurance level wrong. - */ - @Test - public final void testGenerateAuthnRequestQaalErr2() { - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(0); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request personal attribute list null value. - */ - @Test - public final void testGenerateAuthnRequestPALErr1() { - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(null); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request error with assertion consumer URL - * null. - */ - @Test - public final void testGenerateAuthnRequestAssertionConsumerErr1() { - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(null); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request null parameter. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestNullParam() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAuthnRequest(null); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request error bytes encode. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestErrorEncode() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAuthnRequest("messageError".getBytes()); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequest() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - authRequest = engine.generateSTORKAuthnRequest(request).getTokenSaml(); - - final STORKAuthnRequest validatedRequest = engine.validateSTORKAuthnRequest(authRequest); - - assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); - - } - - /** - * Test validate data authenticate request. Verified parameters after - * validation. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateDataAuthnRequest() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = engine.validateSTORKAuthnRequest(authRequest); - - assertEquals("Sestination incorrect: ", request.getDestination(), destination); - - assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); - - assertEquals("Service provider incorrect: ", request.getProviderName(), spName); - assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); - assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); - assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); - assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); - assertEquals("Asserition consumer URL incorrect: ", request.getAssertionConsumerServiceURL(), assertConsumerUrl); - - assertEquals("SP Country incorrect: ", request.getSpCountry(), spCountry); - assertEquals("SP Id incorrect: ", request.getSPID(), spId); - assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), "ES"); - - } - - /** - * Test validate file authentication request. Validate from XML file. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAuthnRequest() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml"); - - try { - engine.validateSTORKAuthnRequest(bytes); - fail("testValidateFileAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - } - } - - /** - * Test validate file authentication request tag delete. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAuthnRequestTagDelete() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml"); - - try { - engine.validateSTORKAuthnRequest(bytes); - fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - - } - } - - /** - * Test validate authentication request not trusted token. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestNotTrustedErr1() - throws STORKSAMLEngineException { - - try { - final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine - .getInstance("CONF2"); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineNotTrusted - .generateSTORKAuthnRequest(request).getTokenSaml(); - - engine.validateSTORKAuthnRequest(authReqNotTrust); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("validateSTORKAuthnRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test validate authentication request trusted. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestTrusted() - throws STORKSAMLEngineException { - - final STORKSAMLEngine engineTrusted = STORKSAMLEngine - .getInstance("CONF3"); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineTrusted.generateSTORKAuthnRequest( - request).getTokenSaml(); - - // engine ("CONF1") no have trust certificate from "CONF2" - engine.validateSTORKAuthnRequest(authReqNotTrust); - - } - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAuthnRequestNADA() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(null); - request.setSpApplication(null); - request.setSpCountry(null); - - try { - engine.validateSTORKAuthnRequest(authRequest); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error: " + e.getMessage()); - } - } - - /** - * Test validate authentication request with unknown elements. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestWithUnknownElements() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute unknown = new PersonalAttribute(); - unknown.setName("unknown"); - unknown.setIsRequired(true); - pAttList.add(unknown); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - - req = engine3.generateSTORKAuthnRequest(request); - - req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); - - assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); - assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); - - } - - /** - * Test generate Request with required elements by default - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - STORKAuthnRequest reqTrue = new STORKAuthnRequest(); - STORKAuthnRequest reqFalse = new STORKAuthnRequest(); - - reqTrue = engine.generateSTORKAuthnRequest(request); - reqFalse = engine2.generateSTORKAuthnRequest(request); - req = engine3.generateSTORKAuthnRequest(request); - - - String token = new String(req.getTokenSaml()); - String reqTrueToken = new String(reqTrue.getTokenSaml()); - String reqFalseToken = new String(reqFalse.getTokenSaml()); - - assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); - assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); - assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); - - } - - /** - * Test validating request and getting alias used to save - * the saml trusted certificate into trustore - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestGettingItsAlias() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - - req = engine3.generateSTORKAuthnRequest(request); - req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - - req = engine2.generateSTORKAuthnRequest(request); - req = engine2.validateSTORKAuthnRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - - - - } - - /** - * Test generating/validating request with signedDoc - * - * @throws STORKSAMLEngineException - * the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnRequestWithSignedDoc() - throws STORKSAMLEngineException { - - String signedDocRequest = "VGVzdCB0ZXh0"; - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - PersonalAttributeList paler = new PersonalAttributeList(); - - final PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - paler.add(eIDNumber); - - final PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - final ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - paler.add(isAgeOver); - - final PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - final ArrayList signedDocs = new ArrayList(); - signedDocs.add(signedDocRequest); - signedDoc.setValue(signedDocs); - signedDoc.setIsRequired(false); - paler.add(signedDoc); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(paler); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - - req = engine.generateSTORKAuthnRequest(request); - req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); - - assertTrue("SignedDoc request should be the same: ", req - .getPersonalAttributeList().get("signedDoc").getValue().get(0) - .equals(signedDocRequest)); - - - } - -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base deleted file mode 100644 index 481cbc28c..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base +++ /dev/null @@ -1,931 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PEPSUtil; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.commons.STORKAuthnResponse; -import eu.stork.peps.auth.commons.STORKStatusCode; -import eu.stork.peps.auth.commons.STORKSubStatusCode; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class AuthRequestTest. - */ -public class StorkResponseTest { - - /** The engine. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - - /** - * Gets the engine. - * - * @return the engine - */ - public static STORKSAMLEngine getEngine() { - return engine; - } - - /** - * Sets the engine. - * - * @param newEngine the new engine - */ - public static void setEngine(final STORKSAMLEngine newEngine) { - StorkResponseTest.engine = newEngine; - } - - /** The destination. */ - private static String destination; - - /** The service provider name. */ - private static String spName; - - /** The service provider sector. */ - private static String spSector; - - /** The service provider institution. */ - private static String spInstitution; - - /** The service provider application. */ - private static String spApplication; - - /** The service provider country. */ - private static String spCountry; - - /** The service provider id. */ - private static String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The state. */ - private static String state = "ES"; - - /** The town. */ - private static String town = "Madrid"; - - /** The municipality code. */ - private static String municipalityCode = "MA001"; - - /** The postal code. */ - private static String postalCode = "28038"; - - /** The street name. */ - private static String streetName = "Marchamalo"; - - /** The street number. */ - private static String streetNumber = "3"; - - /** The apartament number. */ - private static String apartamentNumber = "5º E"; - - /** The List of Personal Attributes. */ - private static IPersonalAttributeList pal; - - /** The assertion consumer URL. */ - private static String assertConsumerUrl; - - /** The authentication request. */ - private static byte[] authRequest; - - /** The authentication response. */ - private static byte[] authResponse; - - /** The authentication request. */ - private static STORKAuthnRequest authenRequest; - - /** The authentication response. */ - private static STORKAuthnResponse authnResponse; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkResponseTest.class.getName()); - - /** - * Instantiates a new stork response test. - */ - public StorkResponseTest() { - super(); - } - - /** The IP address. */ - private static String ipAddress; - - /** The is hashing. */ - private final boolean isHashing = Boolean.TRUE; - - /** The is not hashing. */ - private final boolean isNotHashing = Boolean.FALSE; - - /** The ERROR text. */ - private static final String ERROR_TXT = "generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"; - - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - - pal = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - pal.add(eIDNumber); - - final PersonalAttribute givenName = new PersonalAttribute(); - givenName.setName("givenName"); - givenName.setIsRequired(true); - pal.add(givenName); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - pal.add(canRessAddress); - - PersonalAttribute newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - pal.add(newAttribute); - - destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - spName = "University Oxford"; - - spName = "University of Oxford"; - spSector = "EDU001"; - spInstitution = "OXF001"; - spApplication = "APP001"; - spCountry = "EN"; - - spId = "EDU001-APP001-APP001"; - - final STORKAuthnRequest request = new STORKAuthnRequest(); - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - authRequest = getEngine().generateSTORKAuthnRequest(request) - .getTokenSaml(); - - authenRequest = getEngine().validateSTORKAuthnRequest(authRequest); - - } catch (STORKSAMLEngineException e) { - fail("Error create STORKAuthnRequest"); - } - - ipAddress = "111.222.333.444"; - - pal = new PersonalAttributeList(); - - isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ages = new ArrayList(); - - ages.add("16"); - ages.add("18"); - - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(isAgeOver); - - dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(dateOfBirth); - - eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - eIDNumber.setValue(idNumber); - eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(eIDNumber); - - canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("municipalityCode", municipalityCode); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - address.put("apartamentNumber", apartamentNumber); - - canRessAddress.setComplexValue(address); - pal.add(canRessAddress); - - newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap values = new HashMap(); - - values.put("value1", "value1"); - values.put("value2", "value2"); - values.put("value3", "value3"); - values.put("value4", "value4"); - - newAttribute.setComplexValue(values); - pal.add(newAttribute); - - } - - /** - * Test generate authentication request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnResponse() throws STORKSAMLEngineException { - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - final STORKAuthnResponse storkResponse = getEngine() - .generateSTORKAuthnResponse(authenRequest, response, ipAddress, - isNotHashing); - - authResponse = storkResponse.getTokenSaml(); - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); - } - - /** - * Test validation id parameter mandatory. - */ - @Test - public final void testResponseMandatoryId() { - final String identifier = authenRequest.getSamlId(); - authenRequest.setSamlId(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - authenRequest.setSamlId(identifier); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response in response to err1. - */ - @Test - public final void testResponseMandatoryIssuer() { - - final String issuer = authenRequest.getIssuer(); - authenRequest.setIssuer(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - authenRequest.setIssuer(issuer); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response assertion consumer null. - */ - @Test - public final void testResponseMandatoryAssertionConsumerServiceURL() { - final String asserConsumerUrl = authenRequest - .getAssertionConsumerServiceURL(); - authenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - authenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response IP address null. - */ - @Test - public final void testResponseValidationIP() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, null, - isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication response with personal attribute list null. - */ - @Test - public final void testResponseMandatoryPersonalAttributeList() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(null); - - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication response token null. - */ - @Test - public final void testResponseInvalidParametersToken() { - try { - getEngine().validateSTORKAuthnResponse(null, ipAddress); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication response IP null. - */ - @Test - public final void testResponseInvalidParametersIP() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response parameter name wrong. - */ - @Test - public final void testResponseInvalidParametersAttr() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("AttrWrong"); - wrongList.add(worngAttr); - - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrSimpleValue() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoValue() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoName() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null complex value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrComplexValue() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setComplexValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test validate authentication response IP distinct and disabled validation - * IP. - */ - @Test - public final void testResponseInvalidParametersIPDistinct() { - try { - // ipAddress origin "111.222.333.444" - // ipAddrValidation = false - // Subject Confirmation Bearer. - - getEngine().validateSTORKAuthnResponse(authResponse, "127.0.0.1"); - fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test response invalid parameters invalid token. - */ - @Test - public final void testResponseInvalidParametersTokenMsg() { - try { - // ipAddress origin "111.222.333.444" - // Subject Confirmation Bearer. - getEngine().validateSTORKAuthnResponse("errorMessage".getBytes(), - ipAddress); - fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication response is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseIsFail() - throws STORKSAMLEngineException { - try { - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - fail("Generate incorrect response"); - } catch (Exception e) { - LOG.error("ERROR: " + e.getMessage()); - } - } - - /** - * Test validate authentication response destination. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseDestination() - throws STORKSAMLEngineException { - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - assertEquals("Destination incorrect: ", - authnResponse.getInResponseTo(), authenRequest.getSamlId()); - } - - /** - * Test validate authentication response values. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public final void testValidateAuthenticationResponseValuesComplex() - throws STORKSAMLEngineException { - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - assertEquals("Country incorrect:", authnResponse.getCountry(), "EN"); - - final Iterator iterator = authnResponse - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - final PersonalAttribute attribute = iterator.next(); - if (attribute.getName().equalsIgnoreCase( - "canonicalResidenceAddress")) { - assertEquals("State incorrect: ", state, attribute - .getComplexValue().get("state")); - assertEquals("Municipality Code incorrect: ", municipalityCode, - attribute.getComplexValue().get("municipalityCode")); - assertEquals("Town incorrect: ", town, attribute - .getComplexValue().get("town")); - assertEquals("Postal code incorrect: ", postalCode, attribute - .getComplexValue().get("postalCode")); - assertEquals("Street name incorrect: ", streetName, attribute - .getComplexValue().get("streetName")); - assertEquals("Street number incorrect: ", streetNumber, - attribute.getComplexValue().get("streetNumber")); - assertEquals("Apartament number incorrect: ", apartamentNumber, - attribute.getComplexValue().get("apartamentNumber")); - } - } - } - - /** - * Test generate authenticate response fail in response to it's null. - * @throws STORKSAMLEngineException - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test //( expected=STORKSAMLEngineException.class) - public final void testGenerateAuthnResponseFailInResponseToNull() throws STORKSAMLEngineException { - final String identifier = authenRequest.getSamlId(); - authenRequest.setSamlId(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - authenRequest.setSamlId(identifier); - LOG.error("Error"); - //throw new STORKSAMLEngineException(e); - } - } - - /** - * Test generate authenticate response fail assertion consumer URL err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() - throws STORKSAMLEngineException { - - final String assertConsumerUrl = authenRequest - .getAssertionConsumerServiceURL(); - authenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - authenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response fail code error err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnResponseFailCodeErrorNull() - throws STORKSAMLEngineException { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(null); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test generate authentication request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnResponse() throws STORKSAMLEngineException { - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(dateOfBirth); - - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - complex.put("one", "two"); - - //eIDNumber.setValue(null); - //eIDNumber.setValue(idNumber); - //eIDNumber.setComplexValue(complex); - - eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); - palist.add(eIDNumber); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("municipalityCode", municipalityCode); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - address.put("apartamentNumber", apartamentNumber); - - canRessAddress.setComplexValue(address); - palist.add(canRessAddress); - - - final STORKAuthnResponse response = new STORKAuthnResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAuthnResponse storkResponse = getEngine() - .generateSTORKAuthnResponse(authenRequest, response, ipAddress, - isNotHashing); - - authResponse = storkResponse.getTokenSaml(); - LOG.info("Request id: " + authenRequest.getSamlId()); - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); - - - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - LOG.info("RESPONSE ID: " + authnResponse.getSamlId()); - LOG.info("RESPONSE IN_RESPONSE_TO: " + authnResponse.getInResponseTo()); - LOG.info("RESPONSE COUNTRY: " + authnResponse.getCountry()); - - } - - - - - - /** - * Test validate authentication response fail is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseFailIsFail() - throws STORKSAMLEngineException { - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage("message"); - - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - - LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(authResponse)); - - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - LOG.info("COUNTRY: " + authnResponse.getCountry()); - assertTrue("Generate incorrect response: ", authnResponse.isFail()); - } - - /** - * Test generate/validate response with signedDoc - * - * @throws STORKSAMLEngineException - * the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthenResponseWithSignedDoc() - throws STORKSAMLEngineException { - - String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - palist.add(isAgeOver); - - authenRequest.setPersonalAttributeList(palist); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAuthnResponse storkResponse = getEngine() - .generateSTORKAuthnResponse(authenRequest, response, ipAddress, - isNotHashing); - - authResponse = storkResponse.getTokenSaml(); - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - assertTrue("SignedDoc response should be the same: ", authnResponse - .getPersonalAttributeList().get("signedDoc").getValue().get(0) - .equals(signedDocResponse)); - - } - -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base deleted file mode 100644 index 34fed0e39..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Provides the classes necessary to create a SAML message. - * @since 1.0 - */ -package eu.stork.peps.test.simple; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java deleted file mode 100644 index b1443bb0e..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; - -import javax.xml.XMLConstants; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.apache.commons.io.IOUtils; -import org.bouncycastle.util.encoders.Base64; -import org.opensaml.Configuration; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.Marshaller; -import org.opensaml.xml.io.MarshallerFactory; -import org.opensaml.xml.io.MarshallingException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * The Class SSETestUtils. - */ -public final class SSETestUtils { - - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(SSETestUtils.class.getName()); - - /** - * Instantiates a new sSE test utils. - */ - private SSETestUtils() { - } - - /** - * Prints the tree DOM. - * - * @param samlToken the SAML token - * @param isIndent the is indent - * - * @return the string - * @throws TransformerException the exception - */ - public static String printTreeDOM(final Element samlToken, final boolean isIndent) throws TransformerException { - // set up a transformer - final TransformerFactory transfac = TransformerFactory.newInstance(); - final Transformer trans = transfac.newTransformer(); - trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - trans.setOutputProperty(OutputKeys.INDENT, String.valueOf(isIndent)); - - // create string from XML tree - final StringWriter stringWriter = new StringWriter(); - final StreamResult result = new StreamResult(stringWriter); - final DOMSource source = new DOMSource(samlToken); - trans.transform(source, result); - final String xmlString = stringWriter.toString(); - - return xmlString; - } - - /** - * Marshall. - * - * @param samlToken the SAML token - * - * @return the byte[] - * - * @throws MarshallingException the marshalling exception - * @throws ParserConfigurationException the parser configuration exception - * @throws TransformerException the transformer exception - */ - public static byte[] marshall(final XMLObject samlToken) - throws MarshallingException, ParserConfigurationException, - TransformerException { - - final javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory - .newInstance(); - dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - dbf.setNamespaceAware(true); - dbf.setIgnoringComments(true); - final javax.xml.parsers.DocumentBuilder docBuild = dbf - .newDocumentBuilder(); - - // Get the marshaller factory - final MarshallerFactory marshallerFactory = Configuration - .getMarshallerFactory(); - - // Get the Subject marshaller - final Marshaller marshaller = marshallerFactory - .getMarshaller(samlToken); - - final Document doc = docBuild.newDocument(); - - // Marshall the SAML token - marshaller.marshall(samlToken, doc); - - // Obtain a byte array representation of the marshalled SAML object - final DOMSource domSource = new DOMSource(doc); - final StringWriter writer = new StringWriter(); - final StreamResult result = new StreamResult(writer); - final TransformerFactory transFact = TransformerFactory.newInstance(); - final Transformer transformer = transFact.newTransformer(); - transformer.transform(domSource, result); - - return writer.toString().getBytes(); - } - - /** - * Encode SAML token. - * - * @param samlToken the SAML token - * - * @return the string - */ - public static String encodeSAMLToken(final byte[] samlToken) { - return new String(Base64.encode(samlToken)); - } - - /** - * Read stork SAML from file. - * - * @param resource the resource - * - * @return the byte[] - * @throws IOException the exception - * - */ - public static byte[] readStorkSamlFromFile(final String resource) - throws IOException { - InputStream inputStream = null; - byte[] bytes; - - try { - inputStream = StorkAuthRequestTest.class - .getResourceAsStream(resource); - - // Create the byte array to hold the data - bytes = new byte[(int) inputStream.available()]; - inputStream.read(bytes); - } catch (IOException e) { - LOG.error("Error read from file: " + resource); - throw e; - } finally { - IOUtils.closeQuietly(inputStream); - } - return bytes; - - } -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java deleted file mode 100644 index 97fa4b7cc..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import org.junit.Test; - -import junit.framework.Assert; -import junit.framework.TestCase; -import eu.stork.peps.auth.engine.STORKSAMLEngine; - -/** - * The Class SimpleBaseTest. Defines a set of test the initialization of the - * SAML engine. - */ -public class SimpleBaseTest extends TestCase { - - /** - * Test SAML engine correct configuration name. - */ - @Test - public final void testSamlEngineCorrectInit() { - Assert.assertNotNull(STORKSAMLEngine.getInstance("CONF1")); - } - - /** - * Test SAML engine error configuration name. - */ - @Test - public final void testSamlEngineErrorNameConf() { - Assert.assertNull(STORKSAMLEngine.getInstance("CONF_ERROR")); - } - - /** - * Test SAML engine error name null. - */ - @Test - public final void testSamlEngineErrorNameNull() { - Assert.assertNull(STORKSAMLEngine.getInstance(null)); - } - - /** - * Test SAML engine correct name configuration with spaces. - */ - @Test - public final void testSamlEngineErrorNameSpaces() { - Assert.assertNotNull(STORKSAMLEngine.getInstance(" CONF1 ")); - } - -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java deleted file mode 100644 index 7fa305d3b..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java +++ /dev/null @@ -1,790 +0,0 @@ -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileOutputStream; -import java.util.ArrayList; -import java.util.Arrays; - -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAttrQueryRequest; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -public class StorkAttrQueryRequestTest { - - /** The engines. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0"); - private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); - private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); - - - /** - * Instantiates a new stork authentication request test. - */ - public StorkAttrQueryRequestTest() { - pal = new PersonalAttributeList(); - - final PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - final ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - final PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - final PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - eIDNumber.setValue(Arrays.asList("ES/IS/1234567890")); - pal.add(eIDNumber); - - final PersonalAttribute givenName = new PersonalAttribute(); - givenName.setName("givenName"); - givenName.setIsRequired(true); - givenName.setValue(Arrays.asList("Sveinbjorn")); - pal.add(givenName); - - destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest"; - //assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - - } - - /** The destination. */ - private String destination; - - /** The service provider sector. */ - private String spSector; - - /** The service provider institution. */ - private String spInstitution; - - /** The service provider application. */ - private String spApplication; - - /** The service provider country. */ - private String spCountry; - - /** The service provider id. */ - private String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The List of Personal Attributes. */ - private IPersonalAttributeList pal; - - /** The attribute query request. */ - private static byte[] attrRequest; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkAttrQueryRequestTest.class.getName()); - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - } - - /** - * Test generate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryRequest() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // new parameters - request.setEIDSectorShare(false); - request.setEIDCrossSectorShare(false); - request.setEIDCrossBorderShare(false); - - STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request); - byte[] reqByte = req1.getTokenSaml(); - FileOutputStream output = null; - - try { - output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml")); - output.write(reqByte); - } catch (Exception e) { - e.printStackTrace(); - throw new STORKSAMLEngineException(e); - } finally { - try { output.close(); } catch (Exception e) { throw new STORKSAMLEngineException(e); } - } - - - - - LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); - - request.setCitizenCountryCode("IS"); - LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml())); - } - - /** - * Test generate authentication request error personal attribute name error. - */ - @Test - public final void testGenerateAttrQueryRequestPALsErr1() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("attrNotValid"); - worngAttr.setIsRequired(true); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - - // news parameters - request.setEIDSectorShare(false); - request.setEIDCrossSectorShare(false); - request.setEIDCrossBorderShare(false); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - /** - * Test generate authentication request error personal attribute value error. - */ - @Test - public final void testGenerateAttrQueryRequestPALsErr2() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute attrNotValid = new PersonalAttribute(); - attrNotValid.setName("attrNotValid"); - attrNotValid.setIsRequired(true); - palWrong.add(attrNotValid); - - - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request authentication assurance level - * negative value. - */ - @Test - public final void testGenerateAttrQueryRequestQaalErr1() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(-1); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request service provider sector null. - */ - @Test - public final void testGenerateAttrQueryRequestSectorErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - - } - } - - /** - * Test generate authentication request service provider institution null. - */ - @Test - public final void testGenerateAttrQueryRequestInstitutionrErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(null); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAttrQueryRequestApplicationErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(null); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider country null. - */ - @Test - public final void testGenerateAttrQueryRequestCountryErr() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(null); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request error with quality authentication - * assurance level wrong. - */ - @Test - public final void testGenerateAttrQueryRequestQaalErr2() { - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(0); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request personal attribute list null value. - */ - @Test - public final void testGenerateAttrQueryRequestPALErr1() { - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(null); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - engine.generateSTORKAttrQueryRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request null parameter. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestNullParam() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAttrQueryRequest(null); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request error bytes encode. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestErrorEncode() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAttrQueryRequest("messageError".getBytes()); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequest() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - attrRequest = engine.generateSTORKAttrQueryRequest(request).getTokenSaml(); - - final STORKAttrQueryRequest validatedRequest = engine.validateSTORKAttrQueryRequest(attrRequest); - - assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); - - } - - /** - * Test validate data authenticate request. Verified parameters after - * validation. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateDataAttrQueryRequest() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = engine.validateSTORKAttrQueryRequest(attrRequest); - - assertEquals("Sestination incorrect: ", request.getDestination(), destination); - - assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); - - assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); - assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); - assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); - assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); - assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), null); - - } - - /** - * Test validate file attribute query request. Validate from XML file. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAttrQueryRequest() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml"); - - try { - engine.validateSTORKAttrQueryRequest(bytes); - fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - } - } - - /** - * Test validate file authentication request tag delete. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAttrRequestTagDelete() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml"); - - try { - engine.validateSTORKAttrQueryRequest(bytes); - fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - - } - } - - /** - * Test validate authentication request not trusted token. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestNotTrustedErr1() - throws STORKSAMLEngineException { - - try { - final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine - .getInstance("CONF2"); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineNotTrusted - .generateSTORKAttrQueryRequest(request).getTokenSaml(); - - engine.validateSTORKAttrQueryRequest(authReqNotTrust); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("validateSTORKAttrQueryRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test validate authentication request trusted. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestTrusted() - throws STORKSAMLEngineException { - - final STORKSAMLEngine engineTrusted = STORKSAMLEngine - .getInstance("CONF3"); - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest( - request).getTokenSaml(); - - // engine ("CONF1") no have trust certificate from "CONF2" - engine.validateSTORKAttrQueryRequest(authReqNotTrust); - - } - - - - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAttrQueryRequestNADA() { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(null); - request.setSpApplication(null); - request.setSpCountry(null); - - try { - - engine.validateSTORKAttrQueryRequest(attrRequest); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test validate authentication request with unknown elements. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryRequestWithUnknownElements() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute unknown = new PersonalAttribute(); - unknown.setName("unknown"); - unknown.setIsRequired(true); - pAttList.add(unknown); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - STORKAttrQueryRequest req = new STORKAttrQueryRequest(); - - req = engine3.generateSTORKAttrQueryRequest(request); - - req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); - - assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); - assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); - - } - - /** - * Test generate Request with required elements by default - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - STORKAttrQueryRequest req = new STORKAttrQueryRequest(); - STORKAttrQueryRequest reqTrue = new STORKAttrQueryRequest(); - STORKAttrQueryRequest reqFalse = new STORKAttrQueryRequest(); - - reqTrue = engine.generateSTORKAttrQueryRequest(request); - reqFalse = engine2.generateSTORKAttrQueryRequest(request); - req = engine3.generateSTORKAttrQueryRequest(request); - - - String token = new String(req.getTokenSaml()); - String reqTrueToken = new String(reqTrue.getTokenSaml()); - String reqFalseToken = new String(reqFalse.getTokenSaml()); - - assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); - assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); - assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); - - } - - /** - * Test validating attribute query and getting alias used to save - * the saml trusted certificate into trustore - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAtrrQueryRequestGettingItsAlias() throws STORKSAMLEngineException { - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - - request.setDestination(destination); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - STORKAttrQueryRequest req = new STORKAttrQueryRequest(); - - req = engine3.generateSTORKAttrQueryRequest(request); - req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - - req = engine2.generateSTORKAttrQueryRequest(request); - req = engine2.validateSTORKAttrQueryRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - } - -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java deleted file mode 100644 index 27c6cfe39..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java +++ /dev/null @@ -1,920 +0,0 @@ -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.junit.Ignore; -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PEPSUtil; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAttrQueryRequest; -import eu.stork.peps.auth.commons.STORKAttrQueryResponse; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.commons.STORKAuthnResponse; -import eu.stork.peps.auth.commons.STORKStatusCode; -import eu.stork.peps.auth.commons.STORKSubStatusCode; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -public class StorkAttrQueryResponseTest { - - /** The engine. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - - /** - * Gets the engine. - * - * @return the engine - */ - public static STORKSAMLEngine getEngine() { - return engine; - } - - /** - * Sets the engine. - * - * @param newEngine the new engine - */ - public static void setEngine(final STORKSAMLEngine newEngine) { - StorkAttrQueryResponseTest.engine = newEngine; - } - - /** The destination. */ - private static String destination; - - /** The service provider sector. */ - private static String spSector; - - /** The service provider institution. */ - private static String spInstitution; - - /** The service provider application. */ - private static String spApplication; - - /** The service provider country. */ - private static String spCountry; - - /** The service provider id. */ - private static String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The state. */ - private static String state = "IS"; - - /** The town. */ - private static String town = "Reykjavik"; - - /** The postal code. */ - private static String postalCode = "105"; - - /** The street name. */ - private static String streetName = "Gudrunartun"; - - /** The street number. */ - private static String streetNumber = "10"; - - /** The List of Personal Attributes. */ - private static IPersonalAttributeList pal; - - /** The assertion consumer URL. */ - private static String assertConsumerUrl; - - /** The attribute query request. */ - private static byte[] attrQueryRequest; - - /** The attribute query response. */ - private static byte[] attrQueryResponse; - - /** The attribute query request. */ - private static STORKAttrQueryRequest attrQueryenRequest; - - /** The attribute query response. */ - private static STORKAttrQueryResponse attrQeuryenResponse; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkAttrQueryResponseTest.class.getName()); - - /** - * Instantiates a new stork response test. - */ - public StorkAttrQueryResponseTest() { - super(); - } - - /** The IP address. */ - private static String ipAddress; - - /** The destination URL. */ - private static String destinationUrl; - - /** The is hashing. */ - private final boolean isHashing = Boolean.TRUE; - - /** The is not hashing. */ - private final boolean isNotHashing = Boolean.FALSE; - - /** The ERROR text. */ - private static final String ERROR_TXT = "generateAttrQueryResponse(...) should've thrown an STORKSAMLEngineException!"; - - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - - pal = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - pal.add(eIDNumber); - - final PersonalAttribute givenName = new PersonalAttribute(); - givenName.setName("givenName"); - givenName.setIsRequired(true); - pal.add(givenName); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - pal.add(canRessAddress); - - PersonalAttribute newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - pal.add(newAttribute); - - destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - spSector = "EDU001"; - spInstitution = "OXF001"; - spApplication = "APP001"; - spCountry = "EN"; - - spId = "EDU001-APP001-APP001"; - - final STORKAttrQueryRequest request = new STORKAttrQueryRequest(); - request.setDestination(destination); - //request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - //request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("IS"); - - try { - attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(request) - .getTokenSaml(); - - attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest); - - } catch (STORKSAMLEngineException e) { - fail("Error create STORKAuthnRequest"); - } - - ipAddress = "111.222.333.444"; - - destinationUrl = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - - pal = new PersonalAttributeList(); - - isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ages = new ArrayList(); - - ages.add("16"); - ages.add("18"); - - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(isAgeOver); - - dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(dateOfBirth); - - eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789IS"); - eIDNumber.setValue(idNumber); - eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(eIDNumber); - - canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - - canRessAddress.setComplexValue(address); - pal.add(canRessAddress); - - newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap values = new HashMap(); - - values.put("value1", "value1"); - values.put("value2", "value2"); - values.put("value3", "value3"); - values.put("value4", "value4"); - - newAttribute.setComplexValue(values); - pal.add(newAttribute); - - } - - /** - * Test generate attribute query request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryResponse() throws STORKSAMLEngineException { - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - final STORKAttrQueryResponse storkResponse = getEngine() - .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, - destinationUrl, isNotHashing); - - attrQueryResponse = storkResponse.getTokenSaml(); - - FileOutputStream output = null; - - try { - output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml")); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - try { - output.write(attrQueryResponse); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); - - - } - - /** - * Test validation id parameter mandatory. - */ - @Test - public final void testResponseMandatoryId() { - final String identifier = attrQueryenRequest.getSamlId(); - attrQueryenRequest.setSamlId(null); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, destinationUrl, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setSamlId(identifier); - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response in response to err1. - */ - @Test - public final void testResponseMandatoryIssuer() { - - final String issuer = attrQueryenRequest.getIssuer(); - attrQueryenRequest.setIssuer(null); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, destinationUrl, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setIssuer(issuer); - LOG.error("Error"); - } - } - - - /** - * Test generate attribute query response assertion consumer null. - */ - /*@Test - public final void testResponseMandatoryAssertionConsumerServiceURL() { - final String asserConsumerUrl = attrQueryenRequest - .getAssertionConsumerServiceURL(); - attrQueryenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response IP address null. - */ - @Test - public final void testResponseValidationIP() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, null, - destinationUrl, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response with personal attribute list null. - */ - @Test - public final void testResponseMandatoryPersonalAttributeList() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(null); - - - try { - getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, - ipAddress, destinationUrl, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate attribute query response token null. - */ - @Test - public final void testResponseInvalidParametersToken() { - try { - getEngine().validateSTORKAttrQueryResponse(null, ipAddress); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate attribute query response IP null. - */ - @Test - public final void STORKAttrQueryResponse() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setPersonalAttributeList(pal); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response parameter name wrong. - */ - @Test - public final void testResponseInvalidParametersAttr() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("AttrWrong"); - wrongList.add(worngAttr); - - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrSimpleValue() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoValue() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoName() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate attribute query response set null complex value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrComplexValue() { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setComplexValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test validate attribute query response IP distinct and disabled validation - * IP. - */ - @Test - public final void testResponseInvalidParametersIPDistinct() { - try { - // ipAddress origin "111.222.333.444" - // ipAddrValidation = false - // Subject Confirmation Bearer. - - getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, "127.0.0.1"); - } catch (STORKSAMLEngineException e) { - fail("validateAttributeQueryResponse(...) should've thrown an STORKSAMLEngineException!"); - LOG.error("Error"); - } - } - - /** - * Test response invalid parameters invalid token. - */ - @Test - public final void testResponseInvalidParametersTokenMsg() { - try { - // ipAddress origin "111.222.333.444" - // Subject Confirmation Bearer. - getEngine().validateSTORKAttrQueryResponse("errorMessage".getBytes(), - ipAddress); - fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate attribute query response is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - /*@Test - public final void testValidateAuthenticationResponseIsFail() - throws STORKSAMLEngineException { - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertFalse("Generate incorrect response: ", attrQeuryenResponse.isFail()); - } - - /** - * Test validate attribute query response destination. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseDestination() - throws STORKSAMLEngineException { - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertEquals("Destination incorrect: ", - attrQeuryenResponse.getInResponseTo(), attrQueryenRequest.getSamlId()); - } - - /** - * Test validate attribute query response values. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseValuesComplex() - throws STORKSAMLEngineException { - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertEquals("Country incorrect:", attrQeuryenResponse.getCountry(), "ES"); - - final Iterator iterator = attrQeuryenResponse - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - final PersonalAttribute attribute = iterator.next(); - if (attribute.getName().equalsIgnoreCase( - "canonicalResidenceAddress")) { - assertEquals("State incorrect: ", state, attribute - .getComplexValue().get("state")); - assertEquals("Town incorrect: ", town, attribute - .getComplexValue().get("town")); - assertEquals("Postal code incorrect: ", postalCode, attribute - .getComplexValue().get("postalCode")); - assertEquals("Street name incorrect: ", streetName, attribute - .getComplexValue().get("streetName")); - assertEquals("Street number incorrect: ", streetNumber, - attribute.getComplexValue().get("streetNumber")); - } - } - } - - /** - * Test generate attribute query response fail in response to it's null. - * @throws STORKSAMLEngineException - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test //( expected=STORKSAMLEngineException.class) - public final void testGenerateAttrQueryResponseFailInResponseToNull() throws STORKSAMLEngineException { - final String identifier = attrQueryenRequest.getSamlId(); - attrQueryenRequest.setSamlId(null); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setSamlId(identifier); - LOG.error("Error"); - //throw new STORKSAMLEngineException(e); - } - } - - /** - * Test generate attribute query response fail assertion consumer URL err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - /*@Test - public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() - throws STORKSAMLEngineException { - - final String assertConsumerUrl = attrQueryenRequest - .getAssertionConsumerServiceURL(); - attrQueryenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - attrQueryResponse = getEngine().generateSTORKAuthnResponseFail(attrQueryenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - attrQueryenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate attribute query response fail code error err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryResponseFailCodeErrorNull() - throws STORKSAMLEngineException { - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setStatusCode(null); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - fail("generateAttrQueryResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test generate attribute query request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryResponse() throws STORKSAMLEngineException { - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(dateOfBirth); - - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - complex.put("one", "two"); - - //eIDNumber.setValue(null); - //eIDNumber.setValue(idNumber); - //eIDNumber.setComplexValue(complex); - - eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); - palist.add(eIDNumber); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - - canRessAddress.setComplexValue(address); - palist.add(canRessAddress); - - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAttrQueryResponse storkResponse = getEngine() - .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, - destinationUrl, isNotHashing); - - attrQueryResponse = storkResponse.getTokenSaml(); - LOG.info("Request id: " + attrQueryenRequest.getSamlId()); - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse)); - - - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - LOG.info("RESPONSE ID: " + attrQeuryenResponse.getSamlId()); - LOG.info("RESPONSE IN_RESPONSE_TO: " + attrQeuryenResponse.getInResponseTo()); - LOG.info("RESPONSE COUNTRY: " + attrQeuryenResponse.getCountry()); - - } - - - - - - /** - * Test validate attribute query response fail is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAttrQueryResponseFailIsFail() - throws STORKSAMLEngineException { - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage("message"); - - attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest, - response, ipAddress, destinationUrl, isNotHashing).getTokenSaml(); - - LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(attrQueryResponse)); - - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - LOG.info("COUNTRY: " + attrQeuryenResponse.getCountry()); - assertTrue("Generate incorrect response: ", attrQeuryenResponse.isFail()); - } - - /** - * Test generate/validate response with signedDoc - * - * @throws STORKSAMLEngineException - * the STORKSAML engine exception - */ - @Test - public final void testGenerateAttrQueryResponseWithSignedDoc() - throws STORKSAMLEngineException { - - String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - palist.add(isAgeOver); - - attrQueryenRequest.setPersonalAttributeList(palist); - - final STORKAttrQueryResponse response = new STORKAttrQueryResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAttrQueryResponse storkResponse = getEngine() - .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, - destinationUrl, isNotHashing); - - attrQueryResponse = storkResponse.getTokenSaml(); - attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, - ipAddress); - - assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse - .getPersonalAttributeList().get("signedDoc").getValue().get(0) - .equals(signedDocResponse)); - - } -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java deleted file mode 100644 index 7223ab483..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java +++ /dev/null @@ -1,966 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; - -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class StorkAuthRequestTest defines a class to . - */ -public class StorkAuthRequestTest { - - /** The engines. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2"); - private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3"); - - - /** - * Instantiates a new stork authentication request test. - */ - public StorkAuthRequestTest() { - pal = new PersonalAttributeList(); - - final PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - final ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - final PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - final PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - pal.add(eIDNumber); - - destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - - spName = "University of Oxford"; - spSector = "EDU001"; - spInstitution = "OXF001"; - spApplication = "APP001"; - spCountry = "EN"; - - spId = "EDU001-OXF001-APP001"; - - } - - /** The destination. */ - private String destination; - - /** The service provider name. */ - private String spName; - - /** The service provider sector. */ - private String spSector; - - /** The service provider institution. */ - private String spInstitution; - - /** The service provider application. */ - private String spApplication; - - /** The service provider country. */ - private String spCountry; - - /** The service provider id. */ - private String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The List of Personal Attributes. */ - private IPersonalAttributeList pal; - - /** The assertion consumer URL. */ - private String assertConsumerUrl; - - /** The authentication request. */ - private static byte[] authRequest; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkAuthRequestTest.class.getName()); - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - } - - /** - * Test generate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnRequest() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - //engine.generateSTORKAuthnRequest(request); - - LOG.info("STORKAuthnRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); - request.setCitizenCountryCode("ES"); - LOG.info("STORKAuthnRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml())); - } - - - /** - * Test generate authentication request error personal attribute name error. - */ - @Test - public final void testGenerateAuthnRequestPALsErr1() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("attrNotValid"); - worngAttr.setIsRequired(true); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - /** - * Test generate authentication request error personal attribute value error. - */ - @Test - public final void testGenerateAuthnRequestPALsErr2() { - - final IPersonalAttributeList palWrong = new PersonalAttributeList(); - - final PersonalAttribute attrNotValid = new PersonalAttribute(); - attrNotValid.setName("attrNotValid"); - attrNotValid.setIsRequired(true); - palWrong.add(attrNotValid); - - - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(palWrong); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request error provider name null. - */ - @Test - public final void testGenerateAuthnRequestSPNAmeErr1() { - - - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(null); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try - { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - catch (STORKSAMLEngineException e) - { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request authentication assurance level - * negative value. - */ - @Test - public final void testGenerateAuthnRequestQaalErr1() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(-1); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request service provider sector null. - */ - @Test - public final void testGenerateAuthnRequestSectorErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - - } - } - - /** - * Test generate authentication request service provider institution null. - */ - @Test - public final void testGenerateAuthnRequestInstitutionrErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(null); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAuthnRequestApplicationErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(null); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request service provider country null. - */ - @Test - public final void testGenerateAuthnRequestCountryErr() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(null); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test generate authentication request error with quality authentication - * assurance level wrong. - */ - @Test - public final void testGenerateAuthnRequestQaalErr2() { - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(0); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request personal attribute list null value. - */ - @Test - public final void testGenerateAuthnRequestPALErr1() { - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(null); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication request error with assertion consumer URL - * null. - */ - @Test - public final void testGenerateAuthnRequestAssertionConsumerErr1() { - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(null); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - engine.generateSTORKAuthnRequest(request); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request null parameter. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestNullParam() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAuthnRequest(null); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request error bytes encode. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestErrorEncode() - throws STORKSAMLEngineException { - try { - engine.validateSTORKAuthnRequest("messageError".getBytes()); - fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication request. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequest() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - authRequest = engine.generateSTORKAuthnRequest(request).getTokenSaml(); - - final STORKAuthnRequest validatedRequest = engine.validateSTORKAuthnRequest(authRequest); - - assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false); - - } - - /** - * Test validate data authenticate request. Verified parameters after - * validation. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateDataAuthnRequest() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = engine.validateSTORKAuthnRequest(authRequest); - - assertEquals("Sestination incorrect: ", request.getDestination(), destination); - - assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false); - assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false); - assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false); - - assertEquals("Service provider incorrect: ", request.getProviderName(), spName); - assertEquals("QAAL incorrect: ", request.getQaa(), QAAL); - assertEquals("SPSector incorrect: ", request.getSpSector(), spSector); - assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null); - assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication); - assertEquals("Asserition consumer URL incorrect: ", request.getAssertionConsumerServiceURL(), assertConsumerUrl); - - assertEquals("SP Country incorrect: ", request.getSpCountry(), spCountry); - assertEquals("SP Id incorrect: ", request.getSPID(), spId); - assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), "ES"); - - } - - /** - * Test validate file authentication request. Validate from XML file. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAuthnRequest() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml"); - - try { - engine.validateSTORKAuthnRequest(bytes); - fail("testValidateFileAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - } - } - - /** - * Test validate file authentication request tag delete. - * - * @throws Exception the exception - */ - @Test - public final void testValidateFileAuthnRequestTagDelete() throws Exception { - - final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml"); - - try { - engine.validateSTORKAuthnRequest(bytes); - fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error(e.getMessage()); - - } - } - - /** - * Test validate authentication request not trusted token. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestNotTrustedErr1() - throws STORKSAMLEngineException { - - try { - final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine - .getInstance("CONF2"); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineNotTrusted - .generateSTORKAuthnRequest(request).getTokenSaml(); - - engine.validateSTORKAuthnRequest(authReqNotTrust); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - fail("validateSTORKAuthnRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!"); - } - } - - /** - * Test validate authentication request trusted. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestTrusted() - throws STORKSAMLEngineException { - - final STORKSAMLEngine engineTrusted = STORKSAMLEngine - .getInstance("CONF3"); - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - - final byte[] authReqNotTrust = engineTrusted.generateSTORKAuthnRequest( - request).getTokenSaml(); - - // engine ("CONF1") no have trust certificate from "CONF2" - engine.validateSTORKAuthnRequest(authReqNotTrust); - - } - - /** - * Test generate authentication request service provider application null. - */ - @Test - public final void testGenerateAuthnRequestNADA() { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(null); - request.setSpInstitution(null); - request.setSpApplication(null); - request.setSpCountry(null); - - try { - engine.validateSTORKAuthnRequest(authRequest); - fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!"); - - } catch (STORKSAMLEngineException e) { - LOG.error("Error: " + e.getMessage()); - } - } - - /** - * Test validate authentication request with unknown elements. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestWithUnknownElements() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute unknown = new PersonalAttribute(); - unknown.setName("unknown"); - unknown.setIsRequired(true); - pAttList.add(unknown); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - - req = engine3.generateSTORKAuthnRequest(request); - - req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); - - assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown")); - assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier")); - - } - - /** - * Test generate Request with required elements by default - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - STORKAuthnRequest reqTrue = new STORKAuthnRequest(); - STORKAuthnRequest reqFalse = new STORKAuthnRequest(); - - reqTrue = engine.generateSTORKAuthnRequest(request); - reqFalse = engine2.generateSTORKAuthnRequest(request); - req = engine3.generateSTORKAuthnRequest(request); - - - String token = new String(req.getTokenSaml()); - String reqTrueToken = new String(reqTrue.getTokenSaml()); - String reqFalseToken = new String(reqFalse.getTokenSaml()); - - assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired")); - assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired")); - assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired")); - - } - - /** - * Test validating request and getting alias used to save - * the saml trusted certificate into trustore - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnRequestGettingItsAlias() throws STORKSAMLEngineException { - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - IPersonalAttributeList pAttList = new PersonalAttributeList(); - - final PersonalAttribute eIdentifier = new PersonalAttribute(); - eIdentifier.setName("eIdentifier"); - eIdentifier.setIsRequired(true); - pAttList.add(eIdentifier); - - request.setPersonalAttributeList(pAttList); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - - req = engine3.generateSTORKAuthnRequest(request); - req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - - req = engine2.generateSTORKAuthnRequest(request); - req = engine2.validateSTORKAuthnRequest(req.getTokenSaml()); - assertTrue("The alias should match this value", req.getAlias().equals("local-demo")); - - - - } - - /** - * Test generating/validating request with signedDoc - * - * @throws STORKSAMLEngineException - * the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnRequestWithSignedDoc() - throws STORKSAMLEngineException { - - String signedDocRequest = "VGVzdCB0ZXh0"; - - final STORKAuthnRequest request = new STORKAuthnRequest(); - - PersonalAttributeList paler = new PersonalAttributeList(); - - final PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - paler.add(eIDNumber); - - final PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - final ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - paler.add(isAgeOver); - - final PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - final ArrayList signedDocs = new ArrayList(); - signedDocs.add(signedDocRequest); - signedDoc.setValue(signedDocs); - signedDoc.setIsRequired(false); - paler.add(signedDoc); - - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(paler); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // new parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - STORKAuthnRequest req = new STORKAuthnRequest(); - - req = engine.generateSTORKAuthnRequest(request); - req = engine.validateSTORKAuthnRequest(req.getTokenSaml()); - - assertTrue("SignedDoc request should be the same: ", req - .getPersonalAttributeList().get("signedDoc").getValue().get(0) - .equals(signedDocRequest)); - - - } - -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java deleted file mode 100644 index 481cbc28c..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java +++ /dev/null @@ -1,931 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -package eu.stork.peps.test.simple; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.junit.Test; -import org.opensaml.xml.parse.BasicParserPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.peps.auth.commons.IPersonalAttributeList; -import eu.stork.peps.auth.commons.PEPSUtil; -import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.peps.auth.commons.PersonalAttributeList; -import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.commons.STORKAuthnResponse; -import eu.stork.peps.auth.commons.STORKStatusCode; -import eu.stork.peps.auth.commons.STORKSubStatusCode; -import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.exceptions.STORKSAMLEngineException; - -/** - * The Class AuthRequestTest. - */ -public class StorkResponseTest { - - /** The engine. */ - private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1"); - - /** - * Gets the engine. - * - * @return the engine - */ - public static STORKSAMLEngine getEngine() { - return engine; - } - - /** - * Sets the engine. - * - * @param newEngine the new engine - */ - public static void setEngine(final STORKSAMLEngine newEngine) { - StorkResponseTest.engine = newEngine; - } - - /** The destination. */ - private static String destination; - - /** The service provider name. */ - private static String spName; - - /** The service provider sector. */ - private static String spSector; - - /** The service provider institution. */ - private static String spInstitution; - - /** The service provider application. */ - private static String spApplication; - - /** The service provider country. */ - private static String spCountry; - - /** The service provider id. */ - private static String spId; - - /** The quality authentication assurance level. */ - private static final int QAAL = 3; - - /** The state. */ - private static String state = "ES"; - - /** The town. */ - private static String town = "Madrid"; - - /** The municipality code. */ - private static String municipalityCode = "MA001"; - - /** The postal code. */ - private static String postalCode = "28038"; - - /** The street name. */ - private static String streetName = "Marchamalo"; - - /** The street number. */ - private static String streetNumber = "3"; - - /** The apartament number. */ - private static String apartamentNumber = "5º E"; - - /** The List of Personal Attributes. */ - private static IPersonalAttributeList pal; - - /** The assertion consumer URL. */ - private static String assertConsumerUrl; - - /** The authentication request. */ - private static byte[] authRequest; - - /** The authentication response. */ - private static byte[] authResponse; - - /** The authentication request. */ - private static STORKAuthnRequest authenRequest; - - /** The authentication response. */ - private static STORKAuthnResponse authnResponse; - - /** The Constant LOG. */ - private static final Logger LOG = LoggerFactory - .getLogger(StorkResponseTest.class.getName()); - - /** - * Instantiates a new stork response test. - */ - public StorkResponseTest() { - super(); - } - - /** The IP address. */ - private static String ipAddress; - - /** The is hashing. */ - private final boolean isHashing = Boolean.TRUE; - - /** The is not hashing. */ - private final boolean isNotHashing = Boolean.FALSE; - - /** The ERROR text. */ - private static final String ERROR_TXT = "generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"; - - - /** Parser manager used to parse XML. */ - private static BasicParserPool parser; - - - - static { - parser = new BasicParserPool(); - parser.setNamespaceAware(true); - - pal = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - pal.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - pal.add(dateOfBirth); - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - pal.add(eIDNumber); - - final PersonalAttribute givenName = new PersonalAttribute(); - givenName.setName("givenName"); - givenName.setIsRequired(true); - pal.add(givenName); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - pal.add(canRessAddress); - - PersonalAttribute newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - pal.add(newAttribute); - - destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest"; - assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse"; - spName = "University Oxford"; - - spName = "University of Oxford"; - spSector = "EDU001"; - spInstitution = "OXF001"; - spApplication = "APP001"; - spCountry = "EN"; - - spId = "EDU001-APP001-APP001"; - - final STORKAuthnRequest request = new STORKAuthnRequest(); - request.setDestination(destination); - request.setProviderName(spName); - request.setQaa(QAAL); - request.setPersonalAttributeList(pal); - request.setAssertionConsumerServiceURL(assertConsumerUrl); - - // news parameters - request.setSpSector(spSector); - request.setSpInstitution(spInstitution); - request.setSpApplication(spApplication); - request.setSpCountry(spCountry); - request.setSPID(spId); - request.setCitizenCountryCode("ES"); - - try { - authRequest = getEngine().generateSTORKAuthnRequest(request) - .getTokenSaml(); - - authenRequest = getEngine().validateSTORKAuthnRequest(authRequest); - - } catch (STORKSAMLEngineException e) { - fail("Error create STORKAuthnRequest"); - } - - ipAddress = "111.222.333.444"; - - pal = new PersonalAttributeList(); - - isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ages = new ArrayList(); - - ages.add("16"); - ages.add("18"); - - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(isAgeOver); - - dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(dateOfBirth); - - eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - eIDNumber.setValue(idNumber); - eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - pal.add(eIDNumber); - - canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("municipalityCode", municipalityCode); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - address.put("apartamentNumber", apartamentNumber); - - canRessAddress.setComplexValue(address); - pal.add(canRessAddress); - - newAttribute = new PersonalAttribute(); - newAttribute.setName("newAttribute2"); - newAttribute.setIsRequired(true); - newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap values = new HashMap(); - - values.put("value1", "value1"); - values.put("value2", "value2"); - values.put("value3", "value3"); - values.put("value4", "value4"); - - newAttribute.setComplexValue(values); - pal.add(newAttribute); - - } - - /** - * Test generate authentication request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnResponse() throws STORKSAMLEngineException { - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - final STORKAuthnResponse storkResponse = getEngine() - .generateSTORKAuthnResponse(authenRequest, response, ipAddress, - isNotHashing); - - authResponse = storkResponse.getTokenSaml(); - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); - } - - /** - * Test validation id parameter mandatory. - */ - @Test - public final void testResponseMandatoryId() { - final String identifier = authenRequest.getSamlId(); - authenRequest.setSamlId(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - authenRequest.setSamlId(identifier); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response in response to err1. - */ - @Test - public final void testResponseMandatoryIssuer() { - - final String issuer = authenRequest.getIssuer(); - authenRequest.setIssuer(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - authenRequest.setIssuer(issuer); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response assertion consumer null. - */ - @Test - public final void testResponseMandatoryAssertionConsumerServiceURL() { - final String asserConsumerUrl = authenRequest - .getAssertionConsumerServiceURL(); - authenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - authenRequest.setAssertionConsumerServiceURL(asserConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response IP address null. - */ - @Test - public final void testResponseValidationIP() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, null, - isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test generate authentication response with personal attribute list null. - */ - @Test - public final void testResponseMandatoryPersonalAttributeList() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(null); - - - try { - getEngine().generateSTORKAuthnResponse(authenRequest, response, - ipAddress, isHashing); - fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication response token null. - */ - @Test - public final void testResponseInvalidParametersToken() { - try { - getEngine().validateSTORKAuthnResponse(null, ipAddress); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication response IP null. - */ - @Test - public final void testResponseInvalidParametersIP() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setPersonalAttributeList(pal); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response parameter name wrong. - */ - @Test - public final void testResponseInvalidParametersAttr() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("AttrWrong"); - wrongList.add(worngAttr); - - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrSimpleValue() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoValue() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrNoName() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - /** - * Test validate authentication response set null complex value into attribute. - */ - @Test - public final void testResponseInvalidParametersAttrComplexValue() { - final STORKAuthnResponse response = new STORKAuthnResponse(); - final IPersonalAttributeList wrongList = new PersonalAttributeList(); - - final PersonalAttribute worngAttr = new PersonalAttribute(); - worngAttr.setName("isAgeOver"); - worngAttr.setComplexValue(null); - wrongList.add(worngAttr); - - response.setPersonalAttributeList(wrongList); - try { - authResponse = getEngine().generateSTORKAuthnResponse(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - // In Conf1 ipValidate is false - getEngine().validateSTORKAuthnResponse(authResponse, null); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test validate authentication response IP distinct and disabled validation - * IP. - */ - @Test - public final void testResponseInvalidParametersIPDistinct() { - try { - // ipAddress origin "111.222.333.444" - // ipAddrValidation = false - // Subject Confirmation Bearer. - - getEngine().validateSTORKAuthnResponse(authResponse, "127.0.0.1"); - fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test response invalid parameters invalid token. - */ - @Test - public final void testResponseInvalidParametersTokenMsg() { - try { - // ipAddress origin "111.222.333.444" - // Subject Confirmation Bearer. - getEngine().validateSTORKAuthnResponse("errorMessage".getBytes(), - ipAddress); - fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - /** - * Test validate authentication response is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseIsFail() - throws STORKSAMLEngineException { - try { - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - fail("Generate incorrect response"); - } catch (Exception e) { - LOG.error("ERROR: " + e.getMessage()); - } - } - - /** - * Test validate authentication response destination. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseDestination() - throws STORKSAMLEngineException { - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - assertEquals("Destination incorrect: ", - authnResponse.getInResponseTo(), authenRequest.getSamlId()); - } - - /** - * Test validate authentication response values. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - public final void testValidateAuthenticationResponseValuesComplex() - throws STORKSAMLEngineException { - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - assertEquals("Country incorrect:", authnResponse.getCountry(), "EN"); - - final Iterator iterator = authnResponse - .getPersonalAttributeList().iterator(); - - while (iterator.hasNext()) { - final PersonalAttribute attribute = iterator.next(); - if (attribute.getName().equalsIgnoreCase( - "canonicalResidenceAddress")) { - assertEquals("State incorrect: ", state, attribute - .getComplexValue().get("state")); - assertEquals("Municipality Code incorrect: ", municipalityCode, - attribute.getComplexValue().get("municipalityCode")); - assertEquals("Town incorrect: ", town, attribute - .getComplexValue().get("town")); - assertEquals("Postal code incorrect: ", postalCode, attribute - .getComplexValue().get("postalCode")); - assertEquals("Street name incorrect: ", streetName, attribute - .getComplexValue().get("streetName")); - assertEquals("Street number incorrect: ", streetNumber, - attribute.getComplexValue().get("streetNumber")); - assertEquals("Apartament number incorrect: ", apartamentNumber, - attribute.getComplexValue().get("apartamentNumber")); - } - } - } - - /** - * Test generate authenticate response fail in response to it's null. - * @throws STORKSAMLEngineException - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test //( expected=STORKSAMLEngineException.class) - public final void testGenerateAuthnResponseFailInResponseToNull() throws STORKSAMLEngineException { - final String identifier = authenRequest.getSamlId(); - authenRequest.setSamlId(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail(ERROR_TXT); - } catch (STORKSAMLEngineException e) { - authenRequest.setSamlId(identifier); - LOG.error("Error"); - //throw new STORKSAMLEngineException(e); - } - } - - /** - * Test generate authenticate response fail assertion consumer URL err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull() - throws STORKSAMLEngineException { - - final String assertConsumerUrl = authenRequest - .getAssertionConsumerServiceURL(); - authenRequest.setAssertionConsumerServiceURL(null); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - authenRequest.setAssertionConsumerServiceURL(assertConsumerUrl); - LOG.error("Error"); - } - } - - /** - * Test generate authentication response fail code error err1. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthnResponseFailCodeErrorNull() - throws STORKSAMLEngineException { - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(null); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage(""); - - try { - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!"); - } catch (STORKSAMLEngineException e) { - LOG.error("Error"); - } - } - - - - - /** - * Test generate authentication request without errors. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthnResponse() throws STORKSAMLEngineException { - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(true); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(isAgeOver); - - PersonalAttribute dateOfBirth = new PersonalAttribute(); - dateOfBirth.setName("dateOfBirth"); - dateOfBirth.setIsRequired(false); - final ArrayList date = new ArrayList(); - date.add("16/12/2008"); - dateOfBirth.setValue(date); - dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - palist.add(dateOfBirth); - - - PersonalAttribute eIDNumber = new PersonalAttribute(); - eIDNumber.setName("eIdentifier"); - eIDNumber.setIsRequired(true); - - final ArrayList idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - complex.put("one", "two"); - - //eIDNumber.setValue(null); - //eIDNumber.setValue(idNumber); - //eIDNumber.setComplexValue(complex); - - eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString()); - palist.add(eIDNumber); - - PersonalAttribute canRessAddress = new PersonalAttribute(); - canRessAddress.setName("canonicalResidenceAddress"); - canRessAddress.setIsRequired(true); - canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString()); - final HashMap address = new HashMap(); - - address.put("state", state); - address.put("municipalityCode", municipalityCode); - address.put("town", town); - address.put("postalCode", postalCode); - address.put("streetName", streetName); - address.put("streetNumber", streetNumber); - address.put("apartamentNumber", apartamentNumber); - - canRessAddress.setComplexValue(address); - palist.add(canRessAddress); - - - final STORKAuthnResponse response = new STORKAuthnResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAuthnResponse storkResponse = getEngine() - .generateSTORKAuthnResponse(authenRequest, response, ipAddress, - isNotHashing); - - authResponse = storkResponse.getTokenSaml(); - LOG.info("Request id: " + authenRequest.getSamlId()); - - LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse)); - - - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - LOG.info("RESPONSE ID: " + authnResponse.getSamlId()); - LOG.info("RESPONSE IN_RESPONSE_TO: " + authnResponse.getInResponseTo()); - LOG.info("RESPONSE COUNTRY: " + authnResponse.getCountry()); - - } - - - - - - /** - * Test validate authentication response fail is fail. - * - * @throws STORKSAMLEngineException the STORKSAML engine exception - */ - @Test - public final void testValidateAuthenticationResponseFailIsFail() - throws STORKSAMLEngineException { - - final STORKAuthnResponse response = new STORKAuthnResponse(); - response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString()); - response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString()); - response.setMessage("message"); - - authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest, - response, ipAddress, isNotHashing).getTokenSaml(); - - LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(authResponse)); - - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - LOG.info("COUNTRY: " + authnResponse.getCountry()); - assertTrue("Generate incorrect response: ", authnResponse.isFail()); - } - - /** - * Test generate/validate response with signedDoc - * - * @throws STORKSAMLEngineException - * the STORKSAML engine exception - */ - @Test - public final void testGenerateAuthenResponseWithSignedDoc() - throws STORKSAMLEngineException { - - String signedDocResponse = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPkNrMVZxTmQ0NVFJdnEzQVpkOFhZUUx2RWh0QT08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjxkczpSZWZlcmVuY2UgVHlwZT0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMyNTaWduZWRQcm9wZXJ0aWVzIiBVUkk9IiNTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT5BNVk5MW40cXBMZ3l0VFc3ZnhqWENVZVJ2NTQ9PC9kczpEaWdlc3RWYWx1ZT48L2RzOlJlZmVyZW5jZT48ZHM6UmVmZXJlbmNlIFVSST0iI1NpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItS2V5SW5mbyI+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzOkRpZ2VzdFZhbHVlPlZQWDRuS0Z5UzZyRitGNmNSUjBQck5aZHc2Zz08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9IlNpZ25hdHVyZS04ZWFiZDBhNS02NjBkLTRhZmQtOTkwNS0wYWJjNzU1M2QxOTItU2lnbmF0dXJlVmFsdWUiPkxiS04vL0M3WGt5eFR0WVRpQ1VScjhuWnp4QW1zdGNNZDBDZ0VBQ3JLMWR5Z1JIcUdjSzR4dHMrV0NVOFB5RXFXclJJVFl6SXV3LzcNClY0Wno5VFQ2MHA0S1RNZXd1UUw2NHNrRVN4MllnMkVkaWtTTyt0S3hXa2hyYVVzbVZiR2JQbW1jbUR2OTd0SER3ODg3NDdlRnE1RjUNCnYrYVZTeUF6MDNpVUttdVNlSDg9PC9kczpTaWduYXR1cmVWYWx1ZT48ZHM6S2V5SW5mbyBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1LZXlJbmZvIj48ZHM6S2V5VmFsdWU+PGRzOlJTQUtleVZhbHVlPjxkczpNb2R1bHVzPnd1Y21qOXRJV3J2d2JTVFVEZndLbCtKdERNTUVSMGNMZDZEa0JTcjc5MHQrckdOakVTcVlqUndFSWVCbktvUUhQeDVIb1JlRjg4L3QNCnFZOStDaEVYcExITHM5cDVhWDdTREp1YnBRTWZwMXRERlgzNHl3Z3hTUXZjZWVKUVdCWGppZXVJbWZDMjFzNGJPY2dKYlYxaGJpZ1MNCnpPS1RRS3IxVHpkR1IrdVJ5MDA9PC9kczpNb2R1bHVzPjxkczpFeHBvbmVudD5BUUFCPC9kczpFeHBvbmVudD48L2RzOlJTQUtleVZhbHVlPjwvZHM6S2V5VmFsdWU+PGRzOlg1MDlEYXRhPjxkczpYNTA5Q2VydGlmaWNhdGU+TUlJSW1UQ0NCNEdnQXdJQkFnSURBWFVVTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUlCT3pFTE1Ba0dBMVVFQmhNQ1JWTXhPekE1QmdOVg0KQkFvVE1rRm5aVzVqYVdFZ1EyRjBZV3hoYm1FZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUNoT1NVWWdVUzB3T0RBeE1UYzJMVWtwTVRRdw0KTWdZRFZRUUhFeXRRWVhOellYUm5aU0JrWlNCc1lTQkRiMjVqWlhCamFXOGdNVEVnTURnd01EZ2dRbUZ5WTJWc2IyNWhNUzR3TEFZRA0KVlFRTEV5VlRaWEoyWldseklGQjFZbXhwWTNNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVWRFZpMHlNVFV3TXdZRFZRUUxFeXhXWldkbA0KZFNCb2RIUndjem92TDNkM2R5NWpZWFJqWlhKMExtNWxkQzkyWlhKRFNVTXRNaUFvWXlrd016RTFNRE1HQTFVRUN4TXNSVzUwYVhSaA0KZENCd2RXSnNhV05oSUdSbElHTmxjblJwWm1sallXTnBieUJrWlNCamFYVjBZV1JoYm5NeEd6QVpCZ05WQkFNVEVsQlNSVkJTVDBSVg0KUTBOSlR5QkpSRU5oZERBZUZ3MHhNREF5TVRFeE9ESXlNRFJhRncweE5EQXlNVEF4T0RJeU1EUmFNSUd3TVFzd0NRWURWUVFHRXdKRg0KVXpFMU1ETUdBMVVFQ3hNc1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5U1VSRFlYUWdLR01wTURNeA0KRmpBVUJnTlZCQVFURFVKRlVreEJUa2RCSUZOUFZFOHhGekFWQmdOVkJDb1REazFCVWtsQklFVk9SMUpCUTBsQk1SSXdFQVlEVlFRRg0KRXdreE1EQXdNRGswTkZNeEpUQWpCZ05WQkFNVEhFMUJVa2xCSUVWT1IxSkJRMGxCSUVKRlVreEJUa2RCSUZOUFZFOHdnWjh3RFFZSg0KS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNTG5Kby9iU0ZxNzhHMGsxQTM4Q3BmaWJRekRCRWRIQzNlZzVBVXErL2RMZnF4ag0KWXhFcW1JMGNCQ0hnWnlxRUJ6OGVSNkVYaGZQUDdhbVBmZ29SRjZTeHk3UGFlV2wrMGd5Ym02VURINmRiUXhWOStNc0lNVWtMM0huaQ0KVUZnVjQ0bnJpSm53dHRiT0d6bklDVzFkWVc0b0VzemlrMENxOVU4M1JrZnJrY3ROQWdNQkFBR2pnZ1N3TUlJRXJEQU1CZ05WSFJNQg0KQWY4RUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJRm9EQ0J6QVlEVlIwUkJJSEVNSUhCZ1E5aWMyOTBiMEJuYldGcGJDNWpiMjJrZ1lVdw0KZ1lJeEN6QUpCZ05WQkFZVEFrVlRNU3N3S1FZRFZRUUtGQ0pCWjhPb2JtTnBZU0JEWVhSaGJHRnVZU0JrWlNCRFpYSjBhV1pwWTJGag0KYWNPek1RNHdEQVlEVlFRTEV3VkpSRU5CVkRFUE1BMEdBMVVFQlJNR01ERTNOVEUwTVNVd0l3WURWUVFERXh4TlFWSkpRU0JGVGtkUw0KUVVOSlFTQkNSVkpNUVU1SFFTQlRUMVJQb0JBR0Npc0dBUVFCOVhnQkFRR2dBZ3dBb0JRR0RsWUVBQUVEQmdFRUFmVjRBUUVDb0FJTQ0KQURBZkJnTlZIUklFR0RBV2dSUmxZMTlwWkdOaGRFQmpZWFJqWlhKMExtNWxkREFkQmdOVkhRNEVGZ1FVQUZYanVOc2tCMk1seXZVQg0KaDdwOFRKMHVKMHd3Z2dGSUJnTlZIU01FZ2dFL01JSUJPNEFVUkt2Y2tVaE4xNGg0Q24vZ2RPRG42NzIzS1Z5aGdnRVBwSUlCQ3pDQw0KQVFjeEN6QUpCZ05WQkFZVEFrVlRNVHN3T1FZRFZRUUtFekpCWjJWdVkybGhJRU5oZEdGc1lXNWhJR1JsSUVObGNuUnBabWxqWVdOcA0KYnlBb1RrbEdJRkV0TURnd01URTNOaTFKS1RFb01DWUdBMVVFQ3hNZlUyVnlkbVZwY3lCUWRXSnNhV056SUdSbElFTmxjblJwWm1sag0KWVdOcGJ6RThNRG9HQTFVRUN4TXpWbVZuWlhVZ2FIUjBjSE02THk5M2QzY3VZMkYwWTJWeWRDNXVaWFF2ZG1WeWNISmxjSEp2WkhWag0KWTJsdklDaGpLVEF6TVRVd013WURWUVFMRXl4S1pYSmhjbkYxYVdFZ1JXNTBhWFJoZEhNZ1pHVWdRMlZ5ZEdsbWFXTmhZMmx2SUVOaA0KZEdGc1lXNWxjekVjTUJvR0ExVUVBeE1UVUZKRlVGSlBSRlZEUTBsUElFVkRMVUZEUTRJUWR3S1R0TTFFRVU5RkVQWFVZSGdnaERBZA0KQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQWdZSUt3WUJCUVVIQXdRd0VRWUpZSVpJQVliNFFnRUJCQVFEQWdXZ01EUUdDQ3NHQVFVRg0KQndFQkJDZ3dKakFrQmdnckJnRUZCUWN3QVlZWWFIUjBjSE02THk5dlkzTndMbU5oZEdObGNuUXVibVYwTUJnR0NDc0dBUVVGQndFRA0KQkF3d0NqQUlCZ1lFQUk1R0FRRXdnWVlHQTFVZEh3Ui9NSDB3UEtBNm9EaUdObWgwZEhBNkx5OWxjSE5qWkM1allYUmpaWEowTG01bA0KZEM5amNtd3ZjSEpsY0hKdlpIVmpZMmx2WDJWakxXbGtZMkYwTG1OeWJEQTlvRHVnT1lZM2FIUjBjRG92TDJWd2MyTmtNaTVqWVhSag0KWlhKMExtNWxkQzlqY213dmNISmxjSEp2WkhWalkybHZYMlZqTFdsa1kyRjBMbU55YkRDQjlnWURWUjBnQklIdU1JSHJNSUhvQmd3cg0KQmdFRUFmVjRBUU1CVmdFd2dkY3dMQVlJS3dZQkJRVUhBZ0VXSUdoMGRIQnpPaTh2ZDNkM0xtTmhkR05sY25RdWJtVjBMM1psY2tsRQ0KUTJGME1JR21CZ2dyQmdFRkJRY0NBakNCbVJxQmxrRnhkV1Z6ZENEdnY3MXpJSFZ1SUdObGNuUnBabWxqWVhRZ2NHVnljMjl1WVd3Zw0KU1VSRFFWUXNJSEpsWTI5dVpXZDFkQ0JrSjJsa1pXNTBhV1pwWTJGajc3KzlMQ0J6YVdkdVlYUjFjbUVnYVNCNGFXWnlZWFFnWkdVZw0KWTJ4aGMzTmxJRElnYVc1a2FYWnBaSFZoYkM0Z1ZtVm5aWFVnYUhSMGNITTZMeTkzZDNjdVkyRjBZMlZ5ZEM1dVpYUXZkbVZ5UkVOaA0KZERBdEJnTlZIUWtFSmpBa01CQUdDQ3NHQVFVRkJ3a0VNUVFUQWtWVE1CQUdDQ3NHQVFVRkJ3a0ZNUVFUQWtWVE1BMEdDU3FHU0liMw0KRFFFQkJRVUFBNElCQVFDcTc3ODBSR1FNTEIxZ2tkTk1mTFhuZ3FNb1JIR0taYnZ6a3JxSUFtVDhXQWQxRThyQXBoUjkveExKVXRwNQ0KbGJnMmZScjVibDJqOE9WREJLMlltRzQxaDhBRG40U1RJL0FwZU5JTlNmalpzNk5Sc25XekZ5ZlhYbVBDSFlGQi9YV3p5aW1DRXhndg0KdnR1SCszUUF3Y3dobjUwUExFdWh3NUM1dmxYN0x5NUs2ckxMTUZOVVVNYldWeTFoWmVsSy9DQlRjQWpJTzM4TlkrdllSQU1LU2Y0TQ0KL2daUXo0cUJlRlZKYTUyUjdOY0FxQ2ZyZkxmYVhwYkRTZzk4eG9CZU5zMmluR3p4OFVTZ0VyTFpqS0pzZG4vS2pURDlnUy9zVGRRNg0KUTdpZHFsZDJMRlZsTzIvYjk0Wk5aQmNTLzc4RU9EWGdkV2ZreVBDN1J3OHJlOW5JMy9qVDwvZHM6WDUwOUNlcnRpZmljYXRlPjwvZHM6WDUwOURhdGE+PC9kczpLZXlJbmZvPjxkczpPYmplY3QgRW5jb2Rpbmc9ImJhc2U2NCIgSWQ9Ik9iamVjdC05ODczM2NkZS04YmNjLTQ4YTAtOWI3Ny0wZTk5OTdiZGQwNTgiIE1pbWVUeXBlPSJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iPlNHVnNiRzhnVjI5eWJHUT08L2RzOk9iamVjdD48ZHM6T2JqZWN0Pjx4YWRlczpRdWFsaWZ5aW5nUHJvcGVydGllcyB4bWxuczp4YWRlcz0iaHR0cDovL3VyaS5ldHNpLm9yZy8wMTkwMy92MS4zLjIjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1RdWFsaWZ5aW5nUHJvcGVydGllcyIgVGFyZ2V0PSIjU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjx4YWRlczpTaWduZWRQcm9wZXJ0aWVzIElkPSJTaWduYXR1cmUtOGVhYmQwYTUtNjYwZC00YWZkLTk5MDUtMGFiYzc1NTNkMTkyLVNpZ25lZFByb3BlcnRpZXMiPjx4YWRlczpTaWduZWRTaWduYXR1cmVQcm9wZXJ0aWVzPjx4YWRlczpTaWduaW5nVGltZT4yMDExLTAzLTIxVDExOjQ0OjQyKzAxOjAwPC94YWRlczpTaWduaW5nVGltZT48eGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjx4YWRlczpDZXJ0Pjx4YWRlczpDZXJ0RGlnZXN0PjxkczpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSIvPjxkczpEaWdlc3RWYWx1ZT4zbTZ3OTlUb3lTZDlKcEJsMWdCazhEei9iYlU9PC9kczpEaWdlc3RWYWx1ZT48L3hhZGVzOkNlcnREaWdlc3Q+PHhhZGVzOklzc3VlclNlcmlhbD48ZHM6WDUwOUlzc3Vlck5hbWU+Q049UFJFUFJPRFVDQ0lPIElEQ2F0LCBPVT1FbnRpdGF0IHB1YmxpY2EgZGUgY2VydGlmaWNhY2lvIGRlIGNpdXRhZGFucywgT1U9VmVnZXUgaHR0cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - palist.add(isAgeOver); - - authenRequest.setPersonalAttributeList(palist); - - final STORKAuthnResponse response = new STORKAuthnResponse(); - - response.setPersonalAttributeList(palist); - - final STORKAuthnResponse storkResponse = getEngine() - .generateSTORKAuthnResponse(authenRequest, response, ipAddress, - isNotHashing); - - authResponse = storkResponse.getTokenSaml(); - authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, - ipAddress); - - assertTrue("SignedDoc response should be the same: ", authnResponse - .getPersonalAttributeList().get("signedDoc").getValue().get(0) - .equals(signedDocResponse)); - - } - -} diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java deleted file mode 100644 index 34fed0e39..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. You may - * obtain a copy of the Licence at: - * - * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * Licence for the specific language governing permissions and limitations under - * the Licence. - */ - -/** - * Provides the classes necessary to create a SAML message. - * @since 1.0 - */ -package eu.stork.peps.test.simple; \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops deleted file mode 100644 index fe8b26f95..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops +++ /dev/null @@ -1,101 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 67 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources -END -keyStoreCountry1.jks -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry1.jks -END -keyStoreCountry2.jks -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry2.jks -END -keyStoreCountry3.jks -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry3.jks -END -p11Conf.cfg -K 25 -svn:wc:ra_dav:version-url -V 78 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/p11Conf.cfg -END -logback-test.xml -K 25 -svn:wc:ra_dav:version-url -V 83 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/logback-test.xml -END -SamlEngine.xml -K 25 -svn:wc:ra_dav:version-url -V 81 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/SamlEngine.xml -END -SignModule_P11.xml -K 25 -svn:wc:ra_dav:version-url -V 85 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/SignModule_P11.xml -END -StorkSamlEngine_Conf0.xml -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf0.xml -END -StorkSamlEngine_Conf1.xml -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf1.xml -END -SignModule_Conf0.xml -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf0.xml -END -StorkSamlEngine_Conf2.xml -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf2.xml -END -SignModule_Conf1.xml -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf1.xml -END -StorkSamlEngine_Conf3.xml -K 25 -svn:wc:ra_dav:version-url -V 92 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf3.xml -END -SignModule_Conf2.xml -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf2.xml -END -SignModule_Conf3.xml -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf3.xml -END -keyStoreCountry0.jks -K 25 -svn:wc:ra_dav:version-url -V 88 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry0.jks -END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/.svn/entries deleted file mode 100644 index 1afc5a426..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/entries +++ /dev/null @@ -1,575 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -data -dir - -logback-test.xml -file - - - - -2013-12-20T12:27:57.250475Z -9645eaa7005e2fd5856a650a46e58b75 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -530 - -SamlEngine.xml -file - - - - -2013-12-20T12:27:57.250475Z -e2a6926fe3dabd0b07ea0c7f61a5c9a9 -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2236 - -SignModule_P11.xml -file - - - - -2013-12-20T12:27:57.254475Z -13d70d84e25f491976cbbd9a0e3edafe -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -436 - -StorkSamlEngine_Conf0.xml -file - - - - -2013-12-20T12:27:57.250475Z -4ec0bc5ac4fafef57b60184cded62f9f -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3912 - -StorkSamlEngine_Conf1.xml -file - - - - -2013-12-20T12:27:57.250475Z -4ec0bc5ac4fafef57b60184cded62f9f -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -3912 - -SignModule_Conf0.xml -file - - - - -2013-12-20T12:27:57.250475Z -ad61baa5b5d5a0c648b2e4c05b637add -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -541 - -StorkSamlEngine_Conf2.xml -file - - - - -2013-12-20T12:27:57.250475Z -7092c091691b1862d989f856cdc57b82 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2827 - -SignModule_Conf1.xml -file - - - - -2013-12-20T12:27:57.250475Z -16be2497f59cbd9c57acc81b783ecff1 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -522 - -StorkSamlEngine_Conf3.xml -file - - - - -2013-12-20T12:27:57.250475Z -44066ee14d9b2a03f7ee2f72c965c287 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -2774 - -SignModule_Conf2.xml -file - - - - -2013-12-20T12:27:57.250475Z -fb7a26c03ef7400fe296b7d60837dff0 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -522 - -SignModule_Conf3.xml -file - - - - -2013-12-20T12:27:57.250475Z -128795cf3937e23a2af256cc5db88b84 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -540 - -keyStoreCountry0.jks -file - - - - -2013-12-20T12:27:57.250475Z -241d66f1af1a3937dfbbcccc7b7432c8 -2013-12-16T15:04:09.136643Z -316 -emsomavmi -has-props - - - - - - - - - - - - - - - - - - - - -1376 - -keyStoreCountry1.jks -file - - - - -2013-12-20T12:27:57.250475Z -821660c55e39b47f7cd6c750e366531d -2013-12-16T15:04:09.136643Z -316 -emsomavmi -has-props - - - - - - - - - - - - - - - - - - - - -1313 - -keyStoreCountry2.jks -file - - - - -2013-12-20T12:27:57.250475Z -821660c55e39b47f7cd6c750e366531d -2013-12-16T15:04:09.136643Z -316 -emsomavmi -has-props - - - - - - - - - - - - - - - - - - - - -1313 - -keyStoreCountry3.jks -file - - - - -2013-12-20T12:27:57.250475Z -821660c55e39b47f7cd6c750e366531d -2013-12-16T15:04:09.136643Z -316 -emsomavmi -has-props - - - - - - - - - - - - - - - - - - - - -1313 - -p11Conf.cfg -file - - - - -2013-12-20T12:27:57.250475Z -d7154f1fb90d3edbad739f703a30ff3d -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -510 - diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base deleted file mode 100644 index 6bb61ae29..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base deleted file mode 100644 index eb9ed6f5d..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry0.jks - local-demo - local-demo - CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS - 529E05C8 - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base deleted file mode 100644 index af68d33aa..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry1.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base deleted file mode 100644 index b13cb390a..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry2.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base deleted file mode 100644 index ed933020a..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry3.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base deleted file mode 100644 index 64eb426c8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base +++ /dev/null @@ -1,11 +0,0 @@ - - - - - HWModule sign with interface PKCS11. - p11Config.cfg - ******* - CN=XXXXXXXXX - xxxxxxxxxxxxxx - PKCS11 - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base deleted file mode 100644 index 0a28a5de8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base +++ /dev/null @@ -1,91 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base deleted file mode 100644 index 0a28a5de8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base +++ /dev/null @@ -1,91 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base deleted file mode 100644 index 435ef4b82..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base +++ /dev/null @@ -1,64 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - obtained - - - entity - - - - HTTP-POST - - false - false - false - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base deleted file mode 100644 index bec8934f8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base +++ /dev/null @@ -1,61 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - obtained - - - entity - - - - HTTP-POST - - false - false - false - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - http://www.stork.gov.eu/1.0/unknown - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base deleted file mode 100644 index 289e952fe..000000000 Binary files a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base and /dev/null differ diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base and /dev/null differ diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base and /dev/null differ diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base and /dev/null differ diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base deleted file mode 100644 index ff900e124..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base deleted file mode 100644 index b712219c1..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//ATTRIBUTE VALUE -//name name suffix of this provider instance -//library pathname of PKCS#11 implementation -//slotListIndex slot index - -//PREFIX DESCRIPTION -//CKO_ Object class -//CKA_ Attribute -//CKK_ Key type - -//attributes(operation, keytype, keyalgorithm) = { -// name1 = value1 -// [...] -//} - -name=nameProvider -library=library.dll -slotListIndex=0 -attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={ - CKA_VERIFY=true -} -attributes(*,CKO_PRIVATE_KEY,CKK_RSA)={ - CKA_SIGN=true -} \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml index 6b0482795..d9dcb34f8 100644 --- a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml +++ b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml @@ -17,65 +17,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops deleted file mode 100644 index 3843fc6b7..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 72 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data -END diff --git a/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries deleted file mode 100644 index 2eb50bbe8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -eu -dir - diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops deleted file mode 100644 index 56d18dd28..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 75 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu -END diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries deleted file mode 100644 index 798ea16b3..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -stork -dir - diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops deleted file mode 100644 index 16ec86311..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 81 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork -END diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries deleted file mode 100644 index 8ec7f9903..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -STORKSAMLEngine -dir - diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops deleted file mode 100644 index 178273e8c..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops +++ /dev/null @@ -1,41 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 97 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine -END -AuthnRequestTagDelete.xml -K 25 -svn:wc:ra_dav:version-url -V 122 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml -END -AttrQueryRequestTagDelete.xml -K 25 -svn:wc:ra_dav:version-url -V 126 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml -END -AuthnRequest.xml -K 25 -svn:wc:ra_dav:version-url -V 113 -/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml -END -AttrQueryRequest.xml -K 25 -svn:wc:ra_dav:version-url -V 118 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml -END -AuthnRequestTagDeleteEncoded.xml -K 25 -svn:wc:ra_dav:version-url -V 129 -/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml -END -AttrQueryResponse.xml -K 25 -svn:wc:ra_dav:version-url -V 119 -/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml -END diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries deleted file mode 100644 index 16e2ccd8d..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries +++ /dev/null @@ -1,232 +0,0 @@ -10 - -dir -357 -https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine -https://webgate.ec.europa.eu/CITnet/svn/STORK2 - - - -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - -aa842e49-f825-43fc-93ba-11ee9fd5a035 - -AttrQueryResponse.xml -file - - - - -2013-12-20T12:27:57.242475Z -8f576c406bd8b2756899bbe1738e56d6 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -6092 - -AuthnRequestTagDelete.xml -file - - - - -2013-12-20T12:27:57.242475Z -13df3f7c9b0fb6e10ac782c43b8f3cdb -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2611 - -AttrQueryRequestTagDelete.xml -file - - - - -2013-12-20T12:27:57.242475Z -cd245752b96826be0c3b72e3428c6aac -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -4045 - -AuthnRequest.xml -file - - - - -2013-12-20T12:27:57.242475Z -e993b1b24f5abbfa974485b0cbbc0211 -2013-07-25T08:47:40.940990Z -6 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -3898 - -AttrQueryRequest.xml -file - - - - -2013-12-20T12:27:57.242475Z -d78d68c7f18dc10e7cd7343954388987 -2013-12-16T15:04:09.136643Z -316 -emsomavmi - - - - - - - - - - - - - - - - - - - - - -4253 - -AuthnRequestTagDeleteEncoded.xml -file - - - - -2013-12-20T12:27:57.242475Z -c5122af357fd2a8339239853479b4aed -2013-10-24T15:44:04.704923Z -56 -emgrtargr - - - - - - - - - - - - - - - - - - - - - -2612 - diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base deleted file mode 100644 index 852727dc5..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl -eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT -VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 -MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph -dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt -by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 -2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj -9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G -CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl -XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK -W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base deleted file mode 100644 index 9f9fe5156..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw -YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v -LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG -A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv -Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab -ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU -0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n -6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 -y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z -9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F -6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM -pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT -/NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq -yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 -Ppm8IFVTk8mYfX8/jw==3falsefalsefalse1618SveinbjörnES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base deleted file mode 100644 index b7e578c2d..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw -YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v -MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM -BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k -ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja -Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ -525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG -SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr -y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG -1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base deleted file mode 100644 index c822702df..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -http://S-PEPS.gov.xx - - - - - - - - - -yzsqaxBNicOrixBUno5cL0CBOpE= - - - -Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC -wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi -YIN/BUEtXkoYTjPtkmA= - -MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw -MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG -9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu -h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r -/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk -3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K -eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq -KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base deleted file mode 100644 index 2a54c7d59..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -http://S-PEPS.gov.xx - -S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR -Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC -Xt8p8tK3EoMocZse2hw= - -MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw -OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl -lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK -ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl -r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w -kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS -3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base deleted file mode 100644 index 3239cf6e7..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -http://S-PEPS.gov.xx - -S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR -Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC -Xt8p8tK3EoMocZse2hw= - -MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw -OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl -lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK -ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl -r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w -kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS -3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml index 852727dc5..511919167 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml @@ -1,11 +1,16 @@ -http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl -eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT -VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 -MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph -dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt -by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 -2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj -9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G -CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl -XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK -W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file +http://S-PEPS.gov.xxBgPDTVCv7BhiWIs6HsC06jaHaag=dIC61bGi6Jqp1zSVojpjaVq9WaZcDtNImXgo1Dyze5/hJA07Sy4TaHu+/IuLEC99aLjM6rxh2UUNqpPaQCFlF5eVkVv/c4gHEZVyevhjJKTidqmnuhlI78PGMx2thfxFsHsPcqHqOzy1Z6w18K1ds6APQP+aXI9TNKis+pykn4nJititYuiSseD0VY0F4QnXx+U6k3raoi1CAFE5fe7EuI/KfxuhhQLAbLq90Vm8R94ITBjfSS25mXstXNe9zppTSjDB42ld1TjDovDwXAn5OxiZasIEb5m68sRlxgoQ/2/+ZdYNNINFLAwkCbb8MiCbGASd626Bme0Kx+ropeWdxw==MIIDXjCCAkagAwIBAgIEUk1MbDANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJJUzESMBAGA1UE +CAwJUmV5a2phdmlrMRIwEAYDVQQHDAlSZXlramF2aWsxEDAOBgNVBAoMB0FkdmFuaWExDzANBgNV +BAsMBlNUT1JLMjEXMBUGA1UEAwwOc2FtbC1kZW1vLWNlcnQwHhcNMTMxMDAzMTA1MzEyWhcNMjMx +MDAzMTA1MzEyWjBxMQswCQYDVQQGEwJJUzESMBAGA1UECAwJUmV5a2phdmlrMRIwEAYDVQQHDAlS +ZXlramF2aWsxEDAOBgNVBAoMB0FkdmFuaWExDzANBgNVBAsMBlNUT1JLMjEXMBUGA1UEAwwOc2Ft +bC1kZW1vLWNlcnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCkSgTxZkNRXZTKLB0c +4oz7/8Dh56FX+0cYg7hjw4e8vn+ITXkxzrmUH57FtsvKln4mq1H0FHXL80u3IiWX8qY+QLgNeKeB +m85lXuyOb3wWpKAaQvpLAkejGLCx22AN2L0WZkKZV2puwRQVsRHCq6U6vToJXDZ6Ui6ltKsAl/ZS +8qUFpiIvqD5ea4ohz4JsFE/uApRc7pbJ4VbOmAAeH/tQTayptq2kPb2vvUVk+2cH5J7UD+GCI88E +e+mS+C33tV9NmWUHL69mYEe8FXjumbKA5e9i1ejn9i0/BLUtHFonHnL9YFMim0foI7NNc5mNg9aw +vm0PuByVU3kuibQkqGBLAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAA9X5B4NBmVuhjECi+KOnRRX +5oUV+jbYKhGZODDPi+F4Uo7ZtPFQ6sS3tE54+8AoDl5zQ5q5fDDVXhB42IIIjDxHKo8cBXie5FZ6 +mJtErvWZWYWdO0uV2OQAUALq2LieidqSFDJ+Pjl8w1New8oi3migwyE0jZo4Q97lJGDfJTruV0A2 +JE/Gt6QAAcWhhN2hZl92pYkIi5OeqHXyzBUp5vg8LLfNmeyziCAiXDC1Sy/aQU/cllZ3zFJMrqZM +s2xBpmB4sF1YRbIrr2OqEVE6M6DUx+pAQOd2uogV3AMT9D5MYpckI1jx/o/Tto7ju74nIVOskDiN +K0FR8izxcT0HixM=3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml index b7e578c2d..1ff7fbeeb 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml @@ -1,10 +1,15 @@ -http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw -YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v -MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM -BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k -ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja -Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ -525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG -SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr -y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG -1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file +http://C-PEPS.gov.xxyMOVS1T/yRiVh3L6IBM9rR9Ie3w=d8e/RyNNPmnHRIzTIuRSnW6B60oWGBGxjRua/HvNxTuod0qSarYJxEedhY9Wl1Z9WYXlry28FuKjp3DA3HhzNaVd7A7QpFqNC4dnizSVWFjxlhmoE/Uv3Y/ha9P/fk6nbtHCSKW4kHSX7QfFLeggcLmUG0IULRF8UmRdQ0WerCl0aSZZeSp8J3LsFBPeWCRSwXgfiLn+RehggzZmQU6g0ssxrpnsYEAtjAiOli+YVQGuumsZGaJ8zHA/DgJ2FTGovNUyfuSUFLhd9nLlSqFs2Avnx0Ck7Q1dxDO5truOm6e285YLHqLaGdetFyPQAj/Z4w4RJ5u5X6d7rhBjTfRAAw==MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v +LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG +A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv +Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab +ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU +0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n +6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 +y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z +9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F +6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM +pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT +/NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq +yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 +Ppm8IFVTk8mYfX8/jw==urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file -- cgit v1.2.3 From 8cdac4252e1ea43aada04b71ee95d2509c4a75f3 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 21 Jan 2014 16:02:14 +0100 Subject: respect global mandatory state of attributes --- .../moa/id/auth/AuthenticationServer.java | 354 ++++++++++----------- .../moa/id/config/stork/STORKConfig.java | 126 ++++---- 2 files changed, 239 insertions(+), 241 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 3857cd15c..0fbcc97b2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -106,6 +106,7 @@ import at.gv.egovernment.moa.id.client.SZRGWClient; import at.gv.egovernment.moa.id.client.SZRGWClientException; import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber; import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute; +import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.ConnectionParameter; @@ -118,7 +119,6 @@ import at.gv.egovernment.moa.id.storage.AssertionStorage; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; import at.gv.egovernment.moa.id.storage.DBExceptionStoreImpl; import at.gv.egovernment.moa.id.util.HTTPUtils; -import at.gv.egovernment.moa.id.util.MOAIDMessageProvider; import at.gv.egovernment.moa.id.util.Random; import at.gv.egovernment.moa.id.util.SSLUtils; import at.gv.egovernment.moa.id.util.client.mis.simple.MISMandate; @@ -138,23 +138,14 @@ import eu.stork.peps.auth.commons.PEPSUtil; import eu.stork.peps.auth.commons.PersonalAttribute; import eu.stork.peps.auth.commons.PersonalAttributeList; import eu.stork.peps.auth.commons.STORKAuthnRequest; -import eu.stork.peps.auth.engine.SAMLEngine; import eu.stork.peps.auth.engine.STORKSAMLEngine; -import eu.stork.peps.auth.engine.core.QAAAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttribute; -import eu.stork.peps.auth.engine.core.RequestedAttributes; -import eu.stork.peps.auth.engine.core.impl.QAAAttributeBuilder; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributeBuilder; -import eu.stork.peps.auth.engine.core.impl.RequestedAttributesBuilder; -import eu.stork.peps.exceptions.SAMLEngineException; import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.vidp.messages.builder.STORKMessagesBuilder; import eu.stork.vidp.messages.util.XMLUtil; /** * API for MOA ID Authentication Service.
{@link AuthenticationSession} is * stored in a session store and retrieved by giving the session ID. - * + * * @author Paul Ivancsics * @version $Id: AuthenticationServer.java 1273 2012-02-27 14:50:18Z kstranacher * $ @@ -177,7 +168,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { /** * Returns the single instance of AuthenticationServer. - * + * * @return the single instance of AuthenticationServer */ public static AuthenticationServer getInstance() { @@ -208,7 +199,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * response to * * - * + * * @param authURL * URL of the servlet to be used as data URL * @param target @@ -243,13 +234,13 @@ public class AuthenticationServer implements MOAIDAuthConstants { if (session == null) { throw new AuthenticationException("auth.18", new Object[] { }); } - + //load OnlineApplication configuration OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(session.getPublicOAURLPrefix()); if (oaParam == null) throw new AuthenticationException("auth.00", new Object[] { session.getPublicOAURLPrefix() }); - + //load Template String template = null; if (session.getTemplateURL() != null) { @@ -262,7 +253,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { } String infoboxReadRequest = ""; - + if (session.isSsoRequested()) { //load identityLink with SSO Target boolean isbuisness = false; @@ -272,50 +263,50 @@ public class AuthenticationServer implements MOAIDAuthConstants { isbuisness = true; domainIdentifier = ssobusiness.getValue(); } - + //build ReadInfobox request infoboxReadRequest = new InfoboxReadRequestBuilder().build( isbuisness, domainIdentifier); - + } else { //build ReadInfobox request infoboxReadRequest = new InfoboxReadRequestBuilder().build( oaParam.getBusinessService(), oaParam .getIdentityLinkDomainIdentifier()); } - + String dataURL = new DataURLBuilder().buildDataURL( session.getAuthURL(), REQ_VERIFY_IDENTITY_LINK, session .getSessionID()); - + //removed in MOAID 2.0 String pushInfobox = ""; - + // VerifyInfoboxParameters verifyInfoboxParameters = oaParam // .getVerifyInfoboxParameters(); // if (verifyInfoboxParameters != null) { // pushInfobox = verifyInfoboxParameters.getPushInfobox(); // session.setPushInfobox(pushInfobox); // } - + //build CertInfo request String certInfoRequest = new CertInfoVerifyXMLSignatureRequestBuilder() .build(); String certInfoDataURL = new DataURLBuilder() .buildDataURL(session.getAuthURL(), REQ_START_AUTHENTICATION, session.getSessionID()); - + //get Applet Parameters String appletwidth = req.getParameter(PARAM_APPLET_WIDTH); String appletheigth = req.getParameter(PARAM_APPLET_HEIGTH); appletheigth = StringEscapeUtils.escapeHtml(appletheigth); appletwidth = StringEscapeUtils.escapeHtml(appletwidth); - + String htmlForm = new GetIdentityLinkFormBuilder().build(template, session.getBkuURL(), infoboxReadRequest, dataURL, certInfoRequest, certInfoDataURL, pushInfobox, oaParam, appletheigth, appletwidth); - + return htmlForm; } @@ -335,7 +326,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * containg the authentication block, meant to be returned to the security * layer implementation * - * + * * @param sessionID * ID of associated authentication session data * @param infoboxReadResponseParameters @@ -343,7 +334,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * including the <InfoboxReadResponse> * @return String representation of the * <CreateXMLSignatureRequest> - * @throws BKUException + * @throws BKUException */ public String verifyIdentityLink(AuthenticationSession session, Map infoboxReadResponseParameters) throws AuthenticationException, @@ -360,7 +351,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { if (isEmpty(xmlInfoboxReadResponse)) throw new AuthenticationException("auth.10", new Object[] { REQ_VERIFY_IDENTITY_LINK, PARAM_XMLRESPONSE }); - + AuthConfigurationProvider authConf = AuthConfigurationProvider .getInstance(); @@ -420,7 +411,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { session.setIdentityLink(identityLink); // now validate the extended infoboxes - + //Removed in MOA-ID 2.0 //verifyInfoboxes(session, infoboxReadResponseParameters, false); @@ -443,7 +434,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * containg the authentication block, meant to be returned to the security * layer implementation * - * + * * @param sessionID * ID of associated authentication session data * @param infoboxReadResponseParameters @@ -468,14 +459,14 @@ public class AuthenticationServer implements MOAIDAuthConstants { if (certificate.getExtension(OWid) != null) { session.setOW(true); } - + } - + } catch (X509ExtensionInitException e) { Logger.warn("Certificate extension is not readable."); session.setOW(false); } - + AuthConfigurationProvider authConf = AuthConfigurationProvider .getInstance(); @@ -484,10 +475,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { String returnvalue = getCreateXMLSignatureRequestAuthBlockOrRedirect(session, authConf, oaParam); - + return returnvalue; } - + /** * Processes an Mandate sent by the MIS.
*

    @@ -498,7 +489,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * containg the authentication block, meant to be returned to the security * layer implementation *
- * + * * @param sessionID * ID of associated authentication session data * @param infoboxReadResponseParameters @@ -522,10 +513,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { // sets the extended SAML attributes for OID (Organwalter) setExtendedSAMLAttributeForMandatesOID(session, mandate, oaParam .getBusinessService()); - + validateExtendedSAMLAttributeForMandates(session, mandate, oaParam.getBusinessService()); - - + + } catch (SAXException e) { throw new AuthenticationException("auth.16", new Object[] { GET_MIS_SESSIONID }, e); @@ -539,11 +530,11 @@ public class AuthenticationServer implements MOAIDAuthConstants { throw new AuthenticationException("auth.16", new Object[] { GET_MIS_SESSIONID }, e); } - + } /** - * + * * @param session * @param authConf * @param oaParam @@ -588,7 +579,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { *
    *
  • Creates an CreateXMLSignatureRequest to be signed by the user
  • *
- * + * * @param sessionID * ID of associated authentication session data * @param cert @@ -610,7 +601,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { OAAuthParameter oaParam = AuthConfigurationProvider.getInstance() .getOnlineApplicationParameter(session.getPublicOAURLPrefix()); - + return getCreateXMLSignatureRequestForeigID(session, authConf, oaParam, cert); } @@ -648,13 +639,13 @@ public class AuthenticationServer implements MOAIDAuthConstants { *
  • Verifies signature by calling the MOA SP component
  • *
  • Returns the signer certificate
  • * - * + * * @param sessionID * ID of associated authentication session data * @param createXMLSignatureResponseParameters * The parameters from the response returned from the BKU * including the <CreateXMLSignatureResponse> - * @throws BKUException + * @throws BKUException */ public X509Certificate verifyXMLSignature(String sessionID, Map createXMLSignatureResponseParameters) @@ -708,13 +699,13 @@ public class AuthenticationServer implements MOAIDAuthConstants { *
  • Verifies signature by calling the MOA SP component
  • *
  • Returns the signer certificate
  • * - * + * * @param sessionID * ID of associated authentication session data * @param readInfoboxResponseParameters * The parameters from the response returned from the BKU * including the <ReadInfoboxResponse> - * @throws BKUException + * @throws BKUException */ public X509Certificate getCertificate(String sessionID, Map readInfoboxResponseParameters) throws AuthenticationException, @@ -744,80 +735,80 @@ public class AuthenticationServer implements MOAIDAuthConstants { /** * Builds an authentication block <saml:Assertion> from * given session data. - * + * * @param session * authentication session - * + * * @return <saml:Assertion> as a String - * + * * @throws BuildException * If an error occurs on serializing an extended SAML attribute * to be appended to the AUTH-Block. */ private String buildAuthenticationBlock(AuthenticationSession session, OAAuthParameter oaParam) throws BuildException { - + IdentityLink identityLink = session.getIdentityLink(); String issuer = identityLink.getName(); String gebDat = identityLink.getDateOfBirth(); String identificationValue = null; String identificationType = null; - + //set empty AuthBlock BPK in case of OW or SSO or bpk is not requested if (session.isOW() || session.isSsoRequested() || oaParam.isRemovePBKFromAuthBlock()) { identificationType = ""; identificationValue = ""; - + } else if (identityLink.getIdentificationType().equals(Constants.URN_PREFIX_BASEID)) { if (oaParam.getBusinessService()) { - + String bpkBase64 = new BPKBuilder().buildWBPK(identityLink .getIdentificationValue(), oaParam.getIdentityLinkDomainIdentifier()); identificationValue = bpkBase64; - + if (oaParam.getIdentityLinkDomainIdentifier().startsWith(Constants.URN_PREFIX_WBPK + "+" )) identificationType = oaParam.getIdentityLinkDomainIdentifier(); else identificationType = Constants.URN_PREFIX_WBPK + "+" + oaParam.getIdentityLinkDomainIdentifier(); - + } else { String bpkBase64 = new BPKBuilder().buildBPK(identityLink .getIdentificationValue(), session.getTarget()); identificationValue = bpkBase64; identificationType = Constants.URN_PREFIX_CDID + "+" + session.getTarget(); } - + } else { identificationValue = identityLink.getIdentificationValue(); identificationType = identityLink.getIdentificationType(); - + } - + String issueInstant = DateTimeUtils.buildDateTimeUTC(Calendar .getInstance()); session.setIssueInstant(issueInstant); String authURL = session.getAuthURL(); String target = session.getTarget(); String targetFriendlyName = session.getTargetFriendlyName(); - + // Bug #485 // (https://egovlabs.gv.at/tracker/index.php?func=detail&aid=485&group_id=6&atid=105) // String oaURL = session.getPublicOAURLPrefix(); - + List extendedSAMLAttributes = session.getExtendedSAMLAttributesAUTH(); - - + + if (session.isSsoRequested()) { String oaURL =new String(); try { oaURL = AuthConfigurationProvider.getInstance().getSSOPublicUrl(); - + if (MiscUtil.isNotEmpty(oaURL)) oaURL = oaURL.replaceAll("&", "&"); - + } catch (ConfigurationException e) { } String authBlock = new AuthenticationBlockAssertionBuilder() @@ -826,7 +817,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { identificationType, oaURL, gebDat, extendedSAMLAttributes, session, oaParam); return authBlock; - + } else { String oaURL = session.getPublicOAURLPrefix().replaceAll("&", "&"); String authBlock = new AuthenticationBlockAssertionBuilder() @@ -835,20 +826,20 @@ public class AuthenticationServer implements MOAIDAuthConstants { identificationType, oaURL, gebDat, extendedSAMLAttributes, session, oaParam); return authBlock; - } + } } - + /** * Verifies the infoboxes (except of the identity link infobox) returned by * the BKU by calling appropriate validator classes. - * + * * @param session * The actual authentication session. * @param mandate * The Mandate from the MIS - * + * * @throws AuthenticationException * @throws ConfigurationException * @throws TransformerException @@ -871,19 +862,19 @@ public class AuthenticationServer implements MOAIDAuthConstants { verifySAMLAttribute(samlAttribute, i, "MISService", "MISService"); - + } } /** * Verifies the infoboxes (except of the identity link infobox) returned by * the BKU by calling appropriate validator classes. - * + * * @param session * The actual authentication session. * @param mandate * The Mandate from the MIS - * + * * @throws AuthenticationException * @throws ConfigurationException * @throws TransformerException @@ -908,7 +899,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * Adds given SAML Attributes to the current session. They will be appended * to the final SAML Assertion or the AUTH block. If the attributes are * already in the list, they will be replaced. - * + * * @param session * The current session * @param extendedSAMLAttributes @@ -979,7 +970,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * Adds the AUTH block related SAML attributes to the validation result. * This is needed always before the AUTH block is to be signed, because the * name of the mandator has to be set - * + * * @throws ParserConfigurationException * @throws IOException * @throws SAXException @@ -1046,7 +1037,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * Adds the AUTH block related SAML attributes to the validation result. * This is needed always before the AUTH block is to be signed, because the * name of the mandator has to be set - * + * * @throws ParserConfigurationException * @throws IOException * @throws SAXException @@ -1091,7 +1082,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { } /** - * + * * @param mandate * @return * @throws ParserConfigurationException @@ -1143,7 +1134,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { *
  • Deletes authentication session
  • *
  • Returns the SAML artifact, encoded BASE64
  • * - * + * * @param sessionID * session ID of the running authentication session * @param xmlCreateXMLSignatureReadResponse @@ -1151,20 +1142,20 @@ public class AuthenticationServer implements MOAIDAuthConstants { * <CreateXMLSignatureResponse> * @return SAML artifact needed for retrieving authentication data, encoded * BASE64 - * @throws BKUException + * @throws BKUException */ public String verifyAuthenticationBlock(AuthenticationSession session, String xmlCreateXMLSignatureReadResponse) throws AuthenticationException, BuildException, ParseException, ConfigurationException, ServiceException, ValidateException, BKUException { - + if (session == null) throw new AuthenticationException("auth.10", new Object[] { REQ_VERIFY_AUTH_BLOCK, PARAM_SESSIONID }); if (isEmpty(xmlCreateXMLSignatureReadResponse)) throw new AuthenticationException("auth.10", new Object[] { REQ_VERIFY_AUTH_BLOCK, PARAM_XMLRESPONSE }); - + AuthConfigurationProvider authConf = AuthConfigurationProvider .getInstance(); // parses @@ -1187,7 +1178,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { new CreateXMLSignatureResponseValidator().validateSSO(csresp, session); else new CreateXMLSignatureResponseValidator().validate(csresp, session); - + // builds a for a MOA-SPSS call List vtids = authConf.getMoaSpAuthBlockVerifyTransformsInfoIDs(); String tpid = authConf.getMoaSpAuthBlockTrustProfileID(); @@ -1226,7 +1217,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { // Compare AuthBlock Data with information stored in session, especially // date and time CreateXMLSignatureResponseValidator.getInstance().validateSigningDateTime(csresp); - + // compares the public keys from the identityLink with the AuthBlock VerifyXMLSignatureResponseValidator.getInstance().validateCertificate( vsresp, session.getIdentityLink()); @@ -1269,29 +1260,29 @@ public class AuthenticationServer implements MOAIDAuthConstants { } } } - + session.setXMLVerifySignatureResponse(vsresp); session.setSignerCertificate(vsresp.getX509certificate()); vsresp.setX509certificate(null); session.setForeigner(false); - + if (session.getUseMandate()) { // mandate mode return null; - + } else { - + session.setAuthenticatedUsed(false); session.setAuthenticated(true); - + String oldsessionID = session.getSessionID(); - + //Session is implicte stored in changeSessionID!!! String newMOASessionID = AuthenticationSessionStoreage.changeSessionID(session); - + Logger.info("Changed MOASession " + oldsessionID + " to Session " + newMOASessionID); Logger.info("Daten angelegt zu MOASession " + newMOASessionID); - + return newMOASessionID; } } @@ -1313,7 +1304,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { *
  • Deletes authentication session
  • *
  • Returns the SAML artifact, encoded BASE64
  • * - * + * * @param sessionID * session ID of the running authentication session * @param xmlCreateXMLSignatureReadResponse @@ -1374,7 +1365,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { *
  • Deletes authentication session
  • *
  • Returns the SAML artifact, encoded BASE64
  • * - * + * * @param sessionID * session ID of the running authentication session * @return SAML artifact needed for retrieving authentication data, encoded @@ -1383,11 +1374,11 @@ public class AuthenticationServer implements MOAIDAuthConstants { public String getForeignAuthenticationData(AuthenticationSession session) throws AuthenticationException, BuildException, ParseException, ConfigurationException, ServiceException, ValidateException { - + if (session == null) throw new AuthenticationException("auth.10", new Object[] { REQ_VERIFY_AUTH_BLOCK, PARAM_SESSIONID }); - + // post processing of the infoboxes Iterator iter = session.getInfoboxValidatorIterator(); boolean formpending = false; @@ -1430,10 +1421,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { VerifyXMLSignatureResponse vsresp = new VerifyXMLSignatureResponse(); X509Certificate cert = session.getSignerCertificate(); vsresp.setX509certificate(cert); - + session.setAuthenticatedUsed(false); session.setAuthenticated(true); - + session.setXMLVerifySignatureResponse(vsresp); session.setSignerCertificate(vsresp.getX509certificate()); @@ -1447,7 +1438,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { /** * Builds the AuthenticationData object together with the corresponding * <saml:Assertion> - * + * * @param session * authentication session * @param verifyXMLSigResp @@ -1467,23 +1458,23 @@ public class AuthenticationServer implements MOAIDAuthConstants { IdentityLink identityLink = session.getIdentityLink(); AuthenticationData authData = new AuthenticationData(); - + VerifyXMLSignatureResponse verifyXMLSigResp = session.getXMLVerifySignatureResponse(); - + boolean businessService = oaParam.getBusinessService(); - + authData.setMajorVersion(1); authData.setMinorVersion(0); authData.setAssertionID(Random.nextRandom()); authData.setIssuer(session.getAuthURL()); - + authData.setIssueInstant(DateTimeUtils.buildDateTimeUTC(Calendar .getInstance())); - + //baseID or wbpk in case of BusinessService without SSO or BusinessService SSO authData.setIdentificationValue(identityLink.getIdentificationValue()); authData.setIdentificationType(identityLink.getIdentificationType()); - + authData.setGivenName(identityLink.getGivenName()); authData.setFamilyName(identityLink.getFamilyName()); authData.setDateOfBirth(identityLink.getDateOfBirth()); @@ -1493,25 +1484,25 @@ public class AuthenticationServer implements MOAIDAuthConstants { authData.setPublicAuthorityCode(verifyXMLSigResp .getPublicAuthorityCode()); authData.setBkuURL(session.getBkuURL()); - + try { - + if (session.getUseMandate() && session.isOW()) { MISMandate mandate = session.getMISMandate(); authData.setBPK(mandate.getOWbPK()); authData.setBPKType(Constants.URN_PREFIX_CDID + "+" + "OW"); authData.setIdentityLink(identityLink); - + Logger.trace("Authenticated User is OW: " + mandate.getOWbPK()); - + } else { - + if (businessService) { //since we have foreigner, wbPK is not calculated in BKU if(identityLink.getIdentificationType().equals(Constants.URN_PREFIX_BASEID)) { - + String registerAndOrdNr = oaParam.getIdentityLinkDomainIdentifier(); - + if (registerAndOrdNr.startsWith(AuthenticationSession.REGISTERANDORDNR_PREFIX_)) { // If domainIdentifier starts with prefix // "urn:publicid:gv.at:wbpk+"; remove this prefix @@ -1519,47 +1510,47 @@ public class AuthenticationServer implements MOAIDAuthConstants { .substring(AuthenticationSession.REGISTERANDORDNR_PREFIX_.length()); Logger.debug("Register and ordernumber prefix stripped off; resulting register string: " + registerAndOrdNr); - } - + } + String wbpkBase64 = new BPKBuilder().buildWBPK(identityLink.getIdentificationValue(), registerAndOrdNr); authData.setBPK(wbpkBase64); authData.setBPKType( Constants.URN_PREFIX_WBPK + "+" + registerAndOrdNr); - + } else { authData.setBPK(identityLink.getIdentificationValue()); authData.setBPKType(identityLink.getIdentificationType()); - + } - + Logger.trace("Authenticate user with wbPK " + authData.getBPK()); - + Element idlassertion = session.getIdentityLink().getSamlAssertion(); //set bpk/wpbk; Node prIdentification = XPathUtils.selectSingleNode(idlassertion, IdentityLinkAssertionParser.PERSON_IDENT_VALUE_XPATH); prIdentification.getFirstChild().setNodeValue(authData.getBPK()); - //set bkp/wpbk type + //set bkp/wpbk type Node prIdentificationType = XPathUtils.selectSingleNode(idlassertion, IdentityLinkAssertionParser.PERSON_IDENT_TYPE_XPATH); prIdentificationType.getFirstChild().setNodeValue(authData.getBPKType()); - + IdentityLinkAssertionParser idlparser = new IdentityLinkAssertionParser(idlassertion); IdentityLink idl = idlparser.parseIdentityLink(); authData.setIdentityLink(idl); - + } else { - - if(identityLink.getIdentificationType().equals(Constants.URN_PREFIX_BASEID)) { + + if(identityLink.getIdentificationType().equals(Constants.URN_PREFIX_BASEID)) { // only compute bPK if online application is a public service and we have the Stammzahl String bpkBase64 = new BPKBuilder().buildBPK(identityLink.getIdentificationValue(), target); authData.setBPK(bpkBase64); authData.setBPKType(Constants.URN_PREFIX_CDID + "+" + oaParam.getTarget()); } - + Logger.trace("Authenticate user with bPK " + authData.getBPK()); - + authData.setIdentityLink(identityLink); } } - + return authData; } catch (Throwable ex) { @@ -1570,7 +1561,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { /** * Retrieves a session from the session store. - * + * * @param id * session ID * @return AuthenticationSession stored with given session ID, @@ -1578,7 +1569,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { */ public static AuthenticationSession getSession(String id) throws AuthenticationException { - + AuthenticationSession session; try { session = AuthenticationSessionStoreage.getSession(id); @@ -1586,10 +1577,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { if (session == null) throw new AuthenticationException("auth.02", new Object[] { id }); return session; - + } catch (MOADatabaseException e) { throw new AuthenticationException("parser.04", new Object[] { id }); - } + } } /** @@ -1597,38 +1588,38 @@ public class AuthenticationServer implements MOAIDAuthConstants { */ public void cleanup() { long now = new Date().getTime(); - - //clean AuthenticationSessionStore - + + //clean AuthenticationSessionStore + AuthenticationSessionStoreage.clean(now, sessionTimeOutCreated, sessionTimeOutUpdated); - + //clean AssertionStore AssertionStorage assertionstore = AssertionStorage.getInstance(); assertionstore.clean(now, authDataTimeOut); - - //clean ExeptionStore + + //clean ExeptionStore DBExceptionStoreImpl exstore = DBExceptionStoreImpl.getStore(); exstore.clean(now, authDataTimeOut); - + } /** * Sets the sessionTimeOut. - * + * * @param seconds * Time out of the session in seconds */ public void setSecondsSessionTimeOutCreated(long seconds) { sessionTimeOutCreated = seconds * 1000; } - + public void setSecondsSessionTimeOutUpdated(long seconds) { sessionTimeOutUpdated = seconds * 1000; } /** * Sets the authDataTimeOut. - * + * * @param seconds * Time out for signing AuthData in seconds */ @@ -1638,7 +1629,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { /** * Checks a parameter. - * + * * @param param * parameter * @return true if the parameter is null or empty @@ -1649,7 +1640,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { /** * Checks the correctness of SAML attributes and returns its value. - * + * * @param param * samlAttribute * @param i @@ -1698,7 +1689,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { return value; } - + /** * Does the request to the SZR-GW * @param signature XMLDSIG signature @@ -1779,13 +1770,13 @@ public class AuthenticationServer implements MOAIDAuthConstants { return null; } - + /** * Starts a MOA-ID authentication process using STORK * @param req HttpServletRequest * @param resp HttpServletResponse * @param ccc Citizen country code - * @param oaURL URL of the online application + * @param oaURL URL of the online application * @param target Target parameter * @param targetFriendlyName Friendly Name of Target * @param authURL Authentication URL @@ -1797,36 +1788,34 @@ public class AuthenticationServer implements MOAIDAuthConstants { */ public static void startSTORKAuthentication( HttpServletRequest req, - HttpServletResponse resp, + HttpServletResponse resp, AuthenticationSession moasession) throws MOAIDException, AuthenticationException, WrongParametersException, ConfigurationException { - + if (moasession == null) { throw new AuthenticationException("auth.18", new Object[] { }); } - + //read configuration paramters of OA OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(moasession.getPublicOAURLPrefix()); if (oaParam == null) throw new AuthenticationException("auth.00", new Object[] { moasession.getPublicOAURLPrefix() }); - - //Start of STORK Processing + + //Start of STORK Processing STORKConfig storkConfig = AuthConfigurationProvider.getInstance().getStorkConfig(); - + CPEPS cpeps = storkConfig.getCPEPS(moasession.getCcc()); - - Logger.debug("Preparing to assemble STORK AuthnRequest witht the following values:"); - String destination = cpeps.getPepsURL().toExternalForm(); + + Logger.debug("Preparing to assemble STORK AuthnRequest witt the following values:"); + String destination = cpeps.getPepsURL().toExternalForm(); Logger.debug("C-PEPS URL: " + destination); - + String acsURL = HTTPUtils.getBaseURL(req) + PEPSConnectorServlet.PEPSCONNECTOR_SERVLET_URL_PATTERN; Logger.debug("MOA Assertion Consumer URL (PEPSConnctor): " + acsURL); - + String providerName= oaParam.getFriendlyName(); String issuerValue = HTTPUtils.getBaseURL(req); Logger.debug("Issuer value: " + issuerValue); - - // prepare collection of required attributes // - attributes for online application List attributesFromConfig = oaParam.getRequestedAttributes(); @@ -1838,7 +1827,15 @@ public class AuthenticationServer implements MOAIDAuthConstants { for(OAStorkAttribute current : attributesFromConfig) { PersonalAttribute newAttribute = new PersonalAttribute(); newAttribute.setName(current.getName()); - newAttribute.setIsRequired(current.isMandatory()); + + boolean globallyMandatory = false; + for(StorkAttribute currentGlobalAttribute : storkConfig.getStorkAttributes()) + if(current.getName().equals(currentGlobalAttribute.getName())) { + globallyMandatory = currentGlobalAttribute.isMandatory(); + break; + } + + newAttribute.setIsRequired(current.isMandatory() || globallyMandatory); attributeList.add(newAttribute); } @@ -1867,32 +1864,23 @@ public class AuthenticationServer implements MOAIDAuthConstants { authnRequest.setSpSector(spSector); authnRequest.setPersonalAttributeList(attributeList); -// STORKAuthnRequestProcessor.generateSTORKAuthnRequest( -// destination, -// acsURL, -// providerName, -// issuerValue, -// qaaLevel, -// spInstitution, -// spApplication, -// spCountry, -// spSector, -// requestedAttributes, - -// textToBeSigned, -// "application/xhtml+xml"); + authnRequest.setEIDCrossBorderShare(true); + authnRequest.setEIDCrossSectorShare(true); + authnRequest.setEIDSectorShare(true); + + authnRequest.setCitizenCountryCode("LOCAL"); + Logger.debug("STORK AuthnRequest succesfully assembled."); STORKSAMLEngine samlEngine = STORKSAMLEngine.getInstance("CONF0"); try { authnRequest = samlEngine.generateSTORKAuthnRequest(authnRequest); -// authnRequest = STORKAuthnRequestProcessor.signSTORKAuthnRequest(authnRequest, keyStorePath, keyStorePassword, keyName, keyPassword); } catch (STORKSAMLEngineException e) { Logger.error("Could not sign STORK SAML AuthnRequest.", e); throw new MOAIDException("stork.00", null); } - + Logger.info("STORK AuthnRequest successfully signed!"); //validate AuthnRequest @@ -1936,7 +1924,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { Logger.info("STORK AuthnRequest successfully successfully prepared for client with target location: " + authnRequest.getDestination()); } - + /** * Extracts an X509 Certificate out of an XML signagture element * @param signedXML XML signature element @@ -1944,27 +1932,27 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws CertificateException */ public static X509Certificate getCertificateFromXML(Element signedXML) throws CertificateException { - + NodeList nList = signedXML.getElementsByTagNameNS(Constants.DSIG_NS_URI, "X509Certificate"); - + String base64CertString = XMLUtil.getFirstTextValueFromNodeList(nList); - - if (StringUtils.isEmpty(base64CertString)) { + + if (StringUtils.isEmpty(base64CertString)) { String msg = "XML does not contain a X509Certificate element."; Logger.error(msg); throw new CertificateException(msg); } - + InputStream is = new ByteArrayInputStream(Base64.decode(base64CertString)); - + X509Certificate cert; try { cert = new X509Certificate(is); return cert; - + } catch (Throwable e) { throw new CertificateException(e); } } - + } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java index 25f12af62..e388b39e7 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java @@ -1,5 +1,5 @@ /** - * + * */ package at.gv.egovernment.moa.id.config.stork; @@ -25,119 +25,129 @@ import eu.stork.vidp.messages.util.XMLUtil; import at.gv.egovernment.moa.id.commons.db.dao.config.SAMLSigningParameter; import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; import at.gv.egovernment.moa.id.commons.db.dao.config.SignatureVerificationParameterType; +import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.StringUtils; /** * Encapsulates several STORK configuration parameters according MOA configuration - * + * * @author bzwattendorfer * */ public class STORKConfig { - + /** STORK SAML signature creation parameters */ private Properties props = null; private Map cpepsMap = null; private String basedirectory = null; private SignatureVerificationParameter sigverifyparam = null; - - + private List attr = null; + + public STORKConfig(STORK stork, Properties props, String basedirectory) { this.basedirectory = basedirectory; this.props = props; - + //create CPEPS map List cpeps = stork.getCPEPS(); cpepsMap = new HashMap(); - + for(at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS cpep : cpeps) { - + try { CPEPS moacpep = new CPEPS(cpep.getCountryCode(), new URL(cpep.getURL())); - - List attr = cpep.getAttributeValue(); - - ArrayList requestedAttributes = new ArrayList(); - - for (String e1 : attr) { - Element element = XMLUtil.stringToDOM(e1); - RequestedAttribute requestedAttribute = (RequestedAttribute) SAMLUtil.unmarshallMessage(element); - requestedAttributes.add(requestedAttribute); - } - moacpep.setCountrySpecificRequestedAttributes(requestedAttributes); - + + + +// List attr = cpep.getAttributeValue(); +// +// ArrayList requestedAttributes = new ArrayList(); +// +// for (String e1 : attr) { +// Element element = XMLUtil.stringToDOM(e1); +// RequestedAttribute requestedAttribute = (RequestedAttribute) SAMLUtil.unmarshallMessage(element); +// requestedAttributes.add(requestedAttribute); +// } +// moacpep.setCountrySpecificRequestedAttributes(requestedAttributes); + cpepsMap.put(cpep.getCountryCode(), moacpep); - + } catch (MalformedURLException e) { - Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " + Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " + cpep.getCountryCode() + " has an invalid URL and is ignored."); - } catch (ParserConfigurationException e) { - Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " - + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); - } catch (SAXException e) { - Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " - + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); - } catch (IOException e) { - Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " - + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); - } catch (MessageEncodingException e) { - Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " - + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); +// } catch (ParserConfigurationException e) { +// Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " +// + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); +// } catch (SAXException e) { +// Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " +// + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); +// } catch (IOException e) { +// Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " +// + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); +// } catch (MessageEncodingException e) { +// Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " +// + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); } - } - - SAMLSigningParameter samlsign = stork.getSAMLSigningParameter(); - if (samlsign == null) { - Logger.warn("Error in MOA-ID Configuration. No STORK->SAMLSigningParameter configuration found."); - } else { - SignatureVerificationParameterType sigverify = samlsign.getSignatureVerificationParameter(); - - if (sigverify == null) { - Logger.warn("Error in MOA-ID Configuration. No STORK->SignatureVerificationParameter configuration found."); - - } else { - sigverifyparam = new SignatureVerificationParameter(sigverify.getTrustProfileID()); - } +// SAMLSigningParameter samlsign = stork.getSAMLSigningParameter(); // TODO Fix nullpointerexception when nothing is configured +// +// if (samlsign == null) { +// Logger.warn("Error in MOA-ID Configuration. No STORK->SAMLSigningParameter configuration found."); +// +// } else { +// SignatureVerificationParameterType sigverify = samlsign.getSignatureVerificationParameter(); +// +// if (sigverify == null) { +// Logger.warn("Error in MOA-ID Configuration. No STORK->SignatureVerificationParameter configuration found."); +// +// } else { +// sigverifyparam = new SignatureVerificationParameter(sigverify.getTrustProfileID()); +// } +// } + attr = new ArrayList(); + for(StorkAttribute current : stork.getAttributes()) { + attr.add(current); } - + } public SignatureCreationParameter getSignatureCreationParameter() { - + return new SignatureCreationParameter(props, basedirectory); } public SignatureVerificationParameter getSignatureVerificationParameter() { - - return sigverifyparam; + + return sigverifyparam; } public Map getCpepsMap() { return cpepsMap; } - + public boolean isSTORKAuthentication(String ccc) { - + if (StringUtils.isEmpty(ccc) || this.cpepsMap.isEmpty()) return false; - + if (this.cpepsMap.containsKey(ccc.toUpperCase())) return true; else return false; - + } - + public CPEPS getCPEPS(String ccc) { if (isSTORKAuthentication(ccc)) return this.cpepsMap.get(ccc); else return null; } - + public List getStorkAttributes() { + return attr; + } } -- cgit v1.2.3 From bb986a1225a594cf72572af8cbf0edb14039b5c1 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 23 Jan 2014 13:46:37 +0100 Subject: added signrequest to authrequest --- .../moa/id/auth/AuthenticationServer.java | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 0fbcc97b2..49e2cbdd5 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -33,8 +33,10 @@ import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; import java.security.GeneralSecurityException; +import java.security.NoSuchAlgorithmException; import java.security.Principal; import java.security.cert.CertificateException; +import java.util.ArrayList; //import java.security.cert.CertificateFactory; import java.util.Calendar; import java.util.Date; @@ -54,6 +56,8 @@ import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; import org.apache.xpath.XPathAPI; +import org.opensaml.common.IdentifierGenerator; +import org.opensaml.common.impl.SecureRandomIdentifierGenerator; import org.opensaml.xml.util.Base64; import org.opensaml.xml.util.XMLHelper; import org.springframework.util.xml.DomUtils; @@ -1839,6 +1843,15 @@ public class AuthenticationServer implements MOAIDAuthConstants { attributeList.add(newAttribute); } + // add sign request + PersonalAttribute newAttribute = new PersonalAttribute(); + newAttribute.setName("signedDoc"); + List value = new ArrayList(); + value.add(generateDssSignRequest(Base64.encodeBytes(CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession).getBytes()), "application/xhtml+xml")); + newAttribute.setValue(value); + attributeList.add(newAttribute); + + if (Logger.isDebugEnabled()) { Logger.debug("The following attributes are requested for this OA:"); for (OAStorkAttribute logReqAttr : attributesFromConfig) @@ -1925,6 +1938,25 @@ public class AuthenticationServer implements MOAIDAuthConstants { Logger.info("STORK AuthnRequest successfully successfully prepared for client with target location: " + authnRequest.getDestination()); } + private static String generateDssSignRequest(String text, String mimeType) { + IdentifierGenerator idGenerator; + try { + idGenerator = new SecureRandomIdentifierGenerator(); + + return "" + + "" + + "" + + "" + text + "" + + "" + + "" + + ""; + } catch (NoSuchAlgorithmException e) { + Logger.error("Cannot generate id", e); + throw new RuntimeException(e); + } + } + /** * Extracts an X509 Certificate out of an XML signagture element * @param signedXML XML signature element -- cgit v1.2.3 From f5a9a02b839f036eb0ebaa6c58526a2483a3d4b7 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 23 Jan 2014 14:44:14 +0100 Subject: natural person should work --- .../moa/id/auth/servlet/PEPSConnectorServlet.java | 93 +++++++++++----------- .../moa/id/auth/stork/STORKResponseProcessor.java | 10 +-- 2 files changed, 53 insertions(+), 50 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index df93f4d85..653f40670 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -11,7 +11,6 @@ import javax.servlet.http.HttpSession; import org.opensaml.saml2.core.Assertion; import org.opensaml.saml2.core.StatusCode; -import org.opensaml.xml.util.XMLHelper; import org.w3c.dom.Element; import at.gv.egovernment.moa.id.auth.AuthenticationServer; @@ -30,19 +29,21 @@ import at.gv.egovernment.moa.id.util.HTTPUtils; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.DOMUtils; import at.gv.egovernment.moa.util.StringUtils; -import eu.stork.mw.messages.saml.STORKAuthnRequest; -import eu.stork.mw.messages.saml.STORKResponse; -import eu.stork.vidp.messages.util.XMLUtil; +import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.STORKAuthnRequest; +import eu.stork.peps.auth.commons.STORKAuthnResponse; +import eu.stork.peps.auth.engine.STORKSAMLEngine; +import eu.stork.peps.exceptions.STORKSAMLEngineException; /** * Endpoint for receiving STORK response messages */ public class PEPSConnectorServlet extends AuthServlet { private static final long serialVersionUID = 1L; - + public static final String PEPSCONNECTOR_SERVLET_URL_PATTERN = "/PEPSConnector"; - + /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ @@ -89,33 +90,35 @@ public class PEPSConnectorServlet extends AuthServlet { Logger.debug("Beginning to extract SAMLResponse out of HTTP Request"); //extract STORK Response from HTTP Request - STORKResponse storkResponse = null; + //Decodes SAML Response + byte[] decSamlToken; try { - storkResponse = STORKResponseProcessor.receiveSTORKRepsonse(request, response); - } catch (STORKException e) { + decSamlToken = PEPSUtil.decodeSAMLToken(request.getParameter("SAMLResponse")); + } catch(NullPointerException e) { Logger.error("Unable to retrieve STORK Response", e); throw new MOAIDException("stork.04", null); } - - Logger.info("STORK SAML Response message succesfully extracted"); - Logger.debug("STORK response (pretty print): "); - Logger.debug(XMLHelper.prettyPrintXML(storkResponse.getDOM())); - Logger.trace("STORK response (original): "); - Logger.trace(XMLUtil.printXML(storkResponse.getDOM())); - - Logger.debug("Starting validation of SAML response"); - //verify SAML response + + //Get SAMLEngine instance + STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF0"); + + STORKAuthnResponse authnResponse = null; try { - STORKResponseProcessor.verifySTORKResponse(storkResponse); - } catch (STORKException e) { + //validate SAML Token + Logger.debug("Starting validation of SAML response"); + authnResponse = engine.validateSTORKAuthnResponse(decSamlToken, (String) request.getRemoteHost()); + Logger.info("SAML response succesfully verified!"); + }catch(STORKSAMLEngineException e){ Logger.error("Failed to verify STORK SAML Response", e); throw new MOAIDException("stork.05", null); } - - Logger.info("SAML response succesfully verified!"); - - String statusCodeValue = storkResponse.getStatus().getStatusCode().getValue(); - + + Logger.info("STORK SAML Response message succesfully extracted"); + Logger.debug("STORK response: "); + Logger.debug(authnResponse.toString()); + + String statusCodeValue = authnResponse.getStatusCode(); + if (!statusCodeValue.equals(StatusCode.SUCCESS_URI)) { Logger.error("Received ErrorResponse from PEPS: " + statusCodeValue); throw new MOAIDException("stork.06", new Object[] { statusCodeValue }); @@ -136,26 +139,26 @@ public class PEPSConnectorServlet extends AuthServlet { } Logger.debug("Found a preceeding STORK AuthnRequest to this MOA session: " + moaSessionID); - - Logger.debug("Starting validation of SAML assertion"); - //verify SAML assertion - Assertion storkAssertion = storkResponse.getAssertions().get(0); - try { - STORKResponseProcessor.verifySTORKAssertion( - storkAssertion, //assertion - request.getRemoteAddr(), //IP address of user - storkAuthnRequest.getID(), //ID of STORK AuthnRequest - request.getRequestURL().toString(), //destination - HTTPUtils.getBaseURL(request), //audience - storkAuthnRequest.getRequestedAttributes()); //Requested Attributes - } catch (STORKException e) { - Logger.error("Failed to verify STORK SAML Assertion", e); - throw new MOAIDException("stork.08", null); - } - - Logger.info("SAML assertion succesfully verified!"); - - Logger.debug("Starting extraction of signedDoc attribute"); + +// Logger.debug("Starting validation of SAML assertion"); +// //verify SAML assertion + Assertion storkAssertion = authnResponse.getAssertions().get(0); +// try { +// STORKResponseProcessor.verifySTORKAssertion( +// storkAssertion, //assertion +// request.getRemoteAddr(), //IP address of user +// storkAuthnRequest.getID(), //ID of STORK AuthnRequest +// request.getRequestURL().toString(), //destination +// HTTPUtils.getBaseURL(request), //audience +// storkAuthnRequest.getRequestedAttributes()); //Requested Attributes +// } catch (STORKException e) { +// Logger.error("Failed to verify STORK SAML Assertion", e); +// throw new MOAIDException("stork.08", null); +// } +// +// Logger.info("SAML assertion succesfully verified!"); + + Logger.debug("Starting extraction of signedDoc attribute"); //extract signed doc element and citizen signature Element citizenSignature = null; try { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index a6e595239..e47a43c90 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -305,9 +305,9 @@ public class STORKResponseProcessor { public static IdentityLink connectToSZRGateway(Element citizenSignature, List attributeList) throws STORKException { Logger.trace("Calling SZR Gateway with the following attributes:"); - String fiscalNumber = SAMLUtil.getAttributeStringValue(attributeList, STORKConstants.STORK_ATTRIBUTE_FISCALNUMBER); - Logger.trace(STORKConstants.STORK_ATTRIBUTE_FISCALNUMBER + " : " + fiscalNumber); - + String eIdentifier = SAMLUtil.getAttributeStringValue(attributeList, STORKConstants.STORK_ATTRIBUTE_FISCALNUMBER); + Logger.trace(STORKConstants.STORK_ATTRIBUTE_EIDENTIFIER + " : " + eIdentifier); + String givenName = SAMLUtil.getAttributeStringValue(attributeList, STORKConstants.STORK_ATTRIBUTE_GIVENNAME); Logger.trace(STORKConstants.STORK_ATTRIBUTE_GIVENNAME+ " : " + givenName); @@ -325,8 +325,8 @@ public class STORKResponseProcessor { IdentityLink identityLink = null; try { Logger.trace("Starting call..."); - response = AuthenticationServer.getInstance().getIdentityLink(fiscalNumber, givenName, lastName, dateOfBirth, citizenSignature); - if (response.isError()) { + response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature); + if (response.isError()) { Logger.error("Receveid ErrorResponse from SZR Gateway."); throw new SZRGWClientException(response.getError()); } -- cgit v1.2.3 From 8edc54bc0b5fc3f75a88c7d01fb8b0d7b63cfe41 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Sun, 26 Jan 2014 14:15:30 +0100 Subject: moved saml post binding template --- .../resources/templates/saml2-post-binding-moa.vm | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 id/server/idserverlib/src/main/resources/resources/templates/saml2-post-binding-moa.vm diff --git a/id/server/idserverlib/src/main/resources/resources/templates/saml2-post-binding-moa.vm b/id/server/idserverlib/src/main/resources/resources/templates/saml2-post-binding-moa.vm new file mode 100644 index 000000000..cac0bda76 --- /dev/null +++ b/id/server/idserverlib/src/main/resources/resources/templates/saml2-post-binding-moa.vm @@ -0,0 +1,38 @@ +## +## Velocity Template for SAML 2 HTTP-POST binding +## +## Velocity context may contain the following properties +## action - String - the action URL for the form +## RelayState - String - the relay state for the message +## SAMLRequest - String - the Base64 encoded SAML Request +## SAMLResponse - String - the Base64 encoded SAML Response +## Contains target attribute to delegate PEPS authentication out of iFrame + + + + + + +
    +
    + #if($RelayState)#end + + #if($SAMLRequest)#end + + #if($SAMLResponse)#end + +
    + +
    + + + \ No newline at end of file -- cgit v1.2.3 From 885490d16795b5d8f45d2785aaead8b074fa2cc1 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Sun, 26 Jan 2014 16:11:31 +0100 Subject: interface adaptions for szrgw #1 --- .../moa/id/auth/AuthenticationServer.java | 48 +++++++---- .../moa/id/auth/servlet/GetForeignIDServlet.java | 2 +- .../moa/id/auth/servlet/PEPSConnectorServlet.java | 2 +- .../moa/id/auth/stork/STORKResponseProcessor.java | 61 ++++++++++---- .../validator/parep/client/szrgw/SZRGWClient.java | 95 ++++++++-------------- 5 files changed, 112 insertions(+), 96 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 49e2cbdd5..fe23b545f 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -24,7 +24,6 @@ package at.gv.egovernment.moa.id.auth; import iaik.asn1.ObjectID; -import iaik.pki.PKIException; import iaik.x509.X509Certificate; import iaik.x509.X509ExtensionInitException; @@ -32,7 +31,6 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; -import java.security.GeneralSecurityException; import java.security.NoSuchAlgorithmException; import java.security.Principal; import java.security.cert.CertificateException; @@ -60,7 +58,6 @@ import org.opensaml.common.IdentifierGenerator; import org.opensaml.common.impl.SecureRandomIdentifierGenerator; import org.opensaml.xml.util.Base64; import org.opensaml.xml.util.XMLHelper; -import org.springframework.util.xml.DomUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -123,8 +120,8 @@ import at.gv.egovernment.moa.id.storage.AssertionStorage; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; import at.gv.egovernment.moa.id.storage.DBExceptionStoreImpl; import at.gv.egovernment.moa.id.util.HTTPUtils; +import at.gv.egovernment.moa.id.util.MOAIDMessageProvider; import at.gv.egovernment.moa.id.util.Random; -import at.gv.egovernment.moa.id.util.SSLUtils; import at.gv.egovernment.moa.id.util.client.mis.simple.MISMandate; import at.gv.egovernment.moa.logging.LogMsg; import at.gv.egovernment.moa.logging.Logger; @@ -137,7 +134,6 @@ import at.gv.egovernment.moa.util.StringUtils; import at.gv.egovernment.moa.util.XPathUtils; import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest; import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; -import eu.stork.mw.messages.saml.STORKAuthnRequest; import eu.stork.peps.auth.commons.PEPSUtil; import eu.stork.peps.auth.commons.PersonalAttribute; import eu.stork.peps.auth.commons.PersonalAttributeList; @@ -1700,8 +1696,8 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @return Identity link assertion * @throws SZRGWClientException */ - public at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse - getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, Element signature) throws SZRGWClientException { + + public at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String citizenSignature, String represented, String representative, String mandateContent) throws SZRGWClientException { SZRGWClient client = null; @@ -1713,8 +1709,9 @@ public class AuthenticationServer implements MOAIDAuthConstants { CreateIdentityLinkRequest request = new CreateIdentityLinkRequest(); - request.setSignature(DOMUtils.serializeNode(signature).getBytes()); + request.setSignature(citizenSignature.getBytes()); + Logger.info("Starte Kommunikation mit dem Stammzahlenregister Gateway(" + connectionParameters.getUrl() + ")..."); CreateIdentityLinkResponse response = client.sentCreateIDLRequest(request , connectionParameters.getUrl()); @@ -1735,17 +1732,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { // throw new SZRGWClientException("Could not initialize SSL Factory"); // } // } - Logger.info("Starte Kommunikation mit dem Stammzahlenregister Gateway(" + connectionParameters.getUrl() + ")..."); } catch (ConfigurationException e) { Logger.warn(e); Logger.warn(MOAIDMessageProvider.getInstance().getMessage("config.12", null )); - } catch (TransformerException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); } // // create request @@ -1775,6 +1765,34 @@ public class AuthenticationServer implements MOAIDAuthConstants { } + /** + * Does the request to the SZR-GW. + * + * @param signature the signature + * @return the identity link + * @throws SZRGWClientException the sZRGW client exception + * @throws ConfigurationException the configuration exception + */ + public at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse getIdentityLink(Element signature) throws SZRGWClientException, ConfigurationException { + return getIdentityLink(null, null, null, null, XMLHelper.nodeToString(signature), null, null, null); + } + + /** + * Does the request to the SZR-GW. + * + * @param PEPSIdentifier the pEPS identifier + * @param PEPSFirstname the pEPS firstname + * @param PEPSFamilyname the pEPS familyname + * @param PEPSDateOfBirth the pEPS date of birth + * @param signature XMLDSIG signature + * @return Identity link assertion + * @throws SZRGWClientException the sZRGW client exception + * @throws ConfigurationException the configuration exception + */ + public at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException, ConfigurationException { + return getIdentityLink(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, signature, null, null, null); + } + /** * Starts a MOA-ID authentication process using STORK * @param req HttpServletRequest diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java index 222faec37..be307ae14 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java @@ -162,7 +162,7 @@ public class GetForeignIDServlet extends AuthServlet { } // make SZR request to the identity link - CreateIdentityLinkResponse response = AuthenticationServer.getInstance().getIdentityLink(null, null, null, null, signature); + CreateIdentityLinkResponse response = AuthenticationServer.getInstance().getIdentityLink(signature); if (response.isError()) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index 653f40670..f1ee4c181 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -178,7 +178,7 @@ public class PEPSConnectorServlet extends AuthServlet { //contact SZR Gateway IdentityLink identityLink = null; try { - identityLink = STORKResponseProcessor.connectToSZRGateway(citizenSignature, storkAssertion.getAttributeStatements().get(0).getAttributes()); + identityLink = STORKResponseProcessor.connectToSZRGateway(authnResponse.getPersonalAttributeList()); } catch (STORKException e) { Logger.error("Error connecting SZR Gateway", e); throw new MOAIDException("stork.10", null); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index e47a43c90..e2112a4d9 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -40,6 +40,7 @@ import at.gv.egovernment.moa.util.Constants; import at.gv.egovernment.moa.util.DateTimeUtils; import at.gv.egovernment.moa.util.StringUtils; import eu.stork.mw.messages.saml.STORKResponse; +import eu.stork.peps.auth.commons.IPersonalAttributeList; import eu.stork.vidp.messages.common.STORKConstants; import eu.stork.vidp.messages.util.SAMLUtil; import eu.stork.vidp.messages.util.XMLUtil; @@ -294,29 +295,41 @@ public class STORKResponseProcessor { } - + + /** + * helper for reading attributes. Handles logging and error handling. + * + * @param attributeName the attribute name + * @param attributeList the attribute list + * @return the attribute value + * @throws STORKException the sTORK exception + */ + private static String getAttributeValue(String attributeName, IPersonalAttributeList attributeList) throws STORKException { + try { + String result = attributeList.get(attributeName).getValue().get(0); + Logger.trace(attributeName + " : " + result); + return result; + } catch(NullPointerException e) { + Logger.error(attributeName + " not found in response"); + throw new STORKException(attributeName + " not found in response"); + } + } + /** * Handels connection to SZR-GW and returns Identity Link on success - * @param citizenSignature Citizen signature - * @param attributeList Received attribute List in assertion + * @param iPersonalAttributeList Received attribute List in assertion * @return Identity Link * @throws STORKException */ - public static IdentityLink connectToSZRGateway(Element citizenSignature, List attributeList) throws STORKException { + public static IdentityLink connectToSZRGateway(IPersonalAttributeList attributeList) throws STORKException { Logger.trace("Calling SZR Gateway with the following attributes:"); - String eIdentifier = SAMLUtil.getAttributeStringValue(attributeList, STORKConstants.STORK_ATTRIBUTE_FISCALNUMBER); - Logger.trace(STORKConstants.STORK_ATTRIBUTE_EIDENTIFIER + " : " + eIdentifier); - - String givenName = SAMLUtil.getAttributeStringValue(attributeList, STORKConstants.STORK_ATTRIBUTE_GIVENNAME); - Logger.trace(STORKConstants.STORK_ATTRIBUTE_GIVENNAME+ " : " + givenName); - - String lastName = SAMLUtil.getAttributeStringValue(attributeList, STORKConstants.STORK_ATTRIBUTE_SURNAME); - Logger.trace(STORKConstants.STORK_ATTRIBUTE_SURNAME+ " : " + lastName); - - String dateOfBirth = SAMLUtil.getAttributeStringValue(attributeList, STORKConstants.STORK_ATTRIBUTE_DATEOFBIRTH); - Logger.trace(STORKConstants.STORK_ATTRIBUTE_DATEOFBIRTH + " : " + dateOfBirth); - + // fetch mandatory attributes + String citizenSignature = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_SIGNEDDOC, attributeList); + String eIdentifier = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_EIDENTIFIER, attributeList); + String givenName = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_GIVENNAME, attributeList); + String lastName = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_SURNAME, attributeList); + String dateOfBirth = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_DATEOFBIRTH, attributeList); if (!StringUtils.isEmpty(dateOfBirth)) { dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); } @@ -325,7 +338,21 @@ public class STORKResponseProcessor { IdentityLink identityLink = null; try { Logger.trace("Starting call..."); - response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature); + + // do we have a case of representation? + try { + String representative = getAttributeValue("representative", attributeList); + String represented = getAttributeValue("represented", attributeList); + String mandate = getAttributeValue("mandateContent", attributeList); + + // if we get here we have a representation case + response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate); + + } catch(STORKException e) { + // we do not have a representation case + response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature); + } + if (response.isError()) { Logger.error("Receveid ErrorResponse from SZR Gateway."); throw new SZRGWClientException(response.getError()); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWClient.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWClient.java index e3457f4de..325bf25a0 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWClient.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWClient.java @@ -39,7 +39,6 @@ import org.apache.commons.httpclient.protocol.Protocol; import org.apache.xpath.XPathAPI; import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; @@ -254,8 +253,8 @@ public class SZRGWClient { } } - - public Document buildGetIdentityLinkRequest(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, Element signature) throws SZRGWClientException { + + public Document buildGetIdentityLinkRequest(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature, String representative, String represented, String mandateContent) throws SZRGWClientException { String SZRGW_NS = "http://reference.e-government.gv.at/namespace/szrgw/20070807#"; try { @@ -299,73 +298,25 @@ public class SZRGWClient { Text text= doc.createTextNode(PEPSDateOfBirth); elem.appendChild(text); } - } - - if (signature == null) - throw new SZRGWClientException("Signature element must not be null!"); - else { - Element sig = doc.createElementNS(SZRGW_NS, "szrgw:Signature"); - Element xmlcontent = doc.createElementNS(SZRGW_NS, "szrgw:XMLContent"); - sig.appendChild(xmlcontent); - Node n = doc.importNode(signature, true); - getIdentityLink.appendChild(sig); - xmlcontent.appendChild(n); - } - - - return doc; - } catch (ParserConfigurationException e) { - throw new SZRGWClientException(e); - } /*catch (CertificateEncodingException e) { - throw new SZRGWClientException(e); - }*/ - - } - - public Document buildGetIdentityLinkRequest(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException { - - String SZRGW_NS = "http://reference.e-government.gv.at/namespace/szrgw/20070807#"; - - try { - DocumentBuilderFactory factory =DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - DocumentBuilder builder = factory.newDocumentBuilder(); - Document doc = builder.newDocument(); - - Element getIdentityLink = doc.createElementNS(SZRGW_NS, "szrgw:GetIdentityLinkRequest"); - getIdentityLink.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:szrgw", SZRGW_NS); - doc.appendChild(getIdentityLink); - - if ( (PEPSIdentifier != null) || (PEPSFirstname != null) || (PEPSFamilyname != null) || (PEPSDateOfBirth != null) ) { - - Element pepsDataElem = doc.createElementNS(SZRGW_NS, "szrgw:PEPSData"); - getIdentityLink.appendChild(pepsDataElem); - - if (PEPSIdentifier != null) { - Element elem = doc.createElementNS(SZRGW_NS, "szrgw:Identifier"); - pepsDataElem.appendChild(elem); - Text text= doc.createTextNode(PEPSIdentifier); - elem.appendChild(text); - } - if (PEPSFirstname != null) { - Element elem = doc.createElementNS(SZRGW_NS, "szrgw:Firstname"); + if (representative != null) { + Element elem = doc.createElementNS(SZRGW_NS, "szrgw:Representative"); pepsDataElem.appendChild(elem); - Text text= doc.createTextNode(PEPSFirstname); + Text text= doc.createTextNode(representative); elem.appendChild(text); - } + } - if (PEPSFamilyname != null) { - Element elem = doc.createElementNS(SZRGW_NS, "szrgw:Familyname"); + if (represented != null) { + Element elem = doc.createElementNS(SZRGW_NS, "szrgw:Represented"); pepsDataElem.appendChild(elem); - Text text= doc.createTextNode(PEPSFamilyname); + Text text= doc.createTextNode(represented); elem.appendChild(text); } - if (PEPSDateOfBirth != null) { - Element elem = doc.createElementNS(SZRGW_NS, "szrgw:DateOfBirth"); + if (mandateContent != null) { + Element elem = doc.createElementNS(SZRGW_NS, "szrgw:MandateContent"); pepsDataElem.appendChild(elem); - Text text= doc.createTextNode(PEPSDateOfBirth); + Text text= doc.createTextNode(mandateContent); elem.appendChild(text); } } @@ -380,7 +331,27 @@ public class SZRGWClient { Text text= doc.createTextNode(signature); base64content.appendChild(text); } - + + if(representative != null && represented != null && mandateContent != null) { + Element mis = doc.createElementNS(SZRGW_NS, "szrgw:MIS"); + Element filters = doc.createElementNS(SZRGW_NS, "szrgw:Filters"); + mis.appendChild(filters); + Element target = doc.createElementNS(SZRGW_NS, "szrgw:Target"); + mis.appendChild(target); + Element friendlyName = doc.createElementNS(SZRGW_NS, "szrgw:OAFriendlyName"); + mis.appendChild(friendlyName); + getIdentityLink.appendChild(mis); + +// TODO fetch data from oa params +// String moasessionid = req.getParameter(MOAIDAuthConstants.PARAM_SESSIONID); +// moasessionid = StringEscapeUtils.escapeHtml(moasessionid); +// AuthenticationSession moasession = AuthenticationSessionStoreage.getSession(moasessionid); +// OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(moasession.getPublicOAURLPrefix()); +// if (oaParam == null) +// throw new AuthenticationException("auth.00", new Object[] { moasession.getPublicOAURLPrefix() }); +// Text text = doc.createTextNode(oaParam.getFriendlyName()); + } + return doc; } catch (ParserConfigurationException e) { throw new SZRGWClientException(e); -- cgit v1.2.3 From ef85e5437f8d228978c1eaf9311aa97a292da4fa Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Sun, 26 Jan 2014 16:54:33 +0100 Subject: moved XMLUtil to more reasonable place --- .../moa/id/auth/AuthenticationServer.java | 3 +- .../auth/stork/PEPSConnectorResponseVerifier.java | 2 +- .../moa/id/auth/stork/STORKResponseProcessor.java | 3 +- .../id/config/legacy/BuildFromLegacyConfig.java | 2 +- .../moa/id/config/stork/STORKConfig.java | 2 - .../pvp2x/verification/SAMLVerifierMOASP.java | 2 +- .../at/gv/egovernment/moa/id/util/XMLUtil.java | 143 +++++++++++++++++++++ .../java/eu/stork/vidp/messages/util/XMLUtil.java | 143 --------------------- 8 files changed, 150 insertions(+), 150 deletions(-) create mode 100644 id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/XMLUtil.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/XMLUtil.java diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index fe23b545f..b8a0fe678 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -122,6 +122,8 @@ import at.gv.egovernment.moa.id.storage.DBExceptionStoreImpl; import at.gv.egovernment.moa.id.util.HTTPUtils; import at.gv.egovernment.moa.id.util.MOAIDMessageProvider; import at.gv.egovernment.moa.id.util.Random; +import at.gv.egovernment.moa.id.util.SSLUtils; +import at.gv.egovernment.moa.id.util.XMLUtil; import at.gv.egovernment.moa.id.util.client.mis.simple.MISMandate; import at.gv.egovernment.moa.logging.LogMsg; import at.gv.egovernment.moa.logging.Logger; @@ -140,7 +142,6 @@ import eu.stork.peps.auth.commons.PersonalAttributeList; import eu.stork.peps.auth.commons.STORKAuthnRequest; import eu.stork.peps.auth.engine.STORKSAMLEngine; import eu.stork.peps.exceptions.STORKSAMLEngineException; -import eu.stork.vidp.messages.util.XMLUtil; /** * API for MOA ID Authentication Service.
    {@link AuthenticationSession} is diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/PEPSConnectorResponseVerifier.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/PEPSConnectorResponseVerifier.java index f78067b5f..b3a707134 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/PEPSConnectorResponseVerifier.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/PEPSConnectorResponseVerifier.java @@ -40,11 +40,11 @@ import at.gv.egovernment.moa.id.auth.invoke.SignatureVerificationInvoker; import at.gv.egovernment.moa.id.auth.parser.VerifyXMLSignatureResponseParser; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; +import at.gv.egovernment.moa.id.util.XMLUtil; import at.gv.egovernment.moa.logging.Logger; import eu.stork.mw.messages.saml.STORKResponse; import eu.stork.vidp.messages.exception.SAMLValidationException; import eu.stork.vidp.messages.util.SAMLUtil; -import eu.stork.vidp.messages.util.XMLUtil; /** * Verifies the SMAL response according to the STORK specification diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index e2112a4d9..ab62c2718 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -35,6 +35,8 @@ import at.gv.egovernment.moa.id.auth.exception.ParseException; import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser; import at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse; import at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.SZRGWClientException; +import at.gv.egovernment.moa.id.config.ConfigurationException; +import at.gv.egovernment.moa.id.util.XMLUtil; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.Constants; import at.gv.egovernment.moa.util.DateTimeUtils; @@ -43,7 +45,6 @@ import eu.stork.mw.messages.saml.STORKResponse; import eu.stork.peps.auth.commons.IPersonalAttributeList; import eu.stork.vidp.messages.common.STORKConstants; import eu.stork.vidp.messages.util.SAMLUtil; -import eu.stork.vidp.messages.util.XMLUtil; /** * diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java index 7ef043abe..407e7da52 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java @@ -18,7 +18,6 @@ import org.opensaml.saml2.metadata.RequestedAttribute; import org.w3c.dom.Element; import eu.stork.vidp.messages.util.SAMLUtil; -import eu.stork.vidp.messages.util.XMLUtil; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; @@ -67,6 +66,7 @@ import at.gv.egovernment.moa.id.config.ConfigurationProvider; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; import at.gv.egovernment.moa.id.data.IssuerAndSerial; +import at.gv.egovernment.moa.id.util.XMLUtil; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.Base64Utils; import at.gv.egovernment.moa.util.DOMUtils; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java index e388b39e7..24c7ad264 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java @@ -20,8 +20,6 @@ import org.w3c.dom.Element; import org.xml.sax.SAXException; import eu.stork.vidp.messages.util.SAMLUtil; -import eu.stork.vidp.messages.util.XMLUtil; - import at.gv.egovernment.moa.id.commons.db.dao.config.SAMLSigningParameter; import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; import at.gv.egovernment.moa.id.commons.db.dao.config.SignatureVerificationParameterType; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/SAMLVerifierMOASP.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/SAMLVerifierMOASP.java index c744abdf5..495f5f0db 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/SAMLVerifierMOASP.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/SAMLVerifierMOASP.java @@ -15,8 +15,8 @@ import at.gv.egovernment.moa.id.auth.invoke.SignatureVerificationInvoker; import at.gv.egovernment.moa.id.auth.parser.VerifyXMLSignatureResponseParser; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; +import at.gv.egovernment.moa.id.util.XMLUtil; import at.gv.egovernment.moa.logging.Logger; -import eu.stork.vidp.messages.util.XMLUtil; public class SAMLVerifierMOASP implements ISAMLVerifier { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/XMLUtil.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/XMLUtil.java new file mode 100644 index 000000000..d87d510fa --- /dev/null +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/XMLUtil.java @@ -0,0 +1,143 @@ +/** + * + */ +package at.gv.egovernment.moa.id.util; + +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Helper class for XML processing + * @author bzwattendorfer + * + */ +public class XMLUtil { + + /** + * Transforms a string representation to a DOM representation + * @param xmlString XML as string + * @return DOM representation of String + * @throws ParserConfigurationException + * @throws SAXException + * @throws IOException + */ + public static Element stringToDOM(String xmlString) throws ParserConfigurationException, SAXException, IOException { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + + DocumentBuilder builder = dbf.newDocumentBuilder(); + + Reader reader = new StringReader(xmlString); + InputSource src = new InputSource(reader); + Document domDoc = builder.parse(src); + return domDoc.getDocumentElement(); + } + + /** + * Creates a new and empty XML document + * @return New XML document + * @throws ParserConfigurationException + */ + public static Document createNewDocument() throws ParserConfigurationException { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + + DocumentBuilder builder = dbf.newDocumentBuilder(); + return builder.newDocument(); + } + + /** + * Transforms an XML to a String + * @param node XML node + * @return String represenation of XML + */ + public static String printXML(Node node) { + TransformerFactory tfactory = TransformerFactory.newInstance(); + Transformer serializer; + try { + serializer = tfactory.newTransformer(); + + serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + serializer.setOutputProperty(OutputKeys.ENCODING,"UTF-8"); + + StringWriter output = new StringWriter(); + serializer.transform(new DOMSource(node), new StreamResult(output)); + return output.toString(); + } catch (TransformerException e) { + + throw new RuntimeException(e); + } + } + + /** + * Writes an XML element to a given file + * @param doc XML element + * @param filename Filename of the file where to write XML + */ + public static void writeXmlFile(Element doc, String filename) { + try { + + Source source = new DOMSource(doc); + File file = new File(filename); + Result result = new StreamResult(file); + + Transformer xformer = TransformerFactory.newInstance().newTransformer(); + xformer.transform(source, result); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Gets the first text value of a NodeList + * @param nList NodeList + * @return first text value of a NodeList + */ + public static String getFirstTextValueFromNodeList(NodeList nList) { + if (nList != null && nList.getLength() != 0) { + return nList.item(0).getTextContent(); + } + return null; + } + + /** + * Gets the first element of a Node + * @param parent Node + * @return first element of a Node + */ + public static Element getFirstElement(Node parent) { + Node n = parent.getFirstChild(); + while (n != null && n.getNodeType() != Node.ELEMENT_NODE) { + n = n.getNextSibling(); + } + if (n == null) { + return null; + } + return (Element)n; + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/XMLUtil.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/XMLUtil.java deleted file mode 100644 index 3ca38ec03..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/XMLUtil.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * - */ -package eu.stork.vidp.messages.util; - -import java.io.File; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * Helper class for XML processing - * @author bzwattendorfer - * - */ -public class XMLUtil { - - /** - * Transforms a string representation to a DOM representation - * @param xmlString XML as string - * @return DOM representation of String - * @throws ParserConfigurationException - * @throws SAXException - * @throws IOException - */ - public static Element stringToDOM(String xmlString) throws ParserConfigurationException, SAXException, IOException { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - - DocumentBuilder builder = dbf.newDocumentBuilder(); - - Reader reader = new StringReader(xmlString); - InputSource src = new InputSource(reader); - Document domDoc = builder.parse(src); - return domDoc.getDocumentElement(); - } - - /** - * Creates a new and empty XML document - * @return New XML document - * @throws ParserConfigurationException - */ - public static Document createNewDocument() throws ParserConfigurationException { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - - DocumentBuilder builder = dbf.newDocumentBuilder(); - return builder.newDocument(); - } - - /** - * Transforms an XML to a String - * @param node XML node - * @return String represenation of XML - */ - public static String printXML(Node node) { - TransformerFactory tfactory = TransformerFactory.newInstance(); - Transformer serializer; - try { - serializer = tfactory.newTransformer(); - - serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - serializer.setOutputProperty(OutputKeys.ENCODING,"UTF-8"); - - StringWriter output = new StringWriter(); - serializer.transform(new DOMSource(node), new StreamResult(output)); - return output.toString(); - } catch (TransformerException e) { - - throw new RuntimeException(e); - } - } - - /** - * Writes an XML element to a given file - * @param doc XML element - * @param filename Filename of the file where to write XML - */ - public static void writeXmlFile(Element doc, String filename) { - try { - - Source source = new DOMSource(doc); - File file = new File(filename); - Result result = new StreamResult(file); - - Transformer xformer = TransformerFactory.newInstance().newTransformer(); - xformer.transform(source, result); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Gets the first text value of a NodeList - * @param nList NodeList - * @return first text value of a NodeList - */ - public static String getFirstTextValueFromNodeList(NodeList nList) { - if (nList != null && nList.getLength() != 0) { - return nList.item(0).getTextContent(); - } - return null; - } - - /** - * Gets the first element of a Node - * @param parent Node - * @return first element of a Node - */ - public static Element getFirstElement(Node parent) { - Node n = parent.getFirstChild(); - while (n != null && n.getNodeType() != Node.ELEMENT_NODE) { - n = n.getNextSibling(); - } - if (n == null) { - return null; - } - return (Element)n; - } - - - -} -- cgit v1.2.3 From 133f63cef5bffb06e57896a1e83383a414d932df Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Sun, 26 Jan 2014 17:01:41 +0100 Subject: attribute name handling is more samlengine like --- .../egovernment/moa/id/auth/stork/STORKResponseProcessor.java | 10 +++++----- .../src/test/resources/StorkSamlEngine_demo.xml | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index ab62c2718..b8e823de0 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -326,11 +326,11 @@ public class STORKResponseProcessor { Logger.trace("Calling SZR Gateway with the following attributes:"); // fetch mandatory attributes - String citizenSignature = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_SIGNEDDOC, attributeList); - String eIdentifier = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_EIDENTIFIER, attributeList); - String givenName = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_GIVENNAME, attributeList); - String lastName = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_SURNAME, attributeList); - String dateOfBirth = getAttributeValue(STORKConstants.STORK_ATTRIBUTE_DATEOFBIRTH, attributeList); + String citizenSignature = getAttributeValue("signedDoc", attributeList); + String eIdentifier = getAttributeValue("eIdentifier", attributeList); + String givenName = getAttributeValue("givenName", attributeList); + String lastName = getAttributeValue("surname", attributeList); + String dateOfBirth = getAttributeValue("dateOfBirth", attributeList); if (!StringUtils.isEmpty(dateOfBirth)) { dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); } diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml index 0a28a5de8..f8fc4f91a 100644 --- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml @@ -87,5 +87,7 @@ http://www.stork.gov.eu/1.0/newAttribute2 http://www.stork.gov.eu/1.0/hasDegree http://www.stork.gov.eu/1.0/mandateContent + http://www.stork.gov.eu/1.0/representative + http://www.stork.gov.eu/1.0/represented \ No newline at end of file -- cgit v1.2.3 From 1ff6044b66a717edff42bd3a1c19a044e744c3b3 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Sun, 26 Jan 2014 17:09:46 +0100 Subject: cleanup --- .../moa/id/config/stork/STORKConfig.java | 51 ---------------------- 1 file changed, 51 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java index 24c7ad264..3282b8737 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java @@ -3,7 +3,6 @@ */ package at.gv.egovernment.moa.id.config.stork; -import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -12,17 +11,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; -import javax.xml.parsers.ParserConfigurationException; - -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.ws.message.encoder.MessageEncodingException; -import org.w3c.dom.Element; -import org.xml.sax.SAXException; - -import eu.stork.vidp.messages.util.SAMLUtil; -import at.gv.egovernment.moa.id.commons.db.dao.config.SAMLSigningParameter; import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; -import at.gv.egovernment.moa.id.commons.db.dao.config.SignatureVerificationParameterType; import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.StringUtils; @@ -57,54 +46,14 @@ public class STORKConfig { try { CPEPS moacpep = new CPEPS(cpep.getCountryCode(), new URL(cpep.getURL())); - - -// List attr = cpep.getAttributeValue(); -// -// ArrayList requestedAttributes = new ArrayList(); -// -// for (String e1 : attr) { -// Element element = XMLUtil.stringToDOM(e1); -// RequestedAttribute requestedAttribute = (RequestedAttribute) SAMLUtil.unmarshallMessage(element); -// requestedAttributes.add(requestedAttribute); -// } -// moacpep.setCountrySpecificRequestedAttributes(requestedAttributes); - cpepsMap.put(cpep.getCountryCode(), moacpep); } catch (MalformedURLException e) { Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " + cpep.getCountryCode() + " has an invalid URL and is ignored."); -// } catch (ParserConfigurationException e) { -// Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " -// + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); -// } catch (SAXException e) { -// Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " -// + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); -// } catch (IOException e) { -// Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " -// + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); -// } catch (MessageEncodingException e) { -// Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " -// + cpep.getCountryCode() + " has an invalid Attribute and is ignored."); } -// SAMLSigningParameter samlsign = stork.getSAMLSigningParameter(); // TODO Fix nullpointerexception when nothing is configured -// -// if (samlsign == null) { -// Logger.warn("Error in MOA-ID Configuration. No STORK->SAMLSigningParameter configuration found."); -// -// } else { -// SignatureVerificationParameterType sigverify = samlsign.getSignatureVerificationParameter(); -// -// if (sigverify == null) { -// Logger.warn("Error in MOA-ID Configuration. No STORK->SignatureVerificationParameter configuration found."); -// -// } else { -// sigverifyparam = new SignatureVerificationParameter(sigverify.getTrustProfileID()); -// } -// } attr = new ArrayList(); for(StorkAttribute current : stork.getAttributes()) { attr.add(current); -- cgit v1.2.3 From 8d18054deef38fa8a434f5049664c7219f5c9d7a Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Mon, 27 Jan 2014 10:27:20 +0100 Subject: cleaned legacy config from stork artifacts --- .../id/config/legacy/BuildFromLegacyConfig.java | 68 -------- .../moa/id/config/legacy/ConfigurationBuilder.java | 176 --------------------- .../moa/id/config/legacy/OAAuthParameter.java | 59 ------- 3 files changed, 303 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java index 407e7da52..f5fdbd90a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java @@ -14,15 +14,11 @@ import java.util.Map; import java.util.Properties; import java.util.Set; -import org.opensaml.saml2.metadata.RequestedAttribute; import org.w3c.dom.Element; -import eu.stork.vidp.messages.util.SAMLUtil; - import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; import at.gv.egovernment.moa.id.commons.db.dao.config.BKUURLS; -import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModeType; import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes; import at.gv.egovernment.moa.id.commons.db.dao.config.ConnectionParameterClientAuthType; @@ -32,8 +28,6 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities; import at.gv.egovernment.moa.id.commons.db.dao.config.GeneralConfiguration; import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber; import at.gv.egovernment.moa.id.commons.db.dao.config.IdentityLinkSigners; -import at.gv.egovernment.moa.id.commons.db.dao.config.KeyName; -import at.gv.egovernment.moa.id.commons.db.dao.config.KeyStore; import at.gv.egovernment.moa.id.commons.db.dao.config.LegacyAllowed; import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; import at.gv.egovernment.moa.id.commons.db.dao.config.MOAKeyBoxSelector; @@ -47,13 +41,9 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineMandates; import at.gv.egovernment.moa.id.commons.db.dao.config.Organization; import at.gv.egovernment.moa.id.commons.db.dao.config.PVP2; import at.gv.egovernment.moa.id.commons.db.dao.config.Protocols; -import at.gv.egovernment.moa.id.commons.db.dao.config.SAMLSigningParameter; import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates; import at.gv.egovernment.moa.id.commons.db.dao.config.SSO; -import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; import at.gv.egovernment.moa.id.commons.db.dao.config.SecurityLayer; -import at.gv.egovernment.moa.id.commons.db.dao.config.SignatureCreationParameterType; -import at.gv.egovernment.moa.id.commons.db.dao.config.SignatureVerificationParameterType; import at.gv.egovernment.moa.id.commons.db.dao.config.TemplateType; import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType; import at.gv.egovernment.moa.id.commons.db.dao.config.TimeOuts; @@ -66,7 +56,6 @@ import at.gv.egovernment.moa.id.config.ConfigurationProvider; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; import at.gv.egovernment.moa.id.data.IssuerAndSerial; -import at.gv.egovernment.moa.id.util.XMLUtil; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.Base64Utils; import at.gv.egovernment.moa.util.DOMUtils; @@ -283,63 +272,6 @@ public class BuildFromLegacyConfig { parseConnectionParameterClientAuth(foreignIDConnectionParameter); auth_foreign.setConnectionParameter(auth_foreign_connection); - //set STORK configuration - STORKConfig storkConfig = new STORKConfig(builder.buildSTORKSignatureCreationParameter(),builder.buildSTORKSignatureVerificationParameter(), builder.buildSTORKcPEPSMap()); - STORK auth_foreign_stork = new STORK(); - auth_foreign.setSTORK(auth_foreign_stork); - - //set CPEPS - Map map = storkConfig.getCpepsMap(); - Set map_keys = map.keySet(); - List auth_foreign_stork_cpeps = new ArrayList(); - for (String key : map_keys) { - CPEPS cpep = new CPEPS(); - cpep.setCountryCode(map.get(key).getCountryCode()); - cpep.setURL(map.get(key).getPepsURL().toExternalForm()); //check correctness!!!! - - List cpep_reqs = new ArrayList(); - - List map1 = map.get(key).getCountrySpecificRequestedAttributes(); - for (RequestedAttribute e1 : map1) { - Element element = SAMLUtil.marshallMessage(e1); - cpep_reqs.add(XMLUtil.printXML(element)); - } - cpep.setAttributeValue(cpep_reqs); - auth_foreign_stork_cpeps.add(cpep); - } - auth_foreign_stork.setCPEPS(auth_foreign_stork_cpeps); - - - //set SAMLSigningParameter - if (storkConfig.getSignatureCreationParameter() != null && - storkConfig.getSignatureVerificationParameter() != null) { - SAMLSigningParameter auth_foreign_stork_samlSign = new SAMLSigningParameter(); - auth_foreign_stork.setSAMLSigningParameter(auth_foreign_stork_samlSign); - - SignatureCreationParameterType stork_saml_creat = new SignatureCreationParameterType(); - auth_foreign_stork_samlSign.setSignatureCreationParameter(stork_saml_creat); - KeyStore stork_saml_creat_keystore = new KeyStore(); - stork_saml_creat.setKeyStore(stork_saml_creat_keystore); - stork_saml_creat_keystore.setPassword(storkConfig.getSignatureCreationParameter().getKeyStorePassword()); - stork_saml_creat_keystore.setValue(storkConfig.getSignatureCreationParameter().getKeyStorePath()); - KeyName stork_saml_creat_keyname = new KeyName(); - stork_saml_creat.setKeyName(stork_saml_creat_keyname); - stork_saml_creat_keyname.setValue(storkConfig.getSignatureCreationParameter().getKeyName()); - stork_saml_creat_keyname.setPassword(storkConfig.getSignatureCreationParameter().getKeyPassword()); - - - - SignatureVerificationParameterType stork_saml_verify = new SignatureVerificationParameterType(); - auth_foreign_stork_samlSign.setSignatureVerificationParameter(stork_saml_verify); - stork_saml_verify.setTrustProfileID(storkConfig.getSignatureVerificationParameter().getTrustProfileID()); - - } - - //TODO: check correctness - //set QualityAuthenticationAssurance - //set RequestedAttbutes - - //set OnlineMandates config ConnectionParameter onlineMandatesConnectionParameter = builder.buildOnlineMandatesConnectionParameter(); if (onlineMandatesConnectionParameter != null) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/ConfigurationBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/ConfigurationBuilder.java index 3abc94b02..525c5a24e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/ConfigurationBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/ConfigurationBuilder.java @@ -30,8 +30,6 @@ import iaik.utils.RFC2253NameParserException; import java.io.IOException; import java.math.BigInteger; -import java.net.MalformedURLException; -import java.net.URL; import java.security.Principal; import java.util.ArrayList; import java.util.HashMap; @@ -41,8 +39,6 @@ import java.util.List; import java.util.Map; import java.util.Vector; -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.ws.message.encoder.MessageEncodingException; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -56,9 +52,7 @@ import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.legacy.OAAuthParameter; import at.gv.egovernment.moa.id.config.legacy.VerifyInfoboxParameter; import at.gv.egovernment.moa.id.config.legacy.VerifyInfoboxParameters; -import at.gv.egovernment.moa.id.config.legacy.CPEPS; import at.gv.egovernment.moa.id.config.legacy.SignatureCreationParameter; -import at.gv.egovernment.moa.id.config.legacy.SignatureVerificationParameter; import at.gv.egovernment.moa.id.data.IssuerAndSerial; import at.gv.egovernment.moa.id.util.MOAIDMessageProvider; import at.gv.egovernment.moa.logging.Logger; @@ -66,15 +60,9 @@ import at.gv.egovernment.moa.util.BoolUtils; import at.gv.egovernment.moa.util.Constants; import at.gv.egovernment.moa.util.DOMUtils; import at.gv.egovernment.moa.util.FileUtils; -import at.gv.egovernment.moa.util.MiscUtil; import at.gv.egovernment.moa.util.StringUtils; import at.gv.egovernment.moa.util.XPathException; import at.gv.egovernment.moa.util.XPathUtils; -import eu.stork.vidp.messages.builder.STORKMessagesBuilder; -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; -import eu.stork.vidp.messages.stork.RequestedAttributes; -import eu.stork.vidp.messages.util.SAMLUtil; /** * A class that builds configuration data from a DOM based representation. @@ -1218,170 +1206,6 @@ public List getTrustedTemplateURLs() { } - /** - * Creates a SignatureVerificationParameter object from the MOA-ID configuration - * This configuration object contains the TrustProfile to be used for signature verification (STORK SAML Signature Verification) - * - * @return TrustProfileID for signature verification (STORK SAML Signature Verification) - */ - public SignatureVerificationParameter buildSTORKSignatureVerificationParameter() { - - Logger.debug("Loading STORK signature verification parameters."); - - Element signatureVerificationParameterElement = (Element)XPathUtils.selectSingleNode(configElem_, AUTH_FOREIGN_IDENTITIES_STORK_SIGNATURE_VERIFICATION_PARAMETER); - if (signatureVerificationParameterElement == null) { - Logger.debug("No STORK verification parameters found, " +AUTH_FOREIGN_IDENTITIES_STORK_SIGNATURE_VERIFICATION_PARAMETER + "is missing."); - return null; - } - - SignatureVerificationParameter signatureVerificationParameter = new SignatureVerificationParameter(); - - String trustProfileID = XPathUtils.getElementValue(signatureVerificationParameterElement, AUTH_FOREIGN_IDENTITIES_STORK_TRUSTPROFILE_ID, null); - if (StringUtils.isEmpty(trustProfileID)) { - Logger.error(AUTH_FOREIGN_IDENTITIES_STORK_TRUSTPROFILE_ID + "is missing."); - return null; - } - Logger.trace("Using the following MOA-SP TrustProfile for STORK SAML signature verification: " + trustProfileID); - signatureVerificationParameter.setTrustProfileID(trustProfileID); - - Logger.info("STORK signature verification parameters loaded."); - - return signatureVerificationParameter; - } - - /** - * Builds a C-PEPS object from configuration - * @param cpepsElement DOM Element of C-PEPS from configuration - * @return C-PEPS object - */ - public CPEPS buildSTORKCpeps(Element cpepsElement) { - - String countryCode = cpepsElement.getAttribute(AUTH_FOREIGN_IDENTITIES_STORK_CPEPS_COUNTRY_CODE); - String cpepsURLString = cpepsElement.getAttribute(AUTH_FOREIGN_IDENTITIES_STORK_CPEPS_URL); - if (StringUtils.isEmpty(countryCode)) { - Logger.error(AUTH_FOREIGN_IDENTITIES_STORK_CPEPS_COUNTRY_CODE + "is missing."); - return null; - } - if (StringUtils.isEmpty(cpepsURLString)) { - Logger.error(AUTH_FOREIGN_IDENTITIES_STORK_CPEPS_URL + "is missing."); - return null; - } - - URL cpepsURL; - try { - cpepsURL = new URL(cpepsURLString); - } catch (MalformedURLException e) { - Logger.error("Provided CPEPS-URL (" + cpepsURLString + ") for country " + countryCode + " is not a URL", e); - return null; - } - CPEPS cpeps = new CPEPS(countryCode, cpepsURL); - Logger.debug("Adding C-PEPS for country: " + cpeps.getCountryCode() + ", URL: " + cpeps.getPepsURL()); - - Element reqAttributeElement; - NodeIterator reqAttributeIterator = XPathUtils.selectNodeIterator(cpepsElement, AUTH_FOREIGN_IDENTITIES_STORK_CPEPS_REQUESTED_ATTRIBUTES); - - while ((reqAttributeElement = (Element) reqAttributeIterator.nextNode()) != null) { - RequestedAttribute requestedAttribute; - try { - requestedAttribute = (RequestedAttribute) SAMLUtil.unmarshallMessage(reqAttributeElement); - } catch (MessageEncodingException e) { - Logger.error("Provided RequestedAttributes for CPEPS from country " + countryCode + " is malformed.", e); - return null; - } - //only add if STORK attribute is correct - if (STORKConstants.FULL_STORK_ATTRIBUTE_SET.contains(requestedAttribute.getName())) { - cpeps.addCountrySpecificRequestedAttribute(requestedAttribute); - Logger.debug("Adding also country specific requested attribute for C-PEPS (" + countryCode + "): " + requestedAttribute.getName() + ", isRequired: " + requestedAttribute.isRequired()); - } else { - Logger.warn("Skipping addition of requested STORK Attribute, attribute unknown : " + requestedAttribute.getName()); - } - - } - - return cpeps; - } - - /** - * Builds the supported C-PEPS Map from configuration - * @return Map of C-PEPS - */ - public Map buildSTORKcPEPSMap() { - - Logger.debug("Loading STORK C-PEPS information"); - - Map cpepsMap = new HashMap(); - - NodeIterator cpepsIterator = XPathUtils.selectNodeIterator(configElem_, AUTH_FOREIGN_IDENTITIES_STORK_CPEPS); - - Element cpepsElement; - CPEPS cpeps; - - while ((cpepsElement = (Element) cpepsIterator.nextNode()) != null) { - cpeps = buildSTORKCpeps(cpepsElement); - if (cpeps != null) { - cpepsMap.put(cpeps.getCountryCode(), cpeps); - } - } - - if(!cpepsMap.isEmpty()) { - Logger.info("STORK C-PEPS information loaded"); - } - - return cpepsMap; - - } - - /** - * Builds the required STORK QAALevel for this OA - * @param authComponentElement DOM Element of AuthComponent (from MOA configuration) - * @return STORK QAALevel for this OA - */ - public QualityAuthenticationAssuranceLevel buildOaSTORKQAALevel(Element authComponentElement) { - Element qaaLevelElement = (Element)XPathUtils.selectSingleNode(authComponentElement, OA_AUTH_COMPONENT_STORK_QAA); - - if (qaaLevelElement == null) return null; - - try { - QualityAuthenticationAssuranceLevel qaaLevel = (QualityAuthenticationAssuranceLevel) SAMLUtil.unmarshallMessage(qaaLevelElement); - return qaaLevel; - } catch (MessageEncodingException e) { - Logger.error("Could not build STORK QAALevel, using default."); - return null; - } - - } - - /** - * Builds the Requested Attributes specific for an OA - * @param authComponentElement DOM Element of AuthComponent (from MOA configuration) - * @return STORK RequestedAttributes for this OA - */ - public RequestedAttributes buildOaSTORKRequestedAttributes(Element authComponentElement) { - List reqAttributeList = new ArrayList(); - - - Element reqAttributeElement; - NodeIterator reqAttributeIterator = XPathUtils.selectNodeIterator(authComponentElement, OA_AUTH_COMPONENT_STORK_REQUESTED_ATTRIBUTE); - - while ((reqAttributeElement = (Element) reqAttributeIterator.nextNode()) != null) { - RequestedAttribute requestedAttribute; - try { - requestedAttribute = (RequestedAttribute) SAMLUtil.unmarshallMessage(reqAttributeElement); - } catch (MessageEncodingException e) { - Logger.error("Provided RequestedAttributes Online Application is malformed.", e); - return null; - } - //only add if STORK attribute is correct - if (STORKConstants.FULL_STORK_ATTRIBUTE_SET.contains(requestedAttribute.getName())) { - reqAttributeList.add(requestedAttribute); - } else { - Logger.warn("Skipping addition of requested STORK Attribute, attribute unknown : " + requestedAttribute.getName()); - } - } - - return STORKMessagesBuilder.buildRequestedAttributes(reqAttributeList); - } - /** * Method warn. * @param messageId to identify a country-specific message diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/OAAuthParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/OAAuthParameter.java index 3948522c0..7174e05dc 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/OAAuthParameter.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/OAAuthParameter.java @@ -24,15 +24,6 @@ package at.gv.egovernment.moa.id.config.legacy; -import java.util.ArrayList; - -import org.opensaml.saml2.metadata.RequestedAttribute; - -import eu.stork.vidp.messages.builder.STORKMessagesBuilder; -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; -import eu.stork.vidp.messages.stork.RequestedAttributes; - /** * Configuration parameters belonging to an online application, * to use with the MOA ID Auth component. @@ -129,22 +120,6 @@ public class OAAuthParameter extends OAParameter { */ private String identityLinkDomainIdentifierType; - /** - * STORK QAA Level, Default = 4 - */ - private QualityAuthenticationAssuranceLevel qaaLevel = STORKMessagesBuilder.buildQualityAuthenticationAssuranceLevel(4); - - /** - * STORK RequestedAttributes for Online Application - * Default RequestedAttributes are: eIdentifier, givenName, surname, dateOfBirth - */ - private RequestedAttributes requestedAttributes = STORKMessagesBuilder.buildRequestedAttributes( - STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_EIDENTIFIER, true, null), - STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_GIVENNAME, true, null), - STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_SURNAME, true, null), - STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_DATEOFBIRTH, false, null)); - - /** * Returns true if the Security Layer version is version 1.2, * otherwise false. @@ -464,38 +439,4 @@ public class OAAuthParameter extends OAParameter { return this.mandateProfiles; } - /** - * Returns the defined STORK QAALevel - * @return STORK QAALevel - */ - public QualityAuthenticationAssuranceLevel getQaaLevel() { - return qaaLevel; - } - - /** - * Sets the STORK QAALevel - * @param qaaLevel - */ - public void setQaaLevel(QualityAuthenticationAssuranceLevel qaaLevel) { - this.qaaLevel = qaaLevel; - } - - /** - * Returns the desired STORK Requested Attributes - * @return STORK Requested Attributes - */ - public RequestedAttributes getRequestedAttributes() { - return requestedAttributes; - } - - /** - * Sets the desired STORK Requested Attributes - * @param requestedAttributes - */ - public void setRequestedAttributes(RequestedAttributes requestedAttributes) { - this.requestedAttributes = requestedAttributes; - } - - - } -- cgit v1.2.3 From fdcc7df81a159284d6bcfcd94be28c6f08afc5e4 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Mon, 27 Jan 2014 14:09:32 +0100 Subject: fixed merge issue missing bracket --- .../src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java index 3282b8737..95ed628fa 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java @@ -52,6 +52,7 @@ public class STORKConfig { Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " + cpep.getCountryCode() + " has an invalid URL and is ignored."); } + } attr = new ArrayList(); -- cgit v1.2.3 From 09266016cbcb143d7b6e65d32b49b6b3d2cb53c0 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Mon, 27 Jan 2014 17:24:46 +0100 Subject: fixed issues after merge --- .../configuration/struts/action/EditOAAction.java | 7 ---- .../moa/id/demoOA/servlet/pvp2/BuildMetadata.java | 26 +++++++-------- .../id/demoOA/servlet/pvp2/DemoApplication.java | 15 ++++----- .../moa/id/auth/AuthenticationServer.java | 18 ++++++++++- id/server/moa-id-commons/pom.xml | 37 +++++++++++++++++++++- 5 files changed, 72 insertions(+), 31 deletions(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index ca027e578..b3788c26d 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -102,7 +102,6 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware, private OASAML1Config saml1OA = new OASAML1Config(); private OASSOConfig ssoOA = new OASSOConfig(); private OAOAuth20Config oauth20OA = new OAOAuth20Config(); - private OASTORKConfig storkOA; private OASTORKConfig storkOA = new OASTORKConfig(); private FormularCustomization formOA = new FormularCustomization(); @@ -930,12 +929,6 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware, sso.setSingleLogOutURL(ssoOA.getSingleLogOutURL()); - STORK stork = authoa.getSTORK(); - if (stork == null) { - // TODO: make stork configurable - - } - if (oauth20OA != null) { log.debug("Saving OAuth 2.0 configuration:"); OAOAUTH20 oaOAuth20 = authoa.getOAOAUTH20(); diff --git a/id/oa/src/main/java/at/gv/egovernment/moa/id/demoOA/servlet/pvp2/BuildMetadata.java b/id/oa/src/main/java/at/gv/egovernment/moa/id/demoOA/servlet/pvp2/BuildMetadata.java index f3821374a..efd22668c 100644 --- a/id/oa/src/main/java/at/gv/egovernment/moa/id/demoOA/servlet/pvp2/BuildMetadata.java +++ b/id/oa/src/main/java/at/gv/egovernment/moa/id/demoOA/servlet/pvp2/BuildMetadata.java @@ -20,7 +20,6 @@ import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.apache.log4j.Logger; import org.opensaml.common.impl.SecureRandomIdentifierGenerator; import org.opensaml.common.xml.SAMLConstants; import org.opensaml.saml2.core.NameIDType; @@ -50,13 +49,12 @@ import at.gv.egovernment.moa.id.demoOA.Constants; import at.gv.egovernment.moa.id.demoOA.exception.ConfigurationException; import at.gv.egovernment.moa.id.demoOA.utils.AttributeListBuilder; import at.gv.egovernment.moa.id.demoOA.utils.SAML2Utils; +import at.gv.egovernment.moa.logging.Logger; import at.iaik.commons.util.MiscUtil; public class BuildMetadata extends HttpServlet { private static final long serialVersionUID = 1L; - private static final Logger log = Logger.getLogger(BuildMetadata.class); - /** * @see HttpServlet#HttpServlet() */ @@ -88,7 +86,7 @@ public class BuildMetadata extends HttpServlet { String name = config.getPVP2MetadataEntitiesName(); if (MiscUtil.isEmpty(name)) { - log.info("NO Metadata EntitiesName configurated"); + Logger.info("NO Metadata EntitiesName configurated"); throw new ConfigurationException("NO Metadata EntitiesName configurated"); } @@ -104,7 +102,7 @@ public class BuildMetadata extends HttpServlet { if (!serviceURL.endsWith("/")) serviceURL = serviceURL + "/"; - log.debug("Set OnlineApplicationURL to " + serviceURL); + Logger.debug("Set OnlineApplicationURL to " + serviceURL); spEntityDescriptor.setEntityID(serviceURL); SPSSODescriptor spSSODescriptor = SAML2Utils @@ -126,7 +124,7 @@ public class BuildMetadata extends HttpServlet { config.getPVP2KeystoreMetadataKeyPassword().toCharArray()); - log.debug("Set Metadata key information"); + Logger.debug("Set Metadata key information"); //Set MetaData Signing key KeyDescriptor entitiesSignKeyDescriptor = SAML2Utils .createSAMLObject(KeyDescriptor.class); @@ -162,7 +160,7 @@ public class BuildMetadata extends HttpServlet { spSSODescriptor.getKeyDescriptors().add(encryKeyDescriptor); } else { - log.warn("No Assertion Encryption-Key defined. This setting is not recommended!"); + Logger.warn("No Assertion Encryption-Key defined. This setting is not recommended!"); } @@ -237,32 +235,32 @@ public class BuildMetadata extends HttpServlet { response.getOutputStream().close(); } catch (ConfigurationException e) { - log.warn("Configuration can not be loaded.", e); + Logger.warn("Configuration can not be loaded.", e); throw new ServletException("MetaData can not be created. Look into LogFiles for more details."); } catch (NoSuchAlgorithmException e) { - log.warn("Requested Algorithm could not found.", e); + Logger.warn("Requested Algorithm could not found.", e); throw new ServletException("MetaData can not be created. Look into LogFiles for more details."); } catch (ParserConfigurationException e) { - log.warn("PVP2 Metadata createn error", e); + Logger.warn("PVP2 Metadata createn error", e); throw new ServletException("MetaData can not be created. Look into LogFiles for more details."); } catch (TransformerConfigurationException e) { - log.warn("PVP2 Metadata createn error", e); + Logger.warn("PVP2 Metadata createn error", e); throw new ServletException("MetaData can not be created. Look into LogFiles for more details."); } catch (TransformerFactoryConfigurationError e) { - log.warn("PVP2 Metadata createn error", e); + Logger.warn("PVP2 Metadata createn error", e); throw new ServletException("MetaData can not be created. Look into LogFiles for more details."); } catch (TransformerException e) { - log.warn("PVP2 Metadata createn error", e); + Logger.warn("PVP2 Metadata createn error", e); throw new ServletException("MetaData can not be created. Look into LogFiles for more details."); } catch (Exception e) { - log.warn("Unspecific PVP2 Metadata createn error", e); + Logger.warn("Unspecific PVP2 Metadata createn error", e); throw new ServletException("MetaData can not be created. Look into LogFiles for more details."); } diff --git a/id/oa/src/main/java/at/gv/egovernment/moa/id/demoOA/servlet/pvp2/DemoApplication.java b/id/oa/src/main/java/at/gv/egovernment/moa/id/demoOA/servlet/pvp2/DemoApplication.java index 2d32ce9af..c3e61146e 100644 --- a/id/oa/src/main/java/at/gv/egovernment/moa/id/demoOA/servlet/pvp2/DemoApplication.java +++ b/id/oa/src/main/java/at/gv/egovernment/moa/id/demoOA/servlet/pvp2/DemoApplication.java @@ -11,7 +11,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.log4j.Logger; import org.opensaml.common.SAMLObject; import org.opensaml.common.binding.BasicSAMLMessageContext; import org.opensaml.common.xml.SAMLConstants; @@ -53,13 +52,13 @@ import at.gv.egovernment.moa.id.demoOA.Configuration; import at.gv.egovernment.moa.id.demoOA.PVPConstants; import at.gv.egovernment.moa.id.demoOA.utils.ApplicationBean; import at.gv.egovernment.moa.id.demoOA.utils.SAML2Utils; +import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.DOMUtils; public class DemoApplication extends HttpServlet { private static final long serialVersionUID = -2129228304760706063L; - private static final Logger log = Logger.getLogger(DemoApplication.class); @@ -73,7 +72,7 @@ public class DemoApplication extends HttpServlet { String method = request.getMethod(); HttpSession session = request.getSession(); if (session == null) { - log.info("NO HTTP Session"); + Logger.info("NO HTTP Session"); bean.setErrorMessage("NO HTTP session"); setAnser(request, response, bean); return; @@ -96,7 +95,7 @@ public class DemoApplication extends HttpServlet { Signature sign = samlResponse.getSignature(); if (sign == null) { - log.info("Only http POST Requests can be used"); + Logger.info("Only http POST Requests can be used"); bean.setErrorMessage("Only http POST Requests can be used"); setAnser(request, response, bean); return; @@ -126,7 +125,7 @@ public class DemoApplication extends HttpServlet { ExplicitKeySignatureTrustEngine trustEngine = new ExplicitKeySignatureTrustEngine(credentialResolver, keyInfoResolver); trustEngine.validate(sign, criteriaSet); - log.info("PVP2 Assertion is valid"); + Logger.info("PVP2 Assertion is valid"); if (samlResponse.getStatus().getStatusCode().getValue().equals(StatusCode.SUCCESS_URI)) { @@ -137,7 +136,7 @@ public class DemoApplication extends HttpServlet { if (encryAssertionList != null && encryAssertionList.size() > 0) { //decrypt assertions - log.debug("Found encryped assertion. Start decryption ..."); + Logger.debug("Found encryped assertion. Start decryption ..."); KeyStore keyStore = config.getPVP2KeyStore(); @@ -163,7 +162,7 @@ public class DemoApplication extends HttpServlet { } - log.debug("Assertion decryption finished. "); + Logger.debug("Assertion decryption finished. "); } else { saml2assertions = samlResponse.getAssertions(); @@ -219,7 +218,7 @@ public class DemoApplication extends HttpServlet { } } catch (Exception e) { - log.warn(e); + Logger.warn(e); bean.setErrorMessage("Internal Error: " + e.getMessage()); setAnser(request, response, bean); return; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index b8a0fe678..9ab96a726 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -135,6 +135,7 @@ import at.gv.egovernment.moa.util.MiscUtil; import at.gv.egovernment.moa.util.StringUtils; import at.gv.egovernment.moa.util.XPathUtils; import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest; +import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest.PEPSData; import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; import eu.stork.peps.auth.commons.PEPSUtil; import eu.stork.peps.auth.commons.PersonalAttribute; @@ -1712,6 +1713,21 @@ public class AuthenticationServer implements MOAIDAuthConstants { CreateIdentityLinkRequest request = new CreateIdentityLinkRequest(); request.setSignature(citizenSignature.getBytes()); + PEPSData data = new PEPSData(); + data.setDateOfBirth(PEPSDateOfBirth); + data.setFamilyname(PEPSFamilyname); + data.setFirstname(PEPSFirstname); + data.setIdentifier(PEPSIdentifier); + +// TODO add mandate data +// data.setRepresentative(representative); +// data.setRepresented(represented); +// data.setMandateContent(mandateContent); + request.setPEPSData(data); + + +// request.setMIS(value) + Logger.info("Starte Kommunikation mit dem Stammzahlenregister Gateway(" + connectionParameters.getUrl() + ")..."); CreateIdentityLinkResponse response = client.sentCreateIDLRequest(request , connectionParameters.getUrl()); @@ -1790,7 +1806,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws SZRGWClientException the sZRGW client exception * @throws ConfigurationException the configuration exception */ - public at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException, ConfigurationException { + public at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException { return getIdentityLink(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, signature, null, null, null); } diff --git a/id/server/moa-id-commons/pom.xml b/id/server/moa-id-commons/pom.xml index c3e850b11..d80e91e31 100644 --- a/id/server/moa-id-commons/pom.xml +++ b/id/server/moa-id-commons/pom.xml @@ -190,5 +190,40 @@ - + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.jvnet.hyperjaxb3 + + + maven-hyperjaxb3-plugin + + + [0.5.6,) + + + generate + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 98137f26f5b0bd33d178e16ea5ee9397f2cc2c0a Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Mon, 27 Jan 2014 17:42:26 +0100 Subject: refactored szrgw response type --- .../moa/id/auth/AuthenticationServer.java | 6 ++--- .../moa/id/auth/servlet/GetForeignIDServlet.java | 27 ++++++++-------------- .../moa/id/auth/stork/STORKResponseProcessor.java | 24 +++++++++---------- 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 9ab96a726..3dc2639d5 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1699,7 +1699,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws SZRGWClientException */ - public at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String citizenSignature, String represented, String representative, String mandateContent) throws SZRGWClientException { + public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String citizenSignature, String represented, String representative, String mandateContent) throws SZRGWClientException { SZRGWClient client = null; @@ -1790,7 +1790,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws SZRGWClientException the sZRGW client exception * @throws ConfigurationException the configuration exception */ - public at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse getIdentityLink(Element signature) throws SZRGWClientException, ConfigurationException { + public CreateIdentityLinkResponse getIdentityLink(Element signature) throws SZRGWClientException, ConfigurationException { return getIdentityLink(null, null, null, null, XMLHelper.nodeToString(signature), null, null, null); } @@ -1806,7 +1806,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws SZRGWClientException the sZRGW client exception * @throws ConfigurationException the configuration exception */ - public at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException { + public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException { return getIdentityLink(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, signature, null, null, null); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java index be307ae14..d42cd85dc 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java @@ -24,6 +24,7 @@ package at.gv.egovernment.moa.id.auth.servlet; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.security.cert.CertificateException; import java.util.Map; @@ -47,14 +48,14 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.parser.CreateXMLSignatureResponseParser; import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser; -import at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse; -import at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.SZRGWClientException; +import at.gv.egovernment.moa.id.client.SZRGWClientException; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.moduls.ModulUtils; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; import at.gv.egovernment.moa.id.util.ParamValidatorUtils; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; /** * Servlet requested for getting the foreign eID @@ -165,20 +166,12 @@ public class GetForeignIDServlet extends AuthServlet { CreateIdentityLinkResponse response = AuthenticationServer.getInstance().getIdentityLink(signature); - if (response.isError()) { - throw new SZRGWClientException(response.getError()); + if (null != response.getErrorResponse()){ + // TODO fix exception parameter + throw new SZRGWClientException(response.getErrorResponse().getErrorCode().toString(), null); } else { - - Element samlAssertion = response.getAssertion(); - - try { - System.out.println("PB: " + DOMUtils.serializeNode(samlAssertion)); - } catch (TransformerException e) { - e.printStackTrace(); - } - - IdentityLinkAssertionParser ilParser = new IdentityLinkAssertionParser(samlAssertion); + IdentityLinkAssertionParser ilParser = new IdentityLinkAssertionParser(new ByteArrayInputStream(response.getIdentityLink())); IdentityLink identitylink = ilParser.parseIdentityLink(); session.setIdentityLink(identitylink); @@ -225,9 +218,9 @@ public class GetForeignIDServlet extends AuthServlet { } catch (MOAIDException ex) { handleError(null, ex, req, resp, pendingRequestID); - } - catch (SZRGWClientException ex) { - handleError(null, ex, req, resp, pendingRequestID); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index b8e823de0..9dede7179 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -3,6 +3,7 @@ */ package at.gv.egovernment.moa.id.auth.stork; +import java.io.ByteArrayInputStream; import java.util.List; import java.util.Vector; @@ -33,14 +34,14 @@ import at.gv.egovernment.moa.id.auth.data.ExtendedSAMLAttributeImpl; import at.gv.egovernment.moa.id.auth.data.IdentityLink; import at.gv.egovernment.moa.id.auth.exception.ParseException; import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser; -import at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.CreateIdentityLinkResponse; -import at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw.SZRGWClientException; +import at.gv.egovernment.moa.id.client.SZRGWClientException; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.util.XMLUtil; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.Constants; import at.gv.egovernment.moa.util.DateTimeUtils; import at.gv.egovernment.moa.util.StringUtils; +import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; import eu.stork.mw.messages.saml.STORKResponse; import eu.stork.peps.auth.commons.IPersonalAttributeList; import eu.stork.vidp.messages.common.STORKConstants; @@ -354,18 +355,15 @@ public class STORKResponseProcessor { response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature); } - if (response.isError()) { - Logger.error("Receveid ErrorResponse from SZR Gateway."); - throw new SZRGWClientException(response.getError()); + + if (null != response.getErrorResponse()){ + // TODO fix exception parameter + throw new SZRGWClientException(response.getErrorResponse().getErrorCode().toString(), null); } else { - Logger.trace("Receveid Success Response from SZR Gateway."); - Element samlAssertion = response.getAssertion(); - - IdentityLinkAssertionParser ilParser = new IdentityLinkAssertionParser(samlAssertion); + IdentityLinkAssertionParser ilParser = new IdentityLinkAssertionParser(new ByteArrayInputStream(response.getIdentityLink())); identityLink = ilParser.parseIdentityLink(); - Logger.debug("Received Identity Link from SZR Gateway"); //TODO: is this ok? // if (StringUtils.isEmpty(identityLink.getDateOfBirth())) { @@ -379,9 +377,9 @@ public class STORKResponseProcessor { } catch (ParseException e) { Logger.error("Error parsing IdentityLink received from SZR-Gateway: ", e); throw new STORKException("Error parsing IdentityLink received from SZR-Gateway: ", e); - } catch (at.gv.egovernment.moa.id.client.SZRGWClientException e) { - Logger.error("Error connecting SZR-Gateway: ", e); - throw new STORKException("Error connecting SZR-Gateway: ", e); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); } return identityLink; -- cgit v1.2.3 From 04a2d507dfcf59dac15e542e391797e57a820c82 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Wed, 29 Jan 2014 14:02:05 +0100 Subject: complete workflow untested --- .../moa/id/auth/AuthenticationServer.java | 7 ++-- .../auth/builder/StartAuthenticationBuilder.java | 7 ++-- .../moa/id/auth/data/AuthenticationSession.java | 23 ++++++++++++- .../moa/id/auth/servlet/PEPSConnectorServlet.java | 40 +++++----------------- .../moa/id/auth/stork/STORKResponseProcessor.java | 37 +++++++++----------- .../moa/id/protocols/saml1/GetArtifactAction.java | 14 ++++++++ 6 files changed, 68 insertions(+), 60 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 3dc2639d5..f19881578 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1723,13 +1723,16 @@ public class AuthenticationServer implements MOAIDAuthConstants { // data.setRepresentative(representative); // data.setRepresented(represented); // data.setMandateContent(mandateContent); - request.setPEPSData(data); - + if(null != PEPSIdentifier) + request.setPEPSData(data); + + // TODO add MIS data // request.setMIS(value) Logger.info("Starte Kommunikation mit dem Stammzahlenregister Gateway(" + connectionParameters.getUrl() + ")..."); CreateIdentityLinkResponse response = client.sentCreateIDLRequest(request , connectionParameters.getUrl()); + return response; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/StartAuthenticationBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/StartAuthenticationBuilder.java index e4bf37417..3bc152ec8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/StartAuthenticationBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/StartAuthenticationBuilder.java @@ -36,8 +36,7 @@ public class StartAuthenticationBuilder { Logger.info("Starting authentication for a citizen of country: " + (StringUtils.isEmpty(moasession.getCcc()) ? "AT" : moasession.getCcc())); // STORK or normal authentication - //TODO: commented because npe was thrown - /*if (storkConfig.isSTORKAuthentication(moasession.getCcc())) { + if (storkConfig.isSTORKAuthentication(moasession.getCcc())) { //STORK authentication Logger.trace("Found C-PEPS configuration for citizen of country: " + moasession.getCcc()); Logger.debug("Starting STORK authentication"); @@ -45,13 +44,13 @@ public class StartAuthenticationBuilder { AuthenticationServer.startSTORKAuthentication(req, resp, moasession); return ""; - } else {*/ + } else { //normal MOA-ID authentication Logger.debug("Starting normal MOA-ID authentication"); String getIdentityLinkForm = AuthenticationServer.getInstance().startAuthentication(moasession, req); return getIdentityLinkForm; - //} + } } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java index 4a7676ec8..3ab6701c8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java @@ -26,6 +26,7 @@ import java.util.Vector; import org.w3c.dom.Element; +import eu.stork.peps.auth.commons.IPersonalAttributeList; import eu.stork.peps.auth.commons.STORKAuthnRequest; import at.gv.egovernment.moa.id.auth.validator.InfoboxValidator; @@ -254,7 +255,9 @@ public class AuthenticationSession implements Serializable { private VerifyXMLSignatureResponse XMLVerifySignatureResponse; private boolean isForeigner; - + + private IPersonalAttributeList storkAttributes; + // private String requestedProtocolURL = null; public String getModul() { @@ -962,6 +965,24 @@ public class AuthenticationSession implements Serializable { public void setAuthBlockTokken(String authBlockTokken) { this.authBlockTokken = authBlockTokken; } + + /** + * Memorizes the stork attribute list. + * + * @param personalAttributeList the new stork attributes + */ + public void setStorkAttributes(IPersonalAttributeList personalAttributeList) { + this.storkAttributes = personalAttributeList; + } + + /** + * Recalls the stork attribute list. + * + * @return the stork attributes + */ + public IPersonalAttributeList getStorkAttributes() { + return this.storkAttributes; + } /** // * @return the oAuth20SessionObject diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index f1ee4c181..f05180932 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -78,9 +78,6 @@ public class PEPSConnectorServlet extends AuthServlet { //No authentication session has been started before Logger.error("MOA-SessionID was not found, no previous AuthnRequest had been started"); throw new AuthenticationException("auth.02", new Object[] { moaSessionID }); - } else { - //We know user and MOA takes over session handling, invalidate HttpSession - httpSession.invalidate(); } pendingRequestID = AuthenticationSessionStoreage.getPendingRequestID(moaSessionID); @@ -192,49 +189,28 @@ public class PEPSConnectorServlet extends AuthServlet { Logger.info("Received Identity Link from SZR Gateway"); moaSession.setIdentityLink(identityLink); - Logger.debug("Adding addtional STORK attributes to MOA assertion"); - //add other stork attributes to MOA assertion - List moaExtendedSAMLAttibutes = STORKResponseProcessor.addAdditionalSTORKAttributes(storkAssertion.getAttributeStatements().get(0).getAttributes()); - moaSession.setExtendedSAMLAttributesOA(moaExtendedSAMLAttibutes); + Logger.debug("Adding addtional STORK attributes to MOA session"); + moaSession.setStorkAttributes(authnResponse.getPersonalAttributeList()); //We don't have BKUURL, setting from null to "Not applicable" moaSession.setBkuURL("Not applicable (STORK Authentication)"); - - Logger.debug("Starting to assemble MOA assertion"); - //produce MOA-Assertion and artifact - String samlArtifactBase64 = - AuthenticationServer.getInstance().getForeignAuthenticationData(moaSession); - Logger.info("MOA assertion assembled and SAML Artifact generated."); + + // free for single use + moaSession.setAuthenticatedUsed(false); + + // stork did the authentication step + moaSession.setAuthenticated(true); //session is implicit stored in changeSessionID!!!! String newMOASessionID = AuthenticationSessionStoreage.changeSessionID(moaSession); Logger.info("Changed MOASession " + moaSessionID + " to Session " + newMOASessionID); - Logger.info("Daten angelegt zu MOASession " + newMOASessionID); //redirect String redirectURL = null; - if (!samlArtifactBase64.equals("Redirect to Input Processor")) { - /*redirectURL = moaSession.getOAURLRequested(); - if (!moaSession.getBusinessService()) { - redirectURL = addURLParameter(redirectURL, PARAM_TARGET, URLEncoder.encode(moaSession.getTarget(), "UTF-8")); - } - redirectURL = addURLParameter(redirectURL, PARAM_SAMLARTIFACT, URLEncoder.encode(samlArtifactBase64, "UTF-8")); - redirectURL = response.encodeRedirectURL(redirectURL);*/ - redirectURL = new DataURLBuilder().buildDataURL(moaSession.getAuthURL(), ModulUtils.buildAuthURL(moaSession.getModul(), moaSession.getAction(), pendingRequestID), newMOASessionID); redirectURL = response.encodeRedirectURL(redirectURL); - } else { - - redirectURL = new DataURLBuilder().buildDataURL(moaSession.getAuthURL(), AuthenticationServer.REQ_PROCESS_VALIDATOR_INPUT, newMOASessionID); - } - - try { - AuthenticationSessionStoreage.storeSession(moaSession); - } catch (MOADatabaseException e) { - throw new MOAIDException("Session store error", null); - } response.setContentType("text/html"); response.setStatus(302); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 9dede7179..664d0cf57 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -14,7 +14,6 @@ import javax.xml.namespace.QName; import org.opensaml.common.binding.BasicSAMLMessageContext; import org.opensaml.saml2.binding.decoding.HTTPPostDecoder; import org.opensaml.saml2.core.Assertion; -import org.opensaml.saml2.core.Attribute; import org.opensaml.saml2.metadata.RequestedAttribute; import org.opensaml.ws.transport.http.HTTPInTransport; import org.opensaml.ws.transport.http.HTTPOutTransport; @@ -35,7 +34,6 @@ import at.gv.egovernment.moa.id.auth.data.IdentityLink; import at.gv.egovernment.moa.id.auth.exception.ParseException; import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser; import at.gv.egovernment.moa.id.client.SZRGWClientException; -import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.util.XMLUtil; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.Constants; @@ -44,6 +42,7 @@ import at.gv.egovernment.moa.util.StringUtils; import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; import eu.stork.mw.messages.saml.STORKResponse; import eu.stork.peps.auth.commons.IPersonalAttributeList; +import eu.stork.peps.auth.commons.PersonalAttribute; import eu.stork.vidp.messages.common.STORKConstants; import eu.stork.vidp.messages.util.SAMLUtil; @@ -389,33 +388,29 @@ public class STORKResponseProcessor { /** * Transforms additional STORK attributes to MOA Extended attributes - * @param storkAttributeList STORK attribute list + * @param iPersonalAttributeList STORK attribute list * @return */ - public static List addAdditionalSTORKAttributes(List storkAttributeList) { + public static List addAdditionalSTORKAttributes(IPersonalAttributeList iPersonalAttributeList) { List moaExtendedSAMLAttributeList = new Vector(); + if(null == iPersonalAttributeList) + return moaExtendedSAMLAttributeList; + Logger.trace("Adding the following attributes to MOA assertion: "); int count = 0; - //only add attributes different than eIdentifier, given name, surname, dateOfBirth, signedDoc - for (Attribute attribute : storkAttributeList) { - //attribute is not in default returned attribute set - if (!STORKConstants.DEFAULT_STORK_RETURNED_ATTRIBUTE_SET.contains(attribute.getName())) { - - String attributeValue = null; - if (!attribute.getAttributeValues().isEmpty()) { - //we have attribute value - attributeValue = SAMLUtil.getStringValueFromXMLObject(attribute.getAttributeValues().get(0)); - } - ExtendedSAMLAttribute extendedSAMLAttribute = - new ExtendedSAMLAttributeImpl(attribute.getName(), attributeValue, Constants.STORK_NS_URI, 0); - moaExtendedSAMLAttributeList.add(extendedSAMLAttribute); - count++; - Logger.trace("Additional attribute: " + attribute.getName()); - } + + for (PersonalAttribute attribute : iPersonalAttributeList) { + Object attributeValue = attribute.getValue(); + if (null == attributeValue) + attributeValue = attribute.getComplexValue(); + 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; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java index fa9dbe990..bf353bce4 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java @@ -1,12 +1,17 @@ package at.gv.egovernment.moa.id.protocols.saml1; +import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import at.gv.egovernment.moa.id.auth.AuthenticationServer; 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.exception.AuthenticationException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.servlet.RedirectServlet; +import at.gv.egovernment.moa.id.auth.stork.STORKResponseProcessor; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.data.AuthenticationData; @@ -48,6 +53,15 @@ public class GetArtifactAction implements IAction { oaParam, target); + // add other stork attributes to MOA assertion if available + if(null != session.getStorkAttributes()) { + List moaExtendedSAMLAttibutes = STORKResponseProcessor.addAdditionalSTORKAttributes(session.getStorkAttributes()); + session.setExtendedSAMLAttributesOA(moaExtendedSAMLAttibutes); + //produce MOA-Assertion and artifact + AuthenticationServer.getInstance().getForeignAuthenticationData(session); + Logger.info("MOA assertion assembled and SAML Artifact generated."); + } + String samlArtifactBase64 = saml1server.BuildSAMLArtifact(session, oaParam, authData); if (AuthenticationSessionStoreage.isSSOSession(session.getSessionID())) { -- cgit v1.2.3 From 85a983b556baaaa45ea79a4da232a1a72d323708 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Wed, 29 Jan 2014 15:13:42 +0100 Subject: enhanced samlengine for floating config location --- .../moa/id/auth/AuthenticationServer.java | 3 +- .../moa/id/auth/servlet/PEPSConnectorServlet.java | 2 +- .../peps/configuration/ConfigurationReader.java | 18 +++-- .../src/test/resources/SamlEngine.xml | 6 +- .../src/test/resources/SignModule_demo.xml | 12 --- .../src/test/resources/SignModule_outgoing.xml | 12 +++ .../src/test/resources/StorkSamlEngine_demo.xml | 93 ---------------------- .../test/resources/StorkSamlEngine_outgoing.xml | 93 ++++++++++++++++++++++ 8 files changed, 124 insertions(+), 115 deletions(-) delete mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_outgoing.xml delete mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_outgoing.xml diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index f19881578..204e7f724 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1920,11 +1920,12 @@ public class AuthenticationServer implements MOAIDAuthConstants { authnRequest.setEIDSectorShare(true); authnRequest.setCitizenCountryCode("LOCAL"); +// authnRequest.setCitizenCountryCode(moasession.getCcc()); Logger.debug("STORK AuthnRequest succesfully assembled."); - STORKSAMLEngine samlEngine = STORKSAMLEngine.getInstance("CONF0"); + STORKSAMLEngine samlEngine = STORKSAMLEngine.getInstance("outgoing"); try { authnRequest = samlEngine.generateSTORKAuthnRequest(authnRequest); } catch (STORKSAMLEngineException e) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index f05180932..4819b8219 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -97,7 +97,7 @@ public class PEPSConnectorServlet extends AuthServlet { } //Get SAMLEngine instance - STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF0"); + STORKSAMLEngine engine = STORKSAMLEngine.getInstance("outgoing"); STORKAuthnResponse authnResponse = null; try { diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java index 9ae8bb669..e9b067e76 100644 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java @@ -15,6 +15,7 @@ package eu.stork.peps.configuration; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; @@ -119,8 +120,14 @@ public final class ConfigurationReader { */ public static Map readConfiguration() throws SAMLEngineException { - - LOGGER.info("Init reader: " + ENGINE_CONF_FILE); + + // fetch base from system properties, give a default if there is nothing configured + String base = System.getProperty("eu.stork.samlengine.config.location"); + if(null != base) + if(!base.endsWith("/")) + base += "/"; + + LOGGER.info("Init reader: " + base + ENGINE_CONF_FILE); final Map instanceConfs = new HashMap(); @@ -137,9 +144,10 @@ public final class ConfigurationReader { builder = factory.newDocumentBuilder(); - engineConf = ConfigurationReader.class - .getResourceAsStream("/" + ENGINE_CONF_FILE); - + if(null != base) + engineConf = new FileInputStream(base + ENGINE_CONF_FILE); + else + engineConf = ConfigurationReader.class.getResourceAsStream("/" + ENGINE_CONF_FILE); document = builder.parse(engineConf); diff --git a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml index d9dcb34f8..48fd9adff 100644 --- a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml +++ b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml @@ -3,10 +3,10 @@ - + - + @@ -14,7 +14,7 @@ - + diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml deleted file mode 100644 index c7cee3af4..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks - local-demo - local-demo - CN=local-demo-cert, O=Indra, L=Madrid, ST=Spain, C=ES - 4BA89DB2 - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_outgoing.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_outgoing.xml new file mode 100644 index 000000000..c7cee3af4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_outgoing.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks + local-demo + local-demo + CN=local-demo-cert, O=Indra, L=Madrid, ST=Spain, C=ES + 4BA89DB2 + JKS + \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml deleted file mode 100644 index f8fc4f91a..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - http://www.stork.gov.eu/1.0/representative - http://www.stork.gov.eu/1.0/represented - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_outgoing.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_outgoing.xml new file mode 100644 index 000000000..f8fc4f91a --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_outgoing.xml @@ -0,0 +1,93 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + http://www.stork.gov.eu/1.0/representative + http://www.stork.gov.eu/1.0/represented + + \ No newline at end of file -- cgit v1.2.3 From 3e512ed4c85444fcbd3d364ffa48aa3291813b73 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 30 Jan 2014 13:14:34 +0100 Subject: supply organization details on representative case --- .../moa/id/auth/AuthenticationServer.java | 36 +++++++++++++++++----- .../moa/id/auth/stork/STORKResponseProcessor.java | 16 ++++++++-- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 204e7f724..d77119f4a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1699,7 +1699,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws SZRGWClientException */ - public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String citizenSignature, String represented, String representative, String mandateContent) throws SZRGWClientException { + public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String citizenSignature, String represented, String representative, String mandateContent, String organizationAddress, String organizationType) throws SZRGWClientException { SZRGWClient client = null; @@ -1712,20 +1712,19 @@ public class AuthenticationServer implements MOAIDAuthConstants { CreateIdentityLinkRequest request = new CreateIdentityLinkRequest(); request.setSignature(citizenSignature.getBytes()); - + PEPSData data = new PEPSData(); data.setDateOfBirth(PEPSDateOfBirth); data.setFamilyname(PEPSFamilyname); data.setFirstname(PEPSFirstname); data.setIdentifier(PEPSIdentifier); -// TODO add mandate data -// data.setRepresentative(representative); -// data.setRepresented(represented); -// data.setMandateContent(mandateContent); + data.setRepresentative(representative); + data.setRepresented(represented); + data.setMandateContent(mandateContent); - if(null != PEPSIdentifier) - request.setPEPSData(data); + data.setLegalPersonCanonicalRegisteredAddress(organizationAddress); + data.setLegalPersonTranslatableType(organizationType); // TODO add MIS data // request.setMIS(value) @@ -1812,6 +1811,27 @@ public class AuthenticationServer implements MOAIDAuthConstants { public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException { return getIdentityLink(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, signature, null, null, null); } + + /** + * SZR-GW Client interface. + * + * @param eIdentifier the e identifier + * @param givenName the given name + * @param lastName the last name + * @param dateOfBirth the date of birth + * @param citizenSignature the citizen signature + * @param representative the representative + * @param represented the represented + * @param mandate the mandate + * @return the identity link + * @throws SZRGWClientException the sZRGW client exception + */ + public CreateIdentityLinkResponse getIdentityLink(String eIdentifier, + String givenName, String lastName, String dateOfBirth, + String citizenSignature, String representative, String represented, + String mandate) throws SZRGWClientException { + return getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate, null, null); + } /** * Starts a MOA-ID authentication process using STORK diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 664d0cf57..e81adfb52 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -345,10 +345,20 @@ public class STORKResponseProcessor { String representative = getAttributeValue("representative", attributeList); String represented = getAttributeValue("represented", attributeList); String mandate = getAttributeValue("mandateContent", attributeList); + + // we definitely know we have a representation case here + // lets try if the represented is an organization + try { + String organizationAddress = getAttributeValue("canonicalRegisteredAddress", attributeList); + String organizationType = getAttributeValue("translateableType", attributeList); + + // if we got here, we have a natural person representing a legal person + response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate, organizationAddress, organizationType); + } catch(STORKException e1) { - // if we get here we have a representation case - response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate); - + // if we get here we have natural persons representing each other + response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate); + } } catch(STORKException e) { // we do not have a representation case response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature); -- cgit v1.2.3 From 58b19f33806927a753d76ff2d2f79e44353b0e03 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 30 Jan 2014 15:12:04 +0100 Subject: refactored attribute parsing --- .../moa/id/auth/AuthenticationServer.java | 59 +++++------------ .../moa/id/auth/servlet/PEPSConnectorServlet.java | 19 +----- .../moa/id/auth/stork/STORKResponseProcessor.java | 76 ++++++++++++++-------- 3 files changed, 67 insertions(+), 87 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index d77119f4a..5ae3d8e47 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1733,53 +1733,12 @@ public class AuthenticationServer implements MOAIDAuthConstants { CreateIdentityLinkResponse response = client.sentCreateIDLRequest(request , connectionParameters.getUrl()); return response; - - -// client.setAddress(connectionParameters.getUrl()); -// if (connectionParameters.getUrl().toLowerCase().startsWith("https:")) { -// Logger.debug("Initialisiere SSL Verbindung"); -// try { -// client.setSSLSocketFactory(SSLUtils.getSSLSocketFactory(AuthConfigurationProvider.getInstance(), connectionParameters)); -// } catch (IOException e) { -// Logger.error("Could not initialize SSL Factory", e); -// throw new SZRGWClientException("Could not initialize SSL Factory"); -// } catch (GeneralSecurityException e) { -// Logger.error("Could not initialize SSL Factory", e); -// throw new SZRGWClientException("Could not initialize SSL Factory"); -// } catch (PKIException e) { -// Logger.error("Could not initialize SSL Factory", e); -// throw new SZRGWClientException("Could not initialize SSL Factory"); -// } -// } } catch (ConfigurationException e) { Logger.warn(e); Logger.warn(MOAIDMessageProvider.getInstance().getMessage("config.12", null )); } -// // create request -// CreateIdentityLinkResponse response = null; -// Element request = null; -// try { -// Document doc = client.buildGetIdentityLinkRequest(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, signature); -// request = doc.getDocumentElement(); -// -// // send request -// response = client.createIdentityLinkResponse(request, connectionParameters.getUrl()); -// -// -// -// } catch (SZRGWClientException e) { -// // give him a second try - Nach dem Starten des Tomcat wird beim ersten Mal das Client-Zertifikat offenbar vom HTTPClient nicht mitgeschickt. -//// try { -//// response = client.createIdentityLinkResponse(request); -//// } -//// catch (SZRGWClientException e1) { -//// throw new SZRGWClientException(e1); -//// } -// } - - return null; } @@ -1811,6 +1770,24 @@ public class AuthenticationServer implements MOAIDAuthConstants { public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException { return getIdentityLink(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, signature, null, null, null); } + + /** + * Gets the identity link. + * + * @param citizenSignature the citizen signature + * @param representative the representative + * @param represented the represented + * @param mandate the mandate + * @param organizationAddress the organization address + * @param organizationType the organization type + * @return the identity link + * @throws SZRGWClientException + */ + public CreateIdentityLinkResponse getIdentityLink(String citizenSignature, + String representative, String represented, String mandateContent, + String organizationAddress, String organizationType) throws SZRGWClientException { + return getIdentityLink(null, null, null, null, citizenSignature, represented, representative, mandateContent, organizationAddress, organizationType); + } /** * SZR-GW Client interface. diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index 4819b8219..45e6ab816 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -137,29 +137,12 @@ public class PEPSConnectorServlet extends AuthServlet { Logger.debug("Found a preceeding STORK AuthnRequest to this MOA session: " + moaSessionID); -// Logger.debug("Starting validation of SAML assertion"); -// //verify SAML assertion - Assertion storkAssertion = authnResponse.getAssertions().get(0); -// try { -// STORKResponseProcessor.verifySTORKAssertion( -// storkAssertion, //assertion -// request.getRemoteAddr(), //IP address of user -// storkAuthnRequest.getID(), //ID of STORK AuthnRequest -// request.getRequestURL().toString(), //destination -// HTTPUtils.getBaseURL(request), //audience -// storkAuthnRequest.getRequestedAttributes()); //Requested Attributes -// } catch (STORKException e) { -// Logger.error("Failed to verify STORK SAML Assertion", e); -// throw new MOAIDException("stork.08", null); -// } -// -// Logger.info("SAML assertion succesfully verified!"); - Logger.debug("Starting extraction of signedDoc attribute"); //extract signed doc element and citizen signature Element citizenSignature = null; try { + Assertion storkAssertion = authnResponse.getAssertions().get(0); citizenSignature = STORKResponseProcessor.extractCitizenSignature(storkAssertion); moaSession.setAuthBlock(DOMUtils.serializeNode(citizenSignature)); moaSession.setSignerCertificate(AuthenticationServer.getCertificateFromXML(citizenSignature)); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index e81adfb52..466d86f87 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -296,6 +296,22 @@ public class STORKResponseProcessor { } + + /** + * Checks for attribute. + * + * @param attributeName the attribute name + * @param attributeList the attribute list + * @return true, if successful + */ + private static boolean hasAttribute(String attributeName, IPersonalAttributeList attributeList) { + try { + getAttributeValue(attributeName, attributeList); + return true; + } catch(STORKException e) { + return false; + } + } /** * helper for reading attributes. Handles logging and error handling. @@ -325,52 +341,56 @@ public class STORKResponseProcessor { public static IdentityLink connectToSZRGateway(IPersonalAttributeList attributeList) throws STORKException { Logger.trace("Calling SZR Gateway with the following attributes:"); - // fetch mandatory attributes - String citizenSignature = getAttributeValue("signedDoc", attributeList); - String eIdentifier = getAttributeValue("eIdentifier", attributeList); - String givenName = getAttributeValue("givenName", attributeList); - String lastName = getAttributeValue("surname", attributeList); - String dateOfBirth = getAttributeValue("dateOfBirth", attributeList); - if (!StringUtils.isEmpty(dateOfBirth)) { - dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); - } - - CreateIdentityLinkResponse response; + CreateIdentityLinkResponse identityLinkResponse = null; IdentityLink identityLink = null; try { Logger.trace("Starting call..."); - // do we have a case of representation? - try { + + // if there is no signedDoc attribute, we cannot go on + String citizenSignature = getAttributeValue("signedDoc", attributeList); + + // if we have a signedDoc we test for a representation case + if(hasAttribute("mandateContent", attributeList) || hasAttribute("representative", attributeList) || hasAttribute("represented", attributeList)) { + // we have a representation case String representative = getAttributeValue("representative", attributeList); String represented = getAttributeValue("represented", attributeList); String mandate = getAttributeValue("mandateContent", attributeList); - // we definitely know we have a representation case here - // lets try if the represented is an organization - try { + if(!hasAttribute("dateOfBirth", attributeList)) { + // if we get here, we have a natural person representing a legal person String organizationAddress = getAttributeValue("canonicalRegisteredAddress", attributeList); String organizationType = getAttributeValue("translateableType", attributeList); - // if we got here, we have a natural person representing a legal person - response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate, organizationAddress, organizationType); - } catch(STORKException e1) { + identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(citizenSignature, representative, represented, mandate, organizationAddress, organizationType); + } else { + // if we get here, we have a natural person representing another natural person + String eIdentifier = getAttributeValue("eIdentifier", attributeList); + String givenName = getAttributeValue("givenName", attributeList); + String lastName = getAttributeValue("surname", attributeList); + String dateOfBirth = getAttributeValue("dateOfBirth", attributeList); + if (!StringUtils.isEmpty(dateOfBirth)) + dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); - // if we get here we have natural persons representing each other - response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate); + identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate); } - } catch(STORKException e) { + } else { // we do not have a representation case - response = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature); + String eIdentifier = getAttributeValue("eIdentifier", attributeList); + String givenName = getAttributeValue("givenName", attributeList); + String lastName = getAttributeValue("surname", attributeList); + String dateOfBirth = getAttributeValue("dateOfBirth", attributeList); + if (!StringUtils.isEmpty(dateOfBirth)) + dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); + identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature); } - - - if (null != response.getErrorResponse()){ + + if (null != identityLinkResponse.getErrorResponse()){ // TODO fix exception parameter - throw new SZRGWClientException(response.getErrorResponse().getErrorCode().toString(), null); + throw new SZRGWClientException(identityLinkResponse.getErrorResponse().getErrorCode().toString(), null); } else { - IdentityLinkAssertionParser ilParser = new IdentityLinkAssertionParser(new ByteArrayInputStream(response.getIdentityLink())); + IdentityLinkAssertionParser ilParser = new IdentityLinkAssertionParser(new ByteArrayInputStream(identityLinkResponse.getIdentityLink())); identityLink = ilParser.parseIdentityLink(); Logger.debug("Received Identity Link from SZR Gateway"); -- cgit v1.2.3 From 1c72a260e3633eb8e411992ac25fc747ec71513c Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 30 Jan 2014 17:43:18 +0100 Subject: fixed samlengine config loading --- .../java/eu/stork/peps/auth/engine/core/impl/SignSW.java | 13 +++++++++++-- .../eu/stork/peps/configuration/ConfigurationCreator.java | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java index 9f0a88c84..4554a9586 100644 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java @@ -74,6 +74,7 @@ import org.slf4j.LoggerFactory; import eu.stork.peps.auth.engine.core.CustomAttributeQuery; import eu.stork.peps.auth.engine.core.SAMLEngineSignI; +import eu.stork.peps.configuration.ConfigurationReader; import eu.stork.peps.exceptions.SAMLEngineException; @@ -159,8 +160,16 @@ public class SignSW implements SAMLEngineSignI { throws SAMLEngineException { InputStream fileProperties = null; try { - fileProperties = SignSW.class.getResourceAsStream("/" - + fileConf); + // fetch base from system properties, give a default if there is nothing configured + String base = System.getProperty("eu.stork.samlengine.config.location"); + if(null != base) + if(!base.endsWith("/")) + base += "/"; + + if(null != base) + fileProperties = new FileInputStream(base + fileConf); + else + fileProperties = SignSW.class.getResourceAsStream("/" + fileConf); properties = new Properties(); properties.loadFromXML(fileProperties); diff --git a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java index 2fabff7d6..b40e3f7dd 100644 --- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java +++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java @@ -15,6 +15,7 @@ package eu.stork.peps.configuration; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; @@ -103,8 +104,16 @@ public final class ConfigurationCreator { LOGGER.info("Create file configuration properties to Stork Saml Engine."); InputStream fileEngineProp = null; try { - fileEngineProp = ConfigurationCreator.class - .getResourceAsStream("/" + fileName); + // fetch base from system properties, give a default if there is nothing configured + String base = System.getProperty("eu.stork.samlengine.config.location"); + if(null != base) + if(!base.endsWith("/")) + base += "/"; + + if(null != base) + fileEngineProp = new FileInputStream(base + fileName); + else + fileEngineProp = ConfigurationCreator.class.getResourceAsStream("/" + fileName); final Properties configuration = new Properties(); configuration.loadFromXML(fileEngineProp); return configuration; -- cgit v1.2.3 From b04ffb6167dca0a3d1c116953b23aebe1ddf4e32 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 30 Jan 2014 18:05:19 +0100 Subject: gender retrieval if not delivered by stork --- .../moa/id/auth/AuthenticationServer.java | 12 ++--- .../moa/id/auth/servlet/PEPSConnectorServlet.java | 54 ++++++++++++++++++++++ .../moa/id/auth/stork/STORKResponseProcessor.java | 7 ++- .../resources/resources/templates/fetchGender.html | 16 +++++++ 4 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 id/server/idserverlib/src/main/resources/resources/templates/fetchGender.html diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 5ae3d8e47..ec1762cbf 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1699,7 +1699,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws SZRGWClientException */ - public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String citizenSignature, String represented, String representative, String mandateContent, String organizationAddress, String organizationType) throws SZRGWClientException { + public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String gender, String citizenSignature, String represented, String representative, String mandateContent, String organizationAddress, String organizationType) throws SZRGWClientException { SZRGWClient client = null; @@ -1752,7 +1752,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws ConfigurationException the configuration exception */ public CreateIdentityLinkResponse getIdentityLink(Element signature) throws SZRGWClientException, ConfigurationException { - return getIdentityLink(null, null, null, null, XMLHelper.nodeToString(signature), null, null, null); + return getIdentityLink(null, null, null, null, null, XMLHelper.nodeToString(signature), null, null, null); } /** @@ -1768,7 +1768,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws ConfigurationException the configuration exception */ public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException { - return getIdentityLink(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, signature, null, null, null); + return getIdentityLink(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, null, signature, null, null, null); } /** @@ -1786,7 +1786,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { public CreateIdentityLinkResponse getIdentityLink(String citizenSignature, String representative, String represented, String mandateContent, String organizationAddress, String organizationType) throws SZRGWClientException { - return getIdentityLink(null, null, null, null, citizenSignature, represented, representative, mandateContent, organizationAddress, organizationType); + return getIdentityLink(null, null, null, null, null, citizenSignature, represented, representative, mandateContent, organizationAddress, organizationType); } /** @@ -1804,10 +1804,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws SZRGWClientException the sZRGW client exception */ public CreateIdentityLinkResponse getIdentityLink(String eIdentifier, - String givenName, String lastName, String dateOfBirth, + String givenName, String lastName, String dateOfBirth, String gender, String citizenSignature, String representative, String represented, String mandate) throws SZRGWClientException { - return getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate, null, null); + return getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, gender, citizenSignature, representative, represented, mandate, null, null); } /** diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index 45e6ab816..a1d38d488 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -1,6 +1,8 @@ package at.gv.egovernment.moa.id.auth.servlet; import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; @@ -9,6 +11,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; import org.opensaml.saml2.core.Assertion; import org.opensaml.saml2.core.StatusCode; import org.w3c.dom.Element; @@ -22,6 +27,7 @@ import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.stork.STORKException; import at.gv.egovernment.moa.id.auth.stork.STORKResponseProcessor; +import at.gv.egovernment.moa.id.auth.stork.VelocityProvider; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.moduls.ModulUtils; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; @@ -30,6 +36,7 @@ import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.DOMUtils; import at.gv.egovernment.moa.util.StringUtils; import eu.stork.peps.auth.commons.PEPSUtil; +import eu.stork.peps.auth.commons.PersonalAttribute; import eu.stork.peps.auth.commons.STORKAuthnRequest; import eu.stork.peps.auth.commons.STORKAuthnResponse; import eu.stork.peps.auth.engine.STORKSAMLEngine; @@ -154,12 +161,59 @@ public class PEPSConnectorServlet extends AuthServlet { Logger.debug("Foregin Citizen signature successfully extracted from STORK Assertion (signedDoc)"); Logger.debug("Citizen signature will be verified by SZR Gateway!"); + ////////////// incorporate gender from parameters if not in stork response + + PersonalAttribute gender = authnResponse.getPersonalAttributeList().get("gender"); + if(null == gender) { + String gendervalue = (String) request.getParameter("gender"); + if(null != gendervalue) { + gender = new PersonalAttribute(); + gender.setName("gender"); + ArrayList tmp = new ArrayList(); + tmp.add(gendervalue); + gender.setValue(tmp); + + authnResponse.getPersonalAttributeList().add(gender); + } + } + + ////////////////////////////////////////////////////////////////////////// + + Logger.debug("Starting connecting SZR Gateway"); //contact SZR Gateway IdentityLink identityLink = null; try { identityLink = STORKResponseProcessor.connectToSZRGateway(authnResponse.getPersonalAttributeList()); } catch (STORKException e) { + // this is really nasty but we work against the system here. We are supposed to get the gender attribute from + // stork. If we do not, we cannot register the person in the ERnP - we have to have the + // gender for the represented person. So here comes the dirty hack. + if(e.getMessage().equals("gender not found in response")) { + // fetch gender + + try { + Logger.trace("Initialize VelocityEngine..."); + + VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine(); + Template template = velocityEngine.getTemplate("/resources/templates/fetchGender.html"); + VelocityContext context = new VelocityContext(); + context.put("SAMLResponse", request.getParameter("SAMLResponse")); + context.put("action", request.getRequestURL()); + + StringWriter writer = new StringWriter(); + template.merge(context, writer); + +// response.setContentType("text/html"); + response.getOutputStream().write(writer.toString().getBytes()); + } catch (Exception e1) { + Logger.error("Error sending gender retrival form.", e1); + httpSession.invalidate(); + throw new MOAIDException("stork.10", null); + } + + return; + } Logger.error("Error connecting SZR Gateway", e); throw new MOAIDException("stork.10", null); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 466d86f87..5406dc0e1 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -369,10 +369,13 @@ public class STORKResponseProcessor { String givenName = getAttributeValue("givenName", attributeList); String lastName = getAttributeValue("surname", attributeList); String dateOfBirth = getAttributeValue("dateOfBirth", attributeList); + + // gender attribute is mandatory here because of some legal stuff +// String gender = getAttributeValue("gender", attributeList); if (!StringUtils.isEmpty(dateOfBirth)) dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); - identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, representative, represented, mandate); + identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, gender, citizenSignature, representative, represented, mandate); } } else { // we do not have a representation case @@ -406,6 +409,8 @@ public class STORKResponseProcessor { } catch (ParseException e) { Logger.error("Error parsing IdentityLink received from SZR-Gateway: ", e); throw new STORKException("Error parsing IdentityLink received from SZR-Gateway: ", e); + } catch(STORKException e) { + throw e; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/id/server/idserverlib/src/main/resources/resources/templates/fetchGender.html b/id/server/idserverlib/src/main/resources/resources/templates/fetchGender.html new file mode 100644 index 000000000..f47ee53ff --- /dev/null +++ b/id/server/idserverlib/src/main/resources/resources/templates/fetchGender.html @@ -0,0 +1,16 @@ + + + +
    +
    + +
    +

    Please indicate the gender of the represented.

    +
    + + +
    +
    + + + \ No newline at end of file -- cgit v1.2.3 From 8449c5ab138f0b7a1760cb5f2aa6db2eb9d0b22e Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 30 Jan 2014 19:04:02 +0100 Subject: added stork signature client api - untested --- id/server/idserverlib/pom.xml | 5 ++ .../moa/id/auth/AuthenticationServer.java | 36 ++++++--- .../moa/id/auth/servlet/PEPSConnectorServlet.java | 39 +++++----- .../1.0.0-SNAPSHOT/maven-metadata-local.xml | 12 +++ .../oasis-dss-api-1.0.0-SNAPSHOT.jar | Bin 0 -> 180095 bytes .../oasis-dss-api-1.0.0-SNAPSHOT.pom | 85 +++++++++++++++++++++ .../stork/oasis-dss-api/maven-metadata-local.xml | 12 +++ 7 files changed, 162 insertions(+), 27 deletions(-) create mode 100644 repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/maven-metadata-local.xml create mode 100644 repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/oasis-dss-api-1.0.0-SNAPSHOT.jar create mode 100644 repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/oasis-dss-api-1.0.0-SNAPSHOT.pom create mode 100644 repository/eu/stork/oasis-dss-api/maven-metadata-local.xml diff --git a/id/server/idserverlib/pom.xml b/id/server/idserverlib/pom.xml index 8a9cdd51f..245348d09 100644 --- a/id/server/idserverlib/pom.xml +++ b/id/server/idserverlib/pom.xml @@ -37,6 +37,11 @@ SamlEngine 1.1.0 + + eu.stork + oasis-dss-api + 1.0.0-SNAPSHOT + MOA.id.server moa-id-commons diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index ec1762cbf..decf166c4 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -58,6 +58,7 @@ import org.opensaml.common.IdentifierGenerator; import org.opensaml.common.impl.SecureRandomIdentifierGenerator; import org.opensaml.xml.util.Base64; import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -137,6 +138,11 @@ import at.gv.egovernment.moa.util.XPathUtils; import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest; import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest.PEPSData; import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; +import eu.stork.oasisdss.api.ApiUtils; +import eu.stork.oasisdss.api.ApiUtilsException; +import eu.stork.oasisdss.profile.DocumentType; +import eu.stork.oasisdss.profile.InputDocuments; +import eu.stork.oasisdss.profile.SignRequest; import eu.stork.peps.auth.commons.PEPSUtil; import eu.stork.peps.auth.commons.PersonalAttribute; import eu.stork.peps.auth.commons.PersonalAttributeList; @@ -1882,7 +1888,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { PersonalAttribute newAttribute = new PersonalAttribute(); newAttribute.setName("signedDoc"); List value = new ArrayList(); - value.add(generateDssSignRequest(Base64.encodeBytes(CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession).getBytes()), "application/xhtml+xml")); + value.add(generateDssSignRequest(CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession), "application/xhtml+xml")); newAttribute.setValue(value); attributeList.add(newAttribute); @@ -1978,18 +1984,28 @@ public class AuthenticationServer implements MOAIDAuthConstants { IdentifierGenerator idGenerator; try { idGenerator = new SecureRandomIdentifierGenerator(); - - return "" + - "" + - "" + - "" + text + "" + - "" + - "" + - ""; + + DocumentType doc = new DocumentType(); + doc.setBase64XML(Base64.encodeBytes(text.getBytes()).getBytes()); + + SignRequest request = new SignRequest(); + request.setInputDocuments(ApiUtils.createInputDocuments(doc)); + + request.setRequestID(idGenerator.generateIdentifier()); + + return ApiUtils.marshalToDocument(request).getTextContent(); } catch (NoSuchAlgorithmException e) { Logger.error("Cannot generate id", e); throw new RuntimeException(e); + } catch (ApiUtilsException e) { + Logger.error("Could not create SignRequest", e); + throw new RuntimeException(e); + } catch (DOMException e) { + Logger.error("Could not create SignRequest", e); + throw new RuntimeException(e); + } catch (ParserConfigurationException e) { + Logger.error("Could not create SignRequest", e); + throw new RuntimeException(e); } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index a1d38d488..3129c9e31 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -10,6 +10,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javax.xml.transform.stream.StreamSource; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; @@ -30,11 +31,15 @@ import at.gv.egovernment.moa.id.auth.stork.STORKResponseProcessor; import at.gv.egovernment.moa.id.auth.stork.VelocityProvider; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.moduls.ModulUtils; +import at.gv.egovernment.moa.id.proxy.parser.SAMLResponseParser; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; import at.gv.egovernment.moa.id.util.HTTPUtils; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.DOMUtils; import at.gv.egovernment.moa.util.StringUtils; +import eu.stork.oasisdss.api.ApiUtils; +import eu.stork.oasisdss.api.LightweightSourceResolver; +import eu.stork.oasisdss.profile.SignResponse; import eu.stork.peps.auth.commons.PEPSUtil; import eu.stork.peps.auth.commons.PersonalAttribute; import eu.stork.peps.auth.commons.STORKAuthnRequest; @@ -144,23 +149,6 @@ public class PEPSConnectorServlet extends AuthServlet { Logger.debug("Found a preceeding STORK AuthnRequest to this MOA session: " + moaSessionID); - Logger.debug("Starting extraction of signedDoc attribute"); - //extract signed doc element and citizen signature - Element citizenSignature = null; - try { - - Assertion storkAssertion = authnResponse.getAssertions().get(0); - citizenSignature = STORKResponseProcessor.extractCitizenSignature(storkAssertion); - moaSession.setAuthBlock(DOMUtils.serializeNode(citizenSignature)); - moaSession.setSignerCertificate(AuthenticationServer.getCertificateFromXML(citizenSignature)); - - } catch (Exception e) { - Logger.error("Could not extract citizen signature from C-PEPS", e); - throw new MOAIDException("stork.09", null); - } - Logger.debug("Foregin Citizen signature successfully extracted from STORK Assertion (signedDoc)"); - Logger.debug("Citizen signature will be verified by SZR Gateway!"); - ////////////// incorporate gender from parameters if not in stork response PersonalAttribute gender = authnResponse.getPersonalAttributeList().get("gender"); @@ -179,6 +167,23 @@ public class PEPSConnectorServlet extends AuthServlet { ////////////////////////////////////////////////////////////////////////// + Logger.debug("Starting extraction of signedDoc attribute"); + //extract signed doc element and citizen signature + String citizenSignature = null; + try { + citizenSignature = authnResponse.getPersonalAttributeList().get("signedDoc").getValue().get(0); + moaSession.setAuthBlock(citizenSignature); + + // FIXME untested + Element sepp = (Element) ApiUtils.unmarshal(new StreamSource(new java.io.StringReader(citizenSignature))); + moaSession.setSignerCertificate(AuthenticationServer.getCertificateFromXML(sepp)); + + } catch (Exception e) { + Logger.error("Could not extract citizen signature from C-PEPS", e); + throw new MOAIDException("stork.09", null); + } + Logger.debug("Foregin Citizen signature successfully extracted from STORK Assertion (signedDoc)"); + Logger.debug("Citizen signature will be verified by SZR Gateway!"); Logger.debug("Starting connecting SZR Gateway"); //contact SZR Gateway diff --git a/repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/maven-metadata-local.xml b/repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/maven-metadata-local.xml new file mode 100644 index 000000000..99d92cd77 --- /dev/null +++ b/repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/maven-metadata-local.xml @@ -0,0 +1,12 @@ + + + eu.stork + oasis-dss-api + 1.0.0-SNAPSHOT + + + true + + 20140130171508 + + diff --git a/repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/oasis-dss-api-1.0.0-SNAPSHOT.jar b/repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/oasis-dss-api-1.0.0-SNAPSHOT.jar new file mode 100644 index 000000000..5ad0cb42e Binary files /dev/null and b/repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/oasis-dss-api-1.0.0-SNAPSHOT.jar differ diff --git a/repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/oasis-dss-api-1.0.0-SNAPSHOT.pom b/repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/oasis-dss-api-1.0.0-SNAPSHOT.pom new file mode 100644 index 000000000..ef04f07c4 --- /dev/null +++ b/repository/eu/stork/oasis-dss-api/1.0.0-SNAPSHOT/oasis-dss-api-1.0.0-SNAPSHOT.pom @@ -0,0 +1,85 @@ + + 4.0.0 + oasis-dss-api + eu.stork + 1.0.0-SNAPSHOT + + + + org.codehaus.mojo + jaxb2-maven-plugin + 1.5 + + + oasis-dss + + xjc + + + + + + -npa + + ${project.basedir}/src/main/resources/schema/oasis-dss + oasis-dss-core-schema-v1.0-os.xsd + eu.stork.oasisdss.profile + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.6 + 1.6 + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-resources-plugin + 2.4 + + ${project.build.sourceEncoding} + + + + + + + UTF-8 + + + + log4j + log4j + 1.2.17 + + + xerces + xercesImpl + 2.11.0 + + provided + + + junit + junit + 4.11 + + + org.apache.commons + commons-io + 1.3.2 + + + com.sun.xml.ws + jaxws-rt + 2.1.7 + + + + \ No newline at end of file diff --git a/repository/eu/stork/oasis-dss-api/maven-metadata-local.xml b/repository/eu/stork/oasis-dss-api/maven-metadata-local.xml new file mode 100644 index 000000000..8c8297768 --- /dev/null +++ b/repository/eu/stork/oasis-dss-api/maven-metadata-local.xml @@ -0,0 +1,12 @@ + + + eu.stork + oasis-dss-api + 1.0.0-SNAPSHOT + + + 1.0.0-SNAPSHOT + + 20140130171508 + + -- cgit v1.2.3 From 20c7b74026da669ff560281e69b4df37392154fd Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 30 Jan 2014 20:49:58 +0100 Subject: supply MIS information to SZRGW --- .../moa/id/auth/AuthenticationServer.java | 45 ++++++++++++++++------ .../moa/id/auth/servlet/PEPSConnectorServlet.java | 21 +++++++++- .../moa/id/auth/stork/STORKResponseProcessor.java | 12 ++++-- 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index decf166c4..60b269059 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -135,9 +135,13 @@ import at.gv.egovernment.moa.util.FileUtils; import at.gv.egovernment.moa.util.MiscUtil; import at.gv.egovernment.moa.util.StringUtils; import at.gv.egovernment.moa.util.XPathUtils; +import at.gv.util.xsd.mis.MandateIdentifiers; +import at.gv.util.xsd.mis.Target; import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest; import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest.PEPSData; import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; +import at.gv.util.xsd.srzgw.MISType; +import at.gv.util.xsd.srzgw.MISType.Filters; import eu.stork.oasisdss.api.ApiUtils; import eu.stork.oasisdss.api.ApiUtilsException; import eu.stork.oasisdss.profile.DocumentType; @@ -1700,20 +1704,19 @@ public class AuthenticationServer implements MOAIDAuthConstants { /** * Does the request to the SZR-GW - * @param signature XMLDSIG signature + * @param oaFriendlyName + * @param signature XMLDSIG signature * @return Identity link assertion * @throws SZRGWClientException */ - public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String gender, String citizenSignature, String represented, String representative, String mandateContent, String organizationAddress, String organizationType) throws SZRGWClientException { + public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String gender, String citizenSignature, String represented, String representative, String mandateContent, String organizationAddress, String organizationType, String target, String oaFriendlyName, String filters) throws SZRGWClientException { - SZRGWClient client = null; - try { AuthConfigurationProvider authConf = AuthConfigurationProvider.getInstance(); ConnectionParameter connectionParameters = authConf.getForeignIDConnectionParameter(); - client = new SZRGWClient(connectionParameters); + SZRGWClient client = new SZRGWClient(connectionParameters); CreateIdentityLinkRequest request = new CreateIdentityLinkRequest(); @@ -1732,8 +1735,24 @@ public class AuthenticationServer implements MOAIDAuthConstants { data.setLegalPersonCanonicalRegisteredAddress(organizationAddress); data.setLegalPersonTranslatableType(organizationType); - // TODO add MIS data -// request.setMIS(value) + if(null != mandateContent) { + MISType mis = new MISType(); + + Target targetObject = new Target(); + targetObject.setValue(target); + mis.setTarget(targetObject); + + mis.setOAFriendlyName(oaFriendlyName); + + Filters filterObject = new Filters(); + MandateIdentifiers mandateIds = new MandateIdentifiers(); + for(String current : filters.split(",")) + mandateIds.getMandateIdentifier().add(current.trim()); + filterObject.setMandateIdentifiers(mandateIds); + mis.setFilters(filterObject); + + request.setMIS(mis); + } Logger.info("Starte Kommunikation mit dem Stammzahlenregister Gateway(" + connectionParameters.getUrl() + ")..."); CreateIdentityLinkResponse response = client.sentCreateIDLRequest(request , connectionParameters.getUrl()); @@ -1791,8 +1810,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { */ public CreateIdentityLinkResponse getIdentityLink(String citizenSignature, String representative, String represented, String mandateContent, - String organizationAddress, String organizationType) throws SZRGWClientException { - return getIdentityLink(null, null, null, null, null, citizenSignature, represented, representative, mandateContent, organizationAddress, organizationType); + String organizationAddress, String organizationType, String target, String oaFriendlyName, String filters) throws SZRGWClientException { + return getIdentityLink(null, null, null, null, null, + citizenSignature, represented, representative, mandateContent, organizationAddress, + organizationType, target, oaFriendlyName, filters); } /** @@ -1812,8 +1833,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { public CreateIdentityLinkResponse getIdentityLink(String eIdentifier, String givenName, String lastName, String dateOfBirth, String gender, String citizenSignature, String representative, String represented, - String mandate) throws SZRGWClientException { - return getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, gender, citizenSignature, representative, represented, mandate, null, null); + String mandate, String target, String oaFriendlyName, String filters) throws SZRGWClientException { + return getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, gender, + citizenSignature, representative, represented, mandate, null, + null, target, oaFriendlyName, filters); } /** diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index 3129c9e31..bd8c6420d 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -30,6 +30,8 @@ import at.gv.egovernment.moa.id.auth.stork.STORKException; import at.gv.egovernment.moa.id.auth.stork.STORKResponseProcessor; import at.gv.egovernment.moa.id.auth.stork.VelocityProvider; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; +import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; +import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.moduls.ModulUtils; import at.gv.egovernment.moa.id.proxy.parser.SAMLResponseParser; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; @@ -185,11 +187,28 @@ public class PEPSConnectorServlet extends AuthServlet { Logger.debug("Foregin Citizen signature successfully extracted from STORK Assertion (signedDoc)"); Logger.debug("Citizen signature will be verified by SZR Gateway!"); + Logger.debug("fetching OAParameters from database"); + + //read configuration paramters of OA + AuthenticationSession moasession; + try { + moasession = AuthenticationSessionStoreage.getSession(moaSessionID); + } catch (MOADatabaseException e2) { + Logger.error("could not retrieve moa session"); + throw new AuthenticationException("auth.01", null); + } + OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(moasession.getPublicOAURLPrefix()); + if (oaParam == null) + throw new AuthenticationException("auth.00", new Object[] { moasession.getPublicOAURLPrefix() }); + Logger.debug("Starting connecting SZR Gateway"); //contact SZR Gateway IdentityLink identityLink = null; try { - identityLink = STORKResponseProcessor.connectToSZRGateway(authnResponse.getPersonalAttributeList()); + identityLink = STORKResponseProcessor.connectToSZRGateway(authnResponse.getPersonalAttributeList(), + oaParam.getFriendlyName(), + oaParam.getTarget(), + oaParam.getMandateProfiles()); } catch (STORKException e) { // this is really nasty but we work against the system here. We are supposed to get the gender attribute from // stork. If we do not, we cannot register the person in the ERnP - we have to have the diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 5406dc0e1..8385c5dbe 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -334,11 +334,15 @@ public class STORKResponseProcessor { /** * Handels connection to SZR-GW and returns Identity Link on success + * @param oaFriendlyName + * @param target + * @param filters + * @param filter * @param iPersonalAttributeList Received attribute List in assertion * @return Identity Link * @throws STORKException */ - public static IdentityLink connectToSZRGateway(IPersonalAttributeList attributeList) throws STORKException { + public static IdentityLink connectToSZRGateway(IPersonalAttributeList attributeList, String oaFriendlyName, String target, String filters) throws STORKException { Logger.trace("Calling SZR Gateway with the following attributes:"); CreateIdentityLinkResponse identityLinkResponse = null; @@ -362,7 +366,7 @@ public class STORKResponseProcessor { String organizationAddress = getAttributeValue("canonicalRegisteredAddress", attributeList); String organizationType = getAttributeValue("translateableType", attributeList); - identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(citizenSignature, representative, represented, mandate, organizationAddress, organizationType); + identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(citizenSignature, representative, represented, mandate, organizationAddress, organizationType, target, oaFriendlyName, filters); } else { // if we get here, we have a natural person representing another natural person String eIdentifier = getAttributeValue("eIdentifier", attributeList); @@ -375,7 +379,9 @@ public class STORKResponseProcessor { if (!StringUtils.isEmpty(dateOfBirth)) dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); - identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, gender, citizenSignature, representative, represented, mandate); + identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, + givenName, lastName, dateOfBirth, gender, citizenSignature, representative, + represented, mandate, target, oaFriendlyName, filters); } } else { // we do not have a representation case -- cgit v1.2.3 From e1e410da00a399a8b059645a14a7848b39d3525c Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 30 Jan 2014 20:59:16 +0100 Subject: removed old saml-engine --- .../struts/action/ImportExportAction.java | 18 +- id/server/idserverlib/pom.xml | 7 - .../moa/id/auth/stork/STORKResponseProcessor.java | 189 --- id/server/stork-saml-engine/pom.xml | 92 -- .../stork/mw/messages/saml/STORKAuthnRequest.java | 139 -- .../eu/stork/mw/messages/saml/STORKResponse.java | 52 - .../messages/builder/STORKMessagesBuilder.java | 1367 -------------------- .../stork/vidp/messages/common/STORKBootstrap.java | 75 -- .../stork/vidp/messages/common/STORKConstants.java | 176 --- .../vidp/messages/exception/SAMLException.java | 60 - .../exception/SAMLValidationException.java | 60 - .../stork/vidp/messages/saml/STORKAttribute.java | 65 - .../vidp/messages/saml/STORKAttributeValue.java | 51 - .../stork/vidp/messages/saml/STORKExtensions.java | 78 -- .../messages/saml/STORKRequestedAttribute.java | 53 - .../messages/saml/impl/STORKAttributeBuilder.java | 60 - .../messages/saml/impl/STORKAttributeImpl.java | 63 - .../saml/impl/STORKAttributeMarshaller.java | 56 - .../saml/impl/STORKAttributeUnmarshaller.java | 58 - .../saml/impl/STORKAuthnRequestBuilder.java | 48 - .../messages/saml/impl/STORKAuthnRequestImpl.java | 170 --- .../saml/impl/STORKAuthnRequestMarshaller.java | 44 - .../saml/impl/STORKAuthnRequestUnmarshaller.java | 137 -- .../messages/saml/impl/STORKExtensionsBuilder.java | 45 - .../messages/saml/impl/STORKExtensionsImpl.java | 74 -- .../saml/impl/STORKExtensionsMarshaller.java | 32 - .../saml/impl/STORKExtensionsUnmarshaller.java | 58 - .../saml/impl/STORKRequestedAttributeBuilder.java | 57 - .../saml/impl/STORKRequestedAttributeImpl.java | 66 - .../impl/STORKRequestedAttributeUnmarshaller.java | 64 - .../messages/saml/impl/STORKResponseBuilder.java | 48 - .../vidp/messages/saml/impl/STORKResponseImpl.java | 59 - .../saml/impl/STORKResponseMarshaller.java | 44 - .../saml/impl/STORKResponseUnmarshaller.java | 51 - .../messages/stork/AuthenticationAttributes.java | 55 - .../vidp/messages/stork/CitizenCountryCode.java | 48 - .../vidp/messages/stork/EIDCrossBorderShare.java | 54 - .../vidp/messages/stork/EIDCrossSectorShare.java | 54 - .../stork/vidp/messages/stork/EIDSectorShare.java | 54 - .../stork/QualityAuthenticationAssuranceLevel.java | 48 - .../vidp/messages/stork/RequestedAttributes.java | 58 - .../stork/vidp/messages/stork/SPAuthRequest.java | 46 - .../eu/stork/vidp/messages/stork/SPCertEnc.java | 44 - .../eu/stork/vidp/messages/stork/SPCertSig.java | 44 - .../eu/stork/vidp/messages/stork/SPCertType.java | 49 - .../java/eu/stork/vidp/messages/stork/SPID.java | 48 - .../stork/vidp/messages/stork/SPInformation.java | 67 - .../stork/vidp/messages/stork/SpApplication.java | 48 - .../eu/stork/vidp/messages/stork/SpCountry.java | 48 - .../stork/vidp/messages/stork/SpInstitution.java | 48 - .../eu/stork/vidp/messages/stork/SpSector.java | 48 - .../stork/VIDPAuthenticationAttributes.java | 60 - .../impl/AuthenticationAttributesBuilder.java | 46 - .../stork/impl/AuthenticationAttributesImpl.java | 74 -- .../impl/AuthenticationAttributesMarshaller.java | 35 - .../impl/AuthenticationAttributesUnmarshaller.java | 52 - .../stork/impl/CitizenCountryCodeBuilder.java | 46 - .../stork/impl/CitizenCountryCodeImpl.java | 60 - .../stork/impl/CitizenCountryCodeMarshaller.java | 45 - .../stork/impl/CitizenCountryCodeUnmarshaller.java | 45 - .../stork/impl/EIDCrossBorderShareBuilder.java | 46 - .../stork/impl/EIDCrossBorderShareImpl.java | 80 -- .../stork/impl/EIDCrossBorderShareMarshaller.java | 45 - .../impl/EIDCrossBorderShareUnmarshaller.java | 45 - .../stork/impl/EIDCrossSectorShareBuilder.java | 46 - .../stork/impl/EIDCrossSectorShareImpl.java | 80 -- .../stork/impl/EIDCrossSectorShareMarshaller.java | 45 - .../impl/EIDCrossSectorShareUnmarshaller.java | 45 - .../messages/stork/impl/EIDSectorShareBuilder.java | 46 - .../messages/stork/impl/EIDSectorShareImpl.java | 80 -- .../stork/impl/EIDSectorShareMarshaller.java | 45 - .../stork/impl/EIDSectorShareUnmarshaller.java | 45 - ...QualityAuthenticationAssuranceLevelBuilder.java | 46 - .../QualityAuthenticationAssuranceLevelImpl.java | 60 - ...lityAuthenticationAssuranceLevelMarshaller.java | 45 - ...tyAuthenticationAssuranceLevelUnmarshaller.java | 45 - .../stork/impl/RequestedAttributesBuilder.java | 58 - .../stork/impl/RequestedAttributesImpl.java | 88 -- .../stork/impl/RequestedAttributesMarshaller.java | 40 - .../impl/RequestedAttributesUnmarshaller.java | 55 - .../messages/stork/impl/SPAuthRequestBuilder.java | 50 - .../messages/stork/impl/SPAuthRequestImpl.java | 76 -- .../stork/impl/SPAuthRequestMarshaller.java | 57 - .../stork/impl/SPAuthRequestUnmarshaller.java | 70 - .../vidp/messages/stork/impl/SPCertEncBuilder.java | 46 - .../vidp/messages/stork/impl/SPCertEncImpl.java | 39 - .../messages/stork/impl/SPCertEncMarshaller.java | 34 - .../messages/stork/impl/SPCertEncUnmarshaller.java | 33 - .../vidp/messages/stork/impl/SPCertSigBuilder.java | 46 - .../vidp/messages/stork/impl/SPCertSigImpl.java | 39 - .../messages/stork/impl/SPCertSigMarshaller.java | 34 - .../messages/stork/impl/SPCertSigUnmarshaller.java | 33 - .../vidp/messages/stork/impl/SPCertTypeImpl.java | 72 -- .../messages/stork/impl/SPCertTypeMarshaller.java | 34 - .../stork/impl/SPCertTypeUnmarshaller.java | 53 - .../vidp/messages/stork/impl/SPIDBuilder.java | 46 - .../stork/vidp/messages/stork/impl/SPIDImpl.java | 60 - .../vidp/messages/stork/impl/SPIDMarshaller.java | 45 - .../vidp/messages/stork/impl/SPIDUnmarshaller.java | 45 - .../messages/stork/impl/SPInformationBuilder.java | 46 - .../messages/stork/impl/SPInformationImpl.java | 121 -- .../stork/impl/SPInformationMarshaller.java | 35 - .../stork/impl/SPInformationUnmarshaller.java | 61 - .../messages/stork/impl/SpApplicationBuilder.java | 46 - .../messages/stork/impl/SpApplicationImpl.java | 60 - .../stork/impl/SpApplicationMarshaller.java | 45 - .../stork/impl/SpApplicationUnmarshaller.java | 45 - .../vidp/messages/stork/impl/SpCountryBuilder.java | 46 - .../vidp/messages/stork/impl/SpCountryImpl.java | 60 - .../messages/stork/impl/SpCountryMarshaller.java | 45 - .../messages/stork/impl/SpCountryUnmarshaller.java | 45 - .../messages/stork/impl/SpInstitutionBuilder.java | 46 - .../messages/stork/impl/SpInstitutionImpl.java | 60 - .../stork/impl/SpInstitutionMarshaller.java | 45 - .../stork/impl/SpInstitutionUnmarshaller.java | 45 - .../vidp/messages/stork/impl/SpSectorBuilder.java | 47 - .../vidp/messages/stork/impl/SpSectorImpl.java | 60 - .../messages/stork/impl/SpSectorMarshaller.java | 45 - .../messages/stork/impl/SpSectorUnmarshaller.java | 45 - .../impl/VIDPAuthenticationAttributesBuilder.java | 46 - .../impl/VIDPAuthenticationAttributesImpl.java | 91 -- .../VIDPAuthenticationAttributesMarshaller.java | 35 - .../VIDPAuthenticationAttributesUnmarshaller.java | 55 - .../java/eu/stork/vidp/messages/util/SAMLUtil.java | 414 ------ .../validation/StorkAssertionValidator.java | 91 -- .../validation/StorkAttributeValidator.java | 204 --- .../StorkAudienceRestrictionValidator.java | 56 - .../StorkAuthenticationAttributesValidator.java | 57 - .../validation/StorkAuthnRequestValidator.java | 137 -- .../validation/StorkAuthnStatementValidator.java | 62 - .../StorkCitizenCountryCodeValidator.java | 63 - .../validation/StorkConditionsValidator.java | 70 - .../validation/StorkEIDSectorShareValidator.java | 51 - .../StorkEncryptedAttributeValidator.java | 50 - .../validation/StorkEncryptedIdValidator.java | 51 - .../validation/StorkExtensionsValidator.java | 66 - .../messages/validation/StorkIssuerValidator.java | 61 - .../messages/validation/StorkNameIDValidator.java | 67 - .../validation/StorkNameIdPolicyValidator.java | 52 - ...alityAuthenticationAssuranceLevelValidator.java | 54 - .../StorkRequestedAttributeValidator.java | 92 -- .../StorkRequestedAttributesValidator.java | 45 - .../validation/StorkResponseValidator.java | 137 -- .../messages/validation/StorkSPIDValidator.java | 64 - .../validation/StorkSPInformationValidator.java | 49 - .../validation/StorkSpApplicationValidator.java | 63 - .../validation/StorkSpCountryValidator.java | 58 - .../validation/StorkSpInstitutionValidator.java | 62 - .../validation/StorkSpSectorValidator.java | 65 - .../validation/StorkStatusCodeValidator.java | 139 -- .../messages/validation/StorkStatusValidator.java | 55 - .../StorkSubjectConfirmationValidator.java | 128 -- .../validation/StorkSubjectLocalityValidator.java | 47 - .../messages/validation/StorkSubjectValidator.java | 60 - ...StorkVIDPAuthenticationAttributesValidator.java | 57 - .../src/main/resources/saml2-post-binding-moa.vm | 38 - .../src/main/resources/saml2-stork-config.xml | 242 ---- 157 files changed, 1 insertion(+), 11318 deletions(-) delete mode 100644 id/server/stork-saml-engine/pom.xml delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKAuthnRequest.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKResponse.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/builder/STORKMessagesBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKBootstrap.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKConstants.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLException.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLValidationException.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttribute.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttributeValue.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKExtensions.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKRequestedAttribute.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/AuthenticationAttributes.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/CitizenCountryCode.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossBorderShare.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossSectorShare.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDSectorShare.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/QualityAuthenticationAssuranceLevel.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/RequestedAttributes.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPAuthRequest.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertEnc.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertSig.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertType.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPID.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPInformation.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpApplication.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpCountry.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpInstitution.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpSector.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/VIDPAuthenticationAttributes.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesBuilder.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesImpl.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesMarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesUnmarshaller.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/SAMLUtil.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAssertionValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAttributeValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAudienceRestrictionValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthenticationAttributesValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnRequestValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnStatementValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkCitizenCountryCodeValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkConditionsValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEIDSectorShareValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedAttributeValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedIdValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkExtensionsValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkIssuerValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIDValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIdPolicyValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkQualityAuthenticationAssuranceLevelValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributeValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributesValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkResponseValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPIDValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPInformationValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpApplicationValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpCountryValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpInstitutionValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpSectorValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusCodeValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectConfirmationValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectLocalityValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkVIDPAuthenticationAttributesValidator.java delete mode 100644 id/server/stork-saml-engine/src/main/resources/saml2-post-binding-moa.vm delete mode 100644 id/server/stork-saml-engine/src/main/resources/saml2-stork-config.xml diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java index 428cbbe6f..28be60e07 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java @@ -34,8 +34,6 @@ import at.gv.egovernment.moa.id.util.Random; import com.opensymphony.xwork2.ActionSupport; -import eu.stork.vidp.messages.common.STORKBootstrap; - public class ImportExportAction extends ActionSupport implements ServletRequestAware, ServletResponseAware { @@ -114,21 +112,7 @@ implements ServletRequestAware, ServletResponseAware { session.setAttribute(Constants.SESSION_FORMID, formID); return Constants.STRUTS_ERROR_VALIDATION; } - - //Initialize OpenSAML for STORK - log.info("Starting initialization of OpenSAML..."); - try { - STORKBootstrap.bootstrap(); - - } catch (org.opensaml.xml.ConfigurationException e1) { - log.info("Legacy configuration has an Import Error", e1); - addActionError(LanguageHelper.getErrorString("errors.importexport.legacyimport", new Object[] {e1.getMessage()})); - - formID = Random.nextRandom(); - session.setAttribute(Constants.SESSION_FORMID, formID); - return Constants.STRUTS_ERROR_VALIDATION; - } - log.debug("OpenSAML successfully initialized"); + try { MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration(); diff --git a/id/server/idserverlib/pom.xml b/id/server/idserverlib/pom.xml index 245348d09..1efa46c7d 100644 --- a/id/server/idserverlib/pom.xml +++ b/id/server/idserverlib/pom.xml @@ -25,13 +25,6 @@ - - - MOA.id - stork-saml-engine - 1.5.2 - - eu.stork SamlEngine diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 8385c5dbe..6d88a1684 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -40,11 +40,8 @@ import at.gv.egovernment.moa.util.Constants; import at.gv.egovernment.moa.util.DateTimeUtils; import at.gv.egovernment.moa.util.StringUtils; import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; -import eu.stork.mw.messages.saml.STORKResponse; import eu.stork.peps.auth.commons.IPersonalAttributeList; import eu.stork.peps.auth.commons.PersonalAttribute; -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.util.SAMLUtil; /** * @@ -60,192 +57,6 @@ public class STORKResponseProcessor { /** OASIS DSS Success Message */ public static final String OASIS_DSS_SUCCESS_MSG = "urn:oasis:names:tc:dss:1.0:resultmajor:Success"; - /** - * Extracts a STORK response from a HTTP message - * @param request HttpServletRequest - * @param response HttpServletResponse - * @return STORK Response - * @throws STORKException - */ - public static STORKResponse receiveSTORKRepsonse(HttpServletRequest request, HttpServletResponse response) throws STORKException { - - HTTPInTransport httpInTransport = new HttpServletRequestAdapter(request); - HTTPOutTransport httpOutTransport = new HttpServletResponseAdapter(response, request.isSecure()); - - httpInTransport.getPeerAddress(); - - String samlResponseString = request.getParameter("SAMLResponse"); - - if (StringUtils.isEmpty(samlResponseString)) { - Logger.error("SAMLResponse not found in request."); - throw new STORKException("SAMLResponse not found in request."); - } - - BasicSAMLMessageContext samlMessageContext = new BasicSAMLMessageContext(); - - samlMessageContext.setInboundMessageTransport(httpInTransport); - samlMessageContext.setOutboundMessageTransport(httpOutTransport); - - HTTPPostDecoder postDecoder = new HTTPPostDecoder(); - - try { - postDecoder.decode(samlMessageContext); - } catch (Exception e) { - Logger.error("Error decoding SAMLResponse message", e); - throw new STORKException("Error decoding SAMLResponse message", e); - } - - if (!(samlMessageContext.getInboundSAMLMessage() instanceof STORKResponse)) { - Logger.error("Message received is not a SAMLResponse message"); - throw new STORKException("Message received is not a SAMLResponse message"); - } - - STORKResponse samlResponse = (STORKResponse) samlMessageContext.getInboundSAMLMessage(); - - return samlResponse; - } - - /** - * Verifies a STORK response according STORK specification - * @param storkResponse STORK Response to verify - * @throws STORKException if validation fails - */ - public static void verifySTORKResponse(STORKResponse storkResponse) throws STORKException { - - ResponseVerifier responseVerifier = new PEPSConnectorResponseVerifier(); - try { - responseVerifier.verify(storkResponse); - } catch (SecurityException e) { - Logger.error("Error validating response message from PEPS.", e); - throw new STORKException("Error validating response message from PEPS."); - } - - } - - /** - * Verifies a STORK assertion - * @param assertion STORK assertion - * @param ipAddress Client IP address - * @param authnRequestID ID of the AuthnRequest - * @param recipient recipient for verification - * @param audience audience for verification - * @param reqAttributeList RequestedAttribute list for verification - * @throws STORKException - */ - public static void verifySTORKAssertion( - Assertion assertion, - String ipAddress, - String authnRequestID, - String recipient, - String audience, - List reqAttributeList) throws STORKException { - - //validate Assertion - AssertionVerifier assertionVerifier = new PEPSConnectorAssertionVerifier(); - try { - assertionVerifier.verify(assertion, ipAddress, authnRequestID, recipient, audience, reqAttributeList); - - //verify if all required attributes are present - PEPSConnectorAssertionVerifier.validateRequiredAttributes(reqAttributeList, assertion.getAttributeStatements().get(0).getAttributes()); - - } catch (SecurityException e) { - Logger.error("Error verifying assertion from PEPS", e); - throw new STORKException("Error validating assertion received from PEPS."); - } - - } - - /** - * Extracts the citizen signature from the signedDoc element present in the STORK assertion - * @param storkAssertion STORK assertion - * @return citizen signature as XML - * @throws STORKException - */ - public static Element extractCitizenSignature(Assertion storkAssertion) throws STORKException { - - Logger.debug("Processing DSS signature response from PEPS"); - - Element signatureResponse = getSignedDocAttributeValue(storkAssertion); - - if (signatureResponse == null) { - String msg = "Could not find DSS signature response in SAML assertion"; - Logger.error(msg); - throw new STORKException(msg); - } - - Logger.debug("Found DSS signature in SAML assertion"); - - Logger.debug("DSS Signature creation response received from PEPS (pretty print):"); - Logger.debug(XMLHelper.prettyPrintXML(signatureResponse)); - Logger.trace("DSS Signature creation response received from PEPS (original):"); - Logger.trace(XMLUtil.printXML(signatureResponse)); - - Element signature = getSignature(signatureResponse); - - if (signature == null) { - String msg = "Could not find citizen signature in SAML assertion"; - Logger.error(msg); - throw new STORKException(msg); - } - - Logger.debug("Found foreign citizen signature in SAML assertion (pretty print):"); - Logger.debug(XMLHelper.prettyPrintXML(signature)); - Logger.trace("Found foreign citizen signature in SAML assertion (original):"); - Logger.trace(XMLUtil.printXML(signature)); - - return signature; - } - - /** - * Extracts the signedDoc attribute from a STORK assertion as XML - * @param storkAssertion STORK assertion - * @return Value of signedDoc attribute - * @throws STORKException - */ - private static Element getSignedDocAttributeValue(Assertion storkAssertion) throws STORKException { - - XMLObject xmlObj = SAMLUtil.getAttributeValue(storkAssertion.getAttributeStatements().get(0).getAttributes(), STORKConstants.STORK_ATTRIBUTE_SIGNEDDOC); - - - if (xmlObj instanceof XSAny) - return getSignedDocAttributeValueFromAny((XSAny) xmlObj); - else if (xmlObj instanceof XSString) - return getSignedDocAttributValueFromString((XSString) xmlObj); - else - return null; - - } - - /** - * Get signedDoc as XML if provided as anyType - * @param any AttributeValue as anyType - * @return signedDoc as XML - */ - private static Element getSignedDocAttributeValueFromAny(XSAny any) { - if (!any.getUnknownXMLObjects(new QName(OASIS_DSS_NS, "SignResponse")).isEmpty()) { - XMLObject xmlObj = any.getUnknownXMLObjects(new QName(OASIS_DSS_NS, "SignResponse")).get(0); - return xmlObj.getDOM(); - } else { - return null; - } - } - - /** - * Get signedDoc as XML if provided as String - * @param string AttributeValue as String - * @return signedDoc as XML - * @throws STORKException - */ - private static Element getSignedDocAttributValueFromString(XSString string) throws STORKException { - try { - return XMLUtil.stringToDOM(string.getValue()); - } catch (Exception e) { - Logger.error("Error building DOM", e); - throw new STORKException(e); - - } - } - /** * Extracts the signature value out of a DSS response * @param signatureResponse DSS signature response diff --git a/id/server/stork-saml-engine/pom.xml b/id/server/stork-saml-engine/pom.xml deleted file mode 100644 index 1988b9af0..000000000 --- a/id/server/stork-saml-engine/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - 4.0.0 - - moa-id - MOA.id - 1.9.96-SNAPSHOT - - stork-saml-engine - 1.5.2 - STORK SAML Engine - SAML2 related stuff for STORK - - - - - -org.apache.maven.plugins -maven-compiler-plugin - -1.5 -1.5 - - - - - - - - org.opensaml - opensaml - 2.5.3 - - - org.slf4j - jcl-over-slf4j - - - org.slf4j - jul-to-slf4j - - - org.slf4j - log4j-over-slf4j - - - - - org.opensaml - xmltooling - 1.3.4 - - - org.slf4j - jcl-over-slf4j - - - org.slf4j - jul-to-slf4j - - - org.slf4j - log4j-over-slf4j - - - - - org.opensaml - openws - 1.4.4 - - - org.slf4j - jcl-over-slf4j - - - org.slf4j - jul-to-slf4j - - - org.slf4j - log4j-over-slf4j - - - - - org.slf4j - slf4j-log4j12 - 1.6.4 - - - - \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKAuthnRequest.java b/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKAuthnRequest.java deleted file mode 100644 index b84721ff5..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKAuthnRequest.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.mw.messages.saml; - -import java.security.cert.X509Certificate; -import java.util.List; - -import org.opensaml.saml2.core.AuthnRequest; -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.xml.XMLObject; - -/** - * Interface extending a SAML AuthnRequest by additional attributes required by STORK - * @author bzwattendorfer - * - */ -public interface STORKAuthnRequest extends AuthnRequest { - - /** - * Sets the ID of the requesting Service Provider - * @param spID ID of the Service Provider - */ - public void setSPID(String spID); - - /** - * Gets the ID of the Service Provider - * @return ID of the Service Provider - */ - public String getSPID(); - - /** - * Sets the citizen country code - * @param citizenCountryCode citizen country code - */ - public void setCitizenCountryCode(String citizenCountryCode); - - /** - * Gets the citizen country code - * @return citizen country code - */ - public String getCitizenCountryCode(); - - /** - * Sets the final redirect URL - * @param finalRedirectURL Final redirect URL - */ - public void setFinalRedirectURL(String finalRedirectURL); - - /** - * Gets the final redirect URL - * @return final redirect URL - */ - public String getFinalRedirectURL(); - - /** - * Sets the signing certificate of the service provider - * @param signingCertificate Signing certificate of the SP - */ - public void setSPCertSig(X509Certificate signingCertificate); - - /** - * Gets the signing certificate of the service provider - * @return signing certificate of the service provider - */ - public X509Certificate getSPCertSig(); - - /** - * Sets the encryption certificate of the service provider - * @param encryptionCertificate encryption certificate of the SP - */ - public void setSPCertEnc(X509Certificate encryptionCertificate); - - /** - * Gets the encryption certificate of the service provider - * @return encryption certificate of the SP - */ - public X509Certificate getSPCertEnc(); - - - /** - * Sets the original authentication request of the service provider - * @param spAuthRequest original SP authentication request - */ - public void setOriginalSPAuthRequest(XMLObject spAuthRequest); - - /** - * Gets the original authentication request of the service provider - * @return original SP authentication request - */ - public XMLObject getOriginalSPAuthRequest(); - - /** - * Sets the requested STORK QAA level - * @param authLevel Requested STORK QAA level - */ - public void setQAALevel(int authLevel); - - /** - * Gets the requested STORK QAA level - * @return Requested STORK QAA level - */ - public int getQAALevel(); - - /** - * Gets a list of requested attributes - * @return List containg all requested attributes - */ - public List getRequestedAttributes(); - - /** - * Sets the requested attributes - * @param requestedAttributesList List containg all requested attributes - */ - public void setRequestedAttributes(List requestedAttributesList); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKResponse.java b/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKResponse.java deleted file mode 100644 index 28de6068b..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.mw.messages.saml; - -import org.opensaml.saml2.core.Response; - -/** - * Interface extending a SAML Response by attributes required by STORK - * @author bzwattendorfer - * - */ -public interface STORKResponse extends Response { - - /** - * Sets the QAA level by which the user has been authenticated - * @param authLevel STORK QAA level used for authentication - */ - public void setQAALevel(int authLevel); - - /** - * Gets the QAA level by which the user has been authenticated - * @return STORK QAA level used for authentication - */ - public int getQAALevel(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/builder/STORKMessagesBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/builder/STORKMessagesBuilder.java deleted file mode 100644 index 2f9a19620..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/builder/STORKMessagesBuilder.java +++ /dev/null @@ -1,1367 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.builder; - -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateEncodingException; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.StringUtils; -import org.joda.time.DateTime; -import org.opensaml.Configuration; -import org.opensaml.common.IdentifierGenerator; -import org.opensaml.common.SAMLObject; -import org.opensaml.common.SAMLObjectBuilder; -import org.opensaml.common.SAMLVersion; -import org.opensaml.common.impl.SecureRandomIdentifierGenerator; -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.core.Assertion; -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.core.AttributeStatement; -import org.opensaml.saml2.core.AttributeValue; -import org.opensaml.saml2.core.Audience; -import org.opensaml.saml2.core.AudienceRestriction; -import org.opensaml.saml2.core.AuthnContext; -import org.opensaml.saml2.core.AuthnStatement; -import org.opensaml.saml2.core.Conditions; -import org.opensaml.saml2.core.Issuer; -import org.opensaml.saml2.core.NameID; -import org.opensaml.saml2.core.OneTimeUse; -import org.opensaml.saml2.core.Status; -import org.opensaml.saml2.core.StatusCode; -import org.opensaml.saml2.core.StatusDetail; -import org.opensaml.saml2.core.StatusMessage; -import org.opensaml.saml2.core.Subject; -import org.opensaml.saml2.core.SubjectConfirmation; -import org.opensaml.saml2.core.SubjectConfirmationData; -import org.opensaml.saml2.core.SubjectLocality; -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.ws.soap.common.SOAPObject; -import org.opensaml.ws.soap.common.SOAPObjectBuilder; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.XMLObjectBuilder; -import org.opensaml.xml.schema.XSAny; -import org.opensaml.xml.schema.XSString; -import org.opensaml.xml.schema.impl.XSAnyBuilder; -import org.opensaml.xml.schema.impl.XSStringBuilder; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.signature.X509Data; -import org.opensaml.xml.util.Base64; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.stork.mw.messages.saml.STORKAuthnRequest; -import eu.stork.mw.messages.saml.STORKResponse; -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.saml.STORKAttribute; -import eu.stork.vidp.messages.saml.STORKAttributeValue; -import eu.stork.vidp.messages.saml.STORKExtensions; -import eu.stork.vidp.messages.saml.STORKRequestedAttribute; -import eu.stork.vidp.messages.stork.AuthenticationAttributes; -import eu.stork.vidp.messages.stork.CitizenCountryCode; -import eu.stork.vidp.messages.stork.EIDCrossBorderShare; -import eu.stork.vidp.messages.stork.EIDCrossSectorShare; -import eu.stork.vidp.messages.stork.EIDSectorShare; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; -import eu.stork.vidp.messages.stork.RequestedAttributes; -import eu.stork.vidp.messages.stork.SPAuthRequest; -import eu.stork.vidp.messages.stork.SPCertEnc; -import eu.stork.vidp.messages.stork.SPCertSig; -import eu.stork.vidp.messages.stork.SPCertType; -import eu.stork.vidp.messages.stork.SPID; -import eu.stork.vidp.messages.stork.SPInformation; -import eu.stork.vidp.messages.stork.SpApplication; -import eu.stork.vidp.messages.stork.SpCountry; -import eu.stork.vidp.messages.stork.SpInstitution; -import eu.stork.vidp.messages.stork.SpSector; -import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; - -/** - * Class providing several methods for SAML Object generation - * @author bzwattendorfer - * - */ -public class STORKMessagesBuilder { - - final static Logger log = LoggerFactory.getLogger(STORKMessagesBuilder.class); - - /** - * Builds an arbitrary OpenSAML XML object - * @param OpenSAML XMLObject - * @param objectQName QName of the XML element - * @return Builded OpenSAML XMLObject - */ - @SuppressWarnings("unchecked") - public static T buildXMLObject(QName objectQName) { - - try { - XMLObjectBuilder builder = (XMLObjectBuilder) Configuration.getBuilderFactory().getBuilder(objectQName); - return builder.buildObject(objectQName.getNamespaceURI(), objectQName.getLocalPart(), objectQName.getPrefix()); - } catch (Exception e) { - log.error("Cannot build XML Object {}: {}", objectQName.getLocalPart(), e); - throw new RuntimeException(e); - } - - } - - /** - * Builds a SOAP object - * @param SOAP Object or any extensions - * @param objectQName QName of the XML element - * @return SOAP Object or any extensions - */ - @SuppressWarnings("unchecked") - public static T buildSOAPObject(QName objectQName) { - - try { - SOAPObjectBuilder builder = (SOAPObjectBuilder) Configuration.getBuilderFactory().getBuilder(objectQName); - return builder.buildObject(); - } catch (Exception e) { - log.error("Cannot build SOAP Object {}: {}", objectQName.getLocalPart(), e); - throw new RuntimeException(e); - } - - } - - /** - * Builds an arbitrary OpenSAML SAML object - * @param OpenSAML SAML Object - * @param objectQName QName of the SAML element - * @return Builded OpenSAML SAML Object - */ - @SuppressWarnings("unchecked") - public static T buildSAMLObject(QName objectQName) { - - try { - SAMLObjectBuilder builder = (SAMLObjectBuilder) Configuration.getBuilderFactory().getBuilder(objectQName); - return builder.buildObject(); - } catch (Exception e) { - log.error("Cannot build SAML Object {}: {}", objectQName.getLocalPart(), e); - throw new RuntimeException(e); - } - - } - - - - /** - * Builds SAML Issuer object - * @param issuerValue Value for the issuer element - * @return Issuer object - */ - public static Issuer buildIssuer(String issuerValue) { - if (StringUtils.isEmpty(issuerValue)) - return null; - - Issuer issuer = buildXMLObject(Issuer.DEFAULT_ELEMENT_NAME); - issuer.setValue(issuerValue); - issuer.setFormat(Issuer.ENTITY); - - return issuer; - } - - /** - * Builds a QualityAuthenticationAssuranceLevel object - * @param qaaValue QAALevel (1 to 4) - * @return QualityAuthenticationAssuranceLevel object - */ - public static QualityAuthenticationAssuranceLevel buildQualityAuthenticationAssuranceLevel(int qaaValue) { - if (qaaValue < 1 || qaaValue > 4) { - log.error("QAA Level must be between 1 and 4."); - return null; - } - - QualityAuthenticationAssuranceLevel qaaLevel = buildXMLObject(QualityAuthenticationAssuranceLevel.DEFAULT_ELEMENT_NAME); - qaaLevel.setValue(qaaValue); - return qaaLevel; - } - - /** - * Builds a STORK RequestedAttribute object - * @param name Name of the RequesteAttribute - * @param isRequired true or false if RequestedAttribute is required - * @param value Value of RequestedAttribute - * @return STORK RequestedAttribute object - */ - public static RequestedAttribute buildRequestedAttribute(String name, boolean isRequired, String value) { - - RequestedAttribute reqAttribute = buildXMLObject(STORKRequestedAttribute.DEFAULT_ELEMENT_NAME); - reqAttribute.setName(name); - reqAttribute.setNameFormat(STORKRequestedAttribute.URI_REFERENCE); - reqAttribute.setIsRequired(isRequired); - - if (!StringUtils.isEmpty(value)) { - XSString stringValue = buildXSString(STORKAttributeValue.DEFAULT_ELEMENT_NAME); - stringValue.setValue(value); - reqAttribute.getAttributeValues().add(stringValue); - } - - return reqAttribute; - } - - /** - * Builds XML String type object with given QName - * @param qname QName for object to build - * @return XML object as String type - */ - public static XSString buildXSString(QName qname) { - XSStringBuilder stringBuilder = (XSStringBuilder) Configuration.getBuilderFactory().getBuilder(XSString.TYPE_NAME); - return stringBuilder.buildObject(qname, XSString.TYPE_NAME); - } - - /** - * Builds XML Any type object with given QName - * @param qname QName for object to build - * @return XML object as Any type - */ - public static XSAny buildXSAny(QName qname) { - XSAnyBuilder anyBuilder = (XSAnyBuilder) Configuration.getBuilderFactory().getBuilder(XSAny.TYPE_NAME); - return anyBuilder.buildObject(qname, XSAny.TYPE_NAME); - } - - /** - * Builds a List of RequestedAttribute - * @param requestedAttributeArguments RequestedAttributes - * @return List of RequestedAttribute - */ - public static RequestedAttributes buildRequestedAttributes(RequestedAttribute... requestedAttributeArguments) { - - if (requestedAttributeArguments == null) - return null; - - RequestedAttributes reqAttributes = buildXMLObject(RequestedAttributes.DEFAULT_ELEMENT_NAME); - - for (RequestedAttribute reqAttr : requestedAttributeArguments) { - reqAttributes.getRequestedAttributes().add(reqAttr); - } - - return reqAttributes; - } - - /** - * Builds RequestedAttributes object out of list of RequestedAttribute - * @param requestedAttributeList List of RequestedAttribute - * @return RequestedAttributes object - */ - public static RequestedAttributes buildRequestedAttributes(List requestedAttributeList) { - if (requestedAttributeList == null) - return null; - - RequestedAttributes reqAttributes = buildXMLObject(RequestedAttributes.DEFAULT_ELEMENT_NAME); - reqAttributes.getRequestedAttributes().addAll(requestedAttributeList); - - return reqAttributes; - } - - /** - * Builds a STORK CitizenCountryCode object - * @param ccc ISO country code - * @return CitizenCountryCode object - */ - public static CitizenCountryCode buildCitizenCountryCode(String ccc) { - if (StringUtils.isEmpty(ccc)) { - log.error("CitizenCountryCode must have a value."); - return null; - } - - CitizenCountryCode citizenCountryCode = buildXMLObject(CitizenCountryCode.DEFAULT_ELEMENT_NAME); - citizenCountryCode.setValue(ccc); - - return citizenCountryCode; - } - - /** - * Builds a SPID object - * @param spIDString String to be used as SPID - * @return SPID object - */ - public static SPID buildSPID(String spIDString) { - if (StringUtils.isEmpty(spIDString)) { - log.error("SPID must have a value."); - return null; - } - - SPID spID = buildXMLObject(SPID.DEFAULT_ELEMENT_NAME); - spID.setValue(spIDString); - - return spID; - } - - /** - * Builds SPCertType - * @param cert X509Certificate - * @return SPCertType - */ - private static SPCertType buildSPCertType(X509Certificate cert) { - SPCertType spCertType = buildXMLObject(SPCertType.TYPE_NAME); - KeyInfo keyInfo = buildXMLObject(KeyInfo.DEFAULT_ELEMENT_NAME); - X509Data x509DataElem = buildXMLObject(X509Data.DEFAULT_ELEMENT_NAME); - org.opensaml.xml.signature.X509Certificate x509CertElem = buildXMLObject(org.opensaml.xml.signature.X509Certificate.DEFAULT_ELEMENT_NAME); - - try { - x509CertElem.setValue(Base64.encodeBytes(cert.getEncoded())); - } catch (CertificateEncodingException e) { - log.error("Cannot encode certificate.", e); - throw new RuntimeException(e); - } - - x509DataElem.getX509Certificates().add(x509CertElem); - keyInfo.getX509Datas().add(x509DataElem); - spCertType.setKeyInfo(keyInfo); - return spCertType; - } - - /** - * Builds SPCertSig object - * @param cert X509Certificate - * @return SPCertSig - */ - public static SPCertSig buildSPCertSig(X509Certificate cert) { - return (SPCertSig) buildSPCertType(cert); - } - - /** - * Builds SPCertEnc object - * @param cert X509Certificate - * @return SPCertEnc - */ - public static SPCertEnc buildSPCertEnc(X509Certificate cert) { - return (SPCertEnc) buildSPCertType(cert); - } - - /** - * Builds SPAuthRequest object - * @param xmlObject Abritrary XML object - * @return SPAuthRequest - */ - public static SPAuthRequest buildSPAuthRequest(XMLObject xmlObject) { - SPAuthRequest authRequest = buildXMLObject(SPAuthRequest.DEFAULT_ELEMENT_NAME); - authRequest.getUnknownXMLObjects().add(xmlObject); - return authRequest; - } - - /** - * Builds SPInformation object - * @param spIDString SPID - * @param sigCert SP signature certificate - * @param encCert SP encryption certificate - * @param spAuthRequest Original SP AuthnRequest - * @return SPInformations - */ - public static SPInformation buildSPInformation(String spIDString, X509Certificate sigCert, X509Certificate encCert, XMLObject spAuthRequest) { - - SPInformation spInformation = buildXMLObject(SPInformation.DEFAULT_ELEMENT_NAME); - - SPID spID = buildSPID(spIDString); - spInformation.setSPID(spID); - - if (sigCert != null) { - SPCertSig spCertSig = buildSPCertSig(sigCert); - spInformation.setSPCertSig(spCertSig); - } - - if (encCert != null) { - SPCertEnc spCertEnc = buildSPCertEnc(encCert); - spInformation.setSPCertEnc(spCertEnc); - } - - if (spAuthRequest != null) { - SPAuthRequest spAuthRequestElem = buildSPAuthRequest(spAuthRequest); - spInformation.setSPAuthRequest(spAuthRequestElem); - } - - return spInformation; - - } - - /** - * Builds VIDPAuthenticationAttributes objext - * @param ccc ISO citizen country code - * @param spIDString SPID - * @param sigCert SP signature certificate - * @param encCert SP encryption certificate - * @param spAuthRequest Original SP AuthnRequest - * @return VIDPAuthenticationAttributes - */ - public static VIDPAuthenticationAttributes buildVIDPAuthenticationAttributes(String ccc, String spIDString, X509Certificate sigCert, X509Certificate encCert, XMLObject spAuthRequest) { - VIDPAuthenticationAttributes vidpAuthenticationAttributes = buildXMLObject(VIDPAuthenticationAttributes.DEFAULT_ELEMENT_NAME); - - CitizenCountryCode citizenCountryCode = buildCitizenCountryCode(ccc); - SPInformation spInformation = buildSPInformation(spIDString, sigCert, encCert, spAuthRequest); - - vidpAuthenticationAttributes.setCitizenCountryCode(citizenCountryCode); - vidpAuthenticationAttributes.setSPInformation(spInformation); - - return vidpAuthenticationAttributes; - } - - /** - * Builds AuthenticationAttributes object - * @param ccc ISO citizen country code - * @param spIDString SPID - * @param sigCert SP signature certificate - * @param encCert SP encryption certificate - * @param spAuthRequest Original SP AuthnRequest - * @return AuthenticationAttributes - */ - public static AuthenticationAttributes buildAuthenticationAttributes(String ccc, String spIDString, X509Certificate sigCert, X509Certificate encCert, XMLObject spAuthRequest) { - AuthenticationAttributes authenticationAttributes = buildXMLObject(AuthenticationAttributes.DEFAULT_ELEMENT_NAME); - - VIDPAuthenticationAttributes vidpAuthenticationAttributes = buildVIDPAuthenticationAttributes(ccc, spIDString, sigCert, encCert, spAuthRequest); - - authenticationAttributes.setVIDPAuthenticationAttributes(vidpAuthenticationAttributes); - return authenticationAttributes; - - } - - /** - * Builds SpSector object - * @param spSector Value SPSector value - * @return SpSector - */ - public static SpSector buildSpSector(String spSectorValue) { - - SpSector spSector = buildXMLObject(SpSector.DEFAULT_ELEMENT_NAME); - spSector.setValue(spSectorValue); - - return spSector; - } - - /** - * Builds SpInstitution object - * @param spInstitutionValue Value for SpInstitution - * @return SpInstitution - */ - public static SpInstitution buildSpInstitution(String spInstitutionValue) { - - SpInstitution spInstitution = buildXMLObject(SpInstitution.DEFAULT_ELEMENT_NAME); - spInstitution.setValue(spInstitutionValue); - - return spInstitution; - } - - - /** - * Builds SpApplication object - * @param spApplicationValue Value for SpApplication - * @return SpApplication - */ - public static SpApplication buildSpApplication(String spApplicationValue) { - - SpApplication spApplication = buildXMLObject(SpApplication.DEFAULT_ELEMENT_NAME); - spApplication.setValue(spApplicationValue); - - return spApplication; - } - - /** - * Builds SpCountry object - * @param spCountryValue ISO Code Value for SpCountry - * @return SpCountry - */ - public static SpCountry buildSpCountry(String spCountryValue) { - - SpCountry spCountry = buildXMLObject(SpCountry.DEFAULT_ELEMENT_NAME); - spCountry.setValue(spCountryValue); - - return spCountry; - } - - /** - * Generates secured randomized ID for SAML Messages - * @return secured randomized ID - */ - public static String generateID() { - try { - IdentifierGenerator idGenerator = new SecureRandomIdentifierGenerator(); - return idGenerator.generateIdentifier(); - } catch (NoSuchAlgorithmException e) { - log.error("Cannot generate id", e); - throw new RuntimeException(e); - - } - - } - - /** - * Builds STORKAuthnRequest object - * @param destination Endpoint for AuthnRequest - * @param acsURL Endpoint where STORK response wants to be received - * @param providerName Provider Name - * @param issuerValue Value for Issuer element - * @param qaaLevel STORK QAALevel - * @param requestedAttributes Attributes to be requested - * @param spSector SPSector - * @param spInstitution SPInstitution - * @param spApplication SPApplication - * @param spCountry SPCountry - * @return STORKAuthnRequest - */ - public static STORKAuthnRequest buildSTORKAuthnRequest( - String destination, - String acsURL, - String providerName, - String issuerValue, - QualityAuthenticationAssuranceLevel qaaLevel, - RequestedAttributes requestedAttributes, - String spSector, - String spInstitution, - String spApplication, - String spCountry) { - - //fixed values - String consent = STORKAuthnRequest.UNSPECIFIED_CONSENT; - boolean forceAuthn = true; - boolean isPassive = false; - String binding = SAMLConstants.SAML2_POST_BINDING_URI; - boolean eIDSectorShare = true; - boolean eIDCrossSectorShare = true; - boolean eIDCrossBorderShare = false; - - STORKAuthnRequest authnRequest = buildXMLObject(STORKAuthnRequest.DEFAULT_ELEMENT_NAME); - - authnRequest.setVersion(SAMLVersion.VERSION_20); - authnRequest.setID(generateID()); - authnRequest.setIssueInstant(new DateTime()); - - authnRequest.setConsent(consent); - authnRequest.setForceAuthn(forceAuthn); - authnRequest.setIsPassive(isPassive); - authnRequest.setProtocolBinding(binding); - - authnRequest.setDestination(destination); - authnRequest.setAssertionConsumerServiceURL(acsURL); - authnRequest.setProviderName(providerName); - authnRequest.setIssuer(buildIssuer(issuerValue)); - - STORKExtensions extensions = buildSTORKExtensions(); - - authnRequest.setQAALevel(qaaLevel.getValue()); - extensions.setQAALevel(qaaLevel); - - authnRequest.setRequestedAttributes(requestedAttributes.getRequestedAttributes()); - extensions.setRequestedAttributes(requestedAttributes); - - EIDSectorShare eidSectorShareObj = buildXMLObject(EIDSectorShare.DEFAULT_ELEMENT_NAME); - eidSectorShareObj.setValue(eIDSectorShare); - - EIDCrossSectorShare eidCrossSectorShareObj = buildXMLObject(EIDCrossSectorShare.DEFAULT_ELEMENT_NAME); - eidCrossSectorShareObj.setValue(eIDCrossSectorShare); - - EIDCrossBorderShare eidCrossBorderShareObj = buildXMLObject(EIDCrossBorderShare.DEFAULT_ELEMENT_NAME); - eidCrossBorderShareObj.setValue(eIDCrossBorderShare); - - SpSector spSectorObj = buildSpSector(spSector); - SpInstitution spInstitutionObj = buildSpInstitution(spInstitution); - SpApplication spApplicationObj = buildSpApplication(spApplication); - SpCountry spCountryObj = buildSpCountry(spCountry); - - - extensions.getUnknownXMLObjects().add(qaaLevel); - extensions.getUnknownXMLObjects().add(spSectorObj); - extensions.getUnknownXMLObjects().add(spInstitutionObj); - extensions.getUnknownXMLObjects().add(spApplicationObj); - extensions.getUnknownXMLObjects().add(spCountryObj); - extensions.getUnknownXMLObjects().add(eidSectorShareObj); - extensions.getUnknownXMLObjects().add(eidCrossSectorShareObj); - extensions.getUnknownXMLObjects().add(eidCrossBorderShareObj); - extensions.getUnknownXMLObjects().add(requestedAttributes); - - authnRequest.setExtensions(extensions); - - return authnRequest; - } - - /** - * Builds STORKAuthnRequest object - * @param destination Endpoint for AuthnRequest - * @param acsURL Endpoint where STORK response wants to be received - * @param providerName Provider Name - * @param issuerValue Value for Issuer element - * @param qaaLevel STORK QAALevel - * @param requestedAttributeList List of STORK attributes to be requested - * @param ccc ISO citizen country code - * @param spIDString SPID - * @param sigCert SP signature certificate - * @param encCert SP encryption certificate - * @param spAuthRequest Original SP AuthnRequest - * @param spSector SPSector - * @param spInstitution SPInstitution - * @param spApplication SPApplication - * @param spCountry SPCountry - * @return STORKAuthnRequest - */ - public static STORKAuthnRequest buildSTORKAuthnRequest( - String destination, - String acsURL, - String providerName, - String issuerValue, - int qaaLevel, - List requestedAttributeList, - String ccc, - String spID, - X509Certificate sigCert, - X509Certificate encCert, - XMLObject spAuthRequest, - String spSector, - String spInstitution, - String spApplication, - String spCountry) { - - //fixed values via config - String consent = STORKAuthnRequest.UNSPECIFIED_CONSENT; - boolean forceAuthn = true; - boolean isPassive = false; - String binding = SAMLConstants.SAML2_POST_BINDING_URI; - boolean eIDSectorShare = true; - boolean eIDCrossSectorShare = true; - boolean eIDCrossBorderShare = false; - - return buildSTORKAuthnRequest(consent, forceAuthn, isPassive, binding, eIDSectorShare, eIDCrossSectorShare, eIDCrossBorderShare, destination, acsURL, providerName, issuerValue, qaaLevel, requestedAttributeList, ccc, spID, sigCert, encCert, spAuthRequest, spSector, spInstitution, spApplication, spCountry); - - } - - /** - * Builds STORKAuthnRequest object - * @param consent Consent for the request - * @param forceAuthn forceAuthn - * @param isPassive isPassive - * @param binding Binding the request is sent over - * @param eIDSectorShare Should eIdentifier be shared? - * @param eIDCrossSectorShare Should eIdentifier be shared across sectors? - * @param eIDCrossBorderShare Should eIdentifier be shared across borders? - * @param destination Endpoint for AuthnRequest - * @param acsURL Endpoint where STORK response wants to be received - * @param providerName Provider Name - * @param issuerValue Value for Issuer element - * @param qaaLevel STORK QAALevel - * @param requestedAttributeList List of STORK attributes to be requested - * @param ccc ISO citizen country code - * @param spIDString SPID - * @param sigCert SP signature certificate - * @param encCert SP encryption certificate - * @param spAuthRequest Original SP AuthnRequest - * @param spSector SPSector - * @param spInstitution SPInstitution - * @param spApplication SPApplication - * @param spCountry SPCountry - * @return STORKAuthnRequest - */ - public static STORKAuthnRequest buildSTORKAuthnRequest( - String consent, - boolean forceAuthn, - boolean isPassive, - String binding, - boolean eIDSectorShare, - boolean eIDCrossSectorShare, - boolean eIDCrossBorderShare, - String destination, - String acsURL, - String providerName, - String issuerValue, - int qaaLevel, - List requestedAttributeList, - String ccc, - String spID, - X509Certificate sigCert, - X509Certificate encCert, - XMLObject spAuthRequest, - String spSector, - String spInstitution, - String spApplication, - String spCountry) { - - STORKAuthnRequest authnRequest = buildXMLObject(STORKAuthnRequest.DEFAULT_ELEMENT_NAME); - - authnRequest.setVersion(SAMLVersion.VERSION_20); - authnRequest.setID(generateID()); - authnRequest.setIssueInstant(new DateTime()); - - authnRequest.setDestination(destination); - authnRequest.setAssertionConsumerServiceURL(acsURL); - authnRequest.setProviderName(providerName); - authnRequest.setIssuer(buildIssuer(issuerValue)); - authnRequest.setQAALevel(qaaLevel); - authnRequest.setRequestedAttributes(requestedAttributeList); - authnRequest.setCitizenCountryCode(ccc); - authnRequest.setSPID(spID); - authnRequest.setSPCertSig(sigCert); - authnRequest.setSPCertEnc(encCert); - authnRequest.setOriginalSPAuthRequest(spAuthRequest); - - authnRequest.setConsent(consent); - authnRequest.setForceAuthn(forceAuthn); - authnRequest.setIsPassive(isPassive); - authnRequest.setProtocolBinding(binding); - - addSTORKExtensionsToAuthnRequest(authnRequest, qaaLevel, requestedAttributeList, ccc, spID, sigCert, encCert, spAuthRequest, eIDSectorShare, eIDCrossSectorShare, eIDCrossBorderShare, spSector, spInstitution, spApplication, spCountry); - - return authnRequest; - - } - - /** - * Adds STORK Extensions to STORKAuthnRequest - * @param authnRequest - * @param qaaLevel STORK QAALevel - * @param requestedAttributeList List of STORK attributes to be requested - * @param ccc ISO citizen country code - * @param spIDString SPID - * @param sigCert SP signature certificate - * @param encCert SP encryption certificate - * @param spAuthRequest Original SP AuthnRequest - * @param spSector SPSector - * @param spInstitution SPInstitution - * @param spApplication SPApplication - * @param spCountry SPCountry - */ - public static void addSTORKExtensionsToAuthnRequest( - STORKAuthnRequest authnRequest, - int qaaLevel, - List requestedAttributeList, - String ccc, - String spID, - X509Certificate sigCert, - X509Certificate encCert, - XMLObject spAuthRequest, - boolean eIDSectorShare, - boolean eIDCrossSectorShare, - boolean eIDCrossBorderShare, - String spSector, - String spInstitution, - String spApplication, - String spCountry) { - - STORKExtensions extensions = buildSTORKExtensions(); - authnRequest.setRequestedAttributes(requestedAttributeList); - - QualityAuthenticationAssuranceLevel qaaLevelObj = buildQualityAuthenticationAssuranceLevel(qaaLevel); - RequestedAttributes requestedAttributesObj = buildRequestedAttributes(requestedAttributeList); - AuthenticationAttributes authenticationAttributesObj = buildAuthenticationAttributes(ccc, spID, sigCert, encCert, spAuthRequest); - - EIDSectorShare eidSectorShareObj = buildXMLObject(EIDSectorShare.DEFAULT_ELEMENT_NAME); - eidSectorShareObj.setValue(eIDSectorShare); - - EIDCrossSectorShare eidCrossSectorShareObj = buildXMLObject(EIDCrossSectorShare.DEFAULT_ELEMENT_NAME); - eidCrossSectorShareObj.setValue(eIDCrossSectorShare); - - EIDCrossBorderShare eidCrossBorderShareObj = buildXMLObject(EIDCrossBorderShare.DEFAULT_ELEMENT_NAME); - eidCrossBorderShareObj.setValue(eIDCrossBorderShare); - - SpSector spSectorObj = buildSpSector(spSector); - SpApplication spApplicationObj = buildSpApplication(spApplication); - SpCountry spCountryObj = buildSpCountry(spCountry); - - extensions.setQAALevel(qaaLevelObj); - extensions.setRequestedAttributes(requestedAttributesObj); - extensions.setAuthenticationAttributes(authenticationAttributesObj); - - extensions.getUnknownXMLObjects().add(qaaLevelObj); - extensions.getUnknownXMLObjects().add(spSectorObj); - extensions.getUnknownXMLObjects().add(spApplicationObj); - extensions.getUnknownXMLObjects().add(spCountryObj); - extensions.getUnknownXMLObjects().add(eidSectorShareObj); - extensions.getUnknownXMLObjects().add(eidCrossSectorShareObj); - extensions.getUnknownXMLObjects().add(eidCrossBorderShareObj); - extensions.getUnknownXMLObjects().add(requestedAttributesObj); - extensions.getUnknownXMLObjects().add(authenticationAttributesObj); - - authnRequest.setExtensions(extensions); - - } - - - /** - * Builds STORKExtensions object - * @return STORKExtensions - */ - public static STORKExtensions buildSTORKExtensions() { - QName samlProtocolExtensions = new QName(SAMLConstants.SAML20P_NS, STORKExtensions.LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); - return buildXMLObject(samlProtocolExtensions); - } - - /** - * Builds STORKResponse - * @param destination Endpoint where the STORKResponse should be sent to - * @param inResponseTo ID of the corresponding AuthnRequest - * @param issuer Issuer value of the response - * @param status Status of the response (success, error, etc.) - * @param assertion SAML assertion to be included - * @return STORKResponse - */ - public static STORKResponse buildSTORKResponse( - String destination, - String inResponseTo, - Issuer issuer, - Status status, - Assertion assertion) { - - STORKResponse response = buildXMLObject(STORKResponse.DEFAULT_ELEMENT_NAME); - - response.setDestination(destination); - response.setInResponseTo(inResponseTo); - response.setConsent(STORKResponse.OBTAINED_CONSENT); - response.setID(generateID()); - response.setIssueInstant(new DateTime()); - response.setVersion(SAMLVersion.VERSION_20); - - response.setIssuer(issuer); - response.setStatus(status); - response.getAssertions().add(assertion); - - return response; - } - - /** - * Build STORKResponse - * @param destination Endpoint where the STORKResponse should be sent to - * @param inResponseTo ID of the corresponding AuthnRequest - * @param issuer Issuer value of the response - * @param status Status of the response (success, error, etc.) - * @param statusMessage Status message for the response - * @param assertion SAML assertion to be included - * @return STORKResponse - */ - public static STORKResponse buildSTORKResponse( - String destination, - String inResponseTo, - String issuerString, - String statusCode, - String statusMessage, - Assertion assertion) { - - Status status = buildStatus(statusCode, statusMessage); - Issuer issuer = buildIssuer(issuerString); - - return buildSTORKResponse(destination, inResponseTo, issuer, status, assertion); - } - - - /** - * Builds a STORKResponse containing no assertion - * @param destination Endpoint where the STORKResponse should be sent to - * @param inResponseTo ID of the corresponding AuthnRequest - * @param issuer Issuer value of the response - * @param status Status of the response (success, error, etc.) - * @param statusMessage Status message for the response - * @return STORKResponse - */ - public static STORKResponse buildSTORKErrorResponse( - String destination, - String inResponseTo, - String issuerString, - String statusCode, - String statusMessage) { - - return buildSTORKResponse(destination, inResponseTo, issuerString, statusCode, statusMessage, null); - } - - /** - * Builds Status object - * @param statusCodeValue StatusCode - * @param statusMessageValue StatusMessage - * @return Status - */ - public static Status buildStatus(String statusCodeValue, String statusMessageValue) { - return buildStatus(statusCodeValue, statusMessageValue, null); - } - - /** - * Builds Status object - * @param statusCodeValue StatusCode - * @param statusMessageValue StatusMessage - * @param detail Detail Message - * @return Status - */ - public static Status buildStatus(String statusCodeValue, String statusMessageValue, XMLObject detail) { - StatusCode statusCode = buildXMLObject(StatusCode.DEFAULT_ELEMENT_NAME); - statusCode.setValue(statusCodeValue); - - StatusMessage statusMessage = buildXMLObject(StatusMessage.DEFAULT_ELEMENT_NAME); - statusMessage.setMessage(statusMessageValue); - - StatusDetail statusDetail = buildXMLObject(StatusDetail.DEFAULT_ELEMENT_NAME); - statusDetail.getUnknownXMLObjects().add(detail); - - Status status = buildXMLObject(Status.DEFAULT_ELEMENT_NAME); - status.setStatusCode(statusCode); - status.setStatusMessage(statusMessage); - - return status; - - } - - /** - * Builds Assertion - * @param issuer Issuer value for assertion - * @param subject Subject of assertion - * @param conditions Conditions of assertion - * @param authnStatement AuthnStatement - * @param attributeStatement AttributeAtatement - * @return Assertion - */ - public static Assertion buildAssertion(Issuer issuer, - Subject subject, - Conditions conditions, - AuthnStatement authnStatement, - AttributeStatement attributeStatement) { - Assertion assertion = buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME); - - assertion.setID(generateID()); - assertion.setVersion(SAMLVersion.VERSION_20); - assertion.setIssueInstant(new DateTime()); - - assertion.setIssuer(issuer); - assertion.setSubject(subject); - assertion.setConditions(conditions); - assertion.getAuthnStatements().add(authnStatement); - assertion.getAttributeStatements().add(attributeStatement); - - return assertion; - } - - /** - * Builds Assertion object - * @param issuerValue Value of the issuer - * @param nameQualifier nameQualifier - * @param spNameQualifier spNameQualifier - * @param spProviderID spProviderID - * @param ipAddress IP address of the client - * @param inResponseTo ID of the corresponding AuthnRequest - * @param notBefore Time before assertion is not valid - * @param notOnOrAfter Time after assertion is not valid - * @param recipient Recipient of the assertion - * @param attributeList Attributes to be included in the assertion - * @return Assertion - */ - public static Assertion buildAssertion( - String issuerValue, - String nameQualifier, - String spNameQualifier, - String spProviderID, - String ipAddress, - String inResponseTo, - DateTime notBefore, - DateTime notOnOrAfter, - String recipient, - List attributeList) { - - Issuer issuer = buildIssuer(issuerValue); - NameID nameID = buildNameID(NameID.UNSPECIFIED, nameQualifier, spNameQualifier, spProviderID, NameID.UNSPECIFIED); - SubjectConfirmationData scData = buildSubjectConfirmationData(ipAddress, inResponseTo, notOnOrAfter, recipient); - SubjectConfirmation subjectConfirmation = buildSubjectConfirmation(SubjectConfirmation.METHOD_BEARER, scData); - Subject subject = buildSubject(nameID, subjectConfirmation); - - List audienceList = buildAudienceList(recipient); - Conditions conditions = buildConditions(notBefore, notOnOrAfter, audienceList); - AuthnStatement authnStatement = buildAuthnStatement(ipAddress); - AttributeStatement attributeStatement = buildAttributeStatement(attributeList); - - return buildAssertion(issuer, subject, conditions, authnStatement, attributeStatement); - } - - /** - * Builds List of Audience objects - * @param audiences Audience strings - * @return List of Audience - */ - public static List buildAudienceList(String... audiences) { - List audienceList = new ArrayList(); - - for (String audienceString : audiences) { - Audience audience = buildXMLObject(Audience.DEFAULT_ELEMENT_NAME); - audience.setAudienceURI(audienceString); - audienceList.add(audience); - } - - return audienceList; - } - - /** - * Builds NameID object - * @param format Format of the NameID - * @param nameQualifier nameQualifier - * @param spNameQualifier spNameQualifier - * @param spProviderID spProviderID - * @param value Value of the NameID - * @return NameID - */ - public static NameID buildNameID(String format, - String nameQualifier, - String spNameQualifier, - String spProviderID, - String value) { - - NameID nameID = buildXMLObject(NameID.DEFAULT_ELEMENT_NAME); - - nameID.setFormat(format); - nameID.setNameQualifier(nameQualifier); - nameID.setSPNameQualifier(spNameQualifier); - nameID.setSPProvidedID(spProviderID); - nameID.setValue(value); - - return nameID; - - } - - /** - * Builds SubjectConfirmation object - * @param method Method of SubjectConfirmation - * @param scData SubjectConfirmationData - * @return SubjectConfirmation - */ - public static SubjectConfirmation buildSubjectConfirmation(String method, SubjectConfirmationData scData) { - - SubjectConfirmation subjectConfirmation = buildXMLObject(SubjectConfirmation.DEFAULT_ELEMENT_NAME); - - subjectConfirmation.setMethod(method); - subjectConfirmation.setSubjectConfirmationData(scData); - - return subjectConfirmation; - } - - /** - * Builds SubjectConfirmationData object - * @param ipAddress IP address of the client - * @param inResponseTo ID of the corresponding AuthnRequest - * @param notOnOrAfter Time after subject is not valid - * @param recipient recipient of the assertion - * @return SubjectConfirmationData - */ - public static SubjectConfirmationData buildSubjectConfirmationData(String ipAddress, - String inResponseTo, - DateTime notOnOrAfter, - String recipient) { - - SubjectConfirmationData scData = buildXMLObject(SubjectConfirmationData.DEFAULT_ELEMENT_NAME); - - scData.setAddress(ipAddress); - scData.setInResponseTo(inResponseTo); - scData.setNotOnOrAfter(notOnOrAfter); - scData.setRecipient(recipient); - - return scData; - - } - - /** - * Builds Subject object - * @param nameID NameID object - * @param subjectConfirmation SubjectConfirmation - * @return Subject - */ - public static Subject buildSubject(NameID nameID, SubjectConfirmation subjectConfirmation) { - - Subject subject = buildXMLObject(Subject.DEFAULT_ELEMENT_NAME); - subject.setNameID(nameID); - subject.getSubjectConfirmations().add(subjectConfirmation); - - return subject; - } - - /** - * Build Conditions object - * @param notBefore Time before assertion is not valid - * @param notOnOrAfter Time after assertion is not valid - * @param audienceList List of audience - * @return Conditions - */ - public static Conditions buildConditions(DateTime notBefore, DateTime notOnOrAfter, List audienceList) { - Conditions conditions = buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME); - - conditions.setNotBefore(notBefore); - conditions.setNotOnOrAfter(notOnOrAfter); - - AudienceRestriction audienceRestriction = buildXMLObject(AudienceRestriction.DEFAULT_ELEMENT_NAME); - audienceRestriction.getAudiences().addAll(audienceList); - conditions.getAudienceRestrictions().add(audienceRestriction); - - OneTimeUse oneTimeUse = buildXMLObject(OneTimeUse.DEFAULT_ELEMENT_NAME); - conditions.getConditions().add(oneTimeUse); - - return conditions; - - } - - /** - * Build AuthnStatement object - * @param authInstant Time instant of authentication - * @param subjectLocality subjectLocality - * @param authnContext AuthnContext used - * @return AuthnStatement - */ - public static AuthnStatement buildAuthnStatement(DateTime authInstant, SubjectLocality subjectLocality, AuthnContext authnContext) { - AuthnStatement authnStatement = buildXMLObject(AuthnStatement.DEFAULT_ELEMENT_NAME); - - authnStatement.setAuthnInstant(authInstant); - authnStatement.setSubjectLocality(subjectLocality); - authnStatement.setAuthnContext(authnContext); - - return authnStatement; - } - - /** - * Build AuthnStatement object - * @param ipAddress IP address of the client - * @return AuthnStatement - */ - public static AuthnStatement buildAuthnStatement(String ipAddress) { - AuthnStatement authnStatement = buildXMLObject(AuthnStatement.DEFAULT_ELEMENT_NAME); - - authnStatement.setAuthnInstant(new DateTime()); - - SubjectLocality subjectLocality = buildXMLObject(SubjectLocality.DEFAULT_ELEMENT_NAME); - subjectLocality.setAddress(ipAddress); - authnStatement.setSubjectLocality(subjectLocality); - - AuthnContext authnContext = buildXMLObject(AuthnContext.DEFAULT_ELEMENT_NAME); - authnStatement.setAuthnContext(authnContext); - - return authnStatement; - } - - /** - * Builds AttributeStatement object - * @return AttributeStatement - */ - public static AttributeStatement buildAttributeStatement() { - return buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME); - } - - /** - * Builds AttributeStatement object - * @param attributeList List of attributes - * @return AttributeStatement - */ - public static AttributeStatement buildAttributeStatement(List attributeList) { - AttributeStatement attributeStatement = buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME); - attributeStatement.getAttributes().addAll(attributeList); - - return attributeStatement; - } - - /** - * Builds STORK String Attribute - * @param name Attribute Name - * @param friendlyName friendlyName of Attribute - * @param value Value of Attribute - * @param status STORK status of attribute - * @return STORK String Attribute - */ - public static Attribute buildSTORKStringAttribute(String name, String friendlyName, String value, String status) { - XSString xsString = buildXSString(AttributeValue.DEFAULT_ELEMENT_NAME); - xsString.setValue(value); - - return buildAttribute(name, friendlyName, status, xsString); - } - - /** - * Builds STORK XML Any Attribute - * @param name Attribute Name - * @param friendlyName friendlyName of Attribute - * @param value Value of Attribute - * @param status STORK status of attribute - * @return STORK XML Any Attribute - */ - public static Attribute buildSTORKXMLAttribute(String name, String friendlyName, XMLObject value, String status) { - XSAny xsAny = buildXMLObject(AttributeValue.DEFAULT_ELEMENT_NAME); - xsAny.getUnknownXMLObjects().add(value); - - return buildAttribute(name, friendlyName, status, xsAny); - } - - /** - * Builds STORK Attribute - * @param name Attribute Name - * @param friendlyName friendlyName of Attribute - * @param status STORK status of Attribute - * @param attributeValue Value of the Attribute - * @return Attribute - */ - public static Attribute buildAttribute(String name, String friendlyName, String status, XMLObject attributeValue) { - Attribute attribute = buildXMLObject(STORKAttribute.DEFAULT_ELEMENT_NAME); - - attribute.setNameFormat(STORKAttribute.URI_REFERENCE); - attribute.setFriendlyName(friendlyName); - attribute.setName(name); - attribute.getUnknownAttributes().put(STORKAttribute.DEFAULT_STORK_ATTRIBUTE_QNAME, status); - attribute.getAttributeValues().add(attributeValue); - - return attribute; - } - - /** - * Builds STORK String Attribute - * @param name Attribute Name - * @param friendlyName friendlyName of Attribute - * @param status STORK status of Attribute - * @param attributeValue Value of the Attribute - * @return String Attribute - */ - public static Attribute buildStringAttribute(String name, String friendlyName, String status, String attributeValue) { - Attribute attribute = buildXMLObject(STORKAttribute.DEFAULT_ELEMENT_NAME); - - attribute.setNameFormat(STORKAttribute.URI_REFERENCE); - attribute.setFriendlyName(friendlyName); - attribute.setName(name); - attribute.getUnknownAttributes().put(STORKAttribute.DEFAULT_STORK_ATTRIBUTE_QNAME, status); - - XSString xsString = buildXSString(AttributeValue.DEFAULT_ELEMENT_NAME); - xsString.setValue(attributeValue); - attribute.getAttributeValues().add(xsString); - - return attribute; - } - - /** - * Builds DSS signature request - * @param textToBeSigned Text to be included in the DSS request - * @param mimeType MimeType of the contents - * @return DSS signature request as String - */ - public static String buildSignatureRequestString(String textToBeSigned, String mimeType) { - //MimeType=\"text/plain\" - //MimeType=\"application/xhtml+xml\" - String sigRequestString = - "" + - "" + - "" + - "" + Base64.encodeBytes(textToBeSigned.getBytes()) + "" + - "" + - "" + - ""; - - return sigRequestString; - - } - - /** - * Builds STORK signedDoc RequestedAttribute - * @param textToBeSigned Text to be included in the DSS request - * @param mimeType MimeType of the contents - * @param isRequired true or false if signedDoc RequestedAttribute is required - * @return STORK signedDoc RequestedAttribute - */ - public static RequestedAttribute buildSignatureRequestRequestedAttribute(String textToBeSigned, String mimeType, boolean isRequired) { - return buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_SIGNEDDOC, isRequired, buildSignatureRequestString(textToBeSigned, mimeType)); - } - - /** - * Adds RequestedAttribute to STORKAuthnRequest - * @param authnRequest STORKAuthnRequest - * @param reqAttr RequestedAttribute - */ - public static void addRequestedAttribute(STORKAuthnRequest authnRequest, RequestedAttribute reqAttr) { - if (authnRequest != null) { - RequestedAttributes requestedAttributes = (RequestedAttributes) authnRequest.getExtensions().getUnknownXMLObjects(RequestedAttributes.DEFAULT_ELEMENT_NAME).get(0); - requestedAttributes.getRequestedAttributes().add(reqAttr); - } - } - - /** - * Adds several RequestedAttribute to STORKAuthnRequest - * @param authnRequest STORKAuthnRequest - * @param reqAttr RequestedAttribute - */ - public static void addRequestedAttributes(STORKAuthnRequest authnRequest, RequestedAttribute... reqAttrs) { - for (RequestedAttribute reqAttr : reqAttrs) { - addRequestedAttribute(authnRequest, reqAttr); - } - } - - /** - * Builds STORK signed doc attribute and adds it to STORKAuthnRequest - * @param authnRequest STORKAuthnRequest - * @param textToBeSigned Text to be included in the DSS request - * @param mimeType MimeType of the contents - * @param isRequired true or false if signedDoc RequestedAttribute is required - */ - public static void buildAndAddSignatureRequestToAuthnRequest(STORKAuthnRequest authnRequest, String textToBeSigned, String mimeType, boolean isRequired) { - if (authnRequest != null && !StringUtils.isEmpty(textToBeSigned)) { - addRequestedAttribute(authnRequest, buildSignatureRequestRequestedAttribute(textToBeSigned, mimeType, isRequired)); - } - - } - - /** - * Adds DSS siganture request as String to STORKAuthnRequest - * @param authnRequest STORKAuthnRequest - * @param dssSignatureRequest DSS signature request as String - * @param isRequired true or false if signedDoc RequestedAttribute is required - */ - public static void addSignatureRequestToAuthnRequest(STORKAuthnRequest authnRequest, String dssSignatureRequest, boolean isRequired) { - if (authnRequest != null && !StringUtils.isEmpty(dssSignatureRequest)) { - addRequestedAttribute(authnRequest, buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_SIGNEDDOC, isRequired, dssSignatureRequest)); - } - - } - - /** - * Adds Attribute to an assertion - * @param assertion Assertion - * @param attr Attribute - */ - public static void addAttribute(Assertion assertion, Attribute attr) { - if (assertion != null) { - if (!assertion.getAttributeStatements().isEmpty()) { - assertion.getAttributeStatements().get(0).getAttributes().add(attr); - } - } - } - - /** - * Adds several Attribute to an assertion - * @param assertion Assertion - * @param attr Attribute - */ - public static void addAttributes(Assertion assertion, Attribute... attrs) { - for (Attribute attr : attrs) { - addAttribute(assertion, attr); - } - } - - /** - * Adds several Attribute to first assertion in STORK response - * @param response STORK response - * @param attrs Attribute - */ - public static void addAttribute(STORKResponse response, Attribute... attrs) { - if (response != null) { - if (!response.getAssertions().isEmpty()) { - addAttributes(response.getAssertions().get(0), attrs); - } - } - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKBootstrap.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKBootstrap.java deleted file mode 100644 index 953affdf8..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKBootstrap.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.common; - -import java.io.InputStream; - -import org.opensaml.DefaultBootstrap; -import org.opensaml.common.xml.SAMLSchemaBuilder; -import org.opensaml.xml.ConfigurationException; -import org.opensaml.xml.XMLConfigurator; - -/** - * Class extending the default bootstrap mechanism of OpenSAML - * @author bzwattendorfer - * - */ -public class STORKBootstrap extends DefaultBootstrap { - - /** - * Extends the default bootstrap mechanism of OpenSAML - * Adds STORK schemata and extension elements - * @throws ConfigurationException - */ - public static synchronized void bootstrap() throws ConfigurationException { - - DefaultBootstrap.bootstrap(); - - SAMLSchemaBuilder.addExtensionSchema("stork-schema-assertion-1.0.xsd"); - SAMLSchemaBuilder.addExtensionSchema("stork-schema-protocol-1.0.xsd"); - - - - initStorkConfig("saml2-stork-config.xml"); - - } - - /** - * Initializes OpenSAML with config - * @param xmlConfig XML Config for STORK and SAML2 - * @throws ConfigurationException - */ - private static void initStorkConfig(String xmlConfig) throws ConfigurationException { - - XMLConfigurator configurator = new XMLConfigurator(); - - InputStream is = STORKBootstrap.class.getClassLoader().getResourceAsStream(xmlConfig); - - configurator.load(is); - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKConstants.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKConstants.java deleted file mode 100644 index 5a63e2dcd..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKConstants.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.common; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * Interface encapuslating relevant STORK constants such as namespace, attribute names, etc. - * @author bzwattendorfer - * - */ -public interface STORKConstants { - - /** - * STORK namespace - */ - public static final String STORK10_NS = "urn:eu:stork:names:tc:STORK:1.0:assertion"; - - /** - * STORK namespace prefix - */ - public static final String STORK10_PREFIX = "stork"; - - /** - * STORK protocol namespace - */ - public static final String STORKP10_NS = "urn:eu:stork:names:tc:STORK:1.0:protocol"; - - /** - * STORK protocol namespace prefix - */ - public static final String STORKP10_PREFIX = "storkp"; - - /** - * STORK attribute name prefix - */ - final static String STORK_ATTRIBUTE_NAME_PREFIX = "http://www.stork.gov.eu/1.0/"; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_EIDENTIFIER = "eIdentifier"; - final static String STORK_ATTRIBUTE_EIDENTIFIER = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_EIDENTIFIER; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_GIVENAME = "givenName"; - final static String STORK_ATTRIBUTE_GIVENNAME = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_GIVENAME; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_SURNAME = "surname"; - final static String STORK_ATTRIBUTE_SURNAME = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_SURNAME; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_INHERITED_FAMILYNAME = "inheritedFamilyName"; - final static String STORK_ATTRIBUTE_INHERITED_FAMILYNAME = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_INHERITED_FAMILYNAME; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_ADOPTED_FAMILYNAME = "adoptedFamilyName"; - final static String STORK_ATTRIBUTE_ADOPTED_FAMILYNAME = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_ADOPTED_FAMILYNAME; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_GENDER = "gender"; - final static String STORK_ATTRIBUTE_GENDER = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_GENDER; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_DATEOFBIRTH = "dateOfBirth"; - final static String STORK_ATTRIBUTE_DATEOFBIRTH = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_DATEOFBIRTH; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_COUNTRYOFBIRTH = "countryCodeOfBirth"; - final static String STORK_ATTRIBUTE_COUNTRYCODEOFBIRTH = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_COUNTRYOFBIRTH; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_NATIONALITYCODE = "nationalityCode"; - final static String STORK_ATTRIBUTE_NATIONALITYCODE = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_NATIONALITYCODE; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_MARTIALSTATUS = "maritalStatus"; - final static String STORK_ATTRIBUTE_MARTIALSTATUS = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_MARTIALSTATUS; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_TEXT_RESIDENCE_ADDRESS = "textResidenceAddress"; - final static String STORK_ATTRIBUTE_TEXT_RESIDENCE_ADDRESS = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_TEXT_RESIDENCE_ADDRESS; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_CANONICAL_RESIDENCE_ADDRESS = "canonicalResidenceAddress"; - final static String STORK_ATTRIBUTE_TEXT_CANONICAL_ADDRESS = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_CANONICAL_RESIDENCE_ADDRESS; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_EMAIL = "eMail"; - final static String STORK_ATTRIBUTE_EMAIL = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_EMAIL; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_TITLE = "title"; - final static String STORK_ATTRIBUTE_TITLE = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_TITLE; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_RESIDENCE_PERMIT = "residencePermit"; - final static String STORK_ATTRIBUTE_RESIDENCE_PERMIT = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_RESIDENCE_PERMIT; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_PSEUDONYM = "pseudonym"; - final static String STORK_ATTRIBUTE_PSEUDONYM = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_PSEUDONYM; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_AGE = "age"; - final static String STORK_ATTRIBUTE_AGE = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_AGE; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_ISAGEOVER = "isAgeOver"; - final static String STORK_ATTRIBUTE_ISAGEOVER = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_ISAGEOVER; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_SIGNED_DOC = "signedDoc"; - final static String STORK_ATTRIBUTE_SIGNEDDOC = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_SIGNED_DOC; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_FISCALNUMBER = "fiscalNumber"; - final static String STORK_ATTRIBUTE_FISCALNUMBER = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_FISCALNUMBER; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_CITIZENQAALEVEL_OLD = "citizenQAAlevel"; - final static String STORK_ATTRIBUTE_CITIZENQAALEVEL_OLD = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_CITIZENQAALEVEL_OLD; - - final static String STORK_ATTRIBUTE_NAME_SUFFIX_CITIZENQAALEVEL = "citizenQAALevel"; - final static String STORK_ATTRIBUTE_CITIZENQAALEVEL = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_CITIZENQAALEVEL; - - /** - * Full Set of accepted STORK attributes - */ - public final Set FULL_STORK_ATTRIBUTE_SET = new HashSet(Arrays.asList(new String[] {STORK_ATTRIBUTE_EIDENTIFIER, - STORK_ATTRIBUTE_GIVENNAME, - STORK_ATTRIBUTE_SURNAME, - STORK_ATTRIBUTE_INHERITED_FAMILYNAME, - STORK_ATTRIBUTE_ADOPTED_FAMILYNAME, - STORK_ATTRIBUTE_GENDER, - STORK_ATTRIBUTE_DATEOFBIRTH, - STORK_ATTRIBUTE_COUNTRYCODEOFBIRTH, - STORK_ATTRIBUTE_NATIONALITYCODE, - STORK_ATTRIBUTE_MARTIALSTATUS, - STORK_ATTRIBUTE_TEXT_RESIDENCE_ADDRESS, - STORK_ATTRIBUTE_TEXT_CANONICAL_ADDRESS, - STORK_ATTRIBUTE_TEXT_CANONICAL_ADDRESS, - STORK_ATTRIBUTE_EMAIL, - STORK_ATTRIBUTE_TITLE, - STORK_ATTRIBUTE_RESIDENCE_PERMIT, - STORK_ATTRIBUTE_PSEUDONYM, - STORK_ATTRIBUTE_AGE, - STORK_ATTRIBUTE_ISAGEOVER, - STORK_ATTRIBUTE_SIGNEDDOC, - STORK_ATTRIBUTE_FISCALNUMBER, - STORK_ATTRIBUTE_CITIZENQAALEVEL_OLD, - STORK_ATTRIBUTE_CITIZENQAALEVEL})); - - /** - * Default set of STORK attributes to be requested (without signedDoc) - */ - Set DEFAULT_STORK_REQUESTED_ATTRIBUTE_SET = new HashSet(Arrays.asList(new String[] { - STORK_ATTRIBUTE_EIDENTIFIER, - STORK_ATTRIBUTE_GIVENNAME, - STORK_ATTRIBUTE_SURNAME, - STORK_ATTRIBUTE_DATEOFBIRTH,})); - - /** - * Default required set of returned STORK attributes - */ - Set DEFAULT_STORK_RETURNED_ATTRIBUTE_SET = new HashSet(Arrays.asList(new String[] { - STORK_ATTRIBUTE_EIDENTIFIER, - STORK_ATTRIBUTE_GIVENNAME, - STORK_ATTRIBUTE_SURNAME, - STORK_ATTRIBUTE_DATEOFBIRTH, - STORK_ATTRIBUTE_SIGNEDDOC})); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLException.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLException.java deleted file mode 100644 index 33ee67313..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLException.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.exception; - -/** - * Exception thrown if exception occurs in SAML message processing - * @author bzwattendorfer - * - */ -public class SAMLException extends Exception { - - /** {@inheritDoc} */ - public SAMLException() { - super(); - } - - /** {@inheritDoc} */ - public SAMLException(String message, Throwable cause) { - super(message, cause); - } - - /** {@inheritDoc} */ - public SAMLException(String message) { - super(message); - } - - /** {@inheritDoc} */ - public SAMLException(Throwable cause) { - super(cause); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLValidationException.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLValidationException.java deleted file mode 100644 index 51520d968..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLValidationException.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.exception; - -/** - * Exception thrown if error occurs in SAML message validation - * @author bzwattendorfer - * - */ -public class SAMLValidationException extends Exception { - - private static final long serialVersionUID = 1L; - - /** {@inheritDoc} */ - public SAMLValidationException() { - - super(); - } - - /** {@inheritDoc} */ - public SAMLValidationException(String s) { - - super(s); - } - - /** {@inheritDoc} */ - public SAMLValidationException(Exception e) { - - super(e); - } - - /** {@inheritDoc} */ - public SAMLValidationException(String m, Exception e) { - - super(m, e); - } -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttribute.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttribute.java deleted file mode 100644 index ec8232704..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttribute.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.saml; - -import javax.xml.namespace.QName; - -import org.opensaml.saml2.core.Attribute; - -import eu.stork.vidp.messages.common.STORKConstants; - -/** - * Interface extending original SAML Attribute for STORK with the XML attributeStatus attribute - * {@inheritDoc} - * @author bzwattendorfer - * - */ -public interface STORKAttribute extends Attribute { - - public static final String STORK_ATTRIBUTE_STATUS_ATTTRIB_NAME = "AttributeStatus"; - - public static final QName DEFAULT_STORK_ATTRIBUTE_QNAME = new QName(STORKConstants.STORK10_NS, STORK_ATTRIBUTE_STATUS_ATTTRIB_NAME, STORKConstants.STORK10_PREFIX); - - public static final String ALLOWED_ATTRIBUTE_STATUS_AVAIL = "Available"; - public static final String ALLOWED_ATTRIBUTE_STATUS_NOT_AVAIL = "NotAvailable"; - public static final String ALLOWED_ATTRIBUTE_STATUS_WITHHELD = "Withheld"; - - /** - * Sets the STORK attributeStatus - * @param attributeStatus - */ - public void setAttributeStatus(String attributeStatus); - - /** - * Gets the STORK attributeStatus - * @return - */ - public String getAttributeStatus(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttributeValue.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttributeValue.java deleted file mode 100644 index 2d511d62a..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttributeValue.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.saml; - -import javax.xml.namespace.QName; - -import org.opensaml.saml2.core.AttributeValue; - -import eu.stork.vidp.messages.common.STORKConstants; - -/** - * {@inheritDoc} - * @author bzwattendorfer - * - */ -public interface STORKAttributeValue extends AttributeValue { - - /** Element name, no namespace. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "AttributeValue"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORK10_PREFIX); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKExtensions.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKExtensions.java deleted file mode 100644 index b5e12ea75..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKExtensions.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml; - -import org.opensaml.saml2.common.Extensions; - -import eu.stork.vidp.messages.stork.AuthenticationAttributes; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; -import eu.stork.vidp.messages.stork.RequestedAttributes; - -/** - * Extends the SAML Extension element with STORK related functionality - * {@inheritDoc} - * @author bzwattendorfer - * - */ -public interface STORKExtensions extends Extensions { - - /** - * Sets the QAALevel object - * @param authLevel QAALevel object - */ - public void setQAALevel(QualityAuthenticationAssuranceLevel authLevel); - - /** - * Gets the QAALevel object - * @return QAALevel object - */ - public QualityAuthenticationAssuranceLevel getQAALevel(); - - /** - * Gets the RequestedAttributes object - * @return RequestedAttributes object - */ - public RequestedAttributes getRequestedAttributes(); - - /** - * Sets RequestedAttributes - * @param requestedAttributes RequestedAttributes object - */ - public void setRequestedAttributes(RequestedAttributes requestedAttributes); - - /** - * Gets AuthenticationAttributes - * @return AuthenticationAttributes - */ - public AuthenticationAttributes getAuthenticationAttributes(); - - /** - * Sets AuthenticationAttributes - * @param authenticationAttributes AuthenticationAttributes object - */ - public void setAuthenticationAttributes(AuthenticationAttributes authenticationAttributes); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKRequestedAttribute.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKRequestedAttribute.java deleted file mode 100644 index 38149bea5..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKRequestedAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.saml; - -import javax.xml.namespace.QName; - -import org.opensaml.saml2.metadata.RequestedAttribute; - -import eu.stork.vidp.messages.common.STORKConstants; - -/** - * {@inheritDoc} - * @author bzwattendorfer - * - */ -public interface STORKRequestedAttribute extends RequestedAttribute { - - - /** Default element name */ - public final static QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORK10_PREFIX); - - /** QName of the XSI type */ - public final static QName TYPE_NAME = new QName(STORKConstants.STORK10_NS, TYPE_LOCAL_NAME, - STORKConstants.STORK10_PREFIX); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeBuilder.java deleted file mode 100644 index 413b5f6d7..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeBuilder.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.core.impl.AttributeBuilder; - -import eu.stork.vidp.messages.saml.STORKAttribute; - -/** - * @author bzwattendorfer - * - */ -public class STORKAttributeBuilder extends AttributeBuilder { - - /** - * Constructor. - */ - public STORKAttributeBuilder() { - - } - - /** {@inheritDoc} */ - public STORKAttribute buildObject() { - return buildObject(SAMLConstants.SAML20_NS, Attribute.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX); - } - - /** {@inheritDoc} */ - public STORKAttribute buildObject(String namespaceURI, String localName, String namespacePrefix) { - return new STORKAttributeImpl(namespaceURI, localName, namespacePrefix); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeImpl.java deleted file mode 100644 index 89ad90eae..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.saml2.core.impl.AttributeImpl; - -import eu.stork.vidp.messages.saml.STORKAttribute; - -/** - * @author bzwattendorfer - * - */ -public class STORKAttributeImpl extends AttributeImpl implements STORKAttribute { - - private String attributeStatus; - - protected STORKAttributeImpl(String namespaceURI, String elementLocalName, - String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /* (non-Javadoc) - * @see eu.stork.mw.common.messages.saml.STORKAttribute#getAttributeStatus() - */ - public String getAttributeStatus() { - return attributeStatus; - } - - /* (non-Javadoc) - * @see eu.stork.mw.common.messages.saml.STORKAttribute#setAttributeStatus(java.lang.String) - */ - public void setAttributeStatus(String attributeStatus) { - this.attributeStatus = attributeStatus; - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeMarshaller.java deleted file mode 100644 index ba8c2f1a3..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeMarshaller.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.saml2.core.impl.AttributeMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.saml.STORKAttribute; - -/** - * @author bzwattendorfer - * - */ -public class STORKAttributeMarshaller extends AttributeMarshaller { - - protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException { - STORKAttribute attribute = (STORKAttribute) samlElement; - - if (attribute.getAttributeStatus() != null) { - domElement.setAttributeNS(STORKConstants.STORK10_NS, STORKAttribute.STORK_ATTRIBUTE_STATUS_ATTTRIB_NAME, attribute.getName()); - } - - super.marshallAttributes(samlElement, domElement); - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeUnmarshaller.java deleted file mode 100644 index 5a74dab7d..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeUnmarshaller.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - - -package eu.stork.vidp.messages.saml.impl; - -import javax.xml.namespace.QName; - -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.core.impl.AttributeUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; -import org.w3c.dom.Attr; - -import eu.stork.vidp.messages.saml.STORKAttribute; - -/** - * A thread-safe Unmarshaller for {@link org.opensaml.saml2.core.Attribute} objects. - */ -public class STORKAttributeUnmarshaller extends AttributeUnmarshaller { - - - protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { - - if (samlObject instanceof STORKAttribute) { - STORKAttribute attrib = (STORKAttribute) samlObject; - - if (attribute.getLocalName().equals(STORKAttribute.STORK_ATTRIBUTE_STATUS_ATTTRIB_NAME)) { - attrib.setAttributeStatus(attribute.getValue()); - } - } - - super.processAttribute(samlObject, attribute); - } - -} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestBuilder.java deleted file mode 100644 index 8836b6c8e..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestBuilder.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.core.AuthnRequest; -import org.opensaml.saml2.core.impl.AuthnRequestBuilder; - -import eu.stork.mw.messages.saml.STORKAuthnRequest; - -public class STORKAuthnRequestBuilder extends AuthnRequestBuilder { - - /** {@inheritDoc} */ - - - public STORKAuthnRequest buildObject() { - return buildObject(SAMLConstants.SAML20P_NS, AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); - } - - /** {@inheritDoc} */ - public STORKAuthnRequest buildObject(String namespaceURI, String localName, String namespacePrefix) { - return new STORKAuthnRequestImpl(namespaceURI, localName, namespacePrefix); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestImpl.java deleted file mode 100644 index c9375ceb9..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestImpl.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import java.security.cert.X509Certificate; -import java.util.List; - -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.core.impl.AuthnRequestImpl; -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.xml.XMLObject; - -import eu.stork.mw.messages.saml.STORKAuthnRequest; - -public class STORKAuthnRequestImpl extends AuthnRequestImpl implements STORKAuthnRequest { - - private int qaaLevel; - - private String ccc; - - private String finalRedirectURL; - - private String spID; - - private XMLObject originalSPAuthRequest; - - private X509Certificate spCertSig; - - private X509Certificate spCertEnc; - - //private XMLObjectChildrenList requestedAttributes; - private List requestedAttributes; - - protected STORKAuthnRequestImpl(String namespaceURI, String elementLocalName, - String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - //requestedAttributes = new IndexedXMLObjectChildrenList(this); - } - - public STORKAuthnRequestImpl() { - super(SAMLConstants.SAML20P_NS, STORKAuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); - } - - - - public int getQAALevel() { - return this.qaaLevel; - } - - public void setQAALevel(int authLevel) { - this.qaaLevel = authLevel; - - } - - public String getCitizenCountryCode() { - return ccc; - } - - public String getFinalRedirectURL() { - return finalRedirectURL; - } - - public XMLObject getOriginalSPAuthRequest() { - return originalSPAuthRequest; - } - - public X509Certificate getSPCertEnc() { - return spCertEnc; - } - - public X509Certificate getSPCertSig() { - return spCertSig; - } - - public String getSPID() { - return spID; - } - - public void setCitizenCountryCode(String citizenCountryCode) { - this.ccc = citizenCountryCode; - } - - public void setFinalRedirectURL(String finalRedirectURL) { - this.finalRedirectURL = finalRedirectURL; - } - - public void setOriginalSPAuthRequest(XMLObject spAuthRequest) { - this.originalSPAuthRequest = spAuthRequest; - } - - public void setSPCertEnc(X509Certificate encryptionCertificate) { - this.spCertEnc = encryptionCertificate; - } - - public void setSPCertSig(X509Certificate signingCertificate) { - this.spCertSig = signingCertificate; - } - - public void setSPID(String spID) { - this.spID = spID; - } - - public List getRequestedAttributes() { -// return (List) requestedAttributes.subList(new QName(STORKMessagesConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, STORKMessagesConstants.STORK10_PREFIX)); - return requestedAttributes; - } - - public void setRequestedAttributes(List requestedAttributesList) { - // this.requestedAttributes = (XMLObjectChildrenList) requestedAttributesList; - this.requestedAttributes = requestedAttributesList; - } - -// public List getOrderedChildren() { -// ArrayList children = new ArrayList(); -// -// if (super.getOrderedChildren() != null) { -// children.addAll(super.getOrderedChildren()); -// } -// -// if (qaaLevel != 0 ) { -// children.add(subject); -// } -// -// if (nameIDPolicy != null) { -// children.add(nameIDPolicy); -// } -// -// if (conditions != null) { -// children.add(conditions); -// } -// -// if (requestedAuthnContext != null) { -// children.add(requestedAuthnContext); -// } -// -// if (scoping != null) { -// children.add(scoping); -// } -// -// if (children.size() == 0) { -// return null; -// } -// -// return Collections.unmodifiableList(children); -// } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestMarshaller.java deleted file mode 100644 index faad3a835..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestMarshaller.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.saml2.core.impl.AuthnRequestMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.w3c.dom.Element; - -import eu.stork.mw.messages.saml.STORKAuthnRequest; - -public class STORKAuthnRequestMarshaller extends AuthnRequestMarshaller { - - protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { - STORKAuthnRequest req = (STORKAuthnRequest) samlObject; - -// if (sr.getQAA() != -1) { -// //domElement.setAttributeNS(null, StatusResponseType.VERSION_ATTRIB_NAME, sr.getVersion().toString()); -// } - } -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestUnmarshaller.java deleted file mode 100644 index 7924400fa..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestUnmarshaller.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; - -import org.opensaml.saml2.core.impl.AuthnRequestUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; -import org.opensaml.xml.signature.X509Data; -import org.opensaml.xml.util.Base64; - -import eu.stork.mw.messages.saml.STORKAuthnRequest; -import eu.stork.vidp.messages.saml.STORKExtensions; -import eu.stork.vidp.messages.stork.SPCertEnc; -import eu.stork.vidp.messages.stork.SPCertSig; -import eu.stork.vidp.messages.stork.SPCertType; -import eu.stork.vidp.messages.stork.SPInformation; -import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; - -public class STORKAuthnRequestUnmarshaller extends AuthnRequestUnmarshaller { - - protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) - throws UnmarshallingException { - STORKAuthnRequest req = (STORKAuthnRequest) parentSAMLObject; - - if (childSAMLObject instanceof STORKExtensions) { - STORKExtensions ext = (STORKExtensions) childSAMLObject; - req.setExtensions(ext); - - if (ext.getQAALevel() != null) - req.setQAALevel(ext.getQAALevel().getValue()); - - if (ext.getRequestedAttributes() != null) { - //List reqAttrList = new ArrayList(); -// for (RequestedAttribute reqAtt : ext.getRequestedAttributes().getRequestedAttributes()) { -// req.getRequestedAttributes().add(reqAtt); -// } - req.setRequestedAttributes(ext.getRequestedAttributes().getRequestedAttributes()); - - } - - if (ext.getAuthenticationAttributes() != null) { - VIDPAuthenticationAttributes vidpAuthAttributes = ext.getAuthenticationAttributes().getVIDPAuthenticationAttributes(); - if (vidpAuthAttributes != null) { - if (vidpAuthAttributes.getCitizenCountryCode() != null) - req.setCitizenCountryCode(vidpAuthAttributes.getCitizenCountryCode().getValue()); - - SPInformation spInformation = vidpAuthAttributes.getSPInformation(); - if (spInformation != null) { - if (spInformation.getSPID() != null) - req.setSPID(spInformation.getSPID().getValue()); - - if (spInformation.getSPCertSig() != null) { - SPCertSig spCertSig = spInformation.getSPCertSig(); - try { - req.setSPCertSig(getCertificateFromX509Data(spCertSig)); - } catch (Exception e) { - throw new UnmarshallingException("Error reading SP signing certificate"); - } - } - - if (spInformation.getSPCertEnc() != null) { - SPCertEnc spCertEnc = spInformation.getSPCertEnc(); - try { - req.setSPCertEnc(getCertificateFromX509Data(spCertEnc)); - } catch (Exception e) { - throw new UnmarshallingException("Error reading SP encryption certificate"); - } - } - - if (spInformation.getSPAuthRequest() != null) { - req.setOriginalSPAuthRequest(spInformation.getSPAuthRequest()); - } - - } - } - } - - } else { - super.processChildElement(parentSAMLObject, childSAMLObject); - } - } - - private X509Certificate getCertificateFromX509Data(SPCertType spCert) throws CertificateException { - if (spCert.getKeyInfo() != null) - if (!spCert.getKeyInfo().getX509Datas().isEmpty()) { - X509Data samlX509Data = spCert.getKeyInfo().getX509Datas().get(0); - - if (samlX509Data != null) { - if (!samlX509Data.getX509Certificates().isEmpty()) { - org.opensaml.xml.signature.X509Certificate samlX509Cert = samlX509Data.getX509Certificates().get(0); - if (samlX509Cert != null) { - if (samlX509Cert.getValue() != null && samlX509Cert.getValue().length() != 0) { - InputStream inStream = new ByteArrayInputStream( Base64.decode(samlX509Cert.getValue())); - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream); - return cert; - } - - } - - } - } - } - - return null; - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsBuilder.java deleted file mode 100644 index 96004871c..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsBuilder.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.common.impl.ExtensionsBuilder; -import org.opensaml.saml2.core.Response; - -import eu.stork.vidp.messages.saml.STORKExtensions; - -public class STORKExtensionsBuilder extends ExtensionsBuilder { - - public STORKExtensions buildObject() { - return buildObject(SAMLConstants.SAML20P_NS, Response.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); - } - - /** {@inheritDoc} */ - public STORKExtensions buildObject(String namespaceURI, String localName, String namespacePrefix) { - return new STORKExtensionsImpl(namespaceURI, localName, namespacePrefix); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsImpl.java deleted file mode 100644 index 5417481c7..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.saml2.common.impl.ExtensionsImpl; - -import eu.stork.vidp.messages.saml.STORKExtensions; -import eu.stork.vidp.messages.stork.AuthenticationAttributes; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; -import eu.stork.vidp.messages.stork.RequestedAttributes; - -public class STORKExtensionsImpl extends ExtensionsImpl implements STORKExtensions { - - private QualityAuthenticationAssuranceLevel qaaLevel; - - private RequestedAttributes requestedAttributes; - - private AuthenticationAttributes authenticationAttributes; - - protected STORKExtensionsImpl(String namespaceURI, String elementLocalName, - String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public AuthenticationAttributes getAuthenticationAttributes() { - return authenticationAttributes; - } - - public QualityAuthenticationAssuranceLevel getQAALevel() { - return qaaLevel; - } - - public RequestedAttributes getRequestedAttributes() { - return requestedAttributes; - } - - public void setAuthenticationAttributes( - AuthenticationAttributes authenticationAttributes) { - this.authenticationAttributes = authenticationAttributes; - } - - public void setQAALevel(QualityAuthenticationAssuranceLevel authLevel) { - this.qaaLevel = authLevel; - } - - public void setRequestedAttributes(RequestedAttributes requestedAttributes) { - this.requestedAttributes = requestedAttributes; - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsMarshaller.java deleted file mode 100644 index 7aa86c2ed..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsMarshaller.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.saml2.common.impl.ExtensionsMarshaller; - -public class STORKExtensionsMarshaller extends ExtensionsMarshaller { - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsUnmarshaller.java deleted file mode 100644 index a701c9e6f..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsUnmarshaller.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.saml2.common.impl.ExtensionsUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.vidp.messages.saml.STORKExtensions; -import eu.stork.vidp.messages.stork.AuthenticationAttributes; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; -import eu.stork.vidp.messages.stork.RequestedAttributes; - -public class STORKExtensionsUnmarshaller extends ExtensionsUnmarshaller { - - protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject) - throws UnmarshallingException { - STORKExtensions extensions = (STORKExtensions) parentXMLObject; - - if (childXMLObject instanceof QualityAuthenticationAssuranceLevel) { - QualityAuthenticationAssuranceLevel qaa = (QualityAuthenticationAssuranceLevel) childXMLObject; - extensions.setQAALevel(qaa); - } if (childXMLObject instanceof RequestedAttributes) { - RequestedAttributes requestedAttributes = (RequestedAttributes) childXMLObject; - extensions.setRequestedAttributes(requestedAttributes); - } if (childXMLObject instanceof AuthenticationAttributes) { - AuthenticationAttributes authenticationAttributes = (AuthenticationAttributes) childXMLObject; - extensions.setAuthenticationAttributes(authenticationAttributes); - } else { - super.processChildElement(parentXMLObject, childXMLObject); - } - -} - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeBuilder.java deleted file mode 100644 index 1e23a9f2b..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeBuilder.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectBuilder; -import org.opensaml.saml2.metadata.RequestedAttribute; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.saml.STORKRequestedAttribute; - -/** - * Builder for {@link org.opensaml.saml2.metadata.impl.RequestedAttributeImpl}. - */ -public class STORKRequestedAttributeBuilder extends AbstractSAMLObjectBuilder { - - /** Constructor */ - public STORKRequestedAttributeBuilder() { - - } - - /** {@inheritDoc} */ - public STORKRequestedAttribute buildObject() { - return buildObject(STORKConstants.STORK10_NS, STORKRequestedAttribute.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - - /** {@inheritDoc} */ - public STORKRequestedAttribute buildObject(String namespaceURI, String localName, String namespacePrefix) { - return new STORKRequestedAttributeImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeImpl.java deleted file mode 100644 index e3921919a..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - - -/** - * - */ - -package eu.stork.vidp.messages.saml.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.saml2.metadata.impl.RequestedAttributeImpl; -import org.opensaml.xml.XMLObject; - -import eu.stork.vidp.messages.saml.STORKRequestedAttribute; - -/** - * Concrete implementation of {@link org.opensaml.saml2.metadata.RequestedAttribute} - */ -public class STORKRequestedAttributeImpl extends RequestedAttributeImpl implements STORKRequestedAttribute { - - /** - * Constructor - * - * @param namespaceURI - * @param elementLocalName - * @param namespacePrefix - */ - protected STORKRequestedAttributeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /** {@inheritDoc} */ - public List getOrderedChildren() { - ArrayList children = new ArrayList(); - - children.addAll(getAttributeValues()); - - return Collections.unmodifiableList(children); - } -} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeUnmarshaller.java deleted file mode 100644 index 6b7771c72..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeUnmarshaller.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - - -/** - * - */ - -package eu.stork.vidp.messages.saml.impl; - -import javax.xml.namespace.QName; - -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.metadata.impl.RequestedAttributeUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.vidp.messages.common.STORKConstants; - - -/** - * A thread-safe Unmarshaller for {@link org.opensaml.saml2.metadata.RequestedAttribute} objects. - */ -public class STORKRequestedAttributeUnmarshaller extends RequestedAttributeUnmarshaller { - - protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) - throws UnmarshallingException { - - Attribute attribute = (Attribute) parentSAMLObject; - - QName childQName = childSAMLObject.getElementQName(); - if (childQName.getLocalPart().equals("AttributeValue") - && childQName.getNamespaceURI().equals(STORKConstants.STORK10_NS)) { - attribute.getAttributeValues().add(childSAMLObject); - } else { - super.processChildElement(parentSAMLObject, childSAMLObject); - } -} - - -} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseBuilder.java deleted file mode 100644 index 24cebaef7..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseBuilder.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.core.Response; -import org.opensaml.saml2.core.impl.ResponseBuilder; - -import eu.stork.mw.messages.saml.STORKResponse; - -public class STORKResponseBuilder extends ResponseBuilder { - - /** {@inheritDoc} */ - - - public STORKResponse buildObject() { - return buildObject(SAMLConstants.SAML20P_NS, Response.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); - } - - /** {@inheritDoc} */ - public STORKResponse buildObject(String namespaceURI, String localName, String namespacePrefix) { - return new STORKResponseImpl(namespaceURI, localName, namespacePrefix); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseImpl.java deleted file mode 100644 index 08b5dc9bc..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.common.xml.SAMLConstants; -import org.opensaml.saml2.core.impl.ResponseImpl; - -import eu.stork.mw.messages.saml.STORKAuthnRequest; -import eu.stork.mw.messages.saml.STORKResponse; - -public class STORKResponseImpl extends ResponseImpl implements STORKResponse { - - private int qaaLevel; - - protected STORKResponseImpl(String namespaceURI, String elementLocalName, - String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - - - public STORKResponseImpl() { - super(SAMLConstants.SAML20P_NS, STORKResponse.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); - } - - - public int getQAALevel() { - return this.qaaLevel; - } - - public void setQAALevel(int authLevel) { - this.qaaLevel = authLevel; - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseMarshaller.java deleted file mode 100644 index 1a4654d01..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseMarshaller.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.saml2.core.impl.ResponseMarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.MarshallingException; -import org.w3c.dom.Element; - -import eu.stork.mw.messages.saml.STORKResponse; - -public class STORKResponseMarshaller extends ResponseMarshaller { - - protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { - STORKResponse sr = (STORKResponse) samlObject; - -// if (sr.getQAA() != -1) { -// //domElement.setAttributeNS(null, StatusResponseType.VERSION_ATTRIB_NAME, sr.getVersion().toString()); -// } - } -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseUnmarshaller.java deleted file mode 100644 index c2a7bcef9..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseUnmarshaller.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.saml.impl; - -import org.opensaml.saml2.core.impl.ResponseUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.mw.messages.saml.STORKResponse; -import eu.stork.vidp.messages.saml.STORKExtensions; - -public class STORKResponseUnmarshaller extends ResponseUnmarshaller { - - protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) - throws UnmarshallingException { - STORKResponse resp = (STORKResponse) parentSAMLObject; - - if (childSAMLObject instanceof STORKExtensions) { - STORKExtensions ext = (STORKExtensions) childSAMLObject; - - if (ext.getQAALevel() != null) - resp.setQAALevel(ext.getQAALevel().getValue()); - } else { - super.processChildElement(parentSAMLObject, childSAMLObject); - } - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/AuthenticationAttributes.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/AuthenticationAttributes.java deleted file mode 100644 index 73f9cd503..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/AuthenticationAttributes.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface AuthenticationAttributes extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "AuthenticationAttributes"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - /** Local name of the XSI type. */ - public static final String TYPE_LOCAL_NAME = "AuthenticationAttributesType"; - - /** QName of the XSI type. */ - public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setVIDPAuthenticationAttributes(VIDPAuthenticationAttributes authenticationAttributes); - - public VIDPAuthenticationAttributes getVIDPAuthenticationAttributes(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/CitizenCountryCode.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/CitizenCountryCode.java deleted file mode 100644 index 8c7847dd7..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/CitizenCountryCode.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface CitizenCountryCode extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "CitizenCountryCode"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setValue(String citizenCountryCode); - - public String getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossBorderShare.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossBorderShare.java deleted file mode 100644 index c0f7cb291..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossBorderShare.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -/** - * @author bzwattendorfer - * - */ -public interface EIDCrossBorderShare extends ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "eIDCrossBorderShare"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setValue(boolean value); - - public boolean getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossSectorShare.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossSectorShare.java deleted file mode 100644 index a04376fb2..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossSectorShare.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -/** - * @author bzwattendorfer - * - */ -public interface EIDCrossSectorShare extends ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "eIDCrossSectorShare"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setValue(boolean value); - - public boolean getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDSectorShare.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDSectorShare.java deleted file mode 100644 index 4fbd4a2d9..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDSectorShare.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -/** - * @author bzwattendorfer - * - */ -public interface EIDSectorShare extends ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "eIDSectorShare"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setValue(boolean value); - - public boolean getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/QualityAuthenticationAssuranceLevel.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/QualityAuthenticationAssuranceLevel.java deleted file mode 100644 index 2869177b2..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/QualityAuthenticationAssuranceLevel.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface QualityAuthenticationAssuranceLevel extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "QualityAuthenticationAssuranceLevel"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORK10_PREFIX); - - public void setValue(int level); - - public int getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/RequestedAttributes.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/RequestedAttributes.java deleted file mode 100644 index 0dcb1964c..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/RequestedAttributes.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface RequestedAttributes extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "RequestedAttributes"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - /** Local name of the XSI type. */ - public static final String TYPE_LOCAL_NAME = "RequestedAttributesType"; - - /** QName of the XSI type. */ - public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setRequestedAttributes(List requestedAttributes); - - public List getRequestedAttributes(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPAuthRequest.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPAuthRequest.java deleted file mode 100644 index 8a5fd8644..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPAuthRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.ElementExtensibleXMLObject; -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -/** - * SAML 2.0 Extensions - */ -public interface SPAuthRequest extends ValidatingXMLObject, ElementExtensibleXMLObject { - - /** Local name, no namespace */ - public final static String LOCAL_NAME = "SPAuthRequest"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertEnc.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertEnc.java deleted file mode 100644 index fd0ff31ae..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertEnc.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface SPCertEnc extends - SPCertType { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "SPCertEnc"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertSig.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertSig.java deleted file mode 100644 index c54d23505..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertSig.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface SPCertSig extends - SPCertType { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "SPCertSig"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertType.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertType.java deleted file mode 100644 index e24db06a7..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertType.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface SPCertType extends - ValidatingXMLObject { - - /** Local name of the XSI type. */ - public static final String TYPE_LOCAL_NAME = "SPCertType"; - - /** QName of the XSI type. */ - public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setKeyInfo(KeyInfo keyInfo); - - public KeyInfo getKeyInfo(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPID.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPID.java deleted file mode 100644 index 6c8122b88..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPID.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface SPID extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "SPID"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setValue(String spID); - - public String getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPInformation.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPInformation.java deleted file mode 100644 index e0926cd65..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPInformation.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface SPInformation extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "SPInformation"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - /** Local name of the XSI type. */ - public static final String TYPE_LOCAL_NAME = "SPInformationType"; - - /** QName of the XSI type. */ - public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setSPID(SPID spID); - - public SPID getSPID(); - - public void setSPCertSig(SPCertSig spCertSig); - - public SPCertSig getSPCertSig(); - - public void setSPCertEnc(SPCertEnc spCertEnc); - - public SPCertEnc getSPCertEnc(); - - public void setSPAuthRequest(SPAuthRequest spAuthRequest); - - public SPAuthRequest getSPAuthRequest(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpApplication.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpApplication.java deleted file mode 100644 index c68a29297..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpApplication.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface SpApplication extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "spApplication"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORK10_PREFIX); - - public void setValue(String spApplication); - - public String getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpCountry.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpCountry.java deleted file mode 100644 index d7708cb62..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpCountry.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface SpCountry extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "spCountry"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORK10_PREFIX); - - public void setValue(String spCountry); - - public String getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpInstitution.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpInstitution.java deleted file mode 100644 index dddd9e599..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpInstitution.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface SpInstitution extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "spInstitution"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORK10_PREFIX); - - public void setValue(String spInstitution); - - public String getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpSector.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpSector.java deleted file mode 100644 index f29bf02c8..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpSector.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface SpSector extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "spSector"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORK10_PREFIX); - - public void setValue(String spSector); - - public String getValue(); - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/VIDPAuthenticationAttributes.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/VIDPAuthenticationAttributes.java deleted file mode 100644 index 89c4bec61..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/VIDPAuthenticationAttributes.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.validation.ValidatingXMLObject; - -import eu.stork.vidp.messages.common.STORKConstants; - -public interface VIDPAuthenticationAttributes extends - ValidatingXMLObject { - - /** Element local name. */ - public static final String DEFAULT_ELEMENT_LOCAL_NAME = "VIDPAuthenticationAttributes"; - - /** Default element name. */ - public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - /** Local name of the XSI type. */ - public static final String TYPE_LOCAL_NAME = "VIDPAuthenticationAttributesType"; - - /** QName of the XSI type. */ - public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, - STORKConstants.STORKP10_PREFIX); - - public void setCitizenCountryCode(CitizenCountryCode citizenCountryCode); - - public CitizenCountryCode getCitizenCountryCode(); - - public void setSPInformation(SPInformation spInformation); - - public SPInformation getSPInformation(); - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesBuilder.java deleted file mode 100644 index 7fb418f74..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.AuthenticationAttributes; - -public class AuthenticationAttributesBuilder extends - AbstractXMLObjectBuilder { - - @Override - public AuthenticationAttributes buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new AuthenticationAttributesImpl(namespaceURI, localName, namespacePrefix); - } - - public AuthenticationAttributes buildObject() { - return buildObject(STORKConstants.STORK10_NS, AuthenticationAttributes.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesImpl.java deleted file mode 100644 index 68e751fdc..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.AuthenticationAttributes; -import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; - -public class AuthenticationAttributesImpl extends - AbstractValidatingXMLObject implements - AuthenticationAttributes { - - private VIDPAuthenticationAttributes authenticationAttributes; - - - protected AuthenticationAttributesImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public VIDPAuthenticationAttributes getVIDPAuthenticationAttributes() { - return authenticationAttributes; - } - - public void setVIDPAuthenticationAttributes( - VIDPAuthenticationAttributes authenticationAttributes) { - this.authenticationAttributes = authenticationAttributes; - } - - - public List getOrderedChildren() { - ArrayList children = new ArrayList(); - - if (authenticationAttributes != null) { - children.add(authenticationAttributes); - } - - if (children.size() == 0) { - return null; - } - - return Collections.unmodifiableList(children); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesMarshaller.java deleted file mode 100644 index 05f1f9aec..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesMarshaller.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.io.BaseXMLObjectMarshaller; - -public class AuthenticationAttributesMarshaller extends - BaseXMLObjectMarshaller { - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesUnmarshaller.java deleted file mode 100644 index 564d62383..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesUnmarshaller.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.vidp.messages.stork.AuthenticationAttributes; -import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; - -public class AuthenticationAttributesUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processChildElement(XMLObject parentXMLObject, - XMLObject childXMLObject) throws UnmarshallingException { - AuthenticationAttributes attributes = (AuthenticationAttributes) parentXMLObject; - - if (childXMLObject instanceof VIDPAuthenticationAttributes) { - attributes.setVIDPAuthenticationAttributes((VIDPAuthenticationAttributes) childXMLObject); - } else { - super.processChildElement(parentXMLObject, childXMLObject); - } - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeBuilder.java deleted file mode 100644 index de380d780..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.CitizenCountryCode; - -public class CitizenCountryCodeBuilder extends - AbstractXMLObjectBuilder { - - @Override - public CitizenCountryCode buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new CitizenCountryCodeImpl(namespaceURI, localName, namespacePrefix); - } - - public CitizenCountryCode buildObject() { - return buildObject(STORKConstants.STORK10_NS, CitizenCountryCode.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeImpl.java deleted file mode 100644 index 3de591116..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.CitizenCountryCode; - -public class CitizenCountryCodeImpl extends - AbstractValidatingXMLObject implements - CitizenCountryCode { - - private String citizenCountryCode; - - protected CitizenCountryCodeImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public String getValue() { - return citizenCountryCode; - } - - public void setValue(String citizenCountryCode) { - this.citizenCountryCode = citizenCountryCode; - } - - public List getOrderedChildren() { - return Collections.emptyList(); - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeMarshaller.java deleted file mode 100644 index 8d47d6117..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.CitizenCountryCode; - -public class CitizenCountryCodeMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { - CitizenCountryCode ccc = (CitizenCountryCode) xmlObject; - XMLHelper.appendTextContent(domElement, ccc.getValue()); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeUnmarshaller.java deleted file mode 100644 index 69bd4cdb1..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.CitizenCountryCode; - -public class CitizenCountryCodeUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - CitizenCountryCode ccc = (CitizenCountryCode) xmlObject; - ccc.setValue(elementContent); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareBuilder.java deleted file mode 100644 index d2b1bba08..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.EIDCrossBorderShare; - -public class EIDCrossBorderShareBuilder extends - AbstractXMLObjectBuilder { - - @Override - public EIDCrossBorderShare buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new EIDCrossBorderShareImpl(namespaceURI, localName, namespacePrefix); - } - - public EIDCrossBorderShare buildObject() { - return buildObject(STORKConstants.STORKP10_NS, EIDCrossBorderShare.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORKP10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareImpl.java deleted file mode 100644 index e5182aff1..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.EIDCrossBorderShare; - -/** - * @author bzwattendorfer - * - */ -public class EIDCrossBorderShareImpl extends AbstractValidatingXMLObject implements - EIDCrossBorderShare { - - private boolean value; - - /** - * @param namespaceURI - * @param elementLocalName - * @param namespacePrefix - */ - public EIDCrossBorderShareImpl(String namespaceURI, String elementLocalName, - String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /* (non-Javadoc) - * @see eu.stork.mw.common.messages.stork.EIDSectorShare#getValue() - */ - public boolean getValue() { - return this.value; - } - - /* (non-Javadoc) - * @see eu.stork.mw.common.messages.stork.EIDSectorShare#setValue(boolean) - */ - public void setValue(boolean value) { - this.value = value; - - } - - /* (non-Javadoc) - * @see org.opensaml.xml.XMLObject#getOrderedChildren() - */ - public List getOrderedChildren() { - return Collections.emptyList(); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareMarshaller.java deleted file mode 100644 index 1b98e8a2b..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.EIDCrossBorderShare; - -public class EIDCrossBorderShareMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { - EIDCrossBorderShare cbs = (EIDCrossBorderShare) samlObject; - XMLHelper.appendTextContent(domElement, String.valueOf(cbs.getValue())); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareUnmarshaller.java deleted file mode 100644 index bb7b9d762..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.EIDCrossBorderShare; - -public class EIDCrossBorderShareUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - EIDCrossBorderShare cbs = (EIDCrossBorderShare) xmlObject; - cbs.setValue(Boolean.parseBoolean(elementContent)); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareBuilder.java deleted file mode 100644 index c02b11a7f..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.EIDCrossSectorShare; - -public class EIDCrossSectorShareBuilder extends - AbstractXMLObjectBuilder { - - @Override - public EIDCrossSectorShare buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new EIDCrossSectorShareImpl(namespaceURI, localName, namespacePrefix); - } - - public EIDCrossSectorShare buildObject() { - return buildObject(STORKConstants.STORKP10_NS, EIDCrossSectorShare.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORKP10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareImpl.java deleted file mode 100644 index b58ee4c4b..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.EIDCrossSectorShare; - -/** - * @author bzwattendorfer - * - */ -public class EIDCrossSectorShareImpl extends AbstractValidatingXMLObject implements - EIDCrossSectorShare { - - private boolean value; - - /** - * @param namespaceURI - * @param elementLocalName - * @param namespacePrefix - */ - public EIDCrossSectorShareImpl(String namespaceURI, String elementLocalName, - String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /* (non-Javadoc) - * @see eu.stork.mw.common.messages.stork.EIDSectorShare#getValue() - */ - public boolean getValue() { - return this.value; - } - - /* (non-Javadoc) - * @see eu.stork.mw.common.messages.stork.EIDSectorShare#setValue(boolean) - */ - public void setValue(boolean value) { - this.value = value; - - } - - /* (non-Javadoc) - * @see org.opensaml.xml.XMLObject#getOrderedChildren() - */ - public List getOrderedChildren() { - return Collections.emptyList(); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareMarshaller.java deleted file mode 100644 index bcffdad4a..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.EIDCrossSectorShare; - -public class EIDCrossSectorShareMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { - EIDCrossSectorShare css = (EIDCrossSectorShare) samlObject; - XMLHelper.appendTextContent(domElement, String.valueOf(css.getValue())); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareUnmarshaller.java deleted file mode 100644 index a249c4628..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.EIDCrossSectorShare; - -public class EIDCrossSectorShareUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - EIDCrossSectorShare css = (EIDCrossSectorShare) xmlObject; - css.setValue(Boolean.parseBoolean(elementContent)); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareBuilder.java deleted file mode 100644 index 79e0d1122..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.EIDSectorShare; - -public class EIDSectorShareBuilder extends - AbstractXMLObjectBuilder { - - @Override - public EIDSectorShare buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new EIDSectorShareImpl(namespaceURI, localName, namespacePrefix); - } - - public EIDSectorShare buildObject() { - return buildObject(STORKConstants.STORKP10_NS, EIDSectorShare.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORKP10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareImpl.java deleted file mode 100644 index ae65ad36c..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.EIDSectorShare; - -/** - * @author bzwattendorfer - * - */ -public class EIDSectorShareImpl extends AbstractValidatingXMLObject implements - EIDSectorShare { - - private boolean value; - - /** - * @param namespaceURI - * @param elementLocalName - * @param namespacePrefix - */ - public EIDSectorShareImpl(String namespaceURI, String elementLocalName, - String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - /* (non-Javadoc) - * @see eu.stork.mw.common.messages.stork.EIDSectorShare#getValue() - */ - public boolean getValue() { - return this.value; - } - - /* (non-Javadoc) - * @see eu.stork.mw.common.messages.stork.EIDSectorShare#setValue(boolean) - */ - public void setValue(boolean value) { - this.value = value; - - } - - /* (non-Javadoc) - * @see org.opensaml.xml.XMLObject#getOrderedChildren() - */ - public List getOrderedChildren() { - return Collections.emptyList(); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareMarshaller.java deleted file mode 100644 index ed18cfbd4..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.EIDSectorShare; - -public class EIDSectorShareMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { - EIDSectorShare ss = (EIDSectorShare) samlObject; - XMLHelper.appendTextContent(domElement, String.valueOf(ss.getValue())); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareUnmarshaller.java deleted file mode 100644 index 6631e1ac2..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.EIDSectorShare; - -public class EIDSectorShareUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - EIDSectorShare ss = (EIDSectorShare) xmlObject; - ss.setValue(Boolean.parseBoolean(elementContent)); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelBuilder.java deleted file mode 100644 index d536372e8..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; - -public class QualityAuthenticationAssuranceLevelBuilder extends - AbstractXMLObjectBuilder { - - @Override - public QualityAuthenticationAssuranceLevel buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new QualityAuthenticationAssuranceLevelImpl(namespaceURI, localName, namespacePrefix); - } - - public QualityAuthenticationAssuranceLevel buildObject() { - return buildObject(STORKConstants.STORKP10_NS, QualityAuthenticationAssuranceLevel.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORKP10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelImpl.java deleted file mode 100644 index 69548c149..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; - -public class QualityAuthenticationAssuranceLevelImpl extends - AbstractValidatingXMLObject implements - QualityAuthenticationAssuranceLevel { - - private int qaaLevel; - - protected QualityAuthenticationAssuranceLevelImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public int getValue() { - return this.qaaLevel; - } - - public void setValue(int level) { - this.qaaLevel = level; - - } - - public List getOrderedChildren() { - return Collections.emptyList(); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelMarshaller.java deleted file mode 100644 index 7f0d28895..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; - -public class QualityAuthenticationAssuranceLevelMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { - QualityAuthenticationAssuranceLevel qaa = (QualityAuthenticationAssuranceLevel) samlObject; - XMLHelper.appendTextContent(domElement, String.valueOf(qaa.getValue())); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelUnmarshaller.java deleted file mode 100644 index f024261f8..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; - -public class QualityAuthenticationAssuranceLevelUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - QualityAuthenticationAssuranceLevel qaa = (QualityAuthenticationAssuranceLevel) xmlObject; - qaa.setValue(Integer.parseInt(elementContent)); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesBuilder.java deleted file mode 100644 index d1e80abbb..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesBuilder.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - - -/** - * - */ - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.RequestedAttributes; - -/** - * Builder for {@link org.opensaml.saml2.core.impl.AudienceRestrictionImpl} objects. - */ -public class RequestedAttributesBuilder extends AbstractXMLObjectBuilder { - - /** Constructor. */ - public RequestedAttributesBuilder() { - - } - - /** {@inheritDoc} */ - public RequestedAttributes buildObject() { - return buildObject(STORKConstants.STORK10_NS, RequestedAttributes.DEFAULT_ELEMENT_LOCAL_NAME, - STORKConstants.STORK10_PREFIX); - } - - /** {@inheritDoc} */ - public RequestedAttributes buildObject(String namespaceURI, String localName, String namespacePrefix) { - return new RequestedAttributesImpl(namespaceURI, localName, namespacePrefix); - } -} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesImpl.java deleted file mode 100644 index cd2b4a490..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - - -/** - * - */ - -package eu.stork.vidp.messages.stork.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.util.XMLObjectChildrenList; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.RequestedAttributes; - -/** - * Concrete implementation of {@link org.opensaml.saml2.core.AudienceRestriction}. - */ -public class RequestedAttributesImpl extends AbstractValidatingXMLObject implements RequestedAttributes { - - /** List of the audiences. */ - private XMLObjectChildrenList requestedAttributes; - - /** - * Constructor. - * - * @param namespaceURI the namespace the element is in - * @param elementLocalName the local name of the XML element this Object represents - * @param namespacePrefix the prefix for the given namespace - */ - protected RequestedAttributesImpl(String namespaceURI, String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - requestedAttributes = new XMLObjectChildrenList(this); - } - - /** {@inheritDoc} */ - public List getRequestedAttributes() { - return requestedAttributes; - } - - - /** {@inheritDoc} */ - public List getOrderedChildren() { - ArrayList children = new ArrayList(); - - children.addAll(requestedAttributes); - - return Collections.unmodifiableList(children); - } - - public void setRequestedAttributes( - List requestedAttributes) { - this.requestedAttributes = (XMLObjectChildrenList) requestedAttributes; - - } - - - - -} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesMarshaller.java deleted file mode 100644 index 8716c45a5..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesMarshaller.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - - -/** - * - */ - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.io.BaseXMLObjectMarshaller; - -/** - * A thread safe Marshaller for {@link org.opensaml.saml2.core.AudienceRestriction} objects. - */ -public class RequestedAttributesMarshaller extends BaseXMLObjectMarshaller { - -} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesUnmarshaller.java deleted file mode 100644 index 94e603bd9..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesUnmarshaller.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - - -/** - * - */ - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.vidp.messages.stork.RequestedAttributes; - -/** - * A thread-safe Unmarshaller for {@link org.opensaml.saml2.core.AudienceRestriction} objects. - */ -public class RequestedAttributesUnmarshaller extends BaseXMLObjectUnmarshaller { - - /** {@inheritDoc} */ - protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException { - RequestedAttributes requestedAttributes = (RequestedAttributes) parentObject; - - if (childObject instanceof RequestedAttribute) { - requestedAttributes.getRequestedAttributes().add((RequestedAttribute) childObject); - } else { - super.processChildElement(parentObject, childObject); - } - } -} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestBuilder.java deleted file mode 100644 index 1febbf399..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestBuilder.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.SPAuthRequest; - -/** - * Builder of {@link org.opensaml.saml2.common.impl.ExtensionsImpl} objects. - */ -public class SPAuthRequestBuilder extends AbstractXMLObjectBuilder { - - /** - * {@inheritDoc} - */ - public SPAuthRequest buildObject() { - return buildObject(STORKConstants.STORK10_NS, SPAuthRequest.LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - - /** - * {@inheritDoc} - */ - public SPAuthRequest buildObject(String namespaceURI, String localName, String namespacePrefix) { - return new SPAuthRequestImpl(namespaceURI, localName, namespacePrefix); - } -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestImpl.java deleted file mode 100644 index 9ea20b9cc..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.util.IndexedXMLObjectChildrenList; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.SPAuthRequest; - -/** - * - */ -public class SPAuthRequestImpl extends AbstractValidatingXMLObject implements SPAuthRequest { - - /** "any" children */ - private final IndexedXMLObjectChildrenList unknownChildren; - - /** - * Constructor - * - * @param namespaceURI - * @param elementLocalName - * @param namespacePrefix - */ - protected SPAuthRequestImpl(String namespaceURI, String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - unknownChildren = new IndexedXMLObjectChildrenList(this); - } - - /** - * {@inheritDoc} - */ - public List getUnknownXMLObjects() { - return unknownChildren; - } - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - public List getUnknownXMLObjects(QName typeOrName) { - return (List) unknownChildren.subList(typeOrName); - } - - /** {@inheritDoc} */ - public List getOrderedChildren() { - return Collections.unmodifiableList(unknownChildren); - } -} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestMarshaller.java deleted file mode 100644 index feb730935..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestMarshaller.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.AbstractXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.w3c.dom.Element; - -/** - * A thread-safe Marshaller for {@link org.opensaml.saml2.common.Extensions} objects. - */ -public class SPAuthRequestMarshaller extends AbstractXMLObjectMarshaller { - - /** - * Constructor - */ - public SPAuthRequestMarshaller() { - super(); - } - - /** - * {@inheritDoc} - */ - protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { - // no attributes - } - - /** - * {@inheritDoc} - */ - protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { - // no content - } -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestUnmarshaller.java deleted file mode 100644 index 7d5be220d..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestUnmarshaller.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.AbstractXMLObjectUnmarshaller; -import org.opensaml.xml.io.UnmarshallingException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Attr; - -import eu.stork.vidp.messages.stork.SPAuthRequest; - -public class SPAuthRequestUnmarshaller extends AbstractXMLObjectUnmarshaller { - - /** Logger. */ - private final Logger log = LoggerFactory.getLogger(AbstractSAMLObjectUnmarshaller.class); - - /** Constructor. */ - public SPAuthRequestUnmarshaller() { - super(); - } - - /** - * {@inheritDoc} - */ - protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject) - throws UnmarshallingException { - SPAuthRequest spAuthRequest = (SPAuthRequest) parentXMLObject; - - spAuthRequest.getUnknownXMLObjects().add(childXMLObject); - } - - /** - * {@inheritDoc} - */ - protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException { - log.debug("Ignorning unknown attribute {}", attribute.getLocalName()); - } - - /** - * {@inheritDoc} - */ - protected void processElementContent(XMLObject xmlObject, String elementContent) { - log.debug("Ignoring element content {}", elementContent); - } -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncBuilder.java deleted file mode 100644 index eb13ddf73..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.SPCertEnc; - -public class SPCertEncBuilder extends - AbstractXMLObjectBuilder { - - @Override - public SPCertEnc buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new SPCertEncImpl(namespaceURI, localName, namespacePrefix); - } - - public SPCertEnc buildObject() { - return buildObject(STORKConstants.STORK10_NS, SPCertEnc.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncImpl.java deleted file mode 100644 index 2ee08e1ec..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import eu.stork.vidp.messages.stork.SPCertEnc; - -public class SPCertEncImpl extends - SPCertTypeImpl implements - SPCertEnc { - - protected SPCertEncImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncMarshaller.java deleted file mode 100644 index 091676959..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncMarshaller.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - - -public class SPCertEncMarshaller extends - SPCertTypeMarshaller { - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncUnmarshaller.java deleted file mode 100644 index 3b6339609..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncUnmarshaller.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - - -public class SPCertEncUnmarshaller extends - SPCertTypeUnmarshaller { - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigBuilder.java deleted file mode 100644 index 5e75a0e2c..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.SPCertSig; - -public class SPCertSigBuilder extends - AbstractXMLObjectBuilder { - - @Override - public SPCertSig buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new SPCertSigImpl(namespaceURI, localName, namespacePrefix); - } - - public SPCertSig buildObject() { - return buildObject(STORKConstants.STORK10_NS, SPCertSig.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigImpl.java deleted file mode 100644 index f98e3ede3..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import eu.stork.vidp.messages.stork.SPCertSig; - -public class SPCertSigImpl extends - SPCertTypeImpl implements - SPCertSig { - - protected SPCertSigImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigMarshaller.java deleted file mode 100644 index e9f3d14da..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigMarshaller.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - - -public class SPCertSigMarshaller extends - SPCertTypeMarshaller { - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigUnmarshaller.java deleted file mode 100644 index d706223cb..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigUnmarshaller.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - - -public class SPCertSigUnmarshaller extends - SPCertTypeUnmarshaller { - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeImpl.java deleted file mode 100644 index a9a30dada..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.signature.KeyInfo; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.SPCertType; - -public class SPCertTypeImpl extends - AbstractValidatingXMLObject implements - SPCertType { - - private KeyInfo keyInfo; - - protected SPCertTypeImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public KeyInfo getKeyInfo() { - return keyInfo; - } - - public void setKeyInfo(KeyInfo keyInfo) { - this.keyInfo = keyInfo; - } - - public List getOrderedChildren() { - ArrayList children = new ArrayList(); - - if (keyInfo != null) { - children.add(keyInfo); - } - - if (children.size() == 0) { - return null; - } - - return Collections.unmodifiableList(children); - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeMarshaller.java deleted file mode 100644 index 0443a721a..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeMarshaller.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.io.BaseXMLObjectMarshaller; - -public class SPCertTypeMarshaller extends - BaseXMLObjectMarshaller { - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeUnmarshaller.java deleted file mode 100644 index e23ff6b54..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeUnmarshaller.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; -import org.opensaml.xml.io.UnmarshallingException; -import org.opensaml.xml.signature.KeyInfo; - -import eu.stork.vidp.messages.stork.SPCertType; - -public class SPCertTypeUnmarshaller extends - BaseXMLObjectUnmarshaller { - - - @Override - protected void processChildElement(XMLObject parentXMLObject, - XMLObject childXMLObject) throws UnmarshallingException { - SPCertType spCertType = (SPCertType) parentXMLObject; - - if (childXMLObject instanceof KeyInfo) { - spCertType.setKeyInfo((KeyInfo) childXMLObject); - } else { - super.processChildElement(parentXMLObject, childXMLObject); - } - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDBuilder.java deleted file mode 100644 index f892c88c3..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.SPID; - -public class SPIDBuilder extends - AbstractXMLObjectBuilder { - - @Override - public SPID buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new SPIDImpl(namespaceURI, localName, namespacePrefix); - } - - public SPID buildObject() { - return buildObject(STORKConstants.STORK10_NS, SPID.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDImpl.java deleted file mode 100644 index 34bde4caa..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.SPID; - -public class SPIDImpl extends - AbstractValidatingXMLObject implements - SPID { - - private String spID; - - protected SPIDImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public String getValue() { - return spID; - } - - public void setValue(String spID) { - this.spID = spID; - } - - public List getOrderedChildren() { - return Collections.emptyList(); - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDMarshaller.java deleted file mode 100644 index 8455d5033..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.SPID; - -public class SPIDMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { - SPID spID = (SPID) xmlObject; - XMLHelper.appendTextContent(domElement, spID.getValue()); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDUnmarshaller.java deleted file mode 100644 index f2eb1eb00..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.SPID; - -public class SPIDUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - SPID spID = (SPID) xmlObject; - spID.setValue(elementContent); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationBuilder.java deleted file mode 100644 index 1bc9c6ae8..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.SPInformation; - -public class SPInformationBuilder extends - AbstractXMLObjectBuilder { - - @Override - public SPInformation buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new SPInformationImpl(namespaceURI, localName, namespacePrefix); - } - - public SPInformation buildObject() { - return buildObject(STORKConstants.STORK10_NS, SPInformation.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationImpl.java deleted file mode 100644 index e42c1cff5..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.SPAuthRequest; -import eu.stork.vidp.messages.stork.SPCertEnc; -import eu.stork.vidp.messages.stork.SPCertSig; -import eu.stork.vidp.messages.stork.SPID; -import eu.stork.vidp.messages.stork.SPInformation; - -public class SPInformationImpl extends - AbstractValidatingXMLObject implements - SPInformation { - - private SPID spID; - - private SPCertSig spCertSig; - - private SPCertEnc spCertEnc; - - private SPAuthRequest spAuthRequest; - - protected SPInformationImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public SPAuthRequest getSPAuthRequest() { - return spAuthRequest; - } - - public SPCertEnc getSPCertEnc() { - return spCertEnc; - } - - public SPCertSig getSPCertSig() { - return spCertSig; - } - - public SPID getSPID() { - return spID; - } - - public void setSPAuthRequest(SPAuthRequest spAuthRequest) { - this.spAuthRequest = spAuthRequest; - } - - public void setSPCertEnc(SPCertEnc spCertEnc) { - this.spCertEnc = spCertEnc; - } - - public void setSPCertSig(SPCertSig spCertSig) { - this.spCertSig = spCertSig; - } - - public void setSPID(SPID spID) { - this.spID = spID; - } - - public List getOrderedChildren() { - ArrayList children = new ArrayList(); - - if (spID != null) { - children.add(spID); - } - - if (spCertSig != null) { - children.add(spCertSig); - } - - if (spCertEnc != null) { - children.add(spCertEnc); - } - - if (spAuthRequest != null) { - children.add(spAuthRequest); - } - - if (children.size() == 0) { - return null; - } - - return Collections.unmodifiableList(children); - } - - - - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationMarshaller.java deleted file mode 100644 index aea91af92..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationMarshaller.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.io.BaseXMLObjectMarshaller; - -public class SPInformationMarshaller extends - BaseXMLObjectMarshaller { - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationUnmarshaller.java deleted file mode 100644 index e7f9bd98e..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationUnmarshaller.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.vidp.messages.stork.SPAuthRequest; -import eu.stork.vidp.messages.stork.SPCertEnc; -import eu.stork.vidp.messages.stork.SPCertSig; -import eu.stork.vidp.messages.stork.SPID; -import eu.stork.vidp.messages.stork.SPInformation; - -public class SPInformationUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processChildElement(XMLObject parentXMLObject, - XMLObject childXMLObject) throws UnmarshallingException { - SPInformation spInformation = (SPInformation) parentXMLObject; - - if (childXMLObject instanceof SPID) { - spInformation.setSPID((SPID) childXMLObject); - } else if (childXMLObject instanceof SPCertSig) { - spInformation.setSPCertSig((SPCertSig) childXMLObject); - } if (childXMLObject instanceof SPCertEnc) { - spInformation.setSPCertEnc((SPCertEnc) childXMLObject); - } if (childXMLObject instanceof SPAuthRequest) { - spInformation.setSPAuthRequest((SPAuthRequest) childXMLObject); - } else { - super.processChildElement(parentXMLObject, childXMLObject); - } - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationBuilder.java deleted file mode 100644 index 596d77908..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.SpApplication; - -public class SpApplicationBuilder extends - AbstractXMLObjectBuilder { - - @Override - public SpApplication buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new SpApplicationImpl(namespaceURI, localName, namespacePrefix); - } - - public SpApplication buildObject() { - return buildObject(STORKConstants.STORK10_NS, SpApplication.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationImpl.java deleted file mode 100644 index d9c3b3ad2..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.SpApplication; - -public class SpApplicationImpl extends - AbstractValidatingXMLObject implements - SpApplication { - - private String spApplication; - - protected SpApplicationImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public String getValue() { - return spApplication; - } - - public void setValue(String spApplication) { - this.spApplication = spApplication; - } - - public List getOrderedChildren() { - return Collections.emptyList(); - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationMarshaller.java deleted file mode 100644 index 1b484e338..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.SpApplication; - -public class SpApplicationMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { - SpApplication spApplication = (SpApplication) xmlObject; - XMLHelper.appendTextContent(domElement, spApplication.getValue()); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationUnmarshaller.java deleted file mode 100644 index 70aef824a..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.SpApplication; - -public class SpApplicationUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - SpApplication spSector = (SpApplication) xmlObject; - spSector.setValue(elementContent); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryBuilder.java deleted file mode 100644 index 29c765128..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.SpCountry; - -public class SpCountryBuilder extends - AbstractXMLObjectBuilder { - - @Override - public SpCountry buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new SpCountryImpl(namespaceURI, localName, namespacePrefix); - } - - public SpCountry buildObject() { - return buildObject(STORKConstants.STORK10_NS, SpCountry.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryImpl.java deleted file mode 100644 index 66e2e81a6..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.SpCountry; - -public class SpCountryImpl extends - AbstractValidatingXMLObject implements - SpCountry { - - private String spCountry; - - protected SpCountryImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public String getValue() { - return spCountry; - } - - public void setValue(String spCountry) { - this.spCountry = spCountry; - } - - public List getOrderedChildren() { - return Collections.emptyList(); - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryMarshaller.java deleted file mode 100644 index 60a1f7838..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.SpCountry; - -public class SpCountryMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { - SpCountry spCountry = (SpCountry) xmlObject; - XMLHelper.appendTextContent(domElement, spCountry.getValue()); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryUnmarshaller.java deleted file mode 100644 index 66558248b..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.SpCountry; - -public class SpCountryUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - SpCountry spCountry = (SpCountry) xmlObject; - spCountry.setValue(elementContent); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionBuilder.java deleted file mode 100644 index 4ddc48d53..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.SpInstitution; - -public class SpInstitutionBuilder extends - AbstractXMLObjectBuilder { - - @Override - public SpInstitution buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new SpInstitutionImpl(namespaceURI, localName, namespacePrefix); - } - - public SpInstitution buildObject() { - return buildObject(STORKConstants.STORK10_NS, SpInstitution.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionImpl.java deleted file mode 100644 index 8d9753328..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.SpInstitution; - -public class SpInstitutionImpl extends - AbstractValidatingXMLObject implements - SpInstitution { - - private String spInstitution; - - protected SpInstitutionImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public String getValue() { - return spInstitution; - } - - public void setValue(String spInstitution) { - this.spInstitution = spInstitution; - } - - public List getOrderedChildren() { - return Collections.emptyList(); - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionMarshaller.java deleted file mode 100644 index ec150523d..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.SpInstitution; - -public class SpInstitutionMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { - SpInstitution spInstitution = (SpInstitution) xmlObject; - XMLHelper.appendTextContent(domElement, spInstitution.getValue()); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionUnmarshaller.java deleted file mode 100644 index 34fa89281..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.SpInstitution; - -public class SpInstitutionUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - SpInstitution spInstitution = (SpInstitution) xmlObject; - spInstitution.setValue(elementContent); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorBuilder.java deleted file mode 100644 index 08daa3c7b..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorBuilder.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.CitizenCountryCode; -import eu.stork.vidp.messages.stork.SpSector; - -public class SpSectorBuilder extends - AbstractXMLObjectBuilder { - - @Override - public SpSector buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new SpSectorImpl(namespaceURI, localName, namespacePrefix); - } - - public SpSector buildObject() { - return buildObject(STORKConstants.STORK10_NS, SpSector.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorImpl.java deleted file mode 100644 index f52d2c83d..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.SpSector; - -public class SpSectorImpl extends - AbstractValidatingXMLObject implements - SpSector { - - private String spSector; - - protected SpSectorImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public String getValue() { - return spSector; - } - - public void setValue(String spSector) { - this.spSector = spSector; - } - - public List getOrderedChildren() { - return Collections.emptyList(); - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorMarshaller.java deleted file mode 100644 index 78772c956..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorMarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectMarshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.util.XMLHelper; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.stork.SpSector; - -public class SpSectorMarshaller extends - BaseXMLObjectMarshaller { - - /** {@inheritDoc} */ - protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { - SpSector spSector = (SpSector) xmlObject; - XMLHelper.appendTextContent(domElement, spSector.getValue()); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorUnmarshaller.java deleted file mode 100644 index ea65413a2..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorUnmarshaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; - -import eu.stork.vidp.messages.stork.SpSector; - -public class SpSectorUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processElementContent(XMLObject xmlObject, - String elementContent) { - SpSector spSector = (SpSector) xmlObject; - spSector.setValue(elementContent); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesBuilder.java deleted file mode 100644 index a7827f652..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.AbstractXMLObjectBuilder; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; - -public class VIDPAuthenticationAttributesBuilder extends - AbstractXMLObjectBuilder { - - @Override - public VIDPAuthenticationAttributes buildObject(String namespaceURI, String localName, - String namespacePrefix) { - return new VIDPAuthenticationAttributesImpl(namespaceURI, localName, namespacePrefix); - } - - public VIDPAuthenticationAttributes buildObject() { - return buildObject(STORKConstants.STORK10_NS, VIDPAuthenticationAttributes.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesImpl.java deleted file mode 100644 index 3c8d960db..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.AbstractValidatingXMLObject; - -import eu.stork.vidp.messages.stork.CitizenCountryCode; -import eu.stork.vidp.messages.stork.SPInformation; -import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; - -public class VIDPAuthenticationAttributesImpl extends - AbstractValidatingXMLObject implements - VIDPAuthenticationAttributes { - - private CitizenCountryCode citizenCountryCode; - - private SPInformation spInformation; - - protected VIDPAuthenticationAttributesImpl(String namespaceURI, - String elementLocalName, String namespacePrefix) { - super(namespaceURI, elementLocalName, namespacePrefix); - } - - public CitizenCountryCode getCitizenCountryCode() { - return citizenCountryCode; - } - - - public SPInformation getSPInformation() { - return spInformation; - } - - public void setCitizenCountryCode(CitizenCountryCode citizenCountryCode) { - this.citizenCountryCode = citizenCountryCode; - } - - - public void setSPInformation(SPInformation spInformation) { - this.spInformation = spInformation; - } - - public List getOrderedChildren() { - ArrayList children = new ArrayList(); - - if (citizenCountryCode != null) { - children.add(citizenCountryCode); - } - - - if (spInformation != null) { - children.add(spInformation); - } - - if (children.size() == 0) { - return null; - } - - return Collections.unmodifiableList(children); - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesMarshaller.java deleted file mode 100644 index f21b492a9..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesMarshaller.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.io.BaseXMLObjectMarshaller; - -public class VIDPAuthenticationAttributesMarshaller extends - BaseXMLObjectMarshaller { - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesUnmarshaller.java deleted file mode 100644 index 3b7a1b20e..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesUnmarshaller.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.stork.impl; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; -import org.opensaml.xml.io.UnmarshallingException; - -import eu.stork.vidp.messages.stork.CitizenCountryCode; -import eu.stork.vidp.messages.stork.SPInformation; -import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; - -public class VIDPAuthenticationAttributesUnmarshaller extends - BaseXMLObjectUnmarshaller { - - @Override - protected void processChildElement(XMLObject parentXMLObject, - XMLObject childXMLObject) throws UnmarshallingException { - VIDPAuthenticationAttributes attributes = (VIDPAuthenticationAttributes) parentXMLObject; - - if (childXMLObject instanceof CitizenCountryCode) { - attributes.setCitizenCountryCode((CitizenCountryCode) childXMLObject); - } else if (childXMLObject instanceof SPInformation) { - attributes.setSPInformation((SPInformation) childXMLObject); - } else { - super.processChildElement(parentXMLObject, childXMLObject); - } - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/SAMLUtil.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/SAMLUtil.java deleted file mode 100644 index faff5e7bd..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/SAMLUtil.java +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.opensaml.Configuration; -import org.opensaml.common.SignableSAMLObject; -import org.opensaml.saml2.core.Assertion; -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.core.AttributeStatement; -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.security.SAMLSignatureProfileValidator; -import org.opensaml.ws.message.encoder.MessageEncodingException; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.io.Marshaller; -import org.opensaml.xml.io.MarshallingException; -import org.opensaml.xml.io.Unmarshaller; -import org.opensaml.xml.io.UnmarshallingException; -import org.opensaml.xml.schema.XSAny; -import org.opensaml.xml.schema.XSString; -import org.opensaml.xml.security.SecurityException; -import org.opensaml.xml.security.SecurityHelper; -import org.opensaml.xml.security.credential.Credential; -import org.opensaml.xml.signature.Signature; -import org.opensaml.xml.signature.SignatureConstants; -import org.opensaml.xml.signature.SignatureException; -import org.opensaml.xml.signature.Signer; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.ValidatorSuite; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Element; - -import eu.stork.vidp.messages.builder.STORKMessagesBuilder; -import eu.stork.vidp.messages.exception.SAMLException; -import eu.stork.vidp.messages.exception.SAMLValidationException; -import eu.stork.vidp.messages.saml.STORKAttribute; - -/** - * - * Helper class for SAML message processing - * @author bzwattendorfer - * - */ -public class SAMLUtil { - - private final static Logger log = LoggerFactory.getLogger(SAMLUtil.class); - - /** - * Signs a SAML object - * @param samlObject SAML object to sign - * @param signingCredential Credentials to be used for signing - * @throws SAMLException - */ - public static void signSAMLObject(SignableSAMLObject samlObject, Credential signingCredential) throws SAMLException { - - log.trace("Signing " + samlObject.getElementQName()); - - Signature signature = STORKMessagesBuilder.buildXMLObject(Signature.DEFAULT_ELEMENT_NAME); - - signature.setSigningCredential(signingCredential); - - //TODO: Make signing algorithm configurable - signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); - signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - - try { - //TODO SecurityConfiguration, default signature credentials - SecurityHelper.prepareSignatureParams(signature, signingCredential, null, null); - } catch (SecurityException e) { - throw new SAMLException("Error preparing signature for signing", e); - } - - samlObject.setSignature(signature); - - Marshaller assertionMarshaller = Configuration.getMarshallerFactory().getMarshaller(samlObject); - try { - assertionMarshaller.marshall(samlObject); - Signer.signObject(signature); - } catch (MarshallingException e) { - throw new SAMLException("Unable to marshall " + samlObject.getElementQName() + " for signing", e); - } catch (SignatureException e) { - throw new SAMLException("Unable to sign " + samlObject.getElementQName(), e); - } - - } - - /** - * Validated SAML object according the given validation config - * @param samlObject SAML object to validaate - * @param validatorSuiteConfig Validation config - * @throws SAMLValidationException - */ - public static void verifySAMLObjectStandardValidation(SignableSAMLObject samlObject, String validatorSuiteConfig) throws SAMLValidationException { - - ValidatorSuite validatorSuite = Configuration.getValidatorSuite(validatorSuiteConfig); - try { - validatorSuite.validate(samlObject); - } catch (ValidationException e) { - log.error(e.getMessage(), e); - throw new SAMLValidationException("Could not validate " + samlObject.getElementQName(), e); - } - - } - - /** - * Gets the STORK attribute status from a SAML attribute - * @param attribute SAML attribute - * @return STORK attribute status - */ - public static String getStatusFromAttribute(Attribute attribute) { - return attribute.getUnknownAttributes().get(STORKAttribute.DEFAULT_STORK_ATTRIBUTE_QNAME); - } - - /** - * Gets the XML value of an XML object as String - * @param xmlObj XML object - * @return XML value as String - */ - public static String getStringValueFromXMLObject(XMLObject xmlObj) { - if (xmlObj instanceof XSString) { - return ((XSString) xmlObj).getValue(); - } else if (xmlObj instanceof XSAny) { - return ((XSAny) xmlObj).getTextContent(); - } - return null; - } - - /** - * Gets the attribute value as String of an attribute whereas the attribute is in a given list - * @param attrList List of attributes - * @param name Name of the attribute where the value should be extracted - * @return attribute value as String - */ - public static String getAttributeStringValue(List attrList, String name) { - XMLObject xmlObj = getAttributeValue(attrList, name); - return getStringValueFromXMLObject(xmlObj); - } - - /** - * Gets the attribute value as String of an attribute - * @param attribute Attribute - * @return attribute value as String - */ - public static String getAttributeStringValue(Attribute attribute) { - return ((XSString) attribute.getAttributeValues().get(0)).getValue(); - } - - /** - * Gets the attribute value as anyType of an attribute - * @param attribute Attribute - * @return value as anyType - */ - public static XSAny getAttributeXSAnyValue(Attribute attribute) { - return (XSAny) attribute.getAttributeValues().get(0); - } - - /** - * Gets the attribute value as anyType of an attribute whereas the attribute is in a given list - * @param attrList List of attributes - * @param name Name of the attribute where the value should be extracted - * @return attribute value as anyType - */ - public static XSAny getXSAnyAttributeValue(List attrList, String name) { - //XMLObject xmlObj = getAttributeValue(attrList, name); - return (XSAny) getAttributeValue(attrList, name); - } - - /** - * Gets the attribute value as XMLObject of an attribute whereas the attribute is in a given list - * @param attrList List of attributes - * @param name Name of the attribute where the value should be extracted - * @return attribute value as XMLObject - */ - public static XMLObject getAttributeValue(List attrList, String name) { - Attribute attribute = getAttribute(attrList, name); - return (attribute != null && !attribute.getAttributeValues().isEmpty()) ? attribute.getAttributeValues().get(0) : null; - } - - /** - * Gets the attribute specified by name out of a list - * @param attrList List of attributes - * @param name attribute name of the attribute to extract - * @return attribute - */ - public static Attribute getAttribute(List attrList, String name) { - for (Attribute attribute : attrList) { - if (attribute.getName().equals(name)) { - return attribute; - } - } - - return null; - } - - /** - * Gets the attribute specified by name out of a list and immediately removes it from the list - * @param attrList List of attributes - * @param name attribute name of the attribute to extract and remove - * @return attribute - */ - public static String getAttributeStringValueAndRemove(List attrList, String name) { - - Attribute attribute = getAttribute(attrList, name); - String value = getAttributeStringValue(attrList, name); - attrList.remove(attribute); - - return value; - } - - /** - * Checks if an attribute with a given name is present in a SAML assertion - * @param storkAssertion STORK SAML assertion - * @param attributeName attribute name - * @return true if attribute is present - */ - public static boolean containsAttribute(Assertion storkAssertion, String attributeName) { - AttributeStatement attrStatement = storkAssertion.getAttributeStatements().get(0); - - for (Attribute attribute : attrStatement.getAttributes()) { - if (attribute.getName().equals(attributeName) && (SAMLUtil.getStatusFromAttribute(attribute) == null || SAMLUtil.getStatusFromAttribute(attribute).equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_AVAIL))) { - return true; - } - } - - return false; - } - - /** - * Checks if an attribute with a given name is present in a List of attributes - * @param attributeList List of attributes - * @param attributeName attribute name - * @return true if attribute is present - */ - public static boolean containsAttribute(List attributeList, String attributeName) { - for (Attribute attr : attributeList) { - if (attr.getName().equals(attributeName)) - return true; - } - return false; - } - - /** - * Remeoves attribute with a given name from an attribute list - * @param attributeList List of attributes - * @param attributeName name of the attribute to be removed from list - */ - public static void removeAttribute(List attributeList, String attributeName) { - if (containsAttribute(attributeList, attributeName)) { - attributeList.remove(getAttribute(attributeList, attributeName)); - } - } - - /** - * Gets the String value of an XML object (Only if XMLObject contains String) - * @param xmlObj XMLObject - * @return String value of XMLObject - */ - public static String getXSStringValueFromXMLObject(XMLObject xmlObj) { - if (xmlObj instanceof XSString) - return ((XSString) xmlObj).getValue(); - - return null; - } - - - /** - * Marshalls an XMLObject to an XML element (DOM) - * @param message XMLObject - * @return DOM representation of XMLObject - */ - public static Element marshallMessage(XMLObject message) { - - try { - Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(message); - if (marshaller == null) { - log.error("Unable to marshall message, no marshaller registered for message object: " - + message.getElementQName()); - } - Element messageElem = marshaller.marshall(message); - return messageElem; - } catch (MarshallingException e) { - log.error("Encountered error marshalling message to its DOM representation", e); - throw new RuntimeException("Encountered error marshalling message into its DOM representation", e); - } - } - - /** - * Unmarshalls a DOM XML element into an OpenSAML XMLObject - * @param element DOM element - * @return OpenSAML XMLObject - * @throws MessageEncodingException - */ - public static XMLObject unmarshallMessage(Element element) throws MessageEncodingException { - - try { - Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(element); - if (unmarshaller == null) { - log.error("Unable to unmarshall element, no unmarshaller registered for message element: " - + element.getNodeName()); - } - - return unmarshaller.unmarshall(element); - } catch (UnmarshallingException e) { - log.error("Encountered error unmarshalling element to its XMLObject representation", e); - throw new MessageEncodingException("Encountered error unmarshalling element to its XMLObject representation", e); - } - } - - /** - * Releases the DOM element from an XML document - * @param xmlObjList List of XMLObjects to release - * @return List of released XMLObjects - */ - public static List releaseDOM(List xmlObjList) { - - List newXMLObjList = new ArrayList(); - Iterator it = xmlObjList.iterator(); - - while (it.hasNext()) { - XMLObject xmlObj = it.next(); - xmlObj.detach(); - newXMLObjList.add(xmlObj); - } - - return newXMLObjList; - - } - - /** - * Makes a union of two RequestedAttribute lists (first list has priority and overrides attributes in the second list if equal) - * @param priorityList Priority list if attributes might be equal - * @param list low priority list - * @return Union of both lists - */ - public static List buildRequestedAttributesUnion(List priorityList, List list) { - List reqAttrList = new ArrayList(); - - if (priorityList == null || list == null) - return reqAttrList; - - if (priorityList == null || priorityList.isEmpty()) { - if (list == null || list.isEmpty()) { - return reqAttrList; - } else { - reqAttrList.addAll((List) releaseDOM(list)); - return reqAttrList; - } - } else { - if (list == null || list.isEmpty()) { - reqAttrList.addAll((List) releaseDOM(priorityList)); - return reqAttrList; - } else { - reqAttrList.addAll((List) releaseDOM(priorityList)); - for (RequestedAttribute reqAttr : list) { - boolean found = false; - for (RequestedAttribute prioReqAttr : priorityList) { - if (!prioReqAttr.getName().equals(reqAttr.getName())) { - found = true; - } - } - if (!found) { - reqAttr.detach(); - reqAttrList.add(reqAttr); - log.debug("Adding additional requested attribute: {} , isRequired: {}", reqAttr.getName(), reqAttr.isRequired()); - } - } - } - } - - return reqAttrList; - } - - /** - * Validates the signature references using OpenSAML - * @param signableObject Signable SAML Object - * @throws ValidationException thrown if references are not correct - */ - public static void validateSignatureReferences(SignableSAMLObject signableObject) throws ValidationException { - SAMLSignatureProfileValidator sigValidator = new SAMLSignatureProfileValidator(); - sigValidator.validate(signableObject.getSignature()); - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAssertionValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAssertionValidator.java deleted file mode 100644 index c412ba6a0..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAssertionValidator.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.common.SAMLVersion; -import org.opensaml.saml2.core.Assertion; -import org.opensaml.saml2.core.validator.AssertionSchemaValidator; -import org.opensaml.xml.validation.ValidationException; - -public class StorkAssertionValidator extends AssertionSchemaValidator { - - /** - * Constructor - * - */ - public StorkAssertionValidator() { - - super(); - } - - @Override - public void validate(Assertion assertion) throws ValidationException { - - super.validate(assertion); - - if(assertion.getID() == null) { - - throw new ValidationException("ID is required."); - } - - if(assertion.getVersion() == null || !assertion.getVersion().equals(SAMLVersion.VERSION_20)) { - - throw new ValidationException("Version of assertion not present or invalid."); - } - - if(assertion.getIssueInstant() == null) { - - throw new ValidationException("IssueInstant is required."); - } - - if(assertion.getSubject() == null) { - - throw new ValidationException("Subject is required."); - } - - if(assertion.getConditions() == null) { - - throw new ValidationException("Conditions is required."); - } - - if(assertion.getAuthnStatements() == null || - assertion.getAuthnStatements().size() != 1) { - - throw new ValidationException("Incorrect number of AuthnStatements."); - } - - if(assertion.getAttributeStatements() != null) { - - if(assertion.getAttributeStatements().size() != 0 && - assertion.getAttributeStatements().size() != 1) { - - throw new ValidationException("Incorrect number of AttributeStatements."); - } - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAttributeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAttributeValidator.java deleted file mode 100644 index 6e37725d1..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAttributeValidator.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import java.util.regex.Pattern; - -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; -import org.opensaml.saml2.core.Attribute; -import org.opensaml.saml2.core.validator.AttributeSchemaValidator; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.schema.XSString; -import org.opensaml.xml.util.AttributeMap; -import org.opensaml.xml.validation.ValidationException; - -import eu.stork.vidp.messages.common.STORKConstants; -import eu.stork.vidp.messages.saml.STORKAttribute; - -public class StorkAttributeValidator extends AttributeSchemaValidator { - - private static final String PATTERN_EIDENTIFIER = "^[A-Z]{2}/[A-Z]{2}/[A-Za-z0-9+/=\r\n]+$"; - private static final String PATTERN_GENDER = "^[MF]{1}$"; - private static final String PATTERN_COUNTRYCODEOFBIRTH = "^[A-Z]{2}|[A-Z]{4}$"; - private static final String PATTERN_COUNTRYCODE = "^[A-Z]{2}$"; - private static final String PATTERN_MARTIALSTATUS = "^[SMPDW]{1}$"; - private static final String PATTERN_EMAIL = "^[-+.\\w]{1,64}@[-.\\w]{1,64}\\.[-.\\w]{2,6}$"; - private static final String PATTERN_AGE = "^[0-9]{1,3}$"; - private static final int MAX_AGE = 120; - private static final String PATTERN_ISAGEOVER = PATTERN_AGE; - private static final String PATTERN_CITIZENQAALEVEL = "^[1-4]{1}$"; - - - /** - * Constructor - * - */ - public StorkAttributeValidator() { - - super(); - } - - @Override - public void validate(Attribute attr) throws ValidationException { - - super.validate(attr); - - if(attr.getName() == null) { - - throw new ValidationException("Name is required."); - } - - if(attr.getNameFormat() == null) { - - throw new ValidationException("NameFormat is required."); - } - - - if(attr.getUnknownAttributes() != null) { - - AttributeMap map = attr.getUnknownAttributes(); - - String value = map.get(STORKAttribute.DEFAULT_STORK_ATTRIBUTE_QNAME); - - if (value == null || value.equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_AVAIL)) { - //if AttributeStatus not present, default is "Available" thus AttributeValue must be present - if (attr.getAttributeValues().isEmpty()) { - //isAgeOver can have no value - if (!attr.getName().equals(STORKConstants.STORK_ATTRIBUTE_ISAGEOVER)) { - throw new ValidationException("AttributeStatus indicates that attribute is available but no AttributeValue is present."); - } - } - - //throw new ValidationException("AttributeStatus not present."); - - } else if(!value.equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_AVAIL) && - !value.equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_NOT_AVAIL) && - !value.equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_WITHHELD)) { - - throw new ValidationException("AttributeStatus is invalid."); - } - - } - - if (!attr.getAttributeValues().isEmpty()) { - //validate individual attributes if present - XMLObject attrValueObject = attr.getAttributeValues().get(0); - - if (!(attrValueObject instanceof XSString)) { - //Only validate String attributes - return; - } - - String value = ((XSString) attr.getAttributeValues().get(0)).getValue(); - String attrName = attr.getName(); - - //only isAgeOver can be empty if provided - if (value == null) { - //only isAgeOver can be empty if provided - if (attrName.equals(STORKConstants.STORK_ATTRIBUTE_ISAGEOVER)) { - return; - } else { - throw new ValidationException("Provided AttributeValue is empty"); - } - } - - //validate eIdentifier - validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_EIDENTIFIER, PATTERN_EIDENTIFIER); - - //validate gender - validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_GENDER, PATTERN_GENDER); - - //validate dateOfBirth - if (attrName.equals(STORKConstants.STORK_ATTRIBUTE_DATEOFBIRTH)) { - verifyDate(value); - } - - //validate countryCode of birth - validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_COUNTRYCODEOFBIRTH, PATTERN_COUNTRYCODEOFBIRTH); - - //validate countryCode - validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_NATIONALITYCODE, PATTERN_COUNTRYCODE); - - //validate martialStatus - validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_MARTIALSTATUS, PATTERN_MARTIALSTATUS); - - //validate email - validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_EMAIL, PATTERN_EMAIL); - - //validate age and isAgeOver - validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_AGE, PATTERN_AGE); - validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_ISAGEOVER, PATTERN_ISAGEOVER); - if (attr.getName().equals(STORKConstants.STORK_ATTRIBUTE_AGE) || attr.getName().equals(STORKConstants.STORK_ATTRIBUTE_ISAGEOVER)) { - if (Integer.valueOf(((XSString) attr.getAttributeValues().get(0)).getValue()) > MAX_AGE) { - throw new ValidationException("Maximum age reached"); - } - } - - validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_CITIZENQAALEVEL, PATTERN_CITIZENQAALEVEL); - } - - } - - private void validateAttributeValueFormat(String value, String currentAttrName, String attrNameToTest, String pattern) throws ValidationException { - if (currentAttrName.equals(attrNameToTest)) { - if (!Pattern.matches(pattern, value)) { - throw new ValidationException(attrNameToTest + " has incorrect format."); - } - } - - } - - private static void verifyDate(String pepsDate) throws ValidationException { - DateTimeFormatter fmt = null; - - switch (pepsDate.length()) { - case 4: - fmt = DateTimeFormat.forPattern("yyyy"); - break; - case 6: - fmt = DateTimeFormat.forPattern("yyyyMM"); - break; - case 8: - fmt = DateTimeFormat.forPattern("yyyyMMdd"); - break; - default: - throw new ValidationException("Date has wrong format"); - } - - try { - fmt.parseDateTime(pepsDate); - } catch (IllegalArgumentException e) { - throw new ValidationException("Date has wrong format"); - } - - - } - - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAudienceRestrictionValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAudienceRestrictionValidator.java deleted file mode 100644 index a561d4c33..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAudienceRestrictionValidator.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.AudienceRestriction; -import org.opensaml.saml2.core.validator.AudienceRestrictionSchemaValidator; -import org.opensaml.xml.validation.ValidationException; - -public class StorkAudienceRestrictionValidator extends - AudienceRestrictionSchemaValidator { - - /** - * Constructor - * - */ - public StorkAudienceRestrictionValidator() { - - super(); - } - - @Override - public void validate(AudienceRestriction res) throws ValidationException { - - super.validate(res); - - if(res.getAudiences() == null || res.getAudiences().size() < 1) { - - throw new ValidationException("Audience is required."); - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthenticationAttributesValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthenticationAttributesValidator.java deleted file mode 100644 index 1997da7b6..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthenticationAttributesValidator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.AuthenticationAttributes; -import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; - -public class StorkAuthenticationAttributesValidator implements Validator { - - - public StorkAuthenticationAttributesValidator() { - - } - - public void validate(AuthenticationAttributes authenticationAttributes) throws ValidationException { - - //check AuthenticationAttributes for VIDPs - VIDPAuthenticationAttributes vidpAuthenticationAttributes = authenticationAttributes.getVIDPAuthenticationAttributes(); - - if(vidpAuthenticationAttributes == null) { - - throw new ValidationException("VIDPAuthenticationAttributes is required for sending requests to VIDPs."); - } - - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnRequestValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnRequestValidator.java deleted file mode 100644 index 0e8722d55..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnRequestValidator.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.common.SAMLVersion; -import org.opensaml.saml2.core.AuthnRequest; -import org.opensaml.saml2.core.validator.AuthnRequestSchemaValidator; -import org.opensaml.xml.util.XMLHelper; -import org.opensaml.xml.validation.ValidationException; - -import eu.stork.mw.messages.saml.STORKAuthnRequest; - -public class StorkAuthnRequestValidator extends AuthnRequestSchemaValidator { - - private static final String ALLOWED_CONSENT = "urn:oasis:names:tc:SAML:2.0:consent:unspecified"; - private static final String ALLOWED_PROTOCOL_BINDING_1 = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"; - private static final String ALLOWED_PROTOCOL_BINDING_2 = "urn:oasis:names:tc:SAML:2.0:bindings:SOAP"; - - private static final int MAX_SIZE = 131072; - - /** - * Constructor - * - */ - public StorkAuthnRequestValidator() { - - super(); - } - - @Override - public void validate(AuthnRequest req) throws ValidationException { - - if (XMLHelper.prettyPrintXML(req.getDOM()).getBytes().length > MAX_SIZE) { - throw new ValidationException("SAML AuthnRequest exceeds max size."); - } - - super.validate(req); - - STORKAuthnRequest request = (STORKAuthnRequest) req; - - if (request.getID() == null) { - - throw new ValidationException("ID is required."); - } - - if (request.getVersion() == null) { - - throw new ValidationException("Version is required."); - } else { - - if (!request.getVersion().equals(SAMLVersion.VERSION_20)) { - - throw new ValidationException("Version is invalid."); - } - } - - if (request.getIssueInstant() == null) { - - throw new ValidationException("IssueInstant is required."); - } - - if (request.getConsent() != null) { - - if (!request.getConsent().equals(ALLOWED_CONSENT)) { - - throw new ValidationException("Consent is invalid."); - } - } - - if (request.isForceAuthn() == null) { - - throw new ValidationException("ForceAuthn is required."); - } else if (!request.isForceAuthn()) { - - throw new ValidationException("ForceAuthn is invalid."); - } - - if (request.isPassive() == null) { - - throw new ValidationException("IsPassive is required."); - } else if (request.isPassive()) { - - throw new ValidationException("IsPassive is invalid."); - } - - if (request.getProtocolBinding() == null) { - - throw new ValidationException("ProtocolBinding is required."); - } else { - if (!request.getProtocolBinding() - .equals(ALLOWED_PROTOCOL_BINDING_1) - && !request.getProtocolBinding().equals( - ALLOWED_PROTOCOL_BINDING_2)) { - - throw new ValidationException("ProtocolBinding is invalid."); - } - - } - - if(request.getAssertionConsumerServiceURL() == null) { - - throw new ValidationException("AssertionConsumerServiceURL is required."); - } - - if(request.getProviderName() == null) { - - throw new ValidationException("ProviderName is required."); - } - - - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnStatementValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnStatementValidator.java deleted file mode 100644 index b25b5621f..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnStatementValidator.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.AuthnStatement; -import org.opensaml.saml2.core.validator.AuthnStatementSchemaValidator; -import org.opensaml.xml.validation.ValidationException; - -public class StorkAuthnStatementValidator extends - AuthnStatementSchemaValidator { - - /** - * Constructor - * - */ - public StorkAuthnStatementValidator() { - - super(); - } - - @Override - public void validate(AuthnStatement stmnt) throws ValidationException { - - super.validate(stmnt); - - if(stmnt.getAuthnInstant() == null) { - - throw new ValidationException("AuthnInstant is required."); - } - - if(stmnt.getSubjectLocality() == null) { - - throw new ValidationException("SubjectLocality is required."); - } - - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkCitizenCountryCodeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkCitizenCountryCodeValidator.java deleted file mode 100644 index 15f8e2dd1..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkCitizenCountryCodeValidator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import java.util.regex.Pattern; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.CitizenCountryCode; - -public class StorkCitizenCountryCodeValidator implements - Validator { - - public static final String REGEX_PATTERN = "^[A-Za-z]{2}$"; - - public StorkCitizenCountryCodeValidator() { - - } - - public void validate(CitizenCountryCode ccc) throws ValidationException { - - if(ccc == null) { - - throw new ValidationException("CitizenCountryCode is required."); - } - - if (ccc.getValue() == null) { - throw new ValidationException("CitizenCountryCode has no value"); - } - - - if (!Pattern.matches(REGEX_PATTERN, ccc.getValue())) { - throw new ValidationException("CitizenCountryCode not valid: " + ccc.getValue()); - } - - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkConditionsValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkConditionsValidator.java deleted file mode 100644 index 81b7957fd..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkConditionsValidator.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.Conditions; -import org.opensaml.saml2.core.validator.ConditionsSpecValidator; -import org.opensaml.xml.validation.ValidationException; - -public class StorkConditionsValidator extends ConditionsSpecValidator { - - /** - * Constructor - * - */ - public StorkConditionsValidator() { - - super(); - } - - @Override - public void validate(Conditions conditions) throws ValidationException { - - super.validate(conditions); - - if(conditions.getNotBefore() == null) { - - throw new ValidationException("NotBefore is required."); - } - - if(conditions.getNotOnOrAfter() == null) { - - throw new ValidationException("NotOnOrAfter is required."); - } - - if(conditions.getAudienceRestrictions() == null || conditions.getAudienceRestrictions().size() < 1) { - - throw new ValidationException("AudienceRestriction is required."); - } - - if(conditions.getOneTimeUse() == null) { - - throw new ValidationException("OneTimeUse is required."); - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEIDSectorShareValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEIDSectorShareValidator.java deleted file mode 100644 index 96555e660..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEIDSectorShareValidator.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/** - * - */ -package eu.stork.vidp.messages.validation; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.EIDSectorShare; - -/** - * @author bzwattendorfer - * - */ -public class StorkEIDSectorShareValidator implements Validator { - - public StorkEIDSectorShareValidator() { - - } - - public void validate(EIDSectorShare eidSectorShare) throws ValidationException { - - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedAttributeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedAttributeValidator.java deleted file mode 100644 index 48464b6ec..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedAttributeValidator.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.EncryptedAttribute; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -public class StorkEncryptedAttributeValidator implements - Validator { - - public StorkEncryptedAttributeValidator() { - - } - - public void validate(EncryptedAttribute encAttr) throws ValidationException { - - if(encAttr.getEncryptedData() == null) { - - throw new ValidationException("EncryptedData is required."); - } - - - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedIdValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedIdValidator.java deleted file mode 100644 index 79450b1dc..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedIdValidator.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.EncryptedID; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -public class StorkEncryptedIdValidator implements Validator { - - /** - * Constructor - * - */ - public StorkEncryptedIdValidator() { - - } - - public void validate(EncryptedID encId) throws ValidationException { - - if(encId.getEncryptedData() == null) { - - throw new ValidationException("EncryptedData is required."); - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkExtensionsValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkExtensionsValidator.java deleted file mode 100644 index 21b247071..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkExtensionsValidator.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import java.util.List; - -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.saml.STORKExtensions; -import eu.stork.vidp.messages.stork.AuthenticationAttributes; -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; - -public class StorkExtensionsValidator implements Validator { - - - public StorkExtensionsValidator() { - - } - - public void validate(STORKExtensions ext) throws ValidationException { - - // check QAALevel - List qaaList = ext.getUnknownXMLObjects(QualityAuthenticationAssuranceLevel.DEFAULT_ELEMENT_NAME); - - if(qaaList == null || qaaList.size() != 1) { - - throw new ValidationException("QAALevel is required."); - } - - //check AuthenticationAttributes for VIDPs -// AuthenticationAttributes authenticationAttributes = ext.getAuthenticationAttributes(); -// -// if(authenticationAttributes == null) { -// -// throw new ValidationException("AuthenticationAttributes is required for sending requests to VIDPs."); -// } - - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkIssuerValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkIssuerValidator.java deleted file mode 100644 index df32ee6ad..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkIssuerValidator.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.Issuer; -import org.opensaml.saml2.core.validator.IssuerSchemaValidator; -import org.opensaml.xml.validation.ValidationException; - -public class StorkIssuerValidator extends IssuerSchemaValidator { - - private static final String FORMAT_ALLOWED_VALUE = "urn:oasis:names:tc:SAML:2.0:nameid-format:entity"; - - /** - * Constructor - * - */ - public StorkIssuerValidator() { - - super(); - } - - @Override - public void validate(Issuer issuer) throws ValidationException { - - super.validate(issuer); - - // format is optional - if(issuer.getFormat() != null) { - - if(!issuer.getFormat().equals(FORMAT_ALLOWED_VALUE)) { - - throw new ValidationException("Format has an invalid value."); - } - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIDValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIDValidator.java deleted file mode 100644 index 85fbeff17..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIDValidator.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.NameID; -import org.opensaml.saml2.core.validator.NameIDSchemaValidator; -import org.opensaml.xml.validation.ValidationException; - -public class StorkNameIDValidator extends NameIDSchemaValidator { - - private static final String FORMAT_ALLOWED_VALUE = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"; - private static final String FORMAT_ALLOWED_VALUE_OLD = "urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified"; - - /** - * Constructor - * - */ - public StorkNameIDValidator() { - - super(); - } - - @Override - public void validate(NameID nameID) throws ValidationException { - - super.validate(nameID); - - if (nameID.getNameQualifier() == null) { - - throw new ValidationException("NameQualifier is required."); - } - - if (nameID.getFormat() == null) { - - throw new ValidationException("Format is required."); - - } else if(!(nameID.getFormat().equals(FORMAT_ALLOWED_VALUE) || nameID.getFormat().equals(FORMAT_ALLOWED_VALUE_OLD))) { - - throw new ValidationException("Format is invalid."); - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIdPolicyValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIdPolicyValidator.java deleted file mode 100644 index 7d98b5e60..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIdPolicyValidator.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.NameIDPolicy; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -public class StorkNameIdPolicyValidator implements Validator { - - public StorkNameIdPolicyValidator() { - - } - - public void validate(NameIDPolicy nameIDPolicy) throws ValidationException { - - - if(nameIDPolicy.getAllowCreate() != null) { - - if(!nameIDPolicy.getAllowCreate()) { - - throw new ValidationException("AllowCreate is invalid."); - } - } - - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkQualityAuthenticationAssuranceLevelValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkQualityAuthenticationAssuranceLevelValidator.java deleted file mode 100644 index 5c23fe04b..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkQualityAuthenticationAssuranceLevelValidator.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; - -public class StorkQualityAuthenticationAssuranceLevelValidator implements - Validator { - - - private static final int MIN_VAL = 1; - private static final int MAX_VAL = 4; - - public StorkQualityAuthenticationAssuranceLevelValidator() { - - } - - public void validate(QualityAuthenticationAssuranceLevel qaaLevel) - throws ValidationException { - - if(qaaLevel.getValue() < MIN_VAL || qaaLevel.getValue() > MAX_VAL) { - - throw new ValidationException("QAALevel is invalid."); - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributeValidator.java deleted file mode 100644 index b9b26a38a..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributeValidator.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import java.util.regex.Pattern; - -import org.opensaml.saml2.metadata.RequestedAttribute; -import org.opensaml.saml2.metadata.validator.RequestedAttributeSchemaValidator; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.schema.XSAny; -import org.opensaml.xml.schema.XSString; -import org.opensaml.xml.validation.ValidationException; - -import eu.stork.vidp.messages.common.STORKConstants; - -public class StorkRequestedAttributeValidator extends - RequestedAttributeSchemaValidator { - - private static final String PATTERN_ISAGEOVER = "^[0-9]{1,3}$"; - - public StorkRequestedAttributeValidator() { - - super(); - } - - @Override - public void validate(RequestedAttribute attr) throws ValidationException { - - super.validate(attr); - - if (attr.getName() == null) { - - throw new ValidationException("Name is required."); - } - - if (attr.getNameFormat() == null) { - - throw new ValidationException("NameFormat is required."); - } - - if (!STORKConstants.FULL_STORK_ATTRIBUTE_SET.contains(attr.getName()) && attr.isRequired()) { - throw new ValidationException("Unknown attribute " + attr.getName() + " requested mandatory."); - } - - if (attr.getName().equals(STORKConstants.STORK_ATTRIBUTE_ISAGEOVER)) { - if (attr.getAttributeValues().isEmpty()) { - throw new ValidationException("isAgeOver requires attribute value"); - } - - XMLObject attrValueObject = attr.getAttributeValues().get(0); - - if (attrValueObject instanceof XSString) { - if (!Pattern.matches(PATTERN_ISAGEOVER, ((XSString) attr.getAttributeValues().get(0)).getValue())) { - throw new ValidationException("Value for isAgeOver has incorrect format."); - } - } else if (attrValueObject instanceof XSAny) { - if (!Pattern.matches(PATTERN_ISAGEOVER, ((XSAny) attrValueObject).getTextContent())) { - throw new ValidationException("Value for isAgeOver has incorrect format."); - } - - } else { - throw new ValidationException("Value for isAgeOver has incorrect format."); - } - - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributesValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributesValidator.java deleted file mode 100644 index 0324079f3..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributesValidator.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.RequestedAttributes; - -public class StorkRequestedAttributesValidator implements - Validator { - - public StorkRequestedAttributesValidator() { - - } - - public void validate(RequestedAttributes attrs) throws ValidationException { - - // empty so far - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkResponseValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkResponseValidator.java deleted file mode 100644 index 8028173fa..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkResponseValidator.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.common.SAMLVersion; -import org.opensaml.saml1.core.StatusCode; -import org.opensaml.saml2.core.Response; -import org.opensaml.saml2.core.validator.ResponseSchemaValidator; -import org.opensaml.xml.util.XMLHelper; -import org.opensaml.xml.validation.ValidationException; - -import eu.stork.mw.messages.saml.STORKResponse; - -public class StorkResponseValidator extends ResponseSchemaValidator { - - private static final String CONSENT_ALLOWED_VALUE_1 = "urn:oasis:names:tc:SAML:2.0:consent:obtained"; - private static final String CONSENT_ALLOWED_VALUE_2 = "urn:oasis:names:tc:SAML:2.0:consent:prior"; - private static final String CONSENT_ALLOWED_VALUE_3 = "urn:oasis:names:tc:SAML:2.0:consent:curent-implicit"; - private static final String CONSENT_ALLOWED_VALUE_4 = "urn:oasis:names:tc:SAML:2.0:consent:curent-explicit"; - private static final String CONSENT_ALLOWED_VALUE_5 = "urn:oasis:names:tc:SAML:2.0:consent:unspecified"; - - private static final int MAX_SIZE = 131072; - - /** - * Constructor - * - */ - public StorkResponseValidator() { - - super(); - } - - /** {@inheritDoc} */ - public void validate(Response response) throws ValidationException { - - if (XMLHelper.prettyPrintXML(response.getDOM()).getBytes().length > MAX_SIZE) { - throw new ValidationException("SAML Response exceeds max size."); - } - - super.validate(response); - - STORKResponse resp = (STORKResponse) response; - - if (resp.getID() == null) { - - throw new ValidationException("ID is required"); - } - - if (resp.getInResponseTo() == null) { - - throw new ValidationException("InResponseTo is required"); - } - - if (resp.getVersion() == null) { - - throw new ValidationException("Version is required."); - } else if(!resp.getVersion().equals(SAMLVersion.VERSION_20)) { - - throw new ValidationException("Version is invalid."); - } - - if (resp.getIssueInstant() == null) { - - throw new ValidationException("IssueInstant is required"); - } - - if (resp.getDestination() == null) { - - throw new ValidationException("Destination is required"); - } - - // Consent is optional - if (resp.getConsent() != null) { - - String consent = resp.getConsent(); - - if (!consent.equals(CONSENT_ALLOWED_VALUE_1) - && !consent.equals(CONSENT_ALLOWED_VALUE_2) - && !consent.equals(CONSENT_ALLOWED_VALUE_3) - && !consent.equals(CONSENT_ALLOWED_VALUE_4) - && !consent.equals(CONSENT_ALLOWED_VALUE_5)) { - - throw new ValidationException("Consent is invalid."); - } - } - - - if (resp.getIssuer() == null) { - - throw new ValidationException("Issuer is required."); - } - - if (resp.getStatus() == null) { - - throw new ValidationException("Status is required."); - } - - - if(resp.getSignature() == null) { - - throw new ValidationException("Signature is required."); - } - - - if (resp.getStatus().getStatusCode().getValue().equals(StatusCode.SUCCESS)) { - if (resp.getAssertions() == null || resp.getAssertions().size() == 0) { - - throw new ValidationException("Assertion is required"); - } - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPIDValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPIDValidator.java deleted file mode 100644 index a42d7a453..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPIDValidator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.SPID; - -public class StorkSPIDValidator implements Validator { - - public static final int MIN_SIZE = 1; - public static final int MAX_SIZE = 40; - - public StorkSPIDValidator() { - - } - - public void validate(SPID spid) throws ValidationException { - - - if(spid == null) { - - throw new ValidationException("SPID value is required."); - } - - if(spid != null) { - - if (spid.getValue() == null) { - throw new ValidationException("SPID has no value"); - } - - if (spid.getValue().length() <= MIN_SIZE || spid.getValue().length() > MAX_SIZE) { - throw new ValidationException("SPID has wrong size: " + spid.getValue().length()); - } - } - - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPInformationValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPInformationValidator.java deleted file mode 100644 index 9c54fd620..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPInformationValidator.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.SPInformation; - -public class StorkSPInformationValidator implements Validator { - - public StorkSPInformationValidator() { - - } - - public void validate(SPInformation spi) throws ValidationException { - - if(spi.getSPID() == null) { - - throw new ValidationException("SPID is required."); - } - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpApplicationValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpApplicationValidator.java deleted file mode 100644 index 08551e03e..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpApplicationValidator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.SpApplication; - -public class StorkSpApplicationValidator implements - Validator { - - public static final int MIN_SIZE = 1; - public static final int MAX_SIZE = 100; - //public static final String REGEX_PATTERN = "^[a-zA-Z0-9]{1,30}$"; - - public StorkSpApplicationValidator() { - - } - - public void validate(SpApplication spApplication) throws ValidationException { - - if(spApplication != null) { - - if (spApplication.getValue() == null) { - throw new ValidationException("spApplication has no value"); - } - -// if (!Pattern.matches(REGEX_PATTERN, spApplication.getValue())) { -// throw new ValidationException("spApplication has wrong format: " + spApplication.getValue()); -// } - - if (spApplication.getValue().length() < MIN_SIZE || spApplication.getValue().length() > MAX_SIZE) { - throw new ValidationException("spApplication has wrong size: " + spApplication.getValue().length()); - } - - } - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpCountryValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpCountryValidator.java deleted file mode 100644 index e6ae0f1b7..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpCountryValidator.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import java.util.regex.Pattern; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.SpCountry; - -public class StorkSpCountryValidator implements - Validator { - - public static final String REGEX_PATTERN = "^[A-Z]{2}$"; - - public StorkSpCountryValidator() { - - } - - public void validate(SpCountry spCountry) throws ValidationException { - - if(spCountry != null) { - - if (spCountry.getValue() == null) { - throw new ValidationException("spCountry has no value"); - } - - if (!Pattern.matches(REGEX_PATTERN, spCountry.getValue())) { - throw new ValidationException("spCountry not valid: " + spCountry.getValue()); - } - } - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpInstitutionValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpInstitutionValidator.java deleted file mode 100644 index 9d50d9122..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpInstitutionValidator.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.SpInstitution; - -public class StorkSpInstitutionValidator implements - Validator { - - public static final int MIN_SIZE = 1; - public static final int MAX_SIZE = 50; - //public static final String REGEX_PATTERN = "^[a-zA-Z0-9]{1,50}$"; - - public StorkSpInstitutionValidator() { - - } - - public void validate(SpInstitution spInstitution) throws ValidationException { - - if(spInstitution != null) { - - if (spInstitution.getValue() == null) { - throw new ValidationException("spInstitution has no value"); - } - -// if (!Pattern.matches(REGEX_PATTERN, spApplication.getValue())) { -// throw new ValidationException("spApplication has wrong format: " + spApplication.getValue()); -// } - - if (spInstitution.getValue().length() < MIN_SIZE || spInstitution.getValue().length() > MAX_SIZE) { - throw new ValidationException("spInstitution has wrong size: " + spInstitution.getValue().length()); - } - } - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpSectorValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpSectorValidator.java deleted file mode 100644 index 2cfaa7a4c..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpSectorValidator.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import java.util.regex.Pattern; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.SpSector; - -public class StorkSpSectorValidator implements - Validator { - - public static final int MIN_SIZE = 1; - public static final int MAX_SIZE = 20; - //public static final String REGEX_PATTERN = "^[a-zA-Z0-9]{1,30}$"; - - public StorkSpSectorValidator() { - - } - - public void validate(SpSector spSector) throws ValidationException { - - if(spSector != null) { - - if (spSector.getValue() == null) { - throw new ValidationException("spSector has no value"); - } - -// if (!Pattern.matches(REGEX_PATTERN, spSector.getValue())) { -// throw new ValidationException("spSector has wrong format: " + spSector.getValue()); -// } - - if (spSector.getValue().length() < MIN_SIZE || spSector.getValue().length() > MAX_SIZE) { - throw new ValidationException("spApplication has wrong size: " + spSector.getValue().length()); - } - - } - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusCodeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusCodeValidator.java deleted file mode 100644 index 3ee214c46..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusCodeValidator.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.Status; -import org.opensaml.saml2.core.StatusCode; -import org.opensaml.saml2.core.validator.StatusCodeSchemaValidator; -import org.opensaml.xml.validation.ValidationException; - -public class StorkStatusCodeValidator extends StatusCodeSchemaValidator { - - // supported values according to SAML v2.0 specification - private static String[] ALLOWED_FIRST_LEVEL_STATUS_CODE_VALUES = new String[] { - "urn:oasis:names:tc:SAML:2.0:status:Success", - "urn:oasis:names:tc:SAML:2.0:status:Requester", - "urn:oasis:names:tc:SAML:2.0:status:Responder", - "urn:oasis:names:tc:SAML:2.0:status:VersionMismatch"}; - - private static String[] ALLOWED_SECOND_LEVEL_STATUS_CODE_VALUES = new String[] { - "urn:oasis:names:tc:SAML:2.0:status:AuthnFailed", - "urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue", - "urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy", - "urn:oasis:names:tc:SAML:2.0:status:NoAuthnContext", - "urn:oasis:names:tc:SAML:2.0:status:NoAvailableIDP", - "urn:oasis:names:tc:SAML:2.0:status:NoPassive", - "urn:oasis:names:tc:SAML:2.0:status:NoSupportedIDP", - "urn:oasis:names:tc:SAML:2.0:status:PartialLogout", - "urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded", - "urn:oasis:names:tc:SAML:2.0:status:RequestDenied", - "urn:oasis:names:tc:SAML:2.0:status:RequestUnsupported", - "urn:oasis:names:tc:SAML:2.0:status:RequestVersionDeprecated", - "urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooHigh", - "urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooLow", - "urn:oasis:names:tc:SAML:2.0:status:ResourceNotRecognized", - "urn:oasis:names:tc:SAML:2.0:status:TooManyResponses", - "urn:oasis:names:tc:SAML:2.0:status:UnknownAttrProfile", - "urn:oasis:names:tc:SAML:2.0:status:UnknownPrincipal", - "urn:oasis:names:tc:SAML:2.0:status:UnsupportedBinding", - "http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported" - }; - - /** - * Constructor - * - */ - public StorkStatusCodeValidator() { - - super(); - } - - @Override - public void validate(StatusCode statusCode) throws ValidationException { - - super.validate(statusCode); - - - if(statusCode.getValue() == null) { - - throw new ValidationException("StatusCode is required"); - } - - boolean valid = false; - - if (statusCode.getParent() instanceof Status) { - //first level Status Codes - - String value = statusCode.getValue(); - - - - - for(String allowedVal : ALLOWED_FIRST_LEVEL_STATUS_CODE_VALUES) { - - if(value.equals(allowedVal)) { - - valid = true; - break; - } - } - - if(!valid) { - - throw new ValidationException("First Level StatusCode has an invalid value."); - } - } else { - //parent is status code - //second level Status Codes - - if(statusCode != null) { - - valid = false; - - String subVal = statusCode.getValue(); - - for(String allowedVal : ALLOWED_SECOND_LEVEL_STATUS_CODE_VALUES) { - - if(subVal.equals(allowedVal)) { - - valid = true; - break; - } - } - - if(!valid) { - - throw new ValidationException("Second Level StatusCode has an invalid value."); - } - - } - - } - } - - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusValidator.java deleted file mode 100644 index 36d7ffab5..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusValidator.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.Status; -import org.opensaml.saml2.core.validator.StatusSchemaValidator; -import org.opensaml.xml.validation.ValidationException; - -public class StorkStatusValidator extends StatusSchemaValidator { - - /** - * Constructor - * - */ - public StorkStatusValidator() { - - super(); - } - - @Override - public void validate(Status status) throws ValidationException { - - super.validate(status); - - if(status.getStatusCode() == null) { - - throw new ValidationException("StatusCode is required."); - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectConfirmationValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectConfirmationValidator.java deleted file mode 100644 index 0f1fad295..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectConfirmationValidator.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.opensaml.saml2.core.SubjectConfirmation; -import org.opensaml.saml2.core.SubjectConfirmationData; -import org.opensaml.saml2.core.validator.SubjectConfirmationSchemaValidator; -import org.opensaml.xml.XMLObject; -import org.opensaml.xml.signature.X509Data; -import org.opensaml.xml.validation.ValidationException; - -public class StorkSubjectConfirmationValidator extends - SubjectConfirmationSchemaValidator { - - private static final String ALLOWED_METHOD_1 = "urn:oasis:names:tc:SAML:2.0:cm:bearer"; - private static final String ALLOWED_METHOD_2 = "oasis:names:tc:SAML:2.0:cm:holder-of-key"; - - /** - * Constructor - * - */ - public StorkSubjectConfirmationValidator() { - - super(); - } - - @Override - public void validate(SubjectConfirmation subjectConfirmation) - throws ValidationException { - - super.validate(subjectConfirmation); - - String method = subjectConfirmation.getMethod(); - - if (!(method.equals(ALLOWED_METHOD_1) || method.equals(ALLOWED_METHOD_2))) { - throw new ValidationException("Method is invalid."); - } - - if (subjectConfirmation.getSubjectConfirmationData() == null) { - throw new ValidationException("SubjectConfirmationData required."); - - } - - SubjectConfirmationData confData = subjectConfirmation.getSubjectConfirmationData(); - - - if (method.equals(ALLOWED_METHOD_1)) { - if (confData.getNotBefore() != null) { - throw new ValidationException("NotBefore in SubjectConfirmationData not allowed if confirmation method is \"bearer\"."); - } - - } - - if (confData.getNotOnOrAfter() == null) { - - throw new ValidationException("NotOnOrAfter is required."); - } - - if (confData.getRecipient() == null) { - - throw new ValidationException("Recipient is required."); - } - - if (confData.getInResponseTo() == null) { - - throw new ValidationException("InResponseTo is required."); - } - - if(method.equals(ALLOWED_METHOD_2)) { - - List childrenKeyInfo = confData.getUnknownXMLObjects(new QName("KeyInfo")); - - if(childrenKeyInfo.size() < 1) { - - throw new ValidationException("KeyInfo is required."); - } - - List childrenKeyData = confData.getUnknownXMLObjects(new QName("X509Data")); - - if(childrenKeyData.size() != 1) { - - throw new ValidationException("Invalid number of X509Data elements."); - } else { - - X509Data data = (X509Data)childrenKeyData.get(0); - - if(data.getX509Certificates() == null || data.getX509Certificates().size() < 1 ) { - - throw new ValidationException("X509Certificate is required."); - } - - } - - } - - - - } - - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectLocalityValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectLocalityValidator.java deleted file mode 100644 index 33c7b4478..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectLocalityValidator.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.SubjectLocality; -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -public class StorkSubjectLocalityValidator implements - Validator { - - public StorkSubjectLocalityValidator() { - - } - - public void validate(SubjectLocality sloc) throws ValidationException { - - if (sloc.getAddress() == null) { - - throw new ValidationException("Address is required."); - } - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectValidator.java deleted file mode 100644 index 077b6294a..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectValidator.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.saml2.core.Subject; -import org.opensaml.saml2.core.validator.SubjectSchemaValidator; -import org.opensaml.xml.validation.ValidationException; - -public class StorkSubjectValidator extends SubjectSchemaValidator { - - /** - * Constructor - * - */ - public StorkSubjectValidator() { - - super(); - } - - @Override - public void validate(Subject subject) throws ValidationException { - - super.validate(subject); - - if(subject.getNameID() == null && subject.getEncryptedID() == null) { - - throw new ValidationException("Neither NameID nor EncryptedID is provided."); - } - - if(subject.getSubjectConfirmations() == null || subject.getSubjectConfirmations().size() < 1) { - - throw new ValidationException("SubjectConfirmation is required."); - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkVIDPAuthenticationAttributesValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkVIDPAuthenticationAttributesValidator.java deleted file mode 100644 index 88ff7bed4..000000000 --- a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkVIDPAuthenticationAttributesValidator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * The Austrian STORK Modules have been developed by the E-Government - * Innovation Center EGIZ, a joint initiative of the Federal Chancellery - * Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package eu.stork.vidp.messages.validation; - -import org.opensaml.xml.validation.ValidationException; -import org.opensaml.xml.validation.Validator; - -import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; - -public class StorkVIDPAuthenticationAttributesValidator implements - Validator { - - public StorkVIDPAuthenticationAttributesValidator() { - - } - - public void validate(VIDPAuthenticationAttributes attr) - throws ValidationException { - - - if(attr.getCitizenCountryCode() == null) { - - throw new ValidationException("CitizenCountryCode is required."); - } - - - if(attr.getSPInformation() == null) { - - throw new ValidationException("SPInformation is required."); - } - - } - -} diff --git a/id/server/stork-saml-engine/src/main/resources/saml2-post-binding-moa.vm b/id/server/stork-saml-engine/src/main/resources/saml2-post-binding-moa.vm deleted file mode 100644 index cac0bda76..000000000 --- a/id/server/stork-saml-engine/src/main/resources/saml2-post-binding-moa.vm +++ /dev/null @@ -1,38 +0,0 @@ -## -## Velocity Template for SAML 2 HTTP-POST binding -## -## Velocity context may contain the following properties -## action - String - the action URL for the form -## RelayState - String - the relay state for the message -## SAMLRequest - String - the Base64 encoded SAML Request -## SAMLResponse - String - the Base64 encoded SAML Response -## Contains target attribute to delegate PEPS authentication out of iFrame - - - - - - -
    -
    - #if($RelayState)#end - - #if($SAMLRequest)#end - - #if($SAMLResponse)#end - -
    - -
    - - - \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/resources/saml2-stork-config.xml b/id/server/stork-saml-engine/src/main/resources/saml2-stork-config.xml deleted file mode 100644 index 988480f55..000000000 --- a/id/server/stork-saml-engine/src/main/resources/saml2-stork-config.xml +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3 From 5ee3da37829fa14d70ad827e19364be4800fab37 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 31 Jan 2014 08:55:04 +0100 Subject: fixed target type for MIS info --- .../moa/id/auth/AuthenticationServer.java | 17 +++++++++-------- .../moa/id/auth/servlet/PEPSConnectorServlet.java | 18 +++++++++++++++++- .../moa/id/auth/stork/STORKResponseProcessor.java | 21 +++++++++++---------- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 60b269059..94cab53d4 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1710,7 +1710,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws SZRGWClientException */ - public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String gender, String citizenSignature, String represented, String representative, String mandateContent, String organizationAddress, String organizationType, String target, String oaFriendlyName, String filters) throws SZRGWClientException { + public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String gender, String citizenSignature, String represented, String representative, String mandateContent, String organizationAddress, String organizationType, String targetType, String targetValue, String oaFriendlyName, String filters) throws SZRGWClientException { try { AuthConfigurationProvider authConf = AuthConfigurationProvider.getInstance(); @@ -1739,7 +1739,8 @@ public class AuthenticationServer implements MOAIDAuthConstants { MISType mis = new MISType(); Target targetObject = new Target(); - targetObject.setValue(target); + targetObject.setType(targetType); + targetObject.setValue(targetValue); mis.setTarget(targetObject); mis.setOAFriendlyName(oaFriendlyName); @@ -1777,7 +1778,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws ConfigurationException the configuration exception */ public CreateIdentityLinkResponse getIdentityLink(Element signature) throws SZRGWClientException, ConfigurationException { - return getIdentityLink(null, null, null, null, null, XMLHelper.nodeToString(signature), null, null, null); + return getIdentityLink(null, null, null, null, XMLHelper.nodeToString(signature)); } /** @@ -1793,7 +1794,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { * @throws ConfigurationException the configuration exception */ public CreateIdentityLinkResponse getIdentityLink(String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature) throws SZRGWClientException { - return getIdentityLink(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, null, signature, null, null, null); + return getIdentityLink(PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, null, signature, null, null, null, null, null, null, null); } /** @@ -1810,10 +1811,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { */ public CreateIdentityLinkResponse getIdentityLink(String citizenSignature, String representative, String represented, String mandateContent, - String organizationAddress, String organizationType, String target, String oaFriendlyName, String filters) throws SZRGWClientException { + String organizationAddress, String organizationType, String targetType, String targetValue, String oaFriendlyName, String filters) throws SZRGWClientException { return getIdentityLink(null, null, null, null, null, citizenSignature, represented, representative, mandateContent, organizationAddress, - organizationType, target, oaFriendlyName, filters); + organizationType, targetType, targetValue, oaFriendlyName, filters); } /** @@ -1833,10 +1834,10 @@ public class AuthenticationServer implements MOAIDAuthConstants { public CreateIdentityLinkResponse getIdentityLink(String eIdentifier, String givenName, String lastName, String dateOfBirth, String gender, String citizenSignature, String representative, String represented, - String mandate, String target, String oaFriendlyName, String filters) throws SZRGWClientException { + String mandate, String targetType, String targetValue, String oaFriendlyName, String filters) throws SZRGWClientException { return getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, gender, citizenSignature, representative, represented, mandate, null, - null, target, oaFriendlyName, filters); + null, targetType, targetValue, oaFriendlyName, filters); } /** diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index bd8c6420d..9dfce7838 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -200,6 +200,22 @@ public class PEPSConnectorServlet extends AuthServlet { OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(moasession.getPublicOAURLPrefix()); if (oaParam == null) throw new AuthenticationException("auth.00", new Object[] { moasession.getPublicOAURLPrefix() }); + + // retrieve target + //TODO: check in case of SSO!!! + String targetType = null; + String targetValue = null; + if(oaParam.getBusinessService()) { + String id = oaParam.getIdentityLinkDomainIdentifier(); + if (id.startsWith(AuthenticationSession.REGISTERANDORDNR_PREFIX_)) + targetValue = id.substring(AuthenticationSession.REGISTERANDORDNR_PREFIX_.length()); + else + targetValue = moasession.getDomainIdentifier(); + targetType = AuthenticationSession.REGISTERANDORDNR_PREFIX_; + } else { + targetType = AuthenticationSession.TARGET_PREFIX_; + targetValue = oaParam.getTarget(); + } Logger.debug("Starting connecting SZR Gateway"); //contact SZR Gateway @@ -207,7 +223,7 @@ public class PEPSConnectorServlet extends AuthServlet { try { identityLink = STORKResponseProcessor.connectToSZRGateway(authnResponse.getPersonalAttributeList(), oaParam.getFriendlyName(), - oaParam.getTarget(), + targetType, targetValue, oaParam.getMandateProfiles()); } catch (STORKException e) { // this is really nasty but we work against the system here. We are supposed to get the gender attribute from diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 6d88a1684..20ceb2128 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -144,16 +144,17 @@ public class STORKResponseProcessor { } /** - * Handels connection to SZR-GW and returns Identity Link on success - * @param oaFriendlyName - * @param target - * @param filters - * @param filter - * @param iPersonalAttributeList Received attribute List in assertion + * Handels connection to SZR-GW and returns Identity Link on success. + * + * @param attributeList the attribute list + * @param oaFriendlyName the oa friendly name + * @param targetType the target type + * @param targetValue the target value + * @param filters the filters * @return Identity Link - * @throws STORKException + * @throws STORKException the sTORK exception */ - public static IdentityLink connectToSZRGateway(IPersonalAttributeList attributeList, String oaFriendlyName, String target, String filters) throws STORKException { + public static IdentityLink connectToSZRGateway(IPersonalAttributeList attributeList, String oaFriendlyName, String targetType, String targetValue, String filters) throws STORKException { Logger.trace("Calling SZR Gateway with the following attributes:"); CreateIdentityLinkResponse identityLinkResponse = null; @@ -177,7 +178,7 @@ public class STORKResponseProcessor { String organizationAddress = getAttributeValue("canonicalRegisteredAddress", attributeList); String organizationType = getAttributeValue("translateableType", attributeList); - identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(citizenSignature, representative, represented, mandate, organizationAddress, organizationType, target, oaFriendlyName, filters); + identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(citizenSignature, representative, represented, mandate, organizationAddress, organizationType, targetType, targetValue, oaFriendlyName, filters); } else { // if we get here, we have a natural person representing another natural person String eIdentifier = getAttributeValue("eIdentifier", attributeList); @@ -192,7 +193,7 @@ public class STORKResponseProcessor { identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, gender, citizenSignature, representative, - represented, mandate, target, oaFriendlyName, filters); + represented, mandate, targetType, targetValue, oaFriendlyName, filters); } } else { // we do not have a representation case -- cgit v1.2.3 From 2ee0d4beb3b23613b1bdaa3f9c58723d30303b79 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 31 Jan 2014 14:39:04 +0100 Subject: fixed saml post binding template location --- .../main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 94cab53d4..209743f45 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1986,7 +1986,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { Logger.trace("Initialize VelocityEngine..."); VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine(); - Template template = velocityEngine.getTemplate("/saml2-post-binding-moa.vm"); + Template template = velocityEngine.getTemplate("/resources/templates/saml2-post-binding-moa.vm"); VelocityContext context = new VelocityContext(); context.put("SAMLRequest", PEPSUtil.encodeSAMLToken(authnRequest.getTokenSaml())); context.put("action", destination); -- cgit v1.2.3 From 9122bf6862fe34881e5454f54c69692b7f5ed083 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 31 Jan 2014 16:21:13 +0100 Subject: fixed outgoing signrequest - mostly tested --- .../moa/id/auth/AuthenticationServer.java | 40 +++++++++++++---- .../moa/id/auth/servlet/PEPSConnectorServlet.java | 52 +++++++++++++++++----- .../moa/id/auth/stork/STORKResponseProcessor.java | 51 --------------------- 3 files changed, 73 insertions(+), 70 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 209743f45..146137a2c 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -31,6 +31,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; +import java.math.BigInteger; import java.security.NoSuchAlgorithmException; import java.security.Principal; import java.security.cert.CertificateException; @@ -49,6 +50,7 @@ import javax.servlet.http.HttpSession; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; +import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringEscapeUtils; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; @@ -123,7 +125,6 @@ import at.gv.egovernment.moa.id.storage.DBExceptionStoreImpl; import at.gv.egovernment.moa.id.util.HTTPUtils; import at.gv.egovernment.moa.id.util.MOAIDMessageProvider; import at.gv.egovernment.moa.id.util.Random; -import at.gv.egovernment.moa.id.util.SSLUtils; import at.gv.egovernment.moa.id.util.XMLUtil; import at.gv.egovernment.moa.id.util.client.mis.simple.MISMandate; import at.gv.egovernment.moa.logging.LogMsg; @@ -142,10 +143,14 @@ import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest.PEPSData; import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse; import at.gv.util.xsd.srzgw.MISType; import at.gv.util.xsd.srzgw.MISType.Filters; +import eu.stork.oasisdss.api.AdditionalProfiles; import eu.stork.oasisdss.api.ApiUtils; import eu.stork.oasisdss.api.ApiUtilsException; +import eu.stork.oasisdss.api.Profiles; +import eu.stork.oasisdss.api.QualityLevels; +import eu.stork.oasisdss.api.SignatureTypes; +import eu.stork.oasisdss.profile.AnyType; import eu.stork.oasisdss.profile.DocumentType; -import eu.stork.oasisdss.profile.InputDocuments; import eu.stork.oasisdss.profile.SignRequest; import eu.stork.peps.auth.commons.PEPSUtil; import eu.stork.peps.auth.commons.PersonalAttribute; @@ -1912,7 +1917,9 @@ public class AuthenticationServer implements MOAIDAuthConstants { PersonalAttribute newAttribute = new PersonalAttribute(); newAttribute.setName("signedDoc"); List value = new ArrayList(); - value.add(generateDssSignRequest(CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession), "application/xhtml+xml")); + value.add(generateDssSignRequest(CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession), + "application/xhtml+xml", + moasession.getCcc())); newAttribute.setValue(value); attributeList.add(newAttribute); @@ -2004,20 +2011,37 @@ public class AuthenticationServer implements MOAIDAuthConstants { Logger.info("STORK AuthnRequest successfully successfully prepared for client with target location: " + authnRequest.getDestination()); } - private static String generateDssSignRequest(String text, String mimeType) { + private static String generateDssSignRequest(String text, String mimeType, String citizenCountry) { IdentifierGenerator idGenerator; try { idGenerator = new SecureRandomIdentifierGenerator(); DocumentType doc = new DocumentType(); - doc.setBase64XML(Base64.encodeBytes(text.getBytes()).getBytes()); + doc.setBase64XML(text.getBytes()); + doc.setID(idGenerator.generateIdentifier()); SignRequest request = new SignRequest(); request.setInputDocuments(ApiUtils.createInputDocuments(doc)); - request.setRequestID(idGenerator.generateIdentifier()); + String id = idGenerator.generateIdentifier(); + request.setRequestID(id); + request.setDocUI(id); - return ApiUtils.marshalToDocument(request).getTextContent(); + request.setProfile(Profiles.XADES_BES.toString()); + request.setNumberOfSigners(BigInteger.ONE); + request.setTargetCountry(citizenCountry); + + // no, no todo. PEPS will alter this value anyhow. + request.setReturnURL("http://invalid_return"); + + AnyType required = new AnyType(); + required.getAny().add(ApiUtils.createSignatureType(SignatureTypes.XMLSIG_RFC3275.toString())); + required.getAny().add(ApiUtils.createAdditionalProfile(AdditionalProfiles.XADES.toString())); + required.getAny().add(ApiUtils.createQualityRequirements(QualityLevels.QUALITYLEVEL_QUALIFIEDSIG)); + required.getAny().add(ApiUtils.createIncludeObject(doc)); + request.setOptionalInputs(required); + + return IOUtils.toString(ApiUtils.marshalToInputStream(request)); } catch (NoSuchAlgorithmException e) { Logger.error("Cannot generate id", e); throw new RuntimeException(e); @@ -2027,7 +2051,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { } catch (DOMException e) { Logger.error("Could not create SignRequest", e); throw new RuntimeException(e); - } catch (ParserConfigurationException e) { + } catch (IOException e) { Logger.error("Could not create SignRequest", e); throw new RuntimeException(e); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index 9dfce7838..a3c8ebe4d 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -1,7 +1,10 @@ package at.gv.egovernment.moa.id.auth.servlet; +import iaik.x509.X509Certificate; import java.io.IOException; +import java.io.InputStream; import java.io.StringWriter; +import java.net.URL; import java.util.ArrayList; import java.util.List; @@ -10,19 +13,19 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; import javax.xml.transform.stream.StreamSource; +import org.apache.commons.io.IOUtils; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; -import org.opensaml.saml2.core.Assertion; import org.opensaml.saml2.core.StatusCode; -import org.w3c.dom.Element; import at.gv.egovernment.moa.id.auth.AuthenticationServer; import at.gv.egovernment.moa.id.auth.builder.DataURLBuilder; 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.IdentityLink; import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; @@ -33,14 +36,14 @@ import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.moduls.ModulUtils; -import at.gv.egovernment.moa.id.proxy.parser.SAMLResponseParser; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; import at.gv.egovernment.moa.id.util.HTTPUtils; import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.util.DOMUtils; import at.gv.egovernment.moa.util.StringUtils; +import at.gv.util.xsd.xmldsig.SignatureType; +import at.gv.util.xsd.xmldsig.X509DataType; import eu.stork.oasisdss.api.ApiUtils; -import eu.stork.oasisdss.api.LightweightSourceResolver; +import eu.stork.oasisdss.profile.DocumentWithSignature; import eu.stork.oasisdss.profile.SignResponse; import eu.stork.peps.auth.commons.PEPSUtil; import eu.stork.peps.auth.commons.PersonalAttribute; @@ -173,14 +176,41 @@ public class PEPSConnectorServlet extends AuthServlet { //extract signed doc element and citizen signature String citizenSignature = null; try { - citizenSignature = authnResponse.getPersonalAttributeList().get("signedDoc").getValue().get(0); + String signatureInfo = authnResponse.getPersonalAttributeList().get("signedDoc").getValue().get(0); + SignResponse dssSignResponse = (SignResponse) ApiUtils.unmarshal(new StreamSource(new java.io.StringReader(signatureInfo))); + + List doclocations = ApiUtils.findNamedElement(dssSignResponse.getOptionalOutputs(), DocumentWithSignature.class.getSimpleName(), DocumentWithSignature.class); + // TODO handle multiple docs? + Logger.debug("trying first doclocation"); + String docUrl = doclocations.get(0).getDocument().getDocumentURL(); + Logger.debug("trying first doclocation successful"); + + // fetch signed doc + URL url = new URL(docUrl); + InputStream incomming = url.openStream(); + citizenSignature = IOUtils.toString(incomming); + incomming.close(); + + JAXBContext ctx = JAXBContext.newInstance(SignatureType.class.getPackage().getName()); + SignatureType root = ((JAXBElement) ctx.createUnmarshaller().unmarshal(IOUtils.toInputStream(citizenSignature))).getValue(); + + // memorize signature into authblock moaSession.setAuthBlock(citizenSignature); + + // extract certificate + for(Object current : root.getKeyInfo().getContent()) + if(((JAXBElement) current).getValue() instanceof X509DataType) { + for(Object currentX509Data : ((JAXBElement) current).getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName()) { + JAXBElement casted = ((JAXBElement) currentX509Data); + if(casted.getName().getLocalPart().equals("X509Certificate")) { + moaSession.setSignerCertificate(new X509Certificate(((String)casted.getValue()).getBytes())); + break; + } + } + } - // FIXME untested - Element sepp = (Element) ApiUtils.unmarshal(new StreamSource(new java.io.StringReader(citizenSignature))); - moaSession.setSignerCertificate(AuthenticationServer.getCertificateFromXML(sepp)); - } catch (Exception e) { + } catch (Throwable e) { Logger.error("Could not extract citizen signature from C-PEPS", e); throw new MOAIDException("stork.09", null); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 20ceb2128..2534110d5 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -57,57 +57,6 @@ public class STORKResponseProcessor { /** OASIS DSS Success Message */ public static final String OASIS_DSS_SUCCESS_MSG = "urn:oasis:names:tc:dss:1.0:resultmajor:Success"; - /** - * Extracts the signature value out of a DSS response - * @param signatureResponse DSS signature response - * @return signature - * @throws STORKException - */ - private static Element getSignature(Element signatureResponse) throws STORKException { - - NodeList nList = signatureResponse.getElementsByTagNameNS(OASIS_DSS_NS, "ResultMajor"); - - String resultMajor = XMLUtil.getFirstTextValueFromNodeList(nList); - - if (StringUtils.isEmpty(resultMajor)) { - String msg = "DSS response not correct, ResultMajor element missing."; - Logger.error(msg); - throw new STORKException(msg); - } - - Logger.trace("ResultMajor of DSS response: " + resultMajor); - - if (!OASIS_DSS_SUCCESS_MSG.equals(resultMajor)) { - String msg = "DSS response not correct, ResultMajor is " + resultMajor; - Logger.error(msg); - throw new STORKException(msg); - } - - NodeList nList2 = signatureResponse.getElementsByTagNameNS(OASIS_DSS_NS, "Base64Signature");; - - String base64SigString = XMLUtil.getFirstTextValueFromNodeList(nList2); - - if (StringUtils.isEmpty(base64SigString)) { - String msg = "DSS response not correct, Base64Signature element missing."; - Logger.error(msg); - throw new STORKException(msg); - } - - Logger.trace("Base64Signature element of DSS response: " + base64SigString); - - String sigString = new String(Base64.decode(base64SigString)); - - try { - return XMLUtil.stringToDOM(sigString); - } catch (Exception e) { - String msg = "Unable to extract signature from DSS response"; - Logger.error(msg); - throw new STORKException(msg); - } - - - } - /** * Checks for attribute. * -- cgit v1.2.3 From c2ccb7f48188b369c34cf2116b593a6d7c46b1ac Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 31 Jan 2014 16:29:15 +0100 Subject: refactored gender retrieval --- .../moa/id/auth/servlet/PEPSConnectorServlet.java | 52 ++++++++++------------ .../moa/id/auth/stork/STORKResponseProcessor.java | 3 +- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index a3c8ebe4d..b1829439a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -167,6 +167,30 @@ public class PEPSConnectorServlet extends AuthServlet { gender.setValue(tmp); authnResponse.getPersonalAttributeList().add(gender); + } else { + // this is really nasty but we work against the system here. We are supposed to get the gender attribute from + // stork. If we do not, we cannot register the person in the ERnP - we have to have the + // gender for the represented person. So here comes the dirty hack. + try { + Logger.trace("Initialize VelocityEngine..."); + + VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine(); + Template template = velocityEngine.getTemplate("/resources/templates/fetchGender.html"); + VelocityContext context = new VelocityContext(); + context.put("SAMLResponse", request.getParameter("SAMLResponse")); + context.put("action", request.getRequestURL()); + + StringWriter writer = new StringWriter(); + template.merge(context, writer); + + response.getOutputStream().write(writer.toString().getBytes()); + } catch (Exception e1) { + Logger.error("Error sending gender retrival form.", e1); + httpSession.invalidate(); + throw new MOAIDException("stork.10", null); + } + + return; } } @@ -256,34 +280,6 @@ public class PEPSConnectorServlet extends AuthServlet { targetType, targetValue, oaParam.getMandateProfiles()); } catch (STORKException e) { - // this is really nasty but we work against the system here. We are supposed to get the gender attribute from - // stork. If we do not, we cannot register the person in the ERnP - we have to have the - // gender for the represented person. So here comes the dirty hack. - if(e.getMessage().equals("gender not found in response")) { - // fetch gender - - try { - Logger.trace("Initialize VelocityEngine..."); - - VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine(); - Template template = velocityEngine.getTemplate("/resources/templates/fetchGender.html"); - VelocityContext context = new VelocityContext(); - context.put("SAMLResponse", request.getParameter("SAMLResponse")); - context.put("action", request.getRequestURL()); - - StringWriter writer = new StringWriter(); - template.merge(context, writer); - -// response.setContentType("text/html"); - response.getOutputStream().write(writer.toString().getBytes()); - } catch (Exception e1) { - Logger.error("Error sending gender retrival form.", e1); - httpSession.invalidate(); - throw new MOAIDException("stork.10", null); - } - - return; - } Logger.error("Error connecting SZR Gateway", e); throw new MOAIDException("stork.10", null); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 2534110d5..344e842b2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -136,7 +136,8 @@ public class STORKResponseProcessor { String dateOfBirth = getAttributeValue("dateOfBirth", attributeList); // gender attribute is mandatory here because of some legal stuff -// String gender = getAttributeValue("gender", attributeList); + String gender = getAttributeValue("gender", attributeList); + if (!StringUtils.isEmpty(dateOfBirth)) dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); -- cgit v1.2.3 From 3c1884ee275350e7b2a78256342d9610b1766898 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 31 Jan 2014 16:31:50 +0100 Subject: remove testing Citizen Country Code from auth flow --- .../main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 146137a2c..67824bb44 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1953,8 +1953,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { authnRequest.setEIDCrossSectorShare(true); authnRequest.setEIDSectorShare(true); - authnRequest.setCitizenCountryCode("LOCAL"); -// authnRequest.setCitizenCountryCode(moasession.getCcc()); + authnRequest.setCitizenCountryCode(moasession.getCcc()); Logger.debug("STORK AuthnRequest succesfully assembled."); -- cgit v1.2.3