aboutsummaryrefslogtreecommitdiff
path: root/id/server/stork2-saml-engine
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2015-08-27 12:07:52 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-08-27 12:07:52 +0200
commit1051a42329a603821f415383343d253724d4cd65 (patch)
treef8a0b6e8445b7034dfe38d6ba3a61f1429a75a6e /id/server/stork2-saml-engine
parentbb1b12ac5b240629e16ea1c7a50891e99f4adc14 (diff)
parenteb0cf88708f3d689c2cb6bb0dbf83dd290bee887 (diff)
downloadmoa-id-spss-1051a42329a603821f415383343d253724d4cd65.tar.gz
moa-id-spss-1051a42329a603821f415383343d253724d4cd65.tar.bz2
moa-id-spss-1051a42329a603821f415383343d253724d4cd65.zip
Merge STORK-SAML-Engine 1.5.1 and STORK-Commons 1.5.1
Conflicts: id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/CustomAttributeQueryValidator.java id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/MultipleAssertionResponseValidator.java
Diffstat (limited to 'id/server/stork2-saml-engine')
-rw-r--r--id/server/stork2-saml-engine/pom.xml48
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngine.java128
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/SAMLEngineUtils.java459
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/STORKSAMLEngine.java2491
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java96
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java46
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CitizenCountryCode.java45
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomAttributeQuery.java72
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomRequestAbstractType.java327
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java56
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossSectorShare.java54
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDSectorShare.java55
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/QAAAttribute.java67
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttribute.java215
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/RequestedAttributes.java38
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLCore.java148
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SAMLEngineSignI.java105
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPApplication.java53
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPCountry.java53
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPID.java45
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInformation.java45
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPInstitution.java53
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/SPSector.java53
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/STORKSAMLCore.java910
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/VIDPAuthenticationAttributes.java75
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java54
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesImpl.java140
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java15
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeBuilder.java42
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeImpl.java86
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeMarshaller.java26
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CitizenCountryCodeUnmarshaller.java23
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryBuilder.java25
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryImpl.java62
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java69
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryUnmarshaller.java165
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java16
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareImpl.java93
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareMarshaller.java14
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareUnmarshaller.java13
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareBuilder.java46
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareImpl.java92
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareMarshaller.java13
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossSectorShareUnmarshaller.java15
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareBuilder.java45
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareImpl.java100
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareMarshaller.java12
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDSectorShareUnmarshaller.java14
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeBuilder.java46
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeImpl.java88
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeMarshaller.java26
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/QAAAttributeUnmarshaller.java23
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeBuilder.java51
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeImpl.java360
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeMarshaller.java76
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributeUnmarshaller.java98
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesBuilder.java51
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesImpl.java121
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesMarshaller.java12
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/RequestedAttributesUnmarshaller.java37
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationBuilder.java45
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationImpl.java88
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationMarshaller.java27
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPApplicationUnmarshaller.java24
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryBuilder.java44
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryImpl.java84
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryMarshaller.java26
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPCountryUnmarshaller.java24
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDBuilder.java42
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDImpl.java86
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDMarshaller.java26
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPIDUnmarshaller.java23
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationBuilder.java19
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationImpl.java140
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationMarshaller.java12
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInformationUnmarshaller.java41
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionBuilder.java45
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionImpl.java90
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionMarshaller.java27
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPInstitutionUnmarshaller.java23
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorBuilder.java42
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorImpl.java93
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorMarshaller.java26
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SPSectorUnmarshaller.java24
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignHW.java693
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignModuleFactory.java54
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignP12.java309
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/SignSW.java906
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesBuilder.java19
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesImpl.java170
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesMarshaller.java12
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/VIDPAuthenticationAttributesUnmarshaller.java45
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/CustomAttributeQueryValidator.java59
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/ExtensionsSchemaValidator.java46
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/MultipleAssertionResponseValidator.java75
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/QAAAttributeSchemaValidator.java28
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationCreator.java212
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationEngine.java74
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationReader.java319
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/ConfigurationSingleton.java66
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/InstanceEngine.java74
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/configuration/package-info.java1
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java59
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineException.java223
-rw-r--r--id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/STORKSAMLEngineRuntimeException.java59
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java248
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java61
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java1624
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java1757
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java1681
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkLogoutRequestTest.java129
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkLogoutResponseTest.java223
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkNewResponseTest.java825
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java1586
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml124
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml28
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml14
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml14
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml14
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml13
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml187
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml184
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml151
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml144
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml148
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml69
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml126
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml242
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml138
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml88
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml88
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/logback-test.xml26
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg30
133 files changed, 10866 insertions, 11626 deletions
diff --git a/id/server/stork2-saml-engine/pom.xml b/id/server/stork2-saml-engine/pom.xml
index 36df747e4..ee4a61f3a 100644
--- a/id/server/stork2-saml-engine/pom.xml
+++ b/id/server/stork2-saml-engine/pom.xml
@@ -13,11 +13,10 @@
<name>STORKSAMLEngine</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <saml.version>1.4.0</saml.version>
+ <saml.version>1.5.1</saml.version>
<samlspec.version>0.5.2</samlspec.version>
<samlspecacept.version>0.5.1</samlspecacept.version>
- <commons.version>1.4.0</commons.version>
- <opensaml.version>2.6.2</opensaml.version>
+ <commons.version>1.5.1</commons.version>
<timestamp>${maven.build.timestamp}</timestamp>
<repositoryPath>${basedir}/../../../repository</repositoryPath>
</properties>
@@ -48,14 +47,14 @@
<dependency>
<groupId>eu.stork</groupId>
<artifactId>Commons</artifactId>
- <version>${commons.version}</version>
-<!-- <exclusions>
- <exclusion>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk16</artifactId>
- </exclusion>
- </exclusions> -->
+ <version>1.5.1</version>
</dependency>
+
+ <dependency>
+ <groupId>org.opensaml</groupId>
+ <artifactId>xmltooling</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.opensaml</groupId>
@@ -88,11 +87,6 @@
</exclusions>
</dependency>
- <dependency>
- <groupId>org.opensaml</groupId>
- <artifactId>xmltooling</artifactId>
- </dependency>
-
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -106,10 +100,9 @@
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
-<!-- <dependency>
+<!-- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
- <version>1.7.6</version>
</dependency> -->
<dependency>
<groupId>org.slf4j</groupId>
@@ -153,30 +146,9 @@
<skip>true</skip>
</configuration>
</plugin>
-
</plugins>
</pluginManagement>
<plugins>
-
-<!-- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>properties-maven-plugin</artifactId>
- <version>1.0-alpha-2</version>
- <executions>
- <execution>
- <phase>initialize</phase>
- <goals>
- <goal>read-project-properties</goal>
- </goals>
- <configuration>
- <files>
- <file>${basedir}/../../../moa-id.properties</file>
- </files>
- </configuration>
- </execution>
- </executions>
- </plugin> -->
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
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 26635e337..1dcaf4c95 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
@@ -64,10 +64,8 @@ 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.
+ * 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
@@ -85,8 +83,7 @@ public class SAMLEngine {
private static Map<String, Map<String, Object>> instances;
/** The logger. */
- private static final Logger LOG = LoggerFactory.getLogger(SAMLEngine.class
- .getName());
+ private static final Logger LOG = LoggerFactory.getLogger(SAMLEngine.class.getName());
/** The Constant MODULE_SIGN_CONF. */
private static final String MODULE_SIGN_CONF = "SignatureConf";
@@ -100,7 +97,14 @@ public class SAMLEngine {
/** The Constant SAML_ENGINE_FILE_CONF. */
private static final String SAML_ENGINE_FILE_CONF = "fileConfiguration";
- /** The codification of characters. */
+ /**
+ * Additional trust store for HW signing
+ */
+ private static final String HW_TRUST_STORE_CONF = "softTrustStoreConfig";
+
+ /**
+ * The codification of characters.
+ */
private static final String CHARACTER_ENCODING = "UTF-8";
/** The SAML core. */
@@ -109,7 +113,6 @@ public class SAMLEngine {
/** The Module of Signature. */
private SAMLEngineSignI signer;
-
/** Initializes the SAML engine. */
/** Configure Document Builder Factory. */
@@ -134,23 +137,16 @@ public class SAMLEngine {
}
/**
- * Method that initializes the basic services for the SAML Engine, like the
- * OpenSAML library and the BouncyCastle provider.
+ * 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");
-
-
-/* Commented because it makes a problems with PVP2 MOA-ID
- try {
- DefaultBootstrap.bootstrap();
- } catch (ConfigurationException e) {
- LOG.error("Problem initializing the OpenSAML library.");
- throw new STORKSAMLEngineRuntimeException(e);
- }
-*/
+ /*
+ * Commented because it makes a problems with PVP2 MOA-ID 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 {
@@ -162,8 +158,7 @@ public class SAMLEngine {
LOG.debug("Create all instances of saml engine. (instances of SAMLEngine)");
try {
- instances = ConfigurationCreator
- .createConfiguration(instanceConfigs);
+ instances = ConfigurationCreator.createConfiguration(instanceConfigs);
} catch (STORKSAMLEngineException e) {
LOG.error("Error initializing instances from Stork SAML engine.");
throw new STORKSAMLEngineRuntimeException(e);
@@ -173,12 +168,13 @@ public class SAMLEngine {
/**
* Instantiates a new SAML engine.
*
- * @param nameInstance the name instance
+ * @param nameInstance
+ * the name instance
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- protected SAMLEngine(final String nameInstance)
- throws STORKSAMLEngineException {
+ protected SAMLEngine(final String nameInstance) throws STORKSAMLEngineException {
LOG.info("Loading Specific Configuration.");
LOG.debug("Create intance of saml messages.");
@@ -187,8 +183,7 @@ public class SAMLEngine {
if (instance == null || instance.isEmpty()) {
LOG.error("Instance: " + nameInstance + " not exist.");
- throw new STORKSAMLEngineException("Instance: " + nameInstance
- + " not exist.");
+ throw new STORKSAMLEngineException("Instance: " + nameInstance + " not exist.");
}
Properties properties = (Properties) instance.get(SAML_ENGINE_CONF);
@@ -200,12 +195,10 @@ public class SAMLEngine {
samlCore = new STORKSAMLCore(properties);
- final HashMap<String, String> propertiesSign = (HashMap<String, String>) instance
- .get(MODULE_SIGN_CONF);
+ final HashMap<String, String> propertiesSign = (HashMap<String, String>) instance.get(MODULE_SIGN_CONF);
LOG.debug("Loading Module of sign.");
- signer = SignModuleFactory.getInstance(propertiesSign
- .get(SAML_ENGINE_SIGN_CLASS));
+ signer = SignModuleFactory.getInstance(propertiesSign.get(SAML_ENGINE_SIGN_CLASS));
try {
LOG.info("Initialize module of sign.");
@@ -213,8 +206,7 @@ public class SAMLEngine {
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.error("Error create signature module: " + propertiesSign.get(SAML_ENGINE_FILE_CONF));
LOG.info("Exception" + e);
throw new STORKSAMLEngineException(e);
}
@@ -239,30 +231,28 @@ public class SAMLEngine {
}
/**
- * Method that transform the received SAML object into a byte array
- * representation.
+ * Method that transform the received SAML object into a byte array representation.
*
- * @param samlToken the SAML token.
+ * @param samlToken
+ * the SAML token.
*
* @return the byte[] of the SAML token.
*
- * @throws SAMLEngineException the SAML engine exception
+ * @throws SAMLEngineException
+ * the SAML engine exception
*/
- private byte[] marshall(final XMLObject samlToken)
- throws SAMLEngineException {
+ private byte[] marshall(final XMLObject samlToken) throws SAMLEngineException {
try {
javax.xml.parsers.DocumentBuilder docBuilder = null;
- final MarshallerFactory marshallerFactory = Configuration
- .getMarshallerFactory();
+ final MarshallerFactory marshallerFactory = Configuration.getMarshallerFactory();
final Marshaller marshaller;
if (samlToken.getElementQName().toString().endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME))
marshaller = new CustomAttributeQueryMarshaller();
else
- marshaller = marshallerFactory
- .getMarshaller(samlToken);
+ marshaller = marshallerFactory.getMarshaller(samlToken);
docBuilder = dbf.newDocumentBuilder();
@@ -274,13 +264,12 @@ public class SAMLEngine {
final DOMSource domSource = new DOMSource(doc);
final StringWriter writer = new StringWriter();
final StreamResult result = new StreamResult(writer);
- final TransformerFactory transFactory = TransformerFactory
- .newInstance();
+ final TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer;
transformer = transFactory.newTransformer();
transformer.transform(domSource, result);
- LOG.debug("SAML request \n"+ writer.toString());
+ LOG.debug("SAML request \n" + writer.toString());
return writer.toString().getBytes(CHARACTER_ENCODING);
} catch (ParserConfigurationException e) {
@@ -304,14 +293,15 @@ public class SAMLEngine {
/**
* Method that signs a SAML Token.
*
- * @param tokenSaml the token SAML
+ * @param tokenSaml
+ * the token SAML
*
* @return the SAML object sign
*
- * @throws SAMLEngineException the SAML engine exception
+ * @throws SAMLEngineException
+ * the SAML engine exception
*/
- private SignableSAMLObject sign(final SignableSAMLObject tokenSaml)
- throws SAMLEngineException {
+ private SignableSAMLObject sign(final SignableSAMLObject tokenSaml) throws SAMLEngineException {
LOG.debug("Sign SamlToken.");
signer.sign(tokenSaml);
return tokenSaml;
@@ -320,31 +310,32 @@ public class SAMLEngine {
/**
* Sign and transform to byte array.
*
- * @param samlToken the SAML token
+ * @param samlToken
+ * the SAML token
*
* @return the byte[] of the SAML token
*
- * @throws SAMLEngineException the SAML engine exception
+ * @throws SAMLEngineException
+ * the SAML engine exception
*/
- protected final byte[] signAndMarshall(final SignableSAMLObject samlToken)
- throws SAMLEngineException {
+ 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.
+ * Method that unmarshalls a SAML Object from a byte array representation to an XML Object.
*
- * @param samlToken Byte array representation of a SAML Object
+ * @param samlToken
+ * Byte array representation of a SAML Object
*
* @return XML Object (superclass of SAMLObject)
*
- * @throws SAMLEngineException the SAML engine exception
+ * @throws SAMLEngineException
+ * the SAML engine exception
*/
- protected final XMLObject unmarshall(final byte[] samlToken)
- throws SAMLEngineException {
+ protected final XMLObject unmarshall(final byte[] samlToken) throws SAMLEngineException {
try {
// Get parser pool manager
final BasicParserPool ppMgr = new BasicParserPool();
@@ -358,12 +349,12 @@ public class SAMLEngine {
// Parse SAMLToken
Document document = ppMgr.parse(new ByteArrayInputStream(samlToken));
- if (document != null){
+ 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){
+ if (unmarshallerFact != null && root != null) {
final Unmarshaller unmarshaller;
if (root.getLocalName().equals(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME))
unmarshaller = new CustomAttributeQueryUnmarshaller();
@@ -371,7 +362,7 @@ public class SAMLEngine {
unmarshaller = unmarshallerFact.getUnmarshaller(root);
try {
return unmarshaller.unmarshall(root);
- } catch (NullPointerException e){
+ } catch (NullPointerException e) {
LOG.error("Error element tag incomplet or null.");
throw new SAMLEngineException("NullPointerException", e);
}
@@ -398,14 +389,15 @@ public class SAMLEngine {
/**
* Method that validates an XML Signature contained in a SAML Token.
*
- * @param samlToken the SAML token
+ * @param samlToken
+ * the SAML token
*
* @return the SAML object
*
- * @throws SAMLEngineException the SAML engine exception
+ * @throws SAMLEngineException
+ * the SAML engine exception
*/
- protected final SAMLObject validateSignature(
- final SignableSAMLObject samlToken) throws SAMLEngineException {
+ protected final SAMLObject validateSignature(final SignableSAMLObject samlToken) throws SAMLEngineException {
LOG.info("Validate Signature");
signer.validateSignature(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
index 1efbb8b32..3cc323c96 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
@@ -96,72 +96,37 @@ public final class SAMLEngineUtils {
private static SecureRandomIdentifierGenerator generator;
/** The Constant LOG. */
- private static final Logger LOG = LoggerFactory
- .getLogger(SAMLEngineUtils.class.getName());
+ 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 |
+ * 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.
+ // Initialization of a generator of identifiers for all token SAML.
static {
loadRandomIdentifierGenerator();
}
@@ -169,7 +134,8 @@ public final class SAMLEngineUtils {
/**
* Load random identifier generator.
*
- *@throws STORKSAMLEngineRuntimeException the STORKSAML engine runtime exception
+ * @throws STORKSAMLEngineRuntimeException
+ * the STORKSAML engine runtime exception
*/
private static void loadRandomIdentifierGenerator() {
try {
@@ -184,49 +150,48 @@ public final class SAMLEngineUtils {
/**
* Creates the SAML object.
*
- * @param qname the QName
+ * @param qname
+ * the QName
*
* @return the XML object
*/
public static XMLObject createSamlObject(final QName qname) {
- if (qname.toString().endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME))
- {
+ 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);
+ } else {
+ return Configuration.getBuilderFactory().getBuilder(qname).buildObject(qname);
}
}
/**
* Creates the SAML object.
*
- * @param qname the quality name
- * @param qname1 the qname1
+ * @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);
+ 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
+ * @param value
+ * the value
+ * @param alg
+ * the algorithm
*
* @return the string
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public static String encode(final String value, final String alg)
- throws STORKSAMLEngineException {
+ 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("");
@@ -257,16 +222,18 @@ public final class SAMLEngineUtils {
/**
* Generate assertion.
*
- * @param version the version
- * @param identifier the identifier
- * @param issueInstant the issue instant
- * @param issuer the issuer
+ * @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) {
+ 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);
@@ -280,16 +247,16 @@ public final class SAMLEngineUtils {
/**
* Generate authentication statement.
*
- * @param authnInstant the authentication instant
- * @param authnContext the authentication context
+ * @param authnInstant
+ * the authentication instant
+ * @param authnContext
+ * the authentication context
*
* @return the authentication statement
*/
- public static AuthnStatement generateAthnStatement(final DateTime authnInstant,
- final AuthnContext authnContext) {
+ public static AuthnStatement generateAthnStatement(final DateTime authnInstant, final AuthnContext authnContext) {
// <saml:AuthnStatement>
- final AuthnStatement authnStatement = (AuthnStatement) SAMLEngineUtils
- .createSamlObject(AuthnStatement.DEFAULT_ELEMENT_NAME);
+ final AuthnStatement authnStatement = (AuthnStatement) SAMLEngineUtils.createSamlObject(AuthnStatement.DEFAULT_ELEMENT_NAME);
authnStatement.setAuthnInstant(authnInstant);
authnStatement.setAuthnContext(authnContext);
return authnStatement;
@@ -298,51 +265,45 @@ public final class SAMLEngineUtils {
/**
* 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.
+ * @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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public static Attribute generateAttrComplex(final String name,
- final String status, final Map<String, String> values,
- final boolean isHashing) throws STORKSAMLEngineException {
+ public static Attribute generateAttrComplex(final String name, final String status, final Map<String, String> values, final boolean isHashing) throws STORKSAMLEngineException {
LOG.debug("Generate attribute complex: " + name);
- final Attribute attribute = (Attribute) SAMLEngineUtils
- .createSamlObject(Attribute.DEFAULT_ELEMENT_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);
+ 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<Entry<String, String>> iterator = values.entrySet()
- .iterator();
+ final XSAny attrValue = (XSAny) SAMLEngineUtils.createSamlObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSAny.TYPE_NAME);
+ final Iterator<Entry<String, String>> iterator = values.entrySet().iterator();
while (iterator.hasNext()) {
final Map.Entry<String, String> 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);
+ 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));
+ attrValueSimple.setTextContent(encode(value, SHA_512));
} else {
attrValueSimple.setTextContent(value);
- }
+ }
attrValue.getUnknownXMLObjects().add(attrValueSimple);
attribute.getAttributeValues().add(attrValue);
}
@@ -359,8 +320,7 @@ public final class SAMLEngineUtils {
*/
public static Extensions generateExtension() {
final ExtensionsBuilder extensionsBuilder = new ExtensionsBuilder();
- return extensionsBuilder.buildObject(
- "urn:oasis:names:tc:SAML:2.0:protocol", "Extensions", "saml2p");
+ return extensionsBuilder.buildObject("urn:oasis:names:tc:SAML:2.0:protocol", "Extensions", "saml2p");
}
/**
@@ -369,8 +329,7 @@ public final class SAMLEngineUtils {
* @return the issuer
*/
public static Issuer generateIssuer() {
- return (Issuer) SAMLEngineUtils
- .createSamlObject(Issuer.DEFAULT_ELEMENT_NAME);
+ return (Issuer) SAMLEngineUtils.createSamlObject(Issuer.DEFAULT_ELEMENT_NAME);
}
/**
@@ -379,8 +338,7 @@ public final class SAMLEngineUtils {
* @return the key info
*/
public static KeyInfo generateKeyInfo() {
- return (KeyInfo) SAMLEngineUtils
- .createSamlObject(KeyInfo.DEFAULT_ELEMENT_NAME);
+ return (KeyInfo) SAMLEngineUtils.createSamlObject(KeyInfo.DEFAULT_ELEMENT_NAME);
}
/**
@@ -389,25 +347,24 @@ public final class SAMLEngineUtils {
* @return the name id
*/
public static NameID generateNameID() {
- return (NameID) SAMLEngineUtils
- .createSamlObject(NameID.DEFAULT_ELEMENT_NAME);
+ 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
+ * @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) {
+ public static NameID generateNameID(final String nameQualifier, final String format, final String spNameQualifier) {
// <saml:NameID>
- final NameID nameId = (NameID) Configuration.getBuilderFactory()
- .getBuilder(NameID.DEFAULT_ELEMENT_NAME).buildObject(
- NameID.DEFAULT_ELEMENT_NAME);
+ final NameID nameId = (NameID) Configuration.getBuilderFactory().getBuilder(NameID.DEFAULT_ELEMENT_NAME).buildObject(NameID.DEFAULT_ELEMENT_NAME);
// optional
nameId.setNameQualifier(nameQualifier);
// optional
@@ -429,18 +386,18 @@ public final class SAMLEngineUtils {
/**
* Generate the quality authentication assurance level.
*
- * @param qaal the level of quality authentication assurance.
+ * @param qaal
+ * the level of quality authentication assurance.
*
* @return the quality authentication assurance attribute
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public static QAAAttribute generateQAAAttribute(final int qaal)
- throws STORKSAMLEngineException {
+ public static QAAAttribute generateQAAAttribute(final int qaal) throws STORKSAMLEngineException {
LOG.debug("Generate QAAAttribute.");
- final QAAAttribute qaaAttribute = (QAAAttribute) SAMLEngineUtils
- .createSamlObject(QAAAttribute.DEF_ELEMENT_NAME);
+ final QAAAttribute qaaAttribute = (QAAAttribute) SAMLEngineUtils.createSamlObject(QAAAttribute.DEF_ELEMENT_NAME);
qaaAttribute.setQaaLevel(String.valueOf(qaal));
return qaaAttribute;
}
@@ -448,20 +405,21 @@ public final class SAMLEngineUtils {
/**
* Generate requested attribute.
*
- * @param name the name
- * @param friendlyName the friendly name
- * @param isRequired the is required
- * @param value the value
+ * @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<String> value) {
+ public static RequestedAttribute generateReqAuthnAttributeSimple(final String name, final String friendlyName, final String isRequired, final List<String> value) {
LOG.debug("Generate the requested attribute.");
- final RequestedAttribute requested = (RequestedAttribute) SAMLEngineUtils
- .createSamlObject(RequestedAttribute.DEF_ELEMENT_NAME);
+ final RequestedAttribute requested = (RequestedAttribute) SAMLEngineUtils.createSamlObject(RequestedAttribute.DEF_ELEMENT_NAME);
requested.setName(name);
requested.setNameFormat(RequestedAttribute.URI_REFERENCE);
@@ -473,26 +431,22 @@ public final class SAMLEngineUtils {
if (!value.isEmpty()) {
for (int nextValue = 0; nextValue < value.size(); nextValue++) {
final String valor = value.get(nextValue);
- if (StringUtils.isNotBlank(valor)) {
+ if (StringUtils.isNotBlank(valor)) {
- if(!name.equals("http://www.stork.gov.eu/1.0/signedDoc")){
+ 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);
+ 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{
+ } else {
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
- domFactory.setNamespaceAware(true);
- Document document = null;
+ domFactory.setNamespaceAware(true);
+ Document document = null;
DocumentBuilder builder;
// Parse the signedDoc value into an XML DOM Document
@@ -501,7 +455,7 @@ public final class SAMLEngineUtils {
InputStream is;
is = new ByteArrayInputStream(valor.trim().getBytes(UTF_8));
document = builder.parse(is);
- is.close();
+ is.close();
} catch (SAXException e1) {
LOG.error("SAX Error while parsing signModule attribute", e1);
throw new STORKSAMLEngineRuntimeException(e1);
@@ -517,31 +471,21 @@ public final class SAMLEngineUtils {
}
// 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
+ 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
+ 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);
+ requested.getAttributeValues().add(attrValue);
}
-
}
}
}
@@ -552,18 +496,19 @@ public final class SAMLEngineUtils {
/**
* Generate response.
*
- * @param version the version
- * @param identifier the identifier
- * @param issueInstant the issue instant
- * @param status the status
+ * @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);
+ 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);
@@ -571,20 +516,20 @@ public final class SAMLEngineUtils {
}
/**
- * Method that generates a SAML Authentication Request basing on the
- * provided information.
+ * 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
+ * @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) {
+ 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);
+ final AuthnRequest authnRequest = (AuthnRequest) SAMLEngineUtils.createSamlObject(AuthnRequest.DEFAULT_ELEMENT_NAME);
authnRequest.setID(identifier);
authnRequest.setVersion(version);
@@ -592,11 +537,9 @@ public final class SAMLEngineUtils {
return authnRequest;
}
- public static CustomAttributeQuery generateSAMLAttrQueryRequest(final String identifier,
- final SAMLVersion version, final DateTime issueInstant) {
+ 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);
+ final CustomAttributeQuery attrQueryRequest = (CustomAttributeQuery) SAMLEngineUtils.createSamlObject(CustomAttributeQuery.DEFAULT_ELEMENT_NAME);
attrQueryRequest.setID(identifier);
attrQueryRequest.setVersion(version);
@@ -604,12 +547,9 @@ public final class SAMLEngineUtils {
return attrQueryRequest;
}
- public static LogoutRequest generateSAMLLogoutRequest(final String identifier,
- final SAMLVersion version, final DateTime issueInstant) {
+ 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);
-
+ final LogoutRequest logoutRequest = (LogoutRequest) SAMLEngineUtils.createSamlObject(LogoutRequest.DEFAULT_ELEMENT_NAME);
logoutRequest.setID(identifier);
logoutRequest.setVersion(version);
@@ -617,12 +557,9 @@ public final class SAMLEngineUtils {
return logoutRequest;
}
- public static LogoutResponse generateSAMLLogoutResponse(final String identifier,
- final SAMLVersion version, final DateTime issueInstant,
- final Status status, final String inResponseTo) {
+ 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);
+ final LogoutResponse logoutResponse = (LogoutResponse) SAMLEngineUtils.createSamlObject(LogoutResponse.DEFAULT_ELEMENT_NAME);
logoutResponse.setInResponseTo(inResponseTo);
logoutResponse.setStatus(status);
@@ -635,18 +572,18 @@ public final class SAMLEngineUtils {
/**
* Generate service provider application.
*
- * @param spApplication the service provider application
+ * @param spApplication
+ * the service provider application
*
* @return the sP application
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public static SPApplication generateSPApplication(final String spApplication)
- throws STORKSAMLEngineException {
+ public static SPApplication generateSPApplication(final String spApplication) throws STORKSAMLEngineException {
LOG.debug("Generate SPApplication.");
- final SPApplication applicationAttr = (SPApplication) SAMLEngineUtils
- .createSamlObject(SPApplication.DEF_ELEMENT_NAME);
+ final SPApplication applicationAttr = (SPApplication) SAMLEngineUtils.createSamlObject(SPApplication.DEF_ELEMENT_NAME);
applicationAttr.setSPApplication(spApplication);
return applicationAttr;
}
@@ -654,18 +591,18 @@ public final class SAMLEngineUtils {
/**
* Generate service provider country.
*
- * @param spCountry the service provider country
+ * @param spCountry
+ * the service provider country
*
* @return the service provider country
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public static SPCountry generateSPCountry(final String spCountry)
- throws STORKSAMLEngineException {
+ public static SPCountry generateSPCountry(final String spCountry) throws STORKSAMLEngineException {
LOG.debug("Generate SPApplication.");
- final SPCountry countryAttribute = (SPCountry) SAMLEngineUtils
- .createSamlObject(SPCountry.DEF_ELEMENT_NAME);
+ final SPCountry countryAttribute = (SPCountry) SAMLEngineUtils.createSamlObject(SPCountry.DEF_ELEMENT_NAME);
countryAttribute.setSPCountry(spCountry);
return countryAttribute;
}
@@ -673,18 +610,18 @@ public final class SAMLEngineUtils {
/**
* Generate service provider institution.
*
- * @param spInstitution the service provider institution
+ * @param spInstitution
+ * the service provider institution
*
* @return the service provider institution
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public static SPInstitution generateSPInstitution(final String spInstitution)
- throws STORKSAMLEngineException {
+ public static SPInstitution generateSPInstitution(final String spInstitution) throws STORKSAMLEngineException {
LOG.debug("Generate SPInstitution.");
- final SPInstitution institutionAttr = (SPInstitution) SAMLEngineUtils
- .createSamlObject(SPInstitution.DEF_ELEMENT_NAME);
+ final SPInstitution institutionAttr = (SPInstitution) SAMLEngineUtils.createSamlObject(SPInstitution.DEF_ELEMENT_NAME);
institutionAttr.setSPInstitution(spInstitution);
return institutionAttr;
}
@@ -692,18 +629,18 @@ public final class SAMLEngineUtils {
/**
* Generate service provider sector.
*
- * @param spSector the service provider sector
+ * @param spSector
+ * the service provider sector
*
* @return the service provider sector
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public static SPSector generateSPSector(final String spSector)
- throws STORKSAMLEngineException {
+ public static SPSector generateSPSector(final String spSector) throws STORKSAMLEngineException {
LOG.debug("Generate SPSector.");
- final SPSector sectorAttribute = (SPSector) SAMLEngineUtils
- .createSamlObject(SPSector.DEF_ELEMENT_NAME);
+ final SPSector sectorAttribute = (SPSector) SAMLEngineUtils.createSamlObject(SPSector.DEF_ELEMENT_NAME);
sectorAttribute.setSPSector(spSector);
return sectorAttribute;
}
@@ -711,13 +648,13 @@ public final class SAMLEngineUtils {
/**
* Generate status.
*
- * @param statusCode the status code
+ * @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);
+ final Status status = (Status) SAMLEngineUtils.createSamlObject(Status.DEFAULT_ELEMENT_NAME);
status.setStatusCode(statusCode);
return status;
}
@@ -725,13 +662,13 @@ public final class SAMLEngineUtils {
/**
* Generate status code.
*
- * @param value the value
+ * @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);
+ final StatusCode statusCode = (StatusCode) SAMLEngineUtils.createSamlObject(StatusCode.DEFAULT_ELEMENT_NAME);
statusCode.setValue(value);
return statusCode;
}
@@ -739,13 +676,13 @@ public final class SAMLEngineUtils {
/**
* Generate status message.
*
- * @param message the 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);
+ final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils.createSamlObject(StatusMessage.DEFAULT_ELEMENT_NAME);
statusMessage.setMessage(message);
return statusMessage;
}
@@ -756,24 +693,22 @@ public final class SAMLEngineUtils {
* @return the subject
*/
public static Subject generateSubject() {
- return (Subject) SAMLEngineUtils
- .createSamlObject(Subject.DEFAULT_ELEMENT_NAME);
+ return (Subject) SAMLEngineUtils.createSamlObject(Subject.DEFAULT_ELEMENT_NAME);
}
/**
* Generate subject confirmation.
*
- * @param method the method
- * @param data the data
+ * @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);
+ 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);
@@ -785,17 +720,17 @@ public final class SAMLEngineUtils {
/**
* Generate subject confirmation data.
*
- * @param notOnOrAfter the not on or after
- * @param recipient the recipient
- * @param inResponseTo the in response to
+ * @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);
+ 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);
@@ -805,13 +740,13 @@ public final class SAMLEngineUtils {
/**
* Generate subject locality.
*
- * @param address the address
+ * @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);
+ final SubjectLocality subjectLocality = (SubjectLocality) SAMLEngineUtils.createSamlObject(SubjectLocality.DEFAULT_ELEMENT_NAME);
subjectLocality.setAddress(address);
return subjectLocality;
}
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 6bdf7b320..7bf5d5ca8 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
@@ -175,10 +175,8 @@ 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.
+ * 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
@@ -186,26 +184,25 @@ import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException;
public final class STORKSAMLEngine extends SAMLEngine {
/** The Constant LOG. */
- private static final Logger LOG = LoggerFactory
- .getLogger(STORKSAMLEngine.class.getName());
+ private static final Logger LOG = LoggerFactory.getLogger(STORKSAMLEngine.class.getName());
+
+ private static final String ATTRIBUTE_EMPTY_LITERAL = "Attribute name is null or empty.";
- private static final String ATTRIBUTE_EMPTY_LITERAL = "Attribute name is null or empty.";
/**
* Gets the single instance of STORKSAMLEngine.
*
- * @param nameInstance the name instance
+ * @param nameInstance
+ * the name instance
*
* @return single instance of STORKSAMLEngine
*/
- public static synchronized STORKSAMLEngine getInstance(
- final String nameInstance) {
+ 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 getting instance: " + nameInstance);
- e.printStackTrace();
+ LOG.error("Error get instance: " + nameInstance);
}
return engine;
}
@@ -213,130 +210,79 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Instantiate a new STORKSAML engine.
*
- * @param nameInstance the name instance
+ * @param nameInstance
+ * the name instance
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private STORKSAMLEngine(final String nameInstance)
- throws STORKSAMLEngineException {
+ 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(),
+ 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(),
+ 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(CitizenCountryCode.DEF_ELEMENT_NAME, new CitizenCountryCodeBuilder(), new CitizenCountryCodeMarshaller(), new CitizenCountryCodeUnmarshaller());
- Configuration.registerObjectProvider(
- SPID.DEF_ELEMENT_NAME,
- new SPIDBuilder(),
- new SPIDMarshaller(),
- new SPIDUnmarshaller());
+ Configuration.registerObjectProvider(SPID.DEF_ELEMENT_NAME, new SPIDBuilder(), new SPIDMarshaller(), new SPIDUnmarshaller());
- Configuration.registerObjectProvider(
- SPInformation.DEF_ELEMENT_NAME,
- new SPInformationBuilder(),
- new SPInformationMarshaller(),
- new SPInformationUnmarshaller());
+ 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);
+ final ValidatorSuite validatorSuite = new ValidatorSuite(QAAAttribute.DEF_LOCAL_NAME);
- validatorSuite.registerValidator(QAAAttribute.DEF_ELEMENT_NAME,
- new QAAAttributeSchemaValidator());
+ validatorSuite.registerValidator(QAAAttribute.DEF_ELEMENT_NAME, new QAAAttributeSchemaValidator());
final Extensions extensions = SAMLEngineUtils.generateExtension();
- validatorSuite.registerValidator(extensions.getElementQName(),
- new ExtensionsSchemaValidator());
+ validatorSuite.registerValidator(extensions.getElementQName(), new ExtensionsSchemaValidator());
- Configuration.registerValidatorSuite(
- "stork:QualityAuthenticationAssuranceLevel", validatorSuite);
+ 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
+ * @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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private Response genAuthnRespBase(final Status status,
- final String assertConsumerURL, final String inResponseTo)
- throws STORKSAMLEngineException {
+ 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);
+ final Response response = SAMLEngineUtils.generateResponse(SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), SAMLEngineUtils.getCurrentTime(), status);
// Set name Spaces
this.setNameSpaces(response);
@@ -358,30 +304,29 @@ public final class STORKSAMLEngine extends SAMLEngine {
response.setInResponseTo(inResponseTo.trim());
// Optional STORK
- response.setConsent(super.getSamlCoreProperties()
- .getConsentAuthnResponse());
+ 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
+ * @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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private Response genAttrQueryRespBase(final Status status,
- final String destinationURL, final String inResponseTo)
- throws STORKSAMLEngineException {
+ 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);
+ final Response response = SAMLEngineUtils.generateResponse(SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(), SAMLEngineUtils.getCurrentTime(), status);
// Set name Spaces
this.setNameSpaces(response);
@@ -403,8 +348,7 @@ public final class STORKSAMLEngine extends SAMLEngine {
response.setInResponseTo(inResponseTo.trim());
// Optional STORK
- response.setConsent(super.getSamlCoreProperties()
- .getConsentAuthnResponse());
+ response.setConsent(super.getSamlCoreProperties().getConsentAuthnResponse());
return response;
}
@@ -412,20 +356,24 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* 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
+ * @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
+ * @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 {
+ 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
@@ -434,64 +382,46 @@ public final class STORKSAMLEngine extends SAMLEngine {
issuerAssertion.setValue(super.getSamlCoreProperties().getResponder());
// Format Entity Optional STORK
- issuerAssertion.setFormat(super.getSamlCoreProperties()
- .getFormatEntity());
+ issuerAssertion.setFormat(super.getSamlCoreProperties().getFormatEntity());
- final Assertion assertion = SAMLEngineUtils.generateAssertion(
- SAMLVersion.VERSION_20, SAMLEngineUtils.generateNCName(),
- SAMLEngineUtils.getCurrentTime(), issuerAssertion);
+ 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 format = super.getSamlCoreProperties().getFormat();
final String nameQualifier = "";
-
LOG.debug("Generate NameID");
- final NameID nameId = SAMLEngineUtils.generateNameID(super
- .getSamlCoreProperties().getResponder(), format, nameQualifier);
+ 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);
+ 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 SubjectConfirmation subjectConf = SAMLEngineUtils.generateSubjectConfirmation(SubjectConfirmation.METHOD_BEARER, dataBearer);
final ArrayList<SubjectConfirmation> listSubjectConf = new ArrayList<SubjectConfirmation>();
listSubjectConf.add(subjectConf);
- for (final Iterator<SubjectConfirmation> iter = listSubjectConf
- .iterator(); iter.hasNext();) {
+ for (final Iterator<SubjectConfirmation> 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");
+ throw new STORKSAMLEngineException("ipAddress is null or empty");
}
- element.getSubjectConfirmationData().setAddress(
- ipAddress.trim());
+ element.getSubjectConfirmationData().setAddress(ipAddress.trim());
}
- element.getSubjectConfirmationData()
- .setRecipient(assertConsumerURL);
+ element.getSubjectConfirmationData().setRecipient(assertConsumerURL);
element.getSubjectConfirmationData().setNotOnOrAfter(notOnOrAfter);
}
@@ -503,248 +433,215 @@ public final class STORKSAMLEngine extends SAMLEngine {
// 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);
+ final Conditions conditions = this.generateConditions(SAMLEngineUtils.getCurrentTime(), notOnOrAfter, issuer);
assertion.setConditions(conditions);
LOG.debug("Generate stork Authentication Statement.");
- final AuthnStatement storkAuthnStat = this
- .generateStorkAuthStatement(ipAddress);
+ 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;
- }
+ 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
+ * @param personalAttrList
+ * the personal attribute list
+ * @param isHashing
+ * the is hashing
*
* @return the attribute statement
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
* @throws IOException
*/
- private AttributeStatement generateAttributeStatement(
- final IPersonalAttributeList personalAttrList,
- final boolean isHashing) throws STORKSAMLEngineException {
+ 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);
+ final AttributeStatement attrStatement = (AttributeStatement) SAMLEngineUtils.createSamlObject(AttributeStatement.DEFAULT_ELEMENT_NAME);
for (PersonalAttribute attribute : personalAttrList) {
- String attributeName = getAttributeName(attribute);
+ 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 simpleEmpty = (simpleNull || (!simpleNull && attribute.getValue().isEmpty()));
final boolean complexNull = (attribute.getComplexValue() == null);
- final boolean complexEmpty = (complexNull || (!complexNull && attribute
- .getComplexValue().isEmpty()));
+ 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.");
+ 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));
+ 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));
+ attrStatement.getAttributes().add(SAMLEngineUtils.generateAttrComplex(attributeName, attribute.getStatus(), attribute.getComplexValue(), isHashing));
} else if (!simpleNull) {
- attrStatement.getAttributes().add(
- this.generateAttrSimple(attributeName, attribute
- .getStatus(), new ArrayList<String>(),
- isHashing));
+ attrStatement.getAttributes().add(this.generateAttrSimple(attributeName, attribute.getStatus(), new ArrayList<String>(), isHashing));
} else {
// Add attribute complex.
- attrStatement.getAttributes().add(
- SAMLEngineUtils.generateAttrComplex(attributeName,
- attribute.getStatus(),
- new HashMap<String, String>(), isHashing));
+ attrStatement.getAttributes().add(SAMLEngineUtils.generateAttrComplex(attributeName, attribute.getStatus(), new HashMap<String, String>(), 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;
- }
+
+ 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".
+ * @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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private Attribute generateAttrSimple(final String name,
- final String status, final List<String> 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;
- }
+ private Attribute generateAttrSimple(final String name, final String status, final List<String> 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.
+ * 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.
+ * @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) {
+ 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);
+ 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 AudienceRestriction restrictions = (AudienceRestriction) SAMLEngineUtils.createSamlObject(AudienceRestriction.DEFAULT_ELEMENT_NAME);
- final Audience audience = (Audience) SAMLEngineUtils
- .createSamlObject(Audience.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);
+ final OneTimeUse oneTimeUse = (OneTimeUse) SAMLEngineUtils.createSamlObject(OneTimeUse.DEFAULT_ELEMENT_NAME);
conditions.getConditions().add(oneTimeUse);
}
return conditions;
@@ -753,14 +650,15 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Generate personal attribute list.
*
- * @param assertion the assertion
+ * @param assertion
+ * the assertion
*
* @return the personal attribute list
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private IPersonalAttributeList generatePersonalAttributeList(
- final Assertion assertion) throws STORKSAMLEngineException {
+ private IPersonalAttributeList generatePersonalAttributeList(final Assertion assertion) throws STORKSAMLEngineException {
LOG.debug("Generate personal attribute list from XMLObject.");
final List<XMLObject> listExtensions = assertion.getOrderedChildren();
@@ -778,8 +676,7 @@ public final class STORKSAMLEngine extends SAMLEngine {
if (!find) {
LOG.error("Error: AttributeStatement it's not present.");
- throw new STORKSAMLEngineException(
- "AttributeStatement it's not present.");
+ throw new STORKSAMLEngineException("AttributeStatement it's not present.");
}
final List<Attribute> reqAttrs = requestedAttr.getAttributes();
@@ -794,88 +691,70 @@ public final class STORKSAMLEngine extends SAMLEngine {
final PersonalAttribute personalAttribute = new PersonalAttribute();
attributeName = attribute.getName();
- personalAttribute.setName(attributeName.substring(attributeName
- .lastIndexOf('/') + 1));
+ personalAttribute.setName(attributeName.substring(attributeName.lastIndexOf('/') + 1));
- personalAttribute.setStatus(attribute.getUnknownAttributes().get(
- new QName(SAMLCore.STORK10_NS.getValue(),
- "AttributeStatus", SAMLCore.STORK10_PREFIX
- .getValue())));
+ personalAttribute.setStatus(attribute.getUnknownAttributes().get(new QName(SAMLCore.STORK10_NS.getValue(), "AttributeStatus", SAMLCore.STORK10_PREFIX.getValue())));
final ArrayList<String> simpleValues = new ArrayList<String>();
final HashMap<String, String> multiValues = new HashMap<String, String>();
final List<XMLObject> values = attribute.getOrderedChildren();
-
-
+
// Process the values.
for (int nextValue = 0; nextValue < values.size(); nextValue++) {
final XMLObject xmlObject = values.get(nextValue);
if (xmlObject instanceof XSStringImpl) {
-
+
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);
+ final XSAnyImpl xmlString = (XSAnyImpl) values.get(nextValue);
- TransformerFactory transFactory = TransformerFactory
- .newInstance();
+ TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = null;
try {
transformer = transFactory.newTransformer();
- transformer.setOutputProperty(
- OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
} catch (TransformerConfigurationException e) {
- LOG.error("Error transformer configuration exception", 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));
- }
+ 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);
+ LOG.error("Error transformer exception", e);
}
String str = buffer.toString();
simpleValues.add(str);
- } else if (isComplex(xmlObject))
- {
+ } else if (isComplex(xmlObject)) {
LOG.info(attributeName + " found");
// Process complex value.
final XSAnyImpl complexValue = (XSAnyImpl) xmlObject;
- for (int nextComplexValue = 0; nextComplexValue < complexValue
- .getUnknownXMLObjects().size(); nextComplexValue++) {
+ for (int nextComplexValue = 0; nextComplexValue < complexValue.getUnknownXMLObjects().size(); nextComplexValue++) {
- final XSAnyImpl simple = (XSAnyImpl) complexValue
- .getUnknownXMLObjects().get(
- nextComplexValue);
+ final XSAnyImpl simple = (XSAnyImpl) complexValue.getUnknownXMLObjects().get(nextComplexValue);
- multiValues.put(simple.getElementQName()
- .getLocalPart(), simple.getTextContent());
+ multiValues.put(simple.getElementQName().getLocalPart(), simple.getTextContent());
}
- }
- else {
+ } else {
// Process simple value.
- simpleValues.add(((XSAnyImpl) xmlObject)
- .getTextContent());
+ simpleValues.add(((XSAnyImpl) xmlObject).getTextContent());
}
} else {
LOG.error("Error: attribute value it's unknown.");
- throw new STORKSAMLEngineException(
- "Attribute value it's unknown.");
+ throw new STORKSAMLEngineException("Attribute value it's unknown.");
}
}
@@ -890,24 +769,21 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Generate stork authentication request.
*
- * @param request the request that contain all parameters for generate an
- * 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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAuthnRequest generateSTORKAuthnRequest(
- final STORKAuthnRequest request) throws STORKSAMLEngineException {
+ 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());
+ final AuthnRequest authnRequestAux = SAMLEngineUtils.generateSAMLAuthnRequest(SAMLEngineUtils.generateNCName(), SAMLVersion.VERSION_20, SAMLEngineUtils.getCurrentTime());
// Set name spaces.
setNameSpaces(authnRequestAux);
@@ -918,14 +794,12 @@ public final class STORKSAMLEngine extends SAMLEngine {
// Add parameter Mandatory STORK
authnRequestAux.setIsPassive(Boolean.FALSE);
- authnRequestAux.setAssertionConsumerServiceURL(request
- .getAssertionConsumerServiceURL());
+ authnRequestAux.setAssertionConsumerServiceURL(request.getAssertionConsumerServiceURL());
authnRequestAux.setProviderName(request.getProviderName());
// Add protocol binding
- authnRequestAux.setProtocolBinding(super.getSamlCoreProperties()
- .getProtocolBinding());
+ authnRequestAux.setProtocolBinding(super.getSamlCoreProperties().getProtocolBinding());
// Add parameter optional STORK
// Destination is mandatory if the destination is a C-PEPS
@@ -935,36 +809,32 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
// Consent is optional. Set from SAMLEngine.xml - consent.
- authnRequestAux.setConsent(super.getSamlCoreProperties()
- .getConsentAuthnRequest());
+ authnRequestAux.setConsent(super.getSamlCoreProperties().getConsentAuthnRequest());
final Issuer issuer = SAMLEngineUtils.generateIssuer();
-
- if(request.getIssuer()!=null){
+
+ if (request.getIssuer() != null) {
issuer.setValue(request.getIssuer());
- } else {
+ } else {
issuer.setValue(super.getSamlCoreProperties().getRequester());
- }
+ }
// Optional STORK
- final String formatEntity = super.getSamlCoreProperties()
- .getFormatEntity();
+ 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);
+ 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());
+ final STORKAuthnRequest authRequest = processExtensions(authnRequestAux.getExtensions());
try {
authRequest.setTokenSaml(super.signAndMarshall(authnRequestAux));
@@ -975,8 +845,7 @@ public final class STORKSAMLEngine extends SAMLEngine {
authRequest.setSamlId(authnRequestAux.getID());
authRequest.setDestination(authnRequestAux.getDestination());
- authRequest.setAssertionConsumerServiceURL(authnRequestAux
- .getAssertionConsumerServiceURL());
+ authRequest.setAssertionConsumerServiceURL(authnRequestAux.getAssertionConsumerServiceURL());
authRequest.setProviderName(authnRequestAux.getProviderName());
authRequest.setIssuer(authnRequestAux.getIssuer().getValue());
@@ -987,19 +856,22 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Generate stork authentication response.
*
- * @param request the request
- * @param responseAuthReq the response authentication request
- * @param ipAddress the IP address
- * @param isHashing the is hashing
+ * @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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAuthnResponse generateSTORKAuthnResponse(
- final STORKAuthnRequest request,
- final STORKAuthnResponse responseAuthReq, final String ipAddress,
- final boolean isHashing) throws STORKSAMLEngineException {
+ public STORKAuthnResponse generateSTORKAuthnResponse(final STORKAuthnRequest request, final STORKAuthnResponse responseAuthReq, final String ipAddress, final boolean isHashing)
+ throws STORKSAMLEngineException {
LOG.info("generateSTORKAuthnResponse");
// Validate parameters
@@ -1007,36 +879,28 @@ public final class STORKSAMLEngine extends SAMLEngine {
// Mandatory SAML
LOG.debug("Generate StatusCode");
- final StatusCode statusCode = SAMLEngineUtils
- .generateStatusCode(StatusCode.SUCCESS_URI);
+ 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);
+ 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());
+ final Response response = genAuthnRespBase(status, request.getAssertionConsumerServiceURL(), request.getSamlId());
DateTime notOnOrAfter = new DateTime();
- notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties()
- .getTimeNotOnOrAfter());
+ notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties().getTimeNotOnOrAfter());
- final Assertion assertion = this.generateAssertion(ipAddress, request
- .getAssertionConsumerServiceURL(), request.getSamlId(), request
- .getIssuer(), notOnOrAfter);
+ final Assertion assertion = this.generateAssertion(ipAddress, request.getAssertionConsumerServiceURL(), request.getSamlId(), request.getIssuer(), notOnOrAfter);
- final AttributeStatement attrStatement = this
- .generateAttributeStatement(responseAuthReq
- .getPersonalAttributeList(), isHashing);
+ final AttributeStatement attrStatement = this.generateAttributeStatement(responseAuthReq.getPersonalAttributeList(), isHashing);
assertion.getAttributeStatements().add(attrStatement);
@@ -1054,23 +918,26 @@ 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
+ * @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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAuthnResponse generateSTORKAuthnResponseAfterQuery(
- final STORKAuthnRequest request,
- final STORKAuthnResponse responseAuthReq, final String ipAddress,
- final boolean isHashing, List<STORKAttrQueryResponse> res) throws STORKSAMLEngineException {
+ public STORKAuthnResponse generateSTORKAuthnResponseAfterQuery(final STORKAuthnRequest request, final STORKAuthnResponse responseAuthReq, final String ipAddress, final boolean isHashing,
+ List<STORKAttrQueryResponse> res) throws STORKSAMLEngineException {
LOG.info("generateSTORKAuthnResponse");
// Validate parameters
@@ -1078,52 +945,40 @@ public final class STORKSAMLEngine extends SAMLEngine {
// Mandatory SAML
LOG.debug("Generate StatusCode");
- final StatusCode statusCode = SAMLEngineUtils
- .generateStatusCode(StatusCode.SUCCESS_URI);
+ 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);
+ 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());
+ final Response response = genAuthnRespBase(status, request.getAssertionConsumerServiceURL(), request.getSamlId());
DateTime notOnOrAfter = new DateTime();
- notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties()
- .getTimeNotOnOrAfter());
+ notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties().getTimeNotOnOrAfter());
- final Assertion assertion = this.generateAssertion(ipAddress, request
- .getAssertionConsumerServiceURL(), request.getSamlId(), request
- .getIssuer(), notOnOrAfter);
+ final Assertion assertion = this.generateAssertion(ipAddress, request.getAssertionConsumerServiceURL(), request.getSamlId(), request.getIssuer(), notOnOrAfter);
- final AttributeStatement attrStatement = this
- .generateAttributeStatement(responseAuthReq
- .getPersonalAttributeList(), isHashing);
+ 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++)
- {
+ 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);
@@ -1151,26 +1006,28 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Generate stork authentication response fail.
*
- * @param request the request
- * @param response the response
- * @param ipAddress the IP address
- * @param isHashing the is hashing
+ * @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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAuthnResponse generateSTORKAuthnResponseFail(
- final STORKAuthnRequest request, final STORKAuthnResponse response,
- final String ipAddress, final boolean isHashing)
- throws STORKSAMLEngineException {
+ 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());
+ final StatusCode statusCode = SAMLEngineUtils.generateStatusCode(response.getStatusCode());
// Mandatory SAML
LOG.debug("Generate StatusCode.");
@@ -1182,8 +1039,7 @@ public final class STORKSAMLEngine extends SAMLEngine {
// - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported
if (StringUtils.isNotBlank(response.getSubStatusCode())) {
- final StatusCode newStatusCode = SAMLEngineUtils
- .generateStatusCode(response.getSubStatusCode());
+ final StatusCode newStatusCode = SAMLEngineUtils.generateStatusCode(response.getSubStatusCode());
statusCode.setStatusCode(newStatusCode);
}
@@ -1191,25 +1047,20 @@ public final class STORKSAMLEngine extends SAMLEngine {
final Status status = SAMLEngineUtils.generateStatus(statusCode);
if (StringUtils.isNotBlank(response.getMessage())) {
- final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils
- .generateStatusMessage(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());
+ final Response responseFail = genAuthnRespBase(status, request.getAssertionConsumerServiceURL(), request.getSamlId());
DateTime notOnOrAfter = new DateTime();
- notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties()
- .getTimeNotOnOrAfter());
+ notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties().getTimeNotOnOrAfter());
- final Assertion assertion = this.generateAssertion(ipAddress, request
- .getAssertionConsumerServiceURL(), request.getSamlId(), request
- .getIssuer(), notOnOrAfter);
+ final Assertion assertion = this.generateAssertion(ipAddress, request.getAssertionConsumerServiceURL(), request.getSamlId(), request.getIssuer(), notOnOrAfter);
responseFail.getAssertions().add(assertion);
@@ -1226,41 +1077,36 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
return storkResponse;
}
-
+
/**
* Generate stork attribute query request.
*
- * @param request the request that contain all parameters for generate an
- * 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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAttrQueryRequest generateSTORKAttrQueryRequest(
- final STORKAttrQueryRequest request) throws STORKSAMLEngineException {
+ public STORKAttrQueryRequest generateSTORKAttrQueryRequest(final STORKAttrQueryRequest request) throws STORKSAMLEngineException {
LOG.info("Generate STORKAttrQueryRequest.");
// Validate Parameters mandatories
validateParamAttrQueryReq(request);
- //final AttributeQuery attrQueryRequestAux = SAMLEngineUtils
- final CustomAttributeQuery attrQueryRequestAux = SAMLEngineUtils
- .generateSAMLAttrQueryRequest(SAMLEngineUtils.generateNCName(),
- SAMLVersion.VERSION_20, SAMLEngineUtils
- .getCurrentTime());
+ final CustomAttributeQuery 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());
}
-
+
// Add parameter optional STORK
// Consumer URL is needed if using HTTP-Post
if (StringUtils.isNotBlank(request.getAssertionConsumerServiceURL())) {
@@ -1268,44 +1114,40 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
// Consent is optional. Set from SAMLEngine.xml - consent.
- attrQueryRequestAux.setConsent(super.getSamlCoreProperties()
- .getConsentAuthnRequest());
+ attrQueryRequestAux.setConsent(super.getSamlCoreProperties().getConsentAuthnRequest());
final Issuer issuer = SAMLEngineUtils.generateIssuer();
-
- //Set the subject - needed for attribute query validation
+
+ // Set the subject - needed for attribute query validation
Subject subject = SAMLEngineUtils.generateSubject();
SubjectConfirmationBuilder builder = new SubjectConfirmationBuilder();
- SubjectConfirmation subjectConfirmation = builder.buildObject();
+ 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){
+
+ if (request.getIssuer() != null) {
issuer.setValue(request.getIssuer());
- } else {
+ } else {
issuer.setValue(super.getSamlCoreProperties().getRequester());
- }
+ }
// Optional STORK
- final String formatEntity = super.getSamlCoreProperties()
- .getFormatEntity();
+ 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);
+ 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());
+ final STORKAttrQueryRequest attrQueryRequest = processAttrExtensions(attrQueryRequestAux.getExtensions());
try {
attrQueryRequest.setTokenSaml(super.signAndMarshall(attrQueryRequestAux));
@@ -1321,22 +1163,25 @@ public final class STORKSAMLEngine extends SAMLEngine {
return attrQueryRequest;
}
-
+
/**
* Generate stork attribute query response.
*
- * @param request the request
- * @param responseAttrQueryRes the response authentication request
- * @param ipAddress the IP address
- * @param isHashing the hashing of values
+ * @param request
+ * the request
+ * @param responseAttrQueryRes
+ * the response authentication request
+ * @param ipAddress
+ * the IP address
+ * @param isHashing
+ * the hashing of values
*
* @return the sTORK authentication response
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAttrQueryResponse generateSTORKAttrQueryResponse(
- final STORKAttrQueryRequest request,
- final STORKAttrQueryResponse responseAttrQueryRes, final String ipAddress,
+ public STORKAttrQueryResponse generateSTORKAttrQueryResponse(final STORKAttrQueryRequest request, final STORKAttrQueryResponse responseAttrQueryRes, final String ipAddress,
final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException {
LOG.info("generateSTORKAttrQueryResponse");
@@ -1345,35 +1190,28 @@ public final class STORKSAMLEngine extends SAMLEngine {
// Mandatory SAML
LOG.debug("Generate StatusCode");
- final StatusCode statusCode = SAMLEngineUtils
- .generateStatusCode(StatusCode.SUCCESS_URI);
+ 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);
+ 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());
+ final Response response = genAuthnRespBase(status, destinationUrl, request.getSamlId());
DateTime notOnOrAfter = new DateTime();
- notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties()
- .getTimeNotOnOrAfter());
+ notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties().getTimeNotOnOrAfter());
- final Assertion assertion = this.generateAssertion(ipAddress, ""
- ,request.getSamlId(), request.getIssuer(), notOnOrAfter);
+ final Assertion assertion = this.generateAssertion(ipAddress, "", request.getSamlId(), request.getIssuer(), notOnOrAfter);
- final AttributeStatement attrStatement = this
- .generateAttributeStatement(responseAttrQueryRes
- .getPersonalAttributeList(), isHashing);
+ final AttributeStatement attrStatement = this.generateAttributeStatement(responseAttrQueryRes.getPersonalAttributeList(), isHashing);
assertion.getAttributeStatements().add(attrStatement);
@@ -1391,24 +1229,28 @@ 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
+ * 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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAttrQueryResponse generateSTORKAttrQueryResponseWithAssertions(
- final STORKAttrQueryRequest request, final STORKAttrQueryResponse responseAttrQueryRes,
- final List<STORKAttrQueryResponse> responses, final String ipAddress,
- final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException {
+ public STORKAttrQueryResponse generateSTORKAttrQueryResponseWithAssertions(final STORKAttrQueryRequest request, final STORKAttrQueryResponse responseAttrQueryRes,
+ final List<STORKAttrQueryResponse> responses, final String ipAddress, final String destinationUrl, final boolean isHashing) throws STORKSAMLEngineException {
LOG.info("generateSTORKAttrQueryResponse");
// Validate parameters
@@ -1416,44 +1258,35 @@ public final class STORKSAMLEngine extends SAMLEngine {
// Mandatory SAML
LOG.debug("Generate StatusCode");
- final StatusCode statusCode = SAMLEngineUtils
- .generateStatusCode(StatusCode.SUCCESS_URI);
+ 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);
+ 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());
+ final Response response = genAuthnRespBase(status, destinationUrl, request.getSamlId());
DateTime notOnOrAfter = new DateTime();
- notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties()
- .getTimeNotOnOrAfter());
+ notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties().getTimeNotOnOrAfter());
- final Assertion assertion = this.generateAssertion(ipAddress, ""
- ,request.getSamlId(), request.getIssuer(), notOnOrAfter);
+ final Assertion assertion = this.generateAssertion(ipAddress, "", request.getSamlId(), request.getIssuer(), notOnOrAfter);
- final AttributeStatement attrStatement = this
- .generateAttributeStatement(responseAttrQueryRes
- .getPersonalAttributeList(), isHashing);
+ 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++)
- {
+ 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);
@@ -1471,30 +1304,32 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
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
+ * @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
+ * @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 {
+ 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());
+ final StatusCode statusCode = SAMLEngineUtils.generateStatusCode(response.getStatusCode());
// Mandatory SAML
LOG.debug("Generate StatusCode.");
@@ -1506,8 +1341,7 @@ public final class STORKSAMLEngine extends SAMLEngine {
// - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported
if (StringUtils.isNotBlank(response.getSubStatusCode())) {
- final StatusCode newStatusCode = SAMLEngineUtils
- .generateStatusCode(response.getSubStatusCode());
+ final StatusCode newStatusCode = SAMLEngineUtils.generateStatusCode(response.getSubStatusCode());
statusCode.setStatusCode(newStatusCode);
}
@@ -1515,25 +1349,20 @@ public final class STORKSAMLEngine extends SAMLEngine {
final Status status = SAMLEngineUtils.generateStatus(statusCode);
if (StringUtils.isNotBlank(response.getMessage())) {
- final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils
- .generateStatusMessage(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());
+ final Response responseFail = genAuthnRespBase(status, destinationUrl, request.getSamlId());
DateTime notOnOrAfter = new DateTime();
- notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties()
- .getTimeNotOnOrAfter());
+ notOnOrAfter = notOnOrAfter.plusSeconds(super.getSamlCoreProperties().getTimeNotOnOrAfter());
- final Assertion assertion = this.generateAssertion(ipAddress, "",
- request.getSamlId(), request
- .getIssuer(), notOnOrAfter);
+ final Assertion assertion = this.generateAssertion(ipAddress, "", request.getSamlId(), request.getIssuer(), notOnOrAfter);
responseFail.getAssertions().add(assertion);
@@ -1550,67 +1379,59 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
return storkResponse;
}
-
+
/**
* Generate stork logout request.
*
- * @param request the request that contain all parameters for generate an
- * 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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKLogoutRequest generateSTORKLogoutRequest(
- final STORKLogoutRequest request) throws STORKSAMLEngineException {
+ 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());
+ 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());
+ logoutRequestAux.setConsent(super.getSamlCoreProperties().getConsentAuthnRequest());
final Issuer issuer = SAMLEngineUtils.generateIssuer();
-
-
- if(request.getIssuer()!=null){
+
+ if (request.getIssuer() != null) {
issuer.setValue(request.getIssuer());
- } else {
+ } else {
issuer.setValue(super.getSamlCoreProperties().getRequester());
- }
+ }
// Optional STORK
- final String formatEntity = super.getSamlCoreProperties()
- .getFormatEntity();
+ 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());
+ 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.
@@ -1630,79 +1451,70 @@ public final class STORKSAMLEngine extends SAMLEngine {
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.
+ *
+ * @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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKLogoutResponse generateSTORKLogoutResponse(
- final STORKLogoutRequest request,
- final STORKLogoutResponse response) throws STORKSAMLEngineException {
+ 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);
+ 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);
+ 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());
+ 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());
+ logoutResponseAux.setConsent(super.getSamlCoreProperties().getConsentAuthnRequest());
final Issuer issuer = SAMLEngineUtils.generateIssuer();
-
-
- if(response.getIssuer()!=null){
+
+ if (response.getIssuer() != null) {
issuer.setValue(response.getIssuer());
- } else {
+ } else {
issuer.setValue(super.getSamlCoreProperties().getRequester());
- }
+ }
// Optional STORK
- final String formatEntity = super.getSamlCoreProperties()
- .getFormatEntity();
+ 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();
@@ -1722,28 +1534,26 @@ public final class STORKSAMLEngine extends SAMLEngine {
return logoutResponse;
}
-
+
/**
* Generate failed stork logout response.
*
- * @param response the response that contain all parameters for generate an
- * logout request.
+ * @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
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKLogoutResponse generateSTORKLogoutResponseFail(
- final STORKLogoutRequest request,
- final STORKLogoutResponse response ) throws STORKSAMLEngineException {
+ 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());
+ final StatusCode statusCode = SAMLEngineUtils.generateStatusCode(response.getStatusCode());
// Mandatory SAML
LOG.debug("Generate StatusCode.");
@@ -1755,8 +1565,7 @@ public final class STORKSAMLEngine extends SAMLEngine {
// - http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported
if (StringUtils.isNotBlank(response.getSubStatusCode())) {
- final StatusCode newStatusCode = SAMLEngineUtils
- .generateStatusCode(response.getSubStatusCode());
+ final StatusCode newStatusCode = SAMLEngineUtils.generateStatusCode(response.getSubStatusCode());
statusCode.setStatusCode(newStatusCode);
}
@@ -1764,51 +1573,43 @@ public final class STORKSAMLEngine extends SAMLEngine {
final Status status = SAMLEngineUtils.generateStatus(statusCode);
if (StringUtils.isNotBlank(response.getStatusMessage())) {
- final StatusMessage statusMessage = (StatusMessage) SAMLEngineUtils
- .generateStatusMessage(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());
+ 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());
+ logoutResponseAux.setConsent(super.getSamlCoreProperties().getConsentAuthnRequest());
final Issuer issuer = SAMLEngineUtils.generateIssuer();
-
-
- if(response.getIssuer()!=null){
+
+ if (response.getIssuer() != null) {
issuer.setValue(response.getIssuer());
- } else {
+ } else {
issuer.setValue(super.getSamlCoreProperties().getRequester());
- }
+ }
// Optional STORK
- final String formatEntity = super.getSamlCoreProperties()
- .getFormatEntity();
+ 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();
@@ -1832,25 +1633,22 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Generate stork authentication statement for the authentication statement.
*
- * @param ipAddress the IP address
+ * @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 SubjectLocality subjectLocality = SAMLEngineUtils.generateSubjectLocality(ipAddress);
- final AuthnContext authnContext = (AuthnContext) SAMLEngineUtils
- .createSamlObject(AuthnContext.DEFAULT_ELEMENT_NAME);
+ final AuthnContext authnContext = (AuthnContext) SAMLEngineUtils.createSamlObject(AuthnContext.DEFAULT_ELEMENT_NAME);
- final AuthnContextDecl authnContextDecl = (AuthnContextDecl) SAMLEngineUtils
- .createSamlObject(AuthnContextDecl.DEFAULT_ELEMENT_NAME);
+ final AuthnContextDecl authnContextDecl = (AuthnContextDecl) SAMLEngineUtils.createSamlObject(AuthnContextDecl.DEFAULT_ELEMENT_NAME);
authnContext.setAuthnContextDecl(authnContextDecl);
- final AuthnStatement authnStatement = SAMLEngineUtils
- .generateAthnStatement(new DateTime(), authnContext);
+ final AuthnStatement authnStatement = SAMLEngineUtils.generateAthnStatement(new DateTime(), authnContext);
// Optional STORK
authnStatement.setSessionIndex(null);
@@ -1862,101 +1660,84 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Generate stork extensions.
*
- * @param request the request
+ * @param request
+ * the request
*
* @return the extensions
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private Extensions generateSTORKExtensions(final STORKAuthnRequest request)
- throws STORKSAMLEngineException {
+ 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());
+ final QAAAttribute qaaAttribute = SAMLEngineUtils.generateQAAAttribute(request.getQaa());
extensions.getUnknownXMLObjects().add(qaaAttribute);
-
- if (StringUtils.isNotEmpty(request
- .getSpSector())) {
+ if (StringUtils.isNotEmpty(request.getSpSector())) {
// Add information about service provider.
LOG.debug("Generate SPSector");
- final SPSector sector = SAMLEngineUtils.generateSPSector(request
- .getSpSector());
+ final SPSector sector = SAMLEngineUtils.generateSPSector(request.getSpSector());
extensions.getUnknownXMLObjects().add(sector);
}
- //Delete from specification. Kept for compatibility with Provider Name value
+ // Delete from specification. Kept for compatibility with Provider Name value
LOG.debug("Generate SPInstitution");
- final SPInstitution institution = SAMLEngineUtils
- .generateSPInstitution(request.getProviderName());
+ 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());
+ 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());
+ final SPCountry country = SAMLEngineUtils.generateSPCountry(request.getSpCountry());
extensions.getUnknownXMLObjects().add(country);
}
- //eIDSectorShare: optional; default value: false.
- String valueSectorShare = super.getSamlCoreProperties()
- .iseIDSectorShare();
+ // 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);
+ 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();
+ String valueCrossSectorShare = super.getSamlCoreProperties().iseIDCrossSectorShare();
if (StringUtils.isNotEmpty(valueCrossSectorShare)) {
LOG.debug("Generate EIDCrossSectorShare");
- final EIDCrossSectorShare eIdCrossSecShare = (EIDCrossSectorShare) SAMLEngineUtils
- .createSamlObject(EIDCrossSectorShare.DEF_ELEMENT_NAME);
+ 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();
+ String valueCrossBorderShare = super.getSamlCoreProperties().iseIDCrossBorderShare();
if (StringUtils.isNotEmpty(valueCrossBorderShare)) {
LOG.debug("Generate EIDCrossBorderShare");
- final EIDCrossBorderShare eIdCrossBordShare = (EIDCrossBorderShare) SAMLEngineUtils
- .createSamlObject(EIDCrossBorderShare.DEF_ELEMENT_NAME);
+ 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);
+ final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils.createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME);
LOG.debug("SAML Engine configuration properties load.");
- final Iterator<PersonalAttribute> iterator = request
- .getPersonalAttributeList().iterator();
+ final Iterator<PersonalAttribute> iterator = request.getPersonalAttributeList().iterator();
while (iterator.hasNext()) {
@@ -1968,14 +1749,11 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
// Verified if exits the attribute name.
- final String attributeName = super.getSamlCoreProperties()
- .getProperty(attribute.getName());
+ 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.");
+ 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.
@@ -1985,18 +1763,13 @@ public final class STORKSAMLEngine extends SAMLEngine {
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());
+ final RequestedAttribute requestedAttr = SAMLEngineUtils.generateReqAuthnAttributeSimple(attributeName, friendlyName, isRequired, attribute.getValue());
// Add requested attribute.
reqAttributes.getAttributes().add(requestedAttr);
@@ -2006,123 +1779,103 @@ public final class STORKSAMLEngine extends SAMLEngine {
extensions.getUnknownXMLObjects().add(reqAttributes);
CitizenCountryCode citizenCountryCode = null;
- if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){
+ if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())) {
LOG.debug("Generate CitizenCountryCode");
- citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils
- .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME);
+ citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils.createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME);
- citizenCountryCode.setCitizenCountryCode(request
- .getCitizenCountryCode().toUpperCase());
- }
+ citizenCountryCode.setCitizenCountryCode(request.getCitizenCountryCode().toUpperCase());
+ }
SPID spid = null;
- if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) {
+ if (request.getSPID() != null && StringUtils.isNotBlank(request.getSPID())) {
LOG.debug("Generate SPID");
- spid = (SPID) SAMLEngineUtils
- .createSamlObject(SPID.DEF_ELEMENT_NAME);
+ spid = (SPID) SAMLEngineUtils.createSamlObject(SPID.DEF_ELEMENT_NAME);
spid.setSPID(request.getSPID().toUpperCase());
- }
+ }
- AuthenticationAttributes authenticationAttr = (AuthenticationAttributes) SAMLEngineUtils
- .createSamlObject(AuthenticationAttributes.DEF_ELEMENT_NAME);
+ AuthenticationAttributes authenticationAttr = (AuthenticationAttributes) SAMLEngineUtils.createSamlObject(AuthenticationAttributes.DEF_ELEMENT_NAME);
- final VIDPAuthenticationAttributes vIDPauthenticationAttr = (VIDPAuthenticationAttributes) SAMLEngineUtils
- .createSamlObject(VIDPAuthenticationAttributes.DEF_ELEMENT_NAME);
+ final VIDPAuthenticationAttributes vIDPauthenticationAttr = (VIDPAuthenticationAttributes) SAMLEngineUtils.createSamlObject(VIDPAuthenticationAttributes.DEF_ELEMENT_NAME);
- final SPInformation spInformation = (SPInformation) SAMLEngineUtils
- .createSamlObject(SPInformation.DEF_ELEMENT_NAME);
+ final SPInformation spInformation = (SPInformation) SAMLEngineUtils.createSamlObject(SPInformation.DEF_ELEMENT_NAME);
- if(citizenCountryCode!=null){
+ if (citizenCountryCode != null) {
vIDPauthenticationAttr.setCitizenCountryCode(citizenCountryCode);
}
- if(spid!=null){
+ if (spid != null) {
spInformation.setSPID(spid);
}
vIDPauthenticationAttr.setSPInformation(spInformation);
- authenticationAttr
- .setVIDPAuthenticationAttributes(vIDPauthenticationAttr);
+ authenticationAttr.setVIDPAuthenticationAttributes(vIDPauthenticationAttr);
extensions.getUnknownXMLObjects().add(authenticationAttr);
-
return extensions;
}
-
+
/**
* Generate stork extensions.
*
- * @param request the attribute query request
+ * @param request
+ * the attribute query request
*
* @return the extensions
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private Extensions generateSTORKAttrExtensions(final STORKAttrQueryRequest request)
- throws STORKSAMLEngineException {
+ 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());
+ final QAAAttribute qaaAttribute = SAMLEngineUtils.generateQAAAttribute(request.getQaa());
extensions.getUnknownXMLObjects().add(qaaAttribute);
-
- if (StringUtils.isNotEmpty(request
- .getSpSector())) {
+ if (StringUtils.isNotEmpty(request.getSpSector())) {
// Add information about service provider.
LOG.debug("Generate SPSector");
- final SPSector sector = SAMLEngineUtils.generateSPSector(request
- .getSpSector());
+ 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());
+ 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());
+ final SPCountry country = SAMLEngineUtils.generateSPCountry(request.getSpCountry());
extensions.getUnknownXMLObjects().add(country);
}
- final EIDSectorShare eIdSectorShare = (EIDSectorShare) SAMLEngineUtils
- .createSamlObject(EIDSectorShare.DEF_ELEMENT_NAME);
+ 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);
+ 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);
+ 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);
+ final RequestedAttributes reqAttributes = (RequestedAttributes) SAMLEngineUtils.createSamlObject(RequestedAttributes.DEF_ELEMENT_NAME);
LOG.debug("SAML Engine configuration properties load.");
- final Iterator<PersonalAttribute> iterator = request
- .getPersonalAttributeList().iterator();
+ final Iterator<PersonalAttribute> iterator = request.getPersonalAttributeList().iterator();
while (iterator.hasNext()) {
@@ -2134,14 +1887,11 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
// Verified if exits the attribute name.
- final String attributeName = super.getSamlCoreProperties()
- .getProperty(attribute.getName());
+ 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.");
+ 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.
@@ -2151,18 +1901,13 @@ public final class STORKSAMLEngine extends SAMLEngine {
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());
+ final RequestedAttribute requestedAttr = SAMLEngineUtils.generateReqAuthnAttributeSimple(attributeName, friendlyName, isRequired, attribute.getValue());
// Add requested attribute.
reqAttributes.getAttributes().add(requestedAttr);
@@ -2172,100 +1917,92 @@ public final class STORKSAMLEngine extends SAMLEngine {
extensions.getUnknownXMLObjects().add(reqAttributes);
CitizenCountryCode citizenCountryCode = null;
- if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())){
+ if (request.getCitizenCountryCode() != null && StringUtils.isNotBlank(request.getCitizenCountryCode())) {
LOG.debug("Generate CitizenCountryCode");
- citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils
- .createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME);
+ citizenCountryCode = (CitizenCountryCode) SAMLEngineUtils.createSamlObject(CitizenCountryCode.DEF_ELEMENT_NAME);
+
+ citizenCountryCode.setCitizenCountryCode(request.getCitizenCountryCode().toUpperCase());
- citizenCountryCode.setCitizenCountryCode(request
- .getCitizenCountryCode().toUpperCase());
- }
+ extensions.getUnknownXMLObjects().add(citizenCountryCode);
+ }
SPID spid = null;
- if(request.getSPID()!=null && StringUtils.isNotBlank(request.getSPID())) {
+ if (request.getSPID() != null && StringUtils.isNotBlank(request.getSPID())) {
LOG.debug("Generate SPID");
- spid = (SPID) SAMLEngineUtils
- .createSamlObject(SPID.DEF_ELEMENT_NAME);
+ spid = (SPID) SAMLEngineUtils.createSamlObject(SPID.DEF_ELEMENT_NAME);
spid.setSPID(request.getSPID().toUpperCase());
- }
+ extensions.getUnknownXMLObjects().add(spid);
+ }
return extensions;
}
-
+
/**
* Gets the alias from X.509 Certificate at keystore.
*
- * @param keyInfo the key info
- * @param storkOwnKeyStore
- * @param storkOwnKeyStore
+ * @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");
+ private String getAlias(final KeyInfo keyInfo, KeyStore storkOwnKeyStore) {
- String alias = null;
- try {
- final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo
- .getX509Datas().get(0).getX509Certificates().get(0);
+ LOG.debug("Recover alias information");
- // Transform the KeyInfo to X509Certificate.
- CertificateFactory certFact;
- certFact = CertificateFactory.getInstance("X.509");
+ String alias = null;
+ try {
+ final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo.getX509Datas().get(0).getX509Certificates().get(0);
- final ByteArrayInputStream bis = new ByteArrayInputStream(Base64
- .decode(xmlCert.getValue()));
+ // Transform the KeyInfo to X509Certificate.
+ CertificateFactory certFact;
+ certFact = CertificateFactory.getInstance("X.509");
- final X509Certificate cert = (X509Certificate) certFact
- .generateCertificate(bis);
+ final ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decode(xmlCert.getValue()));
- final String tokenSerialNumber = cert.getSerialNumber().toString(16);
- final X509Principal tokenIssuerDN = new X509Principal(cert.getIssuerDN().getName());
+ 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;
+ String aliasCert;
+ X509Certificate certificate;
+ boolean find = false;
- for (final Enumeration<String> e = storkOwnKeyStore.aliases(); e
- .hasMoreElements()
- && !find; ) {
- aliasCert = e.nextElement();
- certificate = (X509Certificate) storkOwnKeyStore
- .getCertificate(aliasCert);
+ for (final Enumeration<String> e = storkOwnKeyStore.aliases(); e.hasMoreElements() && !find;) {
+ aliasCert = e.nextElement();
+ certificate = (X509Certificate) storkOwnKeyStore.getCertificate(aliasCert);
- final String serialNum = certificate.getSerialNumber()
- .toString(16);
+ final String serialNum = certificate.getSerialNumber().toString(16);
- X509Principal issuerDN = new X509Principal(certificate
- .getIssuerDN().getName());
+ X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName());
- if(serialNum.equalsIgnoreCase(tokenSerialNumber)
- && X509PrincipalUtil.equals2(issuerDN, tokenIssuerDN)){
- alias = aliasCert;
- find = true;
- }
+ 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;
- }
+ } 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
+ * @param keyInfo
+ * the key info
*
* @return the country
*/
@@ -2274,23 +2011,19 @@ public final class STORKSAMLEngine extends SAMLEngine {
String result = "";
try {
- final org.opensaml.xml.signature.X509Certificate xmlCert = keyInfo
- .getX509Datas().get(0).getX509Certificates().get(0);
+ 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 ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decode(xmlCert.getValue()));
- final X509Certificate cert = (X509Certificate) certFact
- .generateCertificate(bis);
+ final X509Certificate cert = (X509Certificate) certFact.generateCertificate(bis);
String distName = cert.getSubjectDN().toString();
- distName = StringUtils.deleteWhitespace(StringUtils
- .upperCase(distName));
+ distName = StringUtils.deleteWhitespace(StringUtils.upperCase(distName));
final String countryCode = "C=";
final int init = distName.indexOf(countryCode);
@@ -2303,12 +2036,11 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
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 = distName.substring(init + countryCode.length(), end);
+ // It must be a two characters value
+ if (result.length() > 2) {
result = result.substring(0, 2);
- }
+ }
}
}
@@ -2321,112 +2053,97 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Process all elements XMLObjects from the extensions.
*
- * @param extensions the extensions from the authentication request.
+ * @param extensions
+ * the extensions from the authentication request.
*
* @return the STORK authentication request
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private STORKAuthnRequest processExtensions(final Extensions extensions)
- throws STORKSAMLEngineException {
+ 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);
+ 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);
+ List optionalElements = extensions.getUnknownXMLObjects(SPSector.DEF_ELEMENT_NAME);
if (!optionalElements.isEmpty()) {
- final SPSector sector = (SPSector) extensions.getUnknownXMLObjects(
- SPSector.DEF_ELEMENT_NAME).get(0);
+ 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);
+ 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);
+ final SPCountry application = (SPCountry) extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0);
request.setSpCountry(application.getSPCountry());
- }
-
+ }
- List listCrossBorderShare = extensions
- .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME);
+ List listCrossBorderShare = extensions.getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME);
- if (!listCrossBorderShare .isEmpty()) {
+ if (!listCrossBorderShare.isEmpty()) {
final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0);
- request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare
- .getEIDCrossBorderShare()));
+ request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare.getEIDCrossBorderShare()));
}
-
- List listCrosSectorShare = extensions
- .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME);
+ List listCrosSectorShare = extensions.getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME);
if (!listCrosSectorShare.isEmpty()) {
final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0);
- request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare
- .getEIDCrossSectorShare()));
+ request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare.getEIDCrossSectorShare()));
}
- List listSectorShareExtension = extensions
- .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME);
+ 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<XMLObject> authAttrs = extensions
- .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME);
+ List<XMLObject> authAttrs = extensions.getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME);
if (authAttrs != null && !authAttrs.isEmpty()) {
- final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs
- .get(0);
+ final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs.get(0);
VIDPAuthenticationAttributes vidpAuthnAttr = null;
- if (authnAttr != null && !authAttrs.isEmpty()){
+ if (authnAttr != null && !authAttrs.isEmpty()) {
vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes();
}
CitizenCountryCode citizenCountryCodeElement = null;
SPInformation spInformation = null;
- if (vidpAuthnAttr != null){
+ if (vidpAuthnAttr != null) {
citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode();
spInformation = vidpAuthnAttr.getSPInformation();
}
String citizenCountryCode = null;
- if(citizenCountryCodeElement!=null){
+ if (citizenCountryCodeElement != null) {
citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode();
}
- if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){
+ if (citizenCountryCode != null && StringUtils.isNotBlank(citizenCountryCode)) {
request.setCitizenCountryCode(citizenCountryCode);
- }
+ }
SPID spidElement = null;
- if (spInformation != null){
+ if (spInformation != null) {
spidElement = spInformation.getSPID();
}
String spid = null;
- if(spidElement!=null){
+ if (spidElement != null) {
spid = spidElement.getSPID();
}
@@ -2435,16 +2152,12 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
}
- if (extensions
- .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) {
+ 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.");
+ throw new STORKSAMLEngineException("Extensions not contains any requested attribute.");
}
- final RequestedAttributes requestedAttr = (RequestedAttributes) extensions
- .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME)
- .get(0);
+ final RequestedAttributes requestedAttr = (RequestedAttributes) extensions.getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME).get(0);
final List<RequestedAttribute> reqAttrs = requestedAttr.getAttributes();
@@ -2459,8 +2172,7 @@ public final class STORKSAMLEngine extends SAMLEngine {
attributeName = attribute.getName();
// recover the last name from the string.
- personalAttribute.setName(attributeName.substring(attributeName
- .lastIndexOf('/') + 1));
+ personalAttribute.setName(attributeName.substring(attributeName.lastIndexOf('/') + 1));
final ArrayList<String> valores = new ArrayList<String>();
final List<XMLObject> values = attribute.getOrderedChildren();
@@ -2469,52 +2181,46 @@ public final class STORKSAMLEngine extends SAMLEngine {
// 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);
+
+ if (xmlObject instanceof XSStringImpl) {
+
+ final XSStringImpl xmlString = (XSStringImpl) values.get(nextSimpleValue);
valores.add(xmlString.getValue());
-
- }else{
-
+
+ } else {
+
if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) {
-
- final XSAnyImpl xmlString = (XSAnyImpl) values
- .get(nextSimpleValue);
-
+
+ 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);
+ LOG.error("Error transformer configuration exception", e);
}
- StringWriter buffer = new StringWriter();
+ 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));
- }
+ 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);
+ LOG.error("Error transformer exception", e);
}
String str = buffer.toString();
-
- valores.add(str);
-
- }else{
-
- final XSAnyImpl xmlString = (XSAnyImpl) values
- .get(nextSimpleValue);
+
+ valores.add(str);
+
+ } else {
+
+ final XSAnyImpl xmlString = (XSAnyImpl) values.get(nextSimpleValue);
valores.add(xmlString.getTextContent());
}
-
-
-
+
}
}
personalAttribute.setValue(valores);
@@ -2526,116 +2232,100 @@ public final class STORKSAMLEngine extends SAMLEngine {
return request;
}
-
/**
* Process all elements XMLObjects from the extensions.
*
- * @param extensions the extensions from the authentication request.
+ * @param extensions
+ * the extensions from the authentication request.
*
* @return the STORK authentication request
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private STORKAttrQueryRequest processAttrExtensions(final Extensions extensions)
- throws STORKSAMLEngineException {
+ 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);
+ 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);
+ List optionalElements = extensions.getUnknownXMLObjects(SPSector.DEF_ELEMENT_NAME);
if (!optionalElements.isEmpty()) {
- final SPSector sector = (SPSector) extensions.getUnknownXMLObjects(
- SPSector.DEF_ELEMENT_NAME).get(0);
+ 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);
+ 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);
+ final SPCountry application = (SPCountry) extensions.getUnknownXMLObjects(SPCountry.DEF_ELEMENT_NAME).get(0);
request.setSpCountry(application.getSPCountry());
- }
-
+ }
- List listCrossBorderShare = extensions
- .getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME);
+ List listCrossBorderShare = extensions.getUnknownXMLObjects(EIDCrossBorderShare.DEF_ELEMENT_NAME);
- if (!listCrossBorderShare .isEmpty()) {
+ if (!listCrossBorderShare.isEmpty()) {
final EIDCrossBorderShare crossBorderShare = (EIDCrossBorderShare) listCrossBorderShare.get(0);
- request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare
- .getEIDCrossBorderShare()));
+ request.setEIDCrossBorderShare(Boolean.parseBoolean(crossBorderShare.getEIDCrossBorderShare()));
}
-
- List listCrosSectorShare = extensions
- .getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME);
+ List listCrosSectorShare = extensions.getUnknownXMLObjects(EIDCrossSectorShare.DEF_ELEMENT_NAME);
if (!listCrosSectorShare.isEmpty()) {
final EIDCrossSectorShare crossSectorShare = (EIDCrossSectorShare) listCrosSectorShare.get(0);
- request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare
- .getEIDCrossSectorShare()));
+ request.setEIDCrossSectorShare(Boolean.parseBoolean(crossSectorShare.getEIDCrossSectorShare()));
}
- List listSectorShareExtension = extensions
- .getUnknownXMLObjects(EIDSectorShare.DEF_ELEMENT_NAME);
+ 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<XMLObject> authAttrs = extensions
- .getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME);
+ List<XMLObject> authAttrs = extensions.getUnknownXMLObjects(AuthenticationAttributes.DEF_ELEMENT_NAME);
if (authAttrs != null && !authAttrs.isEmpty()) {
- final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs
- .get(0);
+ final AuthenticationAttributes authnAttr = (AuthenticationAttributes) authAttrs.get(0);
VIDPAuthenticationAttributes vidpAuthnAttr = null;
- if (authnAttr != null && !authAttrs.isEmpty()){
+ if (authnAttr != null && !authAttrs.isEmpty()) {
vidpAuthnAttr = authnAttr.getVIDPAuthenticationAttributes();
}
CitizenCountryCode citizenCountryCodeElement = null;
SPInformation spInformation = null;
- if (vidpAuthnAttr != null){
+ if (vidpAuthnAttr != null) {
citizenCountryCodeElement = vidpAuthnAttr.getCitizenCountryCode();
spInformation = vidpAuthnAttr.getSPInformation();
}
String citizenCountryCode = null;
- if(citizenCountryCodeElement!=null){
+ if (citizenCountryCodeElement != null) {
citizenCountryCode = citizenCountryCodeElement.getCitizenCountryCode();
}
- if(citizenCountryCode!= null && StringUtils.isNotBlank(citizenCountryCode)){
+ if (citizenCountryCode != null && StringUtils.isNotBlank(citizenCountryCode)) {
request.setCitizenCountryCode(citizenCountryCode);
- }
+ }
SPID spidElement = null;
- if (spInformation != null){
+ if (spInformation != null) {
spidElement = spInformation.getSPID();
}
String spid = null;
- if(spidElement!=null){
+ if (spidElement != null) {
spid = spidElement.getSPID();
}
@@ -2644,16 +2334,12 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
}
- if (extensions
- .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME) == null) {
+ 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.");
+ throw new STORKSAMLEngineException("Extensions not contains any requested attribute.");
}
- final RequestedAttributes requestedAttr = (RequestedAttributes) extensions
- .getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME)
- .get(0);
+ final RequestedAttributes requestedAttr = (RequestedAttributes) extensions.getUnknownXMLObjects(RequestedAttributes.DEF_ELEMENT_NAME).get(0);
final List<RequestedAttribute> reqAttrs = requestedAttr.getAttributes();
@@ -2668,8 +2354,7 @@ public final class STORKSAMLEngine extends SAMLEngine {
attributeName = attribute.getName();
// recover the last name from the string.
- personalAttribute.setName(attributeName.substring(attributeName
- .lastIndexOf('/') + 1));
+ personalAttribute.setName(attributeName.substring(attributeName.lastIndexOf('/') + 1));
final ArrayList<String> valores = new ArrayList<String>();
final List<XMLObject> values = attribute.getOrderedChildren();
@@ -2678,52 +2363,46 @@ public final class STORKSAMLEngine extends SAMLEngine {
// 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);
+
+ if (xmlObject instanceof XSStringImpl) {
+
+ final XSStringImpl xmlString = (XSStringImpl) values.get(nextSimpleValue);
valores.add(xmlString.getValue());
-
- }else{
-
+
+ } else {
+
if (attributeName.equals("http://www.stork.gov.eu/1.0/signedDoc")) {
-
- final XSAnyImpl xmlString = (XSAnyImpl) values
- .get(nextSimpleValue);
-
+
+ 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);
+ LOG.error("Error transformer configuration exception", e);
}
- StringWriter buffer = new StringWriter();
+ 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));
- }
+ 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);
+ LOG.error("Error transformer exception", e);
}
String str = buffer.toString();
-
- valores.add(str);
-
- }else{
-
- final XSAnyImpl xmlString = (XSAnyImpl) values
- .get(nextSimpleValue);
+
+ valores.add(str);
+
+ } else {
+
+ final XSAnyImpl xmlString = (XSAnyImpl) values.get(nextSimpleValue);
valores.add(xmlString.getTextContent());
}
-
-
-
+
}
}
personalAttribute.setValue(valores);
@@ -2738,25 +2417,22 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Sets the name spaces.
*
- * @param tokenSaml the new 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);
+ 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");
+ 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());
+ 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());
+ final Namespace stork = new Namespace(SAMLCore.STORK10_NS.getValue(), SAMLCore.STORK10_PREFIX.getValue());
tokenSaml.addNamespace(stork);
}
@@ -2764,248 +2440,209 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Validate parameters from authentication request.
*
- * @param request the request.
+ * @param request
+ * the request.
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamAuthnReq(final STORKAuthnRequest request)
- throws STORKSAMLEngineException {
+ 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.");
+ 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.");
+ 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.");
+ 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.");
+ if ((request.getQaa() < QAAAttribute.MIN_VALUE) || (request.getQaa() > QAAAttribute.MAX_VALUE)) {
+ throw new STORKSAMLEngineException("Qaal: " + request.getQaa() + ", is invalid.");
}
}
-
+
/**
* Validate parameters from attribute query request.
*
- * @param request the request.
+ * @param request
+ * the request.
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamAttrQueryReq(final STORKAttrQueryRequest request)
- throws STORKSAMLEngineException {
+ private void validateParamAttrQueryReq(final STORKAttrQueryRequest request) throws STORKSAMLEngineException {
LOG.info("Validate parameters from attribute query request.");
// URL to which AP Response must be sent.
if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) {
- throw new STORKSAMLEngineException(
- "StorkSamlEngine: Assertion Consumer Service URL it's mandatory.");
+ throw new STORKSAMLEngineException("StorkSamlEngine: Assertion Consumer Service URL it's mandatory.");
}
- // Destination of the request - not mandatory
- /*if (StringUtils.isBlank(request.getDestination())) {
- throw new STORKSAMLEngineException(
- "StorkSamlEngine: Destination is mandatory.");
- }*/
-
// SP country is empty
if (StringUtils.isBlank(request.getSpCountry())) {
- throw new STORKSAMLEngineException(
- "StorkSamlEngine: SP country is mandatory.");
+ throw new STORKSAMLEngineException("StorkSamlEngine: SP country is mandatory.");
}
// object that contain all attributes requesting.
- if (request.getPersonalAttributeList() == null
- || request.getPersonalAttributeList().isEmpty()) {
- throw new STORKSAMLEngineException(
- "attributeQueries is null or empty.");
+ 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.");
+ if ((request.getQaa() < QAAAttribute.MIN_VALUE) || (request.getQaa() > QAAAttribute.MAX_VALUE)) {
+ throw new STORKSAMLEngineException("Qaal: " + request.getQaa() + ", is invalid.");
}
}
-
+
/**
* Validate parameters from logout request.
*
- * @param request the request.
+ * @param request
+ * the request.
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamLogoutReq(final STORKLogoutRequest request)
- throws STORKSAMLEngineException {
+ 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.");
+ throw new STORKSAMLEngineException("StorkSamlEngine: Destination is mandatory.");
}
-
+
// SP Provided Id
if (StringUtils.isBlank(request.getSpProvidedId())) {
- throw new STORKSAMLEngineException(
- "StorkSamlEngine: SP provided Id is mandatory.");
+ throw new STORKSAMLEngineException("StorkSamlEngine: SP provided Id is mandatory.");
}
}
-
+
/**
* Validate parameters from logout response.
*
- * @param response the response.
+ * @param response
+ * the response.
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamLogoutRes(final STORKLogoutRequest request,
- final STORKLogoutResponse response) throws STORKSAMLEngineException {
+ 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.");
+ 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.");
+ throw new STORKSAMLEngineException("StorkSamlEngine: Destination is mandatory.");
}
-
+
// SP Provided Id
if (StringUtils.isBlank(request.getSpProvidedId())) {
- throw new STORKSAMLEngineException(
- "StorkSamlEngine: SP provided Id is mandatory.");
+ throw new STORKSAMLEngineException("StorkSamlEngine: SP provided Id is mandatory.");
}
-
+
if (StringUtils.isBlank(request.getSamlId())) {
throw new STORKSAMLEngineException("request ID is null or empty.");
}
}
-
/**
* Validate parameters from response.
*
- * @param request the request
- * @param responseAuthReq the response authentication request
+ * @param request
+ * the request
+ * @param responseAuthReq
+ * the response authentication request
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamResponse(final STORKAuthnRequest request,
- final STORKAuthnResponse responseAuthReq)
- throws STORKSAMLEngineException {
+ 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.");
+ 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 (responseAuthReq.getPersonalAttributeList() == null) {
+ LOG.error("PersonalAttributeList is null.");
+ throw new STORKSAMLEngineException("PersonalAttributeList is null.");
}
if (StringUtils.isBlank(request.getAssertionConsumerServiceURL())) {
- throw new STORKSAMLEngineException(
- "assertionConsumerServiceURL is null or empty.");
+ 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
+ * @param request
+ * the request
+ * @param responseAttrQueryReq
+ * the response authentication request
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamAttrQueryResponse(final STORKAttrQueryRequest request,
- final STORKAttrQueryResponse responseAttrQueryReq)
- throws STORKSAMLEngineException {
+ 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.");
+ throw new STORKSAMLEngineException("Issuer must be not empty or null.");
}
- if (responseAttrQueryReq.getPersonalAttributeList() == null
- || responseAttrQueryReq.getPersonalAttributeList().isEmpty()) {
+ if (responseAttrQueryReq.getPersonalAttributeList() == null || responseAttrQueryReq.getPersonalAttributeList().isEmpty()) {
LOG.error("PersonalAttributeList is null or empty.");
- throw new STORKSAMLEngineException(
- "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
+ * @param request
+ * the request
+ * @param responseAttrQueryReq
+ * the response authentication request
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamAttrQueryResponseFromAssertions(final STORKAttrQueryRequest request,
- final STORKAttrQueryResponse responseAttrQueryReq)
- throws STORKSAMLEngineException {
+ private void validateParamAttrQueryResponseFromAssertions(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.");
+ 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 (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.getAssertionConsumerServiceURL())) { throw new STORKSAMLEngineException( "assertionConsumerServiceURL is null or empty."); }
+ */
if (StringUtils.isBlank(request.getSamlId())) {
throw new STORKSAMLEngineException("request ID is null or empty.");
@@ -3015,38 +2652,41 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Validate parameter from response fail.
*
- * @param request the request
- * @param response the response
+ * @param request
+ * the request
+ * @param response
+ * the response
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamResponseFail(final STORKAuthnRequest request,
- final STORKAuthnResponse response) throws STORKSAMLEngineException {
+ 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.");
+ 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
+ * @param request
+ * the request
+ * @param response
+ * the response
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamAttrQueryResponseFail(final STORKAttrQueryRequest request,
- final STORKAttrQueryResponse response) throws STORKSAMLEngineException {
+ 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.");
@@ -3056,22 +2696,23 @@ 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
+ * @param request
+ * the request
+ * @param response
+ * the response
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private void validateParamLogoutResFail(final STORKLogoutRequest request,
- final STORKLogoutResponse response) throws STORKSAMLEngineException {
+ 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.");
+ throw new STORKSAMLEngineException("Issuer must be not empty or null.");
}
if (StringUtils.isBlank(response.getStatusCode())) {
@@ -3086,14 +2727,15 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Validate stork authentication request.
*
- * @param tokenSaml the token SAML
+ * @param tokenSaml
+ * the token SAML
*
* @return the sTORK authentication request
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAuthnRequest validateSTORKAuthnRequest(final byte[] tokenSaml)
- throws STORKSAMLEngineException {
+ public STORKAuthnRequest validateSTORKAuthnRequest(final byte[] tokenSaml) throws STORKSAMLEngineException {
LOG.info("validateSTORKAuthnRequest");
final AuthnRequest samlRequest = (AuthnRequest) validateStorkSaml(tokenSaml);
@@ -3108,60 +2750,56 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
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()));
-
+ 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.setAssertionConsumerServiceURL(samlRequest.getAssertionConsumerServiceURL());
authnRequest.setProviderName(samlRequest.getProviderName());
authnRequest.setIssuer(samlRequest.getIssuer().getValue());
- //Delete unknown elements from requested ones
+ // Delete unknown elements from requested ones
final Iterator<PersonalAttribute> iterator = authnRequest.getPersonalAttributeList().iterator();
- IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) authnRequest.getPersonalAttributeList();
+ 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());
+ 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 attribute query request.
*
- * @param tokenSaml the token SAML
+ * @param tokenSaml
+ * the token SAML
*
* @return the STORK attribute query request
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAttrQueryRequest validateSTORKAttrQueryRequest(final byte[] tokenSaml)
- throws STORKSAMLEngineException {
+ public STORKAttrQueryRequest validateSTORKAttrQueryRequest(final byte[] tokenSaml) 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.");
@@ -3174,82 +2812,77 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
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()));
-
+ 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());
+ attrRequest.setAssertionConsumerServiceURL(samlRequest.getAssertionConsumerServiceURL());
- /*authnRequest.setProviderName(samlRequest.getProviderName());*/
attrRequest.setIssuer(samlRequest.getIssuer().getValue());
- //Delete unknown elements from requested ones
+ // Delete unknown elements from requested ones
final Iterator<PersonalAttribute> iterator = attrRequest.getPersonalAttributeList().iterator();
- IPersonalAttributeList cleanPerAttrList = (PersonalAttributeList) attrRequest.getPersonalAttributeList();
+ 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());
+ 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 logout request.
*
- * @param tokenSaml the token SAML
+ * @param tokenSaml
+ * the token SAML
*
* @return the STORK logout request
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKLogoutRequest validateSTORKLogoutRequest(final byte[] tokenSaml)
- throws STORKSAMLEngineException {
+ public STORKLogoutRequest validateSTORKLogoutRequest(final byte[] tokenSaml) throws STORKSAMLEngineException {
LOG.info("validateSTORKLogoutRequest");
- final LogoutRequest samlRequest = (LogoutRequest)validateStorkSaml(tokenSaml);
+ final LogoutRequest samlRequest = (LogoutRequest) validateStorkSaml(tokenSaml);
- LOG.debug("Validate Extensions.");
- final Validator<Extensions> validatorExt = new ExtensionsSchemaValidator();
- try {
- validatorExt.validate(samlRequest.getExtensions());
- } catch (ValidationException e) {
- LOG.error("ValidationException: validate Extensions.", e);
- throw new STORKSAMLEngineException(e);
+ if (samlRequest.getExtensions() != null) {
+ LOG.debug("Validate Extensions.");
+ final Validator<Extensions> 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.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());
@@ -3259,18 +2892,56 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
/**
+ * Validate stork logout response.
+ *
+ * @param tokenSaml
+ * The SAML token
+ *
+ * @return the STORK logout response
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ public STORKLogoutResponse validateSTORKLogoutResponse(final byte[] tokenSaml) throws STORKSAMLEngineException {
+
+ LOG.info("validate STORK Logout Response");
+
+ final LogoutResponse samlRes = (LogoutResponse) validateStorkSaml(tokenSaml);
+
+ LOG.debug("Generate STORKLogoutResponse.");
+ final STORKLogoutResponse logoutRes = new STORKLogoutResponse();
+
+ try {
+ logoutRes.setTokenSaml(super.signAndMarshall(samlRes));
+ } catch (SAMLEngineException e) {
+ LOG.error("Sign and Marshall.", e);
+ throw new STORKSAMLEngineException(e);
+ }
+
+ logoutRes.setAlias(this.getAlias(samlRes.getSignature().getKeyInfo(), super.getSigner().getTrustStore()));
+ logoutRes.setSamlId(samlRes.getID());
+ logoutRes.setDestination(samlRes.getDestination());
+ logoutRes.setIssuer(samlRes.getIssuer().getValue());
+ logoutRes.setStatusCode(samlRes.getStatus().getStatusCode().getValue().toString());
+ logoutRes.setStatusMessage(samlRes.getStatus().getStatusMessage().getMessage().toString());
+ logoutRes.setInResponseTo(samlRes.getInResponseTo());
+ return logoutRes;
+ }
+
+ /**
* Validate stork authentication response.
*
- * @param tokenSaml the token SAML
- * @param userIP the user IP
+ * @param tokenSaml
+ * the token SAML
+ * @param userIP
+ * the user IP
*
* @return the Stork authentication response
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAuthnResponse validateSTORKAuthnResponse(
- final byte[] tokenSaml, final String userIP)
- throws STORKSAMLEngineException {
+ public STORKAuthnResponse validateSTORKAuthnResponse(final byte[] tokenSaml, final String userIP) throws STORKSAMLEngineException {
LOG.info("validateSTORKAuthnResponse");
final Response samlResponse = (Response) validateStorkSaml(tokenSaml);
@@ -3278,90 +2949,76 @@ public final class STORKSAMLEngine extends SAMLEngine {
LOG.debug("Create StorkAuthResponse.");
final STORKAuthnResponse authnResponse = new STORKAuthnResponse();
- authnResponse.setCountry(this.getCountry(samlResponse.getSignature()
- .getKeyInfo()));
+ 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());
+ authnResponse.setStatusCode(samlResponse.getStatus().getStatusCode().getValue());
// Subordinate code.
if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) {
- authnResponse.setSubStatusCode(samlResponse.getStatus()
- .getStatusCode().getStatusCode().getValue());
+ authnResponse.setSubStatusCode(samlResponse.getStatus().getStatusCode().getStatusCode().getValue());
}
if (samlResponse.getStatus().getStatusMessage() != null) {
LOG.debug("Set statusMessage.");
- authnResponse.setMessage(samlResponse.getStatus()
- .getStatusMessage().getMessage());
+ authnResponse.setMessage(samlResponse.getStatus().getStatusMessage().getMessage());
}
LOG.debug("validateStorkResponse");
- final Assertion assertion = (Assertion) validateStorkResponse(
- samlResponse, userIP);
-
- if(assertion!=null){
+ 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.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());
+ 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.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())) {
+ if (assertion != null && StatusCode.SUCCESS_URI.equalsIgnoreCase(authnResponse.getStatusCode())) {
LOG.debug("Status Success. Set PersonalAttributeList.");
- authnResponse
- .setPersonalAttributeList(generatePersonalAttributeList(assertion));
+ 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
+ * @param tokenSaml
+ * the token SAML
+ * @param userIP
+ * the user IP
*
* @return the Stork authentication response
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAuthnResponse validateSTORKAuthnResponseWithQuery(
- final byte[] tokenSaml, final String userIP)
- throws STORKSAMLEngineException {
+ public STORKAuthnResponse validateSTORKAuthnResponseWithQuery(final byte[] tokenSaml, final String userIP) throws STORKSAMLEngineException {
LOG.info("validateSTORKAuthnResponse");
final Response samlResponse = (Response) validateStorkSaml(tokenSaml);
@@ -3369,113 +3026,95 @@ public final class STORKSAMLEngine extends SAMLEngine {
LOG.debug("Create StorkAuthResponse.");
final STORKAuthnResponse authnResponse = new STORKAuthnResponse();
- authnResponse.setCountry(this.getCountry(samlResponse.getSignature()
- .getKeyInfo()));
+ 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());
+ authnResponse.setStatusCode(samlResponse.getStatus().getStatusCode().getValue());
// Subordinate code.
if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) {
- authnResponse.setSubStatusCode(samlResponse.getStatus()
- .getStatusCode().getStatusCode().getValue());
+ authnResponse.setSubStatusCode(samlResponse.getStatus().getStatusCode().getStatusCode().getValue());
}
if (samlResponse.getStatus().getStatusMessage() != null) {
LOG.debug("Set statusMessage.");
- authnResponse.setMessage(samlResponse.getStatus()
- .getStatusMessage().getMessage());
+ authnResponse.setMessage(samlResponse.getStatus().getStatusMessage().getMessage());
}
LOG.debug("validateStorkResponse");
- final Assertion assertion = (Assertion) validateStorkResponse(
- samlResponse, userIP);
-
- if(assertion!=null){
+ 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.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());
+ 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.setAudienceRestriction(((AudienceRestriction) assertion.getConditions().getAudienceRestrictions().get(0)).getAudiences().get(0).getAudienceURI());
}
-
+
// Case no error.
- if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(authnResponse
- .getStatusCode())) {
+ if (assertion != null && StatusCode.SUCCESS_URI.equalsIgnoreCase(authnResponse.getStatusCode())) {
LOG.debug("Status Success. Set PersonalAttributeList.");
- authnResponse
- .setPersonalAttributeList(generatePersonalAttributeList(assertion));
+ authnResponse.setPersonalAttributeList(generatePersonalAttributeList(assertion));
authnResponse.setFail(false);
} else {
LOG.debug("Status Fail.");
authnResponse.setFail(true);
}
-
+
authnResponse.setAssertions(samlResponse.getAssertions());
- if (samlResponse.getAssertions().size() > 1)
- {
+ if (samlResponse.getAssertions().size() > 1) {
PersonalAttributeList total = new PersonalAttributeList();
- List<IPersonalAttributeList> attrList = new ArrayList();
- for (int i = 0; i < samlResponse.getAssertions().size(); i++)
- {
- Assertion tempAssertion = (Assertion)samlResponse.getAssertions().get(i);
+ List<IPersonalAttributeList> attrList = new ArrayList<IPersonalAttributeList>();
+ for (int i = 0; i < samlResponse.getAssertions().size(); i++) {
+ Assertion tempAssertion = (Assertion) samlResponse.getAssertions().get(i);
IPersonalAttributeList temp = generatePersonalAttributeList(tempAssertion);
- if (temp != null)
- {
+ if (temp != null) {
attrList.add(temp);
- for (PersonalAttribute attribute : temp) {
- PersonalAttribute attr = (PersonalAttribute)attribute.clone();
- attr.setName(attr.getName()+tempAssertion.getID());
- total.add(attr);
+ for (PersonalAttribute attribute : (IPersonalAttributeList) temp.clone()) {
+ attribute.setName(attribute.getName() + tempAssertion.getID());
+ total.add(attribute);
}
}
}
authnResponse.setPersonalAttributeLists(attrList);
authnResponse.setTotalPersonalAttributeList(total);
}
-
+
LOG.debug("Return result.");
return authnResponse;
}
-
+
/**
* Validate stork attribute query response.
*
- * @param tokenSaml the token SAML
- * @param userIP the user IP
+ * @param tokenSaml
+ * the token SAML
+ * @param userIP
+ * the user IP
*
* @return the Stork attribute query response
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- public STORKAttrQueryResponse validateSTORKAttrQueryResponse(
- final byte[] tokenSaml, final String userIP)
- throws STORKSAMLEngineException {
+ public STORKAttrQueryResponse validateSTORKAttrQueryResponse(final byte[] tokenSaml, final String userIP) throws STORKSAMLEngineException {
LOG.info("validateSTORKAttrQueryResponse");
final Response samlResponse = (Response) validateStorkSaml(tokenSaml);
@@ -3483,90 +3122,71 @@ public final class STORKSAMLEngine extends SAMLEngine {
LOG.debug("Create StorkAttrQueryResponse.");
final STORKAttrQueryResponse attrQueryResponse = new STORKAttrQueryResponse();
- attrQueryResponse.setCountry(this.getCountry(samlResponse.getSignature()
- .getKeyInfo()));
+ 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());
-
+ attrQueryResponse.setStatusCode(samlResponse.getStatus().getStatusCode().getValue());
// Subordinate code.
if (samlResponse.getStatus().getStatusCode().getStatusCode() != null) {
- attrQueryResponse.setSubStatusCode(samlResponse.getStatus()
- .getStatusCode().getStatusCode().getValue());
+ attrQueryResponse.setSubStatusCode(samlResponse.getStatus().getStatusCode().getStatusCode().getValue());
}
if (samlResponse.getStatus().getStatusMessage() != null) {
LOG.debug("Set statusMessage.");
- attrQueryResponse.setMessage(samlResponse.getStatus()
- .getStatusMessage().getMessage());
+ attrQueryResponse.setMessage(samlResponse.getStatus().getStatusMessage().getMessage());
}
LOG.debug("validateStorkResponse");
- final Assertion assertion = (Assertion) validateStorkResponse(
- samlResponse, userIP);
-
- if(assertion!=null){
+ final Assertion assertion = (Assertion) validateStorkResponse(samlResponse, userIP);
+
+ 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()
- + ", server_date: " + serverDate + ")");
- throw new STORKSAMLEngineException(
- "Token date expired (getNotOnOrAfter = "
- + assertion.getConditions().getNotOnOrAfter()
- + " ), server_date: " + 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());
+ 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());
+ attrQueryResponse.setAudienceRestriction(((AudienceRestriction) assertion.getConditions().getAudienceRestrictions().get(0)).getAudiences().get(0).getAudienceURI());
}
-
+
// Case no error.
- if (assertion!=null && StatusCode.SUCCESS_URI.equalsIgnoreCase(attrQueryResponse
- .getStatusCode())) {
+ if (assertion != null && StatusCode.SUCCESS_URI.equalsIgnoreCase(attrQueryResponse.getStatusCode())) {
LOG.debug("Status Success. Set PersonalAttributeList.");
- attrQueryResponse
- .setPersonalAttributeList(generatePersonalAttributeList(assertion));
+ attrQueryResponse.setPersonalAttributeList(generatePersonalAttributeList(assertion));
attrQueryResponse.setFail(false);
} else {
LOG.debug("Status Fail.");
attrQueryResponse.setFail(true);
}
-
+
attrQueryResponse.setAssertions(samlResponse.getAssertions());
- if (samlResponse.getAssertions().size() > 1)
- {
+ if (samlResponse.getAssertions().size() > 1) {
PersonalAttributeList total = new PersonalAttributeList();
List<IPersonalAttributeList> attrList = new ArrayList();
- for (int i = 0; i < samlResponse.getAssertions().size(); i++)
- {
- Assertion tempAssertion = (Assertion)samlResponse.getAssertions().get(i);
+ for (int i = 0; i < samlResponse.getAssertions().size(); i++) {
+ Assertion tempAssertion = (Assertion) samlResponse.getAssertions().get(i);
IPersonalAttributeList temp = generatePersonalAttributeList(tempAssertion);
- if (temp != null)
- {
+ if (temp != null) {
attrList.add(temp);
for (PersonalAttribute attribute : temp) {
- PersonalAttribute attr = (PersonalAttribute)attribute.clone();
- attr.setName(attr.getName()+tempAssertion.getID());
+ PersonalAttribute attr = (PersonalAttribute) attribute.clone();
+ attr.setName(attr.getName() + tempAssertion.getID());
total.add(attr);
}
}
@@ -3574,7 +3194,7 @@ public final class STORKSAMLEngine extends SAMLEngine {
attrQueryResponse.setPersonalAttributeLists(attrList);
attrQueryResponse.setTotalPersonalAttributeList(total);
}
-
+
LOG.debug("Return result.");
return attrQueryResponse;
@@ -3583,61 +3203,50 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Validate stork response.
*
- * @param samlResponse the SAML response
- * @param userIP the user IP
+ * @param samlResponse
+ * the SAML response
+ * @param userIP
+ * the user IP
*
* @return the assertion
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private Assertion validateStorkResponse(final Response samlResponse,
- final String userIP) throws STORKSAMLEngineException {
+ 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.")
+ 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);
+ final Assertion assertion = (Assertion) samlResponse.getAssertions().get(0);
LOG.debug("Verified method Bearer");
- for (final Iterator<SubjectConfirmation> iter = assertion.getSubject()
- .getSubjectConfirmations().iterator(); iter.hasNext();) {
+ for (final Iterator<SubjectConfirmation> iter = assertion.getSubject().getSubjectConfirmations().iterator(); iter.hasNext();) {
final SubjectConfirmation element = iter.next();
- final boolean isBearer = SubjectConfirmation.METHOD_BEARER
- .equals(element.getMethod());
+ final boolean isBearer = SubjectConfirmation.METHOD_BEARER.equals(element.getMethod());
- final boolean ipValidate = super.getSamlCoreProperties()
- .isIpValidation();
+ 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())) {
+ 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.");
+ throw new STORKSAMLEngineException("token_ip attribute is null or empty.");
}
}
- final boolean ipEqual = element.getSubjectConfirmationData()
- .getAddress().equals(userIP);
+ 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 + ")");
+ throw new STORKSAMLEngineException("IPs doesn't match : token_ip (" + element.getSubjectConfirmationData().getAddress() + ") browser_ip (" + userIP + ")");
}
}
@@ -3648,27 +3257,27 @@ public final class STORKSAMLEngine extends SAMLEngine {
/**
* Validate stork SAML.
*
- * @param tokenSaml the token SAML
+ * @param tokenSaml
+ * the token SAML
*
* @return the signable SAML object
*
- * @throws STORKSAMLEngineException the STORKSAML engine exception
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
*/
- private SignableSAMLObject validateStorkSaml(final byte[] tokenSaml)
- throws STORKSAMLEngineException {
+ 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.");
+ throw new STORKSAMLEngineException("Saml authentication request is null.");
}
LOG.debug("Generate AuthnRequest from request.");
SignableSAMLObject samlObject;
- try {
+ try {
samlObject = (SignableSAMLObject) super.unmarshall(tokenSaml);
} catch (SAMLEngineException e) {
LOG.error("SAMLEngineException unmarshall.", e);
@@ -3677,10 +3286,8 @@ public final class STORKSAMLEngine extends SAMLEngine {
boolean validateSign = true;
- if (StringUtils.isNotBlank(super.getSamlCoreProperties().getProperty(
- "validateSignature"))) {
- validateSign = Boolean.valueOf(super.getSamlCoreProperties()
- .getProperty("validateSignature"));
+ if (StringUtils.isNotBlank(super.getSamlCoreProperties().getProperty("validateSignature"))) {
+ validateSign = Boolean.valueOf(super.getSamlCoreProperties().getProperty("validateSignature"));
}
if (validateSign) {
@@ -3694,22 +3301,15 @@ public final class STORKSAMLEngine extends SAMLEngine {
}
LOG.debug("Validate Schema.");
- final ValidatorSuite validatorSuite = Configuration
- .getValidatorSuite("saml2-core-schema-validator");
- try {
- if (samlObject.getElementQName().toString().endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME))
- {
- CustomAttributeQueryValidator val =
- new CustomAttributeQueryValidator();
- val.validate((CustomAttributeQuery)samlObject);
- }
- else if (samlObject instanceof Response
- && ((Response) samlObject).getAssertions().size() > 1) {
- MultipleAssertionResponseValidator val =
- new MultipleAssertionResponseValidator();
- val.validate((Response)samlObject);
- }
- else
+ final ValidatorSuite validatorSuite = Configuration.getValidatorSuite("saml2-core-schema-validator");
+ try {
+ if (samlObject.getElementQName().toString().endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME)) {
+ CustomAttributeQueryValidator val = new CustomAttributeQueryValidator();
+ val.validate((CustomAttributeQuery) samlObject);
+ } else if (samlObject instanceof Response && ((Response) samlObject).getAssertions().size() > 1) {
+ MultipleAssertionResponseValidator val = new MultipleAssertionResponseValidator();
+ val.validate((Response) samlObject);
+ } else
validatorSuite.validate(samlObject);
} catch (ValidationException e) {
LOG.error("ValidationException.", e);
@@ -3718,27 +3318,22 @@ public final class STORKSAMLEngine extends SAMLEngine {
return samlObject;
}
-
- private boolean isComplex(XMLObject xmlObject)
- {
+
+ private boolean isComplex(XMLObject xmlObject) {
boolean isComplex = false;
-
+
final XSAnyImpl complexValue = (XSAnyImpl) xmlObject;
- for (int nextComplexValue = 0; nextComplexValue < complexValue
- .getUnknownXMLObjects().size(); nextComplexValue++) {
+ for (int nextComplexValue = 0; nextComplexValue < complexValue.getUnknownXMLObjects().size(); nextComplexValue++) {
- final XSAnyImpl simple = (XSAnyImpl) complexValue
- .getUnknownXMLObjects().get(
- nextComplexValue);
-
- if (simple.getElementQName().getLocalPart() != null)
- {
+ 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/X509PrincipalUtil.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/X509PrincipalUtil.java
index 724a522d1..73d7e4f62 100644
--- 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
@@ -11,59 +11,53 @@ import org.slf4j.LoggerFactory;
* @author vanegdi
* @version $Revision: 1.00 $, $Date: 2013-05-24 20:53:51 $
*/
-public final class X509PrincipalUtil{
+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);
+ private static final DERObjectIdentifier[] DER_OBJECT_IDENTIFIERS_ARRAY = { X509Principal.CN, X509Principal.OU, X509Principal.O, X509Principal.L, X509Principal.ST, X509Principal.C,
+ X509Principal.E };
- /**
- * 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 final Logger LOG = LoggerFactory.getLogger(eu.stork.peps.auth.engine.X509PrincipalUtil.class);
- private static boolean x509ValuesByIdentifierEquals(X509Principal principal1, X509Principal principal2, DERObjectIdentifier identifier){
- return principal1.getValues(identifier).equals(principal2.getValues(identifier));
- }
+ /**
+ * Compares 2 X509Principals to detect if they equals
+ *
+ * @param principal1
+ * @param principal2
+ * @return true if arguments are not null and equals
+ */
+ public static boolean X509equals(X509Principal principal1, X509Principal principal2) {
+ boolean continueProcess = true;
+ if (principal1 == null || principal2 == null) {
+ return false;
+ }
- private X509PrincipalUtil(){
- // default contructor
- LOG.error("Fake X509PrincipalUtil : never be called");
- }
+ 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/AuthenticationAttributes.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/AuthenticationAttributes.java
index a9efe6362..3821f3c06 100644
--- 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
@@ -21,37 +21,35 @@ 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());
+ /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */
+ String DEF_LOCAL_NAME = "AuthenticationAttributes";
- /** Local name of the XSI type. */
- String TYPE_LOCAL_NAME = "AuthenticationAttributesType";
+ /** Default element name. */
+ QName DEF_ELEMENT_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue());
- /** QName of the XSI type. */
- QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_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();
-
+ /**
+ * 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);
+ /**
+ * 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
index 4af7524ea..95994695d 100644
--- 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
@@ -21,36 +21,35 @@ 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 DEFAULT_ELEMENT_LOCAL_NAME. */
+ String DEF_LOCAL_NAME = "CitizenCountryCode";
- /** The Constant TYPE_LOCAL_NAME. */
- String TYPE_LOCAL_NAME = "CitizenCountryCodeType";
+ /** 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_NAME. */
- QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME,
- SAMLCore.STORK10P_PREFIX.getValue());
+ /** The Constant TYPE_LOCAL_NAME. */
+ String TYPE_LOCAL_NAME = "CitizenCountryCodeType";
- /**
- * Gets the SP country.
- *
- * @return the sP country
- */
- String getCitizenCountryCode();
+ /** 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);
+ /**
+ * 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/CustomAttributeQuery.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/CustomAttributeQuery.java
index b558fc19d..d603c2293 100644
--- 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
@@ -10,42 +10,40 @@ 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<Attribute> 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);
+ 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<Attribute> 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
index 77dd8c4a5..2dd36a4d9 100644
--- 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
@@ -10,167 +10,172 @@ 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);
+ 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/EIDCrossBorderShare.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/EIDCrossBorderShare.java
index 03541ece1..423f0f342 100644
--- 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
@@ -21,38 +21,36 @@ 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);
+ /** 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
index 14c504510..260f91046 100644
--- 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
@@ -21,36 +21,36 @@ 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);
+ /** 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
index 0202f000c..a5748d5f1 100644
--- 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
@@ -21,37 +21,36 @@ 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);
+ /** 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
index d99d23896..22d472be9 100644
--- 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
@@ -26,38 +26,37 @@ import org.opensaml.common.SAMLObject;
*/
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);
+ /** 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
index ffd32b3cf..955f6bef9 100644
--- 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
@@ -29,112 +29,113 @@ import org.opensaml.xml.XMLObject;
*
* @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<XMLObject> getAttributeValues();
+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<XMLObject> 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
index 6e3da28c3..4527bfdb6 100644
--- 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
@@ -28,24 +28,22 @@ import org.opensaml.common.SAMLObject;
*/
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<RequestedAttribute> getAttributes();
+ /** 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<RequestedAttribute> 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
index cbedcf7d9..16b9afd18 100644
--- 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
@@ -22,77 +22,81 @@ package eu.stork.peps.auth.engine.core;
*/
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;
- }
+
+ /** 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 format r_tag. */
+ FORMAT_TAG("format"),
+
+ /** 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
index e846983d8..8474eeedc 100644
--- 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
@@ -30,59 +30,64 @@ import eu.stork.peps.exceptions.SAMLEngineException;
*/
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;
+ /**
+ * 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 certificate.
+ *
+ * @return the certificate
+ */
+ X509Certificate getCertificate();
- /**
- * Gets the trustStore used when validating SAMLTokens
- *
- * @return the trustStore
- *
- */
+ /**
+ * 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;
+ /**
+ * 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;
- /**
- * 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
index 9510bf790..82753b61f 100644
--- 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
@@ -26,31 +26,30 @@ import org.opensaml.common.SAMLObject;
*/
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);
+ /** 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
index 829ace878..e04d817ca 100644
--- 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
@@ -26,31 +26,30 @@ import org.opensaml.common.SAMLObject;
*/
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);
+ /** 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
index bd13f6dbf..8dad4d968 100644
--- 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
@@ -21,36 +21,35 @@ 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 DEFAULT_ELEMENT_LOCAL_NAME. */
+ String DEF_LOCAL_NAME = "SPID";
- /** The Constant TYPE_LOCAL_NAME. */
- String TYPE_LOCAL_NAME = "SPIDType";
+ /** 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_NAME. */
- QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME,
- SAMLCore.STORK10P_PREFIX.getValue());
+ /** The Constant TYPE_LOCAL_NAME. */
+ String TYPE_LOCAL_NAME = "SPIDType";
- /**
- * Gets the SP ID.
- *
- * @return the SP ID
- */
- String getSPID();
+ /** 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);
+ /**
+ * 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
index bc870c2cc..8ad5b6eef 100644
--- 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
@@ -21,36 +21,35 @@ 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 DEFAULT_ELEMENT_LOCAL_NAME. */
+ String DEF_LOCAL_NAME = "SPInformation";
- /** The Constant TYPE_LOCAL_NAME. */
- String TYPE_LOCAL_NAME = "SPInformationType";
+ /** 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_NAME. */
- QName TYPE_NAME = new QName(SAMLCore.STORK10P_NS.getValue(), TYPE_LOCAL_NAME,
- SAMLCore.STORK10P_PREFIX.getValue());
+ /** The Constant TYPE_LOCAL_NAME. */
+ String TYPE_LOCAL_NAME = "SPInformationType";
- /**
- * Gets the SP Id.
- *
- * @return the SP Id
- */
- SPID getSPID();
+ /** 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);
+ /**
+ * 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
index add45023c..8a34a94ff 100644
--- 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
@@ -26,31 +26,30 @@ import org.opensaml.common.SAMLObject;
*/
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);
+ /** 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
index 8322a0d47..4b8af10cf 100644
--- 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
@@ -26,31 +26,30 @@ import org.opensaml.common.SAMLObject;
*/
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);
+ /** 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
index 4c314ae68..2a548ca6f 100644
--- 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
@@ -34,475 +34,495 @@ import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException;
*/
public final class STORKSAMLCore {
- /** The Constant LOGGER. */
- private static final Logger LOGGER = LoggerFactory
- .getLogger(STORKSAMLCore.class.getName());
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory.getLogger(STORKSAMLCore.class.getName());
- /** The consent authentication request. */
- private String consentAuthnReq = null;
+ /** The consent authentication request. */
+ private String consentAuthnReq = null;
- /** The consent authentication response. */
- private String consentAuthnResp = null;
+ /** The consent authentication response. */
+ private String consentAuthnResp = null;
- /** The id cross border share. */
- private String eIDCrossBordShare = null;
+ /** The id cross border share. */
+ private String eIDCrossBordShare = null;
- /** The e id cross sect share. */
- private String eIDCrossSectShare = null;
+ /** The e id cross sect share. */
+ private String eIDCrossSectShare = null;
- /** The e id sector share. */
- private String eIDSectorShare = null;
+ /** The e id sector share. */
+ private String eIDSectorShare = null;
- /** The format entity. */
- private String formatEntity = null;
+ /** The format entity. */
+ private String formatEntity = null;
- /** The friendly name. */
- private boolean friendlyName = false;
+ /** The friendly name. */
+ private boolean friendlyName = false;
- /** The IP validation. */
- private boolean ipValidation = false;
+ /** The IP validation. */
+ private boolean ipValidation = false;
- /** The one time use. */
- private boolean oneTimeUse = true;
+ /** The one time use. */
+ private boolean oneTimeUse = true;
- /** The protocol binding. */
- private String protocolBinding = null;
+ /** The protocol binding. */
+ private String protocolBinding = null;
- /** The requester. */
- private String requester = null;
+ /** The requester. */
+ private String requester = null;
+ /** The responder. */
+ private String responder = null;
- /** The responder. */
- private String responder = null;
+ private String format = null;
- /** The SAML core properties. */
- private Properties samlCoreProp = null;
+ /**
+ * The SAML core properties.
+ */
+ private Properties samlCoreProp = null;
- /** The time not on or after. */
- private Integer timeNotOnOrAfter = null;
+ /** The time not on or after. */
+ private Integer timeNotOnOrAfter = null;
- /** The is required parameter. */
- private boolean isRequired = true;
+ /** The is required parameter. */
+ private boolean isRequired = true;
- private static final String SAML_ENGINE_LITERAL = "SamlEngine.xml: ";
+ private static final String SAML_ENGINE_LITERAL = "SamlEngine.xml: ";
- /**
- * Gets the isRequired.
- *
- * @return the isRequired
- */
- public boolean isRequired() {
- return isRequired;
+ /**
+ * Gets the isRequired.
+ *
+ * @return the isRequired
+ */
+ public boolean isRequired() {
+ return isRequired;
}
- /**
- * Sets the isRequired.
- *
- * @param isRequired the required.
- */
+ /**
+ * 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;
- }
+ * 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;
+ }
+
+ /**
+ * return the format string.
+ *
+ * @return
+ */
+ public String getFormat() {
+ return this.format;
+ }
+
+ /**
+ * 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());
+
+ format = samlCoreProp.getProperty(SAMLCore.FORMAT_TAG.getValue(), "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified");
+
+ } 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 format string
+ *
+ * @param newFormat
+ */
+ public void setFormat(final String newFormat) {
+ this.format = newFormat;
+ }
+
+ /**
+ * 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
index 6ee9e0e1b..c4c1ec845 100644
--- 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
@@ -26,47 +26,46 @@ import org.opensaml.common.SAMLObject;
*/
public interface VIDPAuthenticationAttributes extends SAMLObject {
- /** The Constant DEFAULT_ELEMENT_LOCAL_NAME. */
- String DEF_LOCAL_NAME = "VIDPAuthenticationAttributes";
+ /** 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());
+ /** 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";
+ /** 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());
+ /** 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);
- /**
- * 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/AuthenticationAttributesBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesBuilder.java
index 2d9039d4c..f34adfcb4 100644
--- 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
@@ -24,33 +24,31 @@ import eu.stork.peps.auth.engine.core.AuthenticationAttributes;
*
* @author fjquevedo
*/
-public class AuthenticationAttributesBuilder extends
- AbstractSAMLObjectBuilder<AuthenticationAttributes> {
-
-
-
- /**
- * 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);
- }
+public class AuthenticationAttributesBuilder extends AbstractSAMLObjectBuilder<AuthenticationAttributes> {
+
+ /**
+ * 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
index e0de20f7d..9f602aba1 100644
--- 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
@@ -32,78 +32,74 @@ import org.slf4j.LoggerFactory;
*
* @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<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
-
- children.add(vIDPAuthenAttr);
-
- if (getSignature() != null) {
- children.add(getSignature());
+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<XMLObject> getOrderedChildren() {
+ final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
+
+ 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);
}
- 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/AuthenticationAttributesUnmarshaller.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/AuthenticationAttributesUnmarshaller.java
index 113214712..7e1b6bbe2 100644
--- 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
@@ -28,20 +28,21 @@ import eu.stork.peps.auth.engine.core.AuthenticationAttributes;
*
* @author fjquevedo
*/
-public class AuthenticationAttributesUnmarshaller extends
-AbstractSAMLObjectUnmarshaller {
+public class AuthenticationAttributesUnmarshaller extends AbstractSAMLObjectUnmarshaller {
/**
* Process child element.
*
- * @param parentObject the parent object
- * @param childObject the child object
+ * @param parentObject
+ * the parent object
+ * @param childObject
+ * the child object
*
- * @throws UnmarshallingException the unmarshalling exception
+ * @throws UnmarshallingException
+ * the unmarshalling exception
*
*/
- protected final void processChildElement(final XMLObject parentObject,
- final XMLObject childObject) throws UnmarshallingException {
+ protected final void processChildElement(final XMLObject parentObject, final XMLObject childObject) throws UnmarshallingException {
final AuthenticationAttributes attrStatement = (AuthenticationAttributes) parentObject;
if (childObject instanceof VIDPAuthenticationAttributes) {
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
index 64651691f..49ed66d88 100644
--- 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
@@ -26,25 +26,27 @@ import eu.stork.peps.auth.engine.core.CitizenCountryCode;
*/
public class CitizenCountryCodeBuilder extends AbstractSAMLObjectBuilder<CitizenCountryCode> {
- /**
- * Builds the object.
- *
- * @return the citizen country code
- */
- public final CitizenCountryCode buildObject() {
- return buildObject(CitizenCountryCode.DEF_ELEMENT_NAME);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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
index 374398cf1..aa4c725f1 100644
--- 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
@@ -31,52 +31,50 @@ import org.slf4j.LoggerFactory;
*/
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);
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(CitizenCountryCodeImpl.class.getName());
+ /** The citizen country code. */
+ private String citizenCountryCode;
- /**
- * Gets the citizen country code.
- *
- * @return the citizen country code
- */
- public final String getCitizenCountryCode() {
- return 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);
+ }
- /**
- * 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 citizen country code.
+ *
+ * @return the citizen country code
+ */
+ public final String getCitizenCountryCode() {
+ return citizenCountryCode;
+ }
- /**
- * Gets the ordered children.
- *
- * @return the ordered children
- */
- public final List<XMLObject> getOrderedChildren() {
- return null;
- }
+ /**
+ * 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<XMLObject> 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
index decae04c5..e04323f06 100644
--- 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
@@ -30,16 +30,18 @@ import eu.stork.peps.auth.engine.core.CitizenCountryCode;
*/
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());
- }
+ /**
+ * 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
index 93132b508..eca6d69b9 100644
--- 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
@@ -27,15 +27,16 @@ import eu.stork.peps.auth.engine.core.CitizenCountryCode;
*/
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);
- }
+ /**
+ * 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/CustomAttributeQueryBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryBuilder.java
index 48da2a24b..f2d2fe7fb 100644
--- 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
@@ -6,21 +6,20 @@ import eu.stork.peps.auth.engine.core.CustomAttributeQuery;
public class CustomAttributeQueryBuilder extends AbstractSAMLObjectBuilder<CustomAttributeQuery> {
/**
- * Constructor.
- */
- public CustomAttributeQueryBuilder() {
+ * Constructor.
+ */
+ public CustomAttributeQueryBuilder() {
- }
+ }
- /** {@inheritDoc} */
- public CustomAttributeQuery buildObject() {
- return buildObject(SAMLConstants.SAML20P_NS, CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME,
- SAMLConstants.SAML20P_PREFIX);
- }
+ /** {@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);
- }
+ /** {@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
index cbf9221eb..d88ede1a3 100644
--- 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
@@ -11,44 +11,46 @@ 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<Attribute> attributes;
- private String serviceURL;
+ private final XMLObjectChildrenList<Attribute> 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<Attribute>(this);
- }
+ /**
+ * 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<Attribute>(this);
+ }
- /** {@inheritDoc} */
- public List<Attribute> getAttributes() {
- return attributes;
- }
+ /** {@inheritDoc} */
+ public List<Attribute> getAttributes() {
+ return attributes;
+ }
- /** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- ArrayList<XMLObject> children = new ArrayList<XMLObject>();
+ /** {@inheritDoc} */
+ public List<XMLObject> getOrderedChildren() {
+ ArrayList<XMLObject> children = new ArrayList<XMLObject>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
- }
- children.addAll(attributes);
+ if (super.getOrderedChildren() != null) {
+ children.addAll(super.getOrderedChildren());
+ }
+ children.addAll(attributes);
- if (children.size() == 0) {
- return null;
- }
+ if (children.size() == 0) {
+ return null;
+ }
- return Collections.unmodifiableList(children);
- }
+ return Collections.unmodifiableList(children);
+ }
@Override
public String getAssertionConsumerServiceURL() {
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
index 7f2013ca8..5e0cf55b3 100644
--- 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
@@ -10,41 +10,40 @@ 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());
- }
- }
+ /** {@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
index e351b65b0..485d6656b 100644
--- 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
@@ -24,91 +24,88 @@ 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 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);
- }
- }
+ 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/EIDCrossBorderShareBuilder.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/EIDCrossBorderShareBuilder.java
index 3f4fc633d..7c7a88b89 100644
--- 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
@@ -24,8 +24,7 @@ import eu.stork.peps.auth.engine.core.EIDCrossBorderShare;
*
* @author fjquevedo
*/
-public class EIDCrossBorderShareBuilder extends AbstractSAMLObjectBuilder<EIDCrossBorderShare> {
-
+public class EIDCrossBorderShareBuilder extends AbstractSAMLObjectBuilder<EIDCrossBorderShare> {
/**
* Builds the object.
@@ -36,17 +35,18 @@ public class EIDCrossBorderShareBuilder extends AbstractSAMLObjectBuilder<EIDCro
return buildObject(EIDCrossBorderShare.DEF_ELEMENT_NAME);
}
-
/**
* Builds the object.
*
- * @param namespaceURI the namespace uri
- * @param localName the local name
- * @param namespacePrefix the namespace prefix
+ * @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) {
+ 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
index 3827f5085..13cc3d287 100644
--- 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
@@ -29,59 +29,52 @@ import org.slf4j.LoggerFactory;
*
* @author fjquevedo
*/
-public class EIDCrossBorderShareImpl extends AbstractSAMLObject implements
- EIDCrossBorderShare {
+public class EIDCrossBorderShareImpl extends AbstractSAMLObject implements EIDCrossBorderShare {
- private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossBorderShareImpl.class.getName());
+ private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossBorderShareImpl.class.getName());
/** The citizen country code. */
- private String eIDCrossBorderShare;
+ 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;
- }
+ /**
+ * 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<XMLObject> getOrderedChildren() {
- return null;
- }
+ /**
+ * 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);
+ }
- @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
+ /**
+ * Gets the ordered children.
+ *
+ * @return the ordered children {@inheritDoc}
+ */
+ public final List<XMLObject> getOrderedChildren() {
+ return null;
+ }
+
+}
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
index c5e113013..2e8868ac1 100644
--- 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
@@ -23,7 +23,6 @@ import org.w3c.dom.Element;
import eu.stork.peps.auth.engine.core.EIDCrossBorderShare;
-
/**
* The Class EIDCrossBorderShareMarshaller.
*
@@ -31,16 +30,17 @@ import eu.stork.peps.auth.engine.core.EIDCrossBorderShare;
*/
public class EIDCrossBorderShareMarshaller extends AbstractSAMLObjectMarshaller {
-
/**
* Marshall element content.
*
- * @param samlObject the SAML object
- * @param domElement the DOM element
- * @throws MarshallingException the marshalling exception
+ * @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 {
+ 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
index e74bee6ca..013b5b78b 100644
--- 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
@@ -25,18 +25,17 @@ import eu.stork.peps.auth.engine.core.EIDCrossBorderShare;
*
* @author fjquevedo
*/
-public class EIDCrossBorderShareUnmarshaller extends
- AbstractSAMLObjectUnmarshaller {
-
+public class EIDCrossBorderShareUnmarshaller extends AbstractSAMLObjectUnmarshaller {
/**
* Process element content.
*
- * @param samlObject the SAML object
- * @param elementContent the element content
+ * @param samlObject
+ * the SAML object
+ * @param elementContent
+ * the element content
*/
- protected final void processElementContent(final XMLObject samlObject,
- final String elementContent) {
+ 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
index 5e91e18fd..398815719 100644
--- 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
@@ -24,29 +24,29 @@ import eu.stork.peps.auth.engine.core.EIDCrossSectorShare;
*
* @author fjquevedo
*/
-public class EIDCrossSectorShareBuilder extends
- AbstractSAMLObjectBuilder<EIDCrossSectorShare> {
+public class EIDCrossSectorShareBuilder extends AbstractSAMLObjectBuilder<EIDCrossSectorShare> {
- /**
- * Builds the object.
- *
- * @return the eID cross sector share
- */
- public final EIDCrossSectorShare buildObject() {
- return buildObject(EIDCrossSectorShare.DEF_ELEMENT_NAME);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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
index 7b2ad3dbd..2e3f6ab7e 100644
--- 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
@@ -25,65 +25,57 @@ 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 {
+public class EIDCrossSectorShareImpl extends AbstractSAMLObject implements EIDCrossSectorShare {
- private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossSectorShareImpl.class.getName());
+ private static final Logger LOGGER = LoggerFactory.getLogger(EIDCrossSectorShareImpl.class.getName());
/** The citizen country code. */
- private String eIDCrossSectorShare;
+ 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);
+ }
- /**
- * 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;
- }
+ /**
+ * 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);
+ }
- /**
- * 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<XMLObject> getOrderedChildren() {
- return null;
- }
+ /**
+ * Gets the ordered children.
+ *
+ * @return the ordered children
+ */
+ public final List<XMLObject> 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
index 3ee9df698..caa2df56a 100644
--- 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
@@ -23,7 +23,6 @@ import org.w3c.dom.Element;
import eu.stork.peps.auth.engine.core.EIDCrossSectorShare;
-
/**
* The Class EIDCrossSectorShareMarshaller.
*
@@ -34,12 +33,14 @@ public class EIDCrossSectorShareMarshaller extends AbstractSAMLObjectMarshaller
/**
* Marshall element content.
*
- * @param samlObject the SAML object
- * @param domElement the DOM element
- * @throws MarshallingException the marshalling exception
+ * @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 {
+ 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
index 94c7689be..ebf80e700 100644
--- 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
@@ -28,18 +28,19 @@ import eu.stork.peps.auth.engine.core.EIDCrossSectorShare;
*
* @author fjquevedo
*/
-public class EIDCrossSectorShareUnmarshaller extends
- AbstractSAMLObjectUnmarshaller {
+public class EIDCrossSectorShareUnmarshaller extends AbstractSAMLObjectUnmarshaller {
/**
* Process element content.
*
- * @param samlObject the SAML object
- * @param domElement the DOM element
- * @throws MarshallingException the marshalling exception
+ * @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) {
+ 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
index 230ff3ca4..670b6f33a 100644
--- 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
@@ -24,28 +24,29 @@ import eu.stork.peps.auth.engine.core.EIDSectorShare;
*
* @author fjquevedo
*/
-public class EIDSectorShareBuilder extends
- AbstractSAMLObjectBuilder<EIDSectorShare> {
+public class EIDSectorShareBuilder extends AbstractSAMLObjectBuilder<EIDSectorShare> {
- /**
- * Builds the object.
- *
- * @return the eID sector share
- */
- public final EIDSectorShare buildObject() {
- return buildObject(EIDSectorShare.DEF_ELEMENT_NAME);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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
index 9ed726a32..f7c514722 100644
--- 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
@@ -30,56 +30,58 @@ import org.slf4j.LoggerFactory;
*
* @author fjquevedo
*/
-public class EIDSectorShareImpl extends AbstractSAMLObject implements
- EIDSectorShare {
+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;
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(EIDSectorShareImpl.class.getName());
- /**
- * 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<XMLObject> getOrderedChildren() {
- return null;
- }
+ /** The e id sector share. */
+ private String eIDSectorShare;
- @Override
- public int hashCode() {
- LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here");
- return super.hashCode();
- }
+ /**
+ * 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<XMLObject> 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
index 0ce449cd1..509503af0 100644
--- 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
@@ -34,12 +34,14 @@ public class EIDSectorShareMarshaller extends AbstractSAMLObjectMarshaller {
/**
* Marshall element content.
*
- * @param samlObject the SAML object
- * @param domElement the DOM element
- * @throws MarshallingException the marshalling exception
+ * @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 {
+ 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
index f7f00adb9..8e2f327c6 100644
--- 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
@@ -23,7 +23,6 @@ import org.w3c.dom.Element;
import eu.stork.peps.auth.engine.core.EIDSectorShare;
-
/**
* The Class EIDSectorShareUnmarshaller.
*
@@ -31,16 +30,17 @@ import eu.stork.peps.auth.engine.core.EIDSectorShare;
*/
public class EIDSectorShareUnmarshaller extends AbstractSAMLObjectUnmarshaller {
-
/**
* Process element content.
*
- * @param samlObject the SAML object
- * @param domElement the DOM element
- * @throws MarshallingException the marshalling exception
+ * @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) {
+ 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
index 41676931b..deeb2ae56 100644
--- 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
@@ -24,29 +24,29 @@ import eu.stork.peps.auth.engine.core.QAAAttribute;
*
* @author fjquevedo
*/
-public class QAAAttributeBuilder extends
- AbstractSAMLObjectBuilder<QAAAttribute> {
+public class QAAAttributeBuilder extends AbstractSAMLObjectBuilder<QAAAttribute> {
- /**
- * Builds the object.
- *
- * @return the quality authentication assurance object
- */
- public final QAAAttribute buildObject() {
- return buildObject(QAAAttribute.DEF_ELEMENT_NAME);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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
index 46f3bb402..e74ce1fec 100644
--- 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
@@ -29,56 +29,52 @@ import org.slf4j.LoggerFactory;
*
* @author fjquevedo
*/
-public class QAAAttributeImpl extends AbstractSAMLObject implements
- QAAAttribute {
+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;
+ 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);
- }
+ /**
+ * 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;
- }
+ /**
+ * 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);
- }
+ /**
+ * 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<XMLObject> getOrderedChildren() {
- return null;
- }
+ /**
+ * Gets the ordered children.
+ *
+ * @return the ordered children
+ */
+ public final List<XMLObject> 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
index 000879368..03a7a758a 100644
--- 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
@@ -30,16 +30,18 @@ import eu.stork.peps.auth.engine.core.QAAAttribute;
*/
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());
- }
+ /**
+ * 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
index 8445e4eeb..1b9e813f0 100644
--- 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
@@ -27,15 +27,16 @@ import eu.stork.peps.auth.engine.core.QAAAttribute;
*/
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);
- }
+ /**
+ * 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
index c9881c439..4367c4ecf 100644
--- 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
@@ -24,31 +24,30 @@ import eu.stork.peps.auth.engine.core.RequestedAttribute;
*
* @author fjquevedo
*/
-public class RequestedAttributeBuilder extends
- AbstractSAMLObjectBuilder<RequestedAttribute> {
-
-
- /**
- * 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);
- }
+public class RequestedAttributeBuilder extends AbstractSAMLObjectBuilder<RequestedAttribute> {
+
+ /**
+ * 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
index ac2e8a3ee..2537d3794 100644
--- 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
@@ -35,186 +35,182 @@ import org.slf4j.LoggerFactory;
*
* @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<XMLObject> 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<XMLObject>(this);
- }
-
-
- /**
- * Gets the attribute values.
- *
- * @return the attribute values
- */
- public final List<XMLObject> 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<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
- 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();
- }
+public class RequestedAttributeImpl extends AbstractSAMLObject implements RequestedAttribute {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(RequestedAttributeImpl.class.getName());
+ /**
+ * The attribute values.
+ */
+ private final XMLObjectChildrenList<XMLObject> 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<XMLObject>(this);
+ }
+
+ /**
+ * Gets the attribute values.
+ *
+ * @return the attribute values
+ */
+ public final List<XMLObject> 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<XMLObject> getOrderedChildren() {
+ final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
+ 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;
+ }
+
}
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
index 1a14a118a..4a9ec94b1 100644
--- 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
@@ -36,54 +36,44 @@ import eu.stork.peps.auth.engine.core.RequestedAttribute;
*/
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;
+ /**
+ * 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.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.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.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());
- }
+ if (requestedAttr.getIsRequiredXSBoolean() != null) {
+ domElement.setAttributeNS(null, RequestedAttribute.IS_REQUIRED_ATTR, requestedAttr.getIsRequiredXSBoolean().toString());
+ }
- Attr attr;
- for (Entry<QName, String> 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);
- }
+ Attr attr;
+ for (Entry<QName, String> 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
index c07f852d9..098ece427 100644
--- 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
@@ -33,64 +33,60 @@ import eu.stork.peps.auth.engine.core.SAMLCore;
*
* @author fjquevedo
*/
-public class RequestedAttributeUnmarshaller extends
- AbstractSAMLObjectUnmarshaller {
+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 {
+ /**
+ * 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 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);
+ 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 {
+ /**
+ * 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;
+ 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());
+ 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());
+ } 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
index d421c53d2..c9643d7ae 100644
--- 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
@@ -24,31 +24,30 @@ import eu.stork.peps.auth.engine.core.RequestedAttributes;
*
* @author fjquevedo
*/
-public class RequestedAttributesBuilder extends
- AbstractSAMLObjectBuilder<RequestedAttributes> {
-
-
- /**
- * 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);
- }
+public class RequestedAttributesBuilder extends AbstractSAMLObjectBuilder<RequestedAttributes> {
+
+ /**
+ * 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
index 0a5b37add..ad81e4846 100644
--- 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
@@ -31,65 +31,64 @@ import eu.stork.peps.auth.engine.core.RequestedAttributes;
*
* @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<XMLObject>(this);
- }
-
- /** The indexed children. */
- private final IndexedXMLObjectChildrenList<XMLObject> indexedChildren;
-
- /**
- * Gets the indexed children.
- *
- * @return the indexed children
- */
- public final IndexedXMLObjectChildrenList<XMLObject> getIndexedChildren() {
- return indexedChildren;
- }
-
-
- /**
- * Gets the ordered children.
- *
- * @return the ordered children
- */
- public final List<XMLObject> getOrderedChildren() {
-
- final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
-
- 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<RequestedAttribute> getAttributes() {
- return (List<RequestedAttribute>) indexedChildren
- .subList(RequestedAttribute.DEF_ELEMENT_NAME);
- }
-
- @Override
- public int hashCode() {
- throw new UnsupportedOperationException("hashCode method not implemented");
- }
+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<XMLObject>(this);
+ }
+
+ /** The indexed children. */
+ private final IndexedXMLObjectChildrenList<XMLObject> indexedChildren;
+
+ /**
+ * Gets the indexed children.
+ *
+ * @return the indexed children
+ */
+ public final IndexedXMLObjectChildrenList<XMLObject> getIndexedChildren() {
+ return indexedChildren;
+ }
+
+ /**
+ * Gets the ordered children.
+ *
+ * @return the ordered children
+ */
+ public final List<XMLObject> getOrderedChildren() {
+
+ final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
+
+ 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<RequestedAttribute> getAttributes() {
+ return (List<RequestedAttribute>) 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
index dfc42adf3..e1b15015e 100644
--- 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
@@ -24,10 +24,10 @@ import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
*/
public class RequestedAttributesMarshaller extends AbstractSAMLObjectMarshaller {
- /**
- * Instantiates a new requested attributes marshaller.
- */
- public RequestedAttributesMarshaller() {
- super();
- }
+ /**
+ * 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
index 41b3afa40..69990ebe5 100644
--- 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
@@ -27,26 +27,27 @@ import eu.stork.peps.auth.engine.core.RequestedAttributes;
*
* @author fjquevedo
*/
-public class RequestedAttributesUnmarshaller extends
- AbstractSAMLObjectUnmarshaller {
+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;
+ /**
+ * 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);
+ 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
index a35c77936..6d9f9bf1e 100644
--- 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
@@ -24,28 +24,29 @@ import eu.stork.peps.auth.engine.core.SPApplication;
*
* @author fjquevedo
*/
-public class SPApplicationBuilder extends
- AbstractSAMLObjectBuilder<SPApplication> {
+public class SPApplicationBuilder extends AbstractSAMLObjectBuilder<SPApplication> {
- /**
- * Builds the object.
- *
- * @return the service provider application
- */
- public final SPApplication buildObject() {
- return buildObject(SPApplication.DEF_ELEMENT_NAME);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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
index 0a428a521..7f09d611f 100644
--- 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
@@ -29,56 +29,52 @@ import org.slf4j.LoggerFactory;
*
* @author fjquevedo
*/
-public class SPApplicationImpl extends AbstractSAMLObject implements
- SPApplication {
+public class SPApplicationImpl extends AbstractSAMLObject implements SPApplication {
- private static final Logger LOGGER = LoggerFactory.getLogger(SPApplicationImpl.class.getName());
- /** The service provider application. */
- private String 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);
- }
+ /**
+ * 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;
- }
+ /**
+ * 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);
- }
+ /**
+ * 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<XMLObject> getOrderedChildren() {
- return null;
- }
+ /**
+ * Gets the ordered children.
+ *
+ * @return the ordered children
+ */
+ public final List<XMLObject> 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
index 4866c3535..d9268c550 100644
--- 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
@@ -30,17 +30,18 @@ import eu.stork.peps.auth.engine.core.SPApplication;
*/
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());
- }
+ /**
+ * 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
index a28432a13..9fb514cf0 100644
--- 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
@@ -20,7 +20,6 @@ import org.opensaml.xml.XMLObject;
import eu.stork.peps.auth.engine.core.SPApplication;
-
/**
* The Class SPApplicationUnmarshaller.
*
@@ -28,15 +27,16 @@ import eu.stork.peps.auth.engine.core.SPApplication;
*/
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);
- }
+ /**
+ * 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
index 48ec92f49..2c6c124e3 100644
--- 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
@@ -26,27 +26,27 @@ import eu.stork.peps.auth.engine.core.SPCountry;
*/
public class SPCountryBuilder extends AbstractSAMLObjectBuilder<SPCountry> {
-
- /**
- * Builds the object SPCountry.
- *
- * @return the service provider country
- */
- public final SPCountry buildObject() {
- return buildObject(SPCountry.DEF_ELEMENT_NAME);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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
index 40a1ac86a..ea9085867 100644
--- 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
@@ -31,52 +31,50 @@ import org.slf4j.LoggerFactory;
*/
public class SPCountryImpl extends AbstractSAMLObject implements SPCountry {
- private static final Logger LOGGER = LoggerFactory.getLogger(SPCountryImpl.class.getName());
- /** The service provider country. */
- private String 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);
- }
+ /**
+ * 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;
- }
+ /**
+ * 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);
- }
+ /**
+ * 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<XMLObject> getOrderedChildren() {
- return null;
- }
+ /**
+ * Gets the ordered children.
+ *
+ * @return the ordered children
+ */
+ public final List<XMLObject> 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
index e82634749..1bd7121f0 100644
--- 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
@@ -30,16 +30,18 @@ import eu.stork.peps.auth.engine.core.SPCountry;
*/
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());
- }
+ /**
+ * 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
index deb695ac6..c9ac243f1 100644
--- 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
@@ -20,7 +20,6 @@ import org.opensaml.xml.XMLObject;
import eu.stork.peps.auth.engine.core.SPCountry;
-
/**
* The Class SPCountryUnmarshaller.
*
@@ -28,15 +27,16 @@ import eu.stork.peps.auth.engine.core.SPCountry;
*/
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);
- }
+ /**
+ * 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
index b3640947b..2cee08268 100644
--- 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
@@ -26,25 +26,27 @@ import eu.stork.peps.auth.engine.core.SPID;
*/
public class SPIDBuilder extends AbstractSAMLObjectBuilder<SPID> {
- /**
- * Builds the object.
- *
- * @return the SP ID
- */
- public final SPID buildObject() {
- return buildObject(SPID.DEF_ELEMENT_NAME);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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
index 68611997b..03dea20ed 100644
--- 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
@@ -31,52 +31,50 @@ import org.slf4j.LoggerFactory;
*/
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);
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(SPIDImpl.class.getName());
+ /** The citizen country code. */
+ private String spId;
- /**
- * Gets the SP ID.
- *
- * @return the SP ID
- */
- public final String getSPID() {
- return 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);
+ }
- /**
- * 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 SP ID.
+ *
+ * @return the SP ID
+ */
+ public final String getSPID() {
+ return spId;
+ }
- /**
- * Gets the ordered children.
- *
- * @return the ordered children
- */
- public final List<XMLObject> getOrderedChildren() {
- return null;
- }
+ /**
+ * 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<XMLObject> 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
index 24389522e..d8cac34fc 100644
--- 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
@@ -30,16 +30,18 @@ import eu.stork.peps.auth.engine.core.SPID;
*/
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());
- }
+ /**
+ * 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
index e4d230b94..ab3aef878 100644
--- 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
@@ -27,15 +27,16 @@ import eu.stork.peps.auth.engine.core.SPID;
*/
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);
- }
+ /**
+ * 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
index a6e1fe686..af7c97d19 100644
--- 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
@@ -26,16 +26,15 @@ import eu.stork.peps.auth.engine.core.SPInformation;
* @author iinigo
*/
public final class SPInformationBuilder extends AbstractSAMLObjectBuilder<SPInformation> {
-
- /** {@inheritDoc} */
- public SPInformation buildObject() {
- return buildObject(SAMLCore.STORK10P_NS.getValue(), SPInformation.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue());
- }
+ /** {@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);
+ }
- /** {@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
index ff6e90999..41b3d8998 100644
--- 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
@@ -27,84 +27,78 @@ 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;
-
-
+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<XMLObject> getOrderedChildren() {
+ final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
+
+ children.add(spId);
+
+ if (getSignature() != null) {
+ children.add(getSignature());
+ }
+
+ return Collections.unmodifiableList(children);
+
+ }
+
/**
- * 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<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
-
- children.add(spId);
-
- if (getSignature() != null) {
- children.add(getSignature());
+ * Gets the signature reference id.
+ *
+ * @return the signature reference id
+ *
+ */
+ public String getSignatureReferenceID() {
+ return null;
}
-
- 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();
- }
+
+ /**
+ * Sets the SP Id.
+ *
+ * @param newSPId
+ * the new SP Id
+ *
+ */
+ public void setSPID(SPID newSPId) {
+ this.spId = prepareForAssignment(this.spId, newSPId);
+ }
+
}
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
index 44845948c..027e49e9d 100644
--- 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
@@ -24,10 +24,10 @@ import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
*/
public class SPInformationMarshaller extends AbstractSAMLObjectMarshaller {
- /**
- * Instantiates a new SP Information marshaller.
- */
- public SPInformationMarshaller() {
- super();
- }
+ /**
+ * 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
index 414b93386..ecf69e2c7 100644
--- 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
@@ -27,26 +27,27 @@ import eu.stork.peps.auth.engine.core.SPInformation;
*
* @author iinigo
*/
-public class SPInformationUnmarshaller extends
- AbstractSAMLObjectUnmarshaller {
+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;
+ /**
+ * 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);
- }
- }
+ 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
index fe47cf99c..d26b15a1e 100644
--- 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
@@ -24,28 +24,29 @@ import eu.stork.peps.auth.engine.core.SPInstitution;
*
* @author fjquevedo
*/
-public class SPInstitutionBuilder extends
- AbstractSAMLObjectBuilder<SPInstitution> {
+public class SPInstitutionBuilder extends AbstractSAMLObjectBuilder<SPInstitution> {
- /**
- * Builds the object.
- *
- * @return the service provider institution
- */
- public final SPInstitution buildObject() {
- return buildObject(SPInstitution.DEF_ELEMENT_NAME);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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
index 38438613a..ed0a75f35 100644
--- 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
@@ -29,56 +29,52 @@ import org.slf4j.LoggerFactory;
*
* @author fjquevedo
*/
-public class SPInstitutionImpl extends AbstractSAMLObject implements
- SPInstitution {
+public class SPInstitutionImpl extends AbstractSAMLObject implements SPInstitution {
- private static final Logger LOGGER = LoggerFactory.getLogger(SPInstitutionImpl.class.getName());
- /** The service provider institution. */
- private String 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);
- }
+ /**
+ * 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;
- }
+ /**
+ * 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);
- }
+ /**
+ * 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<XMLObject> getOrderedChildren() {
- return null;
- }
+ /**
+ * Gets the ordered children.
+ *
+ * @return the ordered children
+ */
+ public final List<XMLObject> 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
index 504a1f035..48bb3fec5 100644
--- 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
@@ -30,17 +30,18 @@ import eu.stork.peps.auth.engine.core.SPInstitution;
*/
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());
- }
+ /**
+ * 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
index 103d5f2b2..f7b1f440e 100644
--- 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
@@ -27,15 +27,16 @@ import eu.stork.peps.auth.engine.core.SPInstitution;
*/
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);
- }
+ /**
+ * 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
index a691b9008..b97e91b36 100644
--- 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
@@ -26,25 +26,27 @@ import eu.stork.peps.auth.engine.core.SPSector;
*/
public class SPSectorBuilder extends AbstractSAMLObjectBuilder<SPSector> {
- /**
- * Builds the object SPSector.
- *
- * @return the service provider sector.
- */
- public final SPSector buildObject() {
- return buildObject(SPSector.DEF_ELEMENT_NAME);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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
index 4ac822876..670198e67 100644
--- 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
@@ -22,7 +22,6 @@ import org.opensaml.xml.XMLObject;
import eu.stork.peps.auth.engine.core.SPSector;
-
/**
* The Class SPSectorImpl.
*
@@ -30,55 +29,55 @@ import eu.stork.peps.auth.engine.core.SPSector;
*/
public class SPSectorImpl extends AbstractSAMLObject implements SPSector {
- /** The service provider sector. */
- private String 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);
- }
+ /**
+ * 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;
- }
+ /**
+ * 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);
- }
+ /**
+ * 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<XMLObject> getOrderedChildren() {
- return null;
- }
+ /**
+ * Gets the ordered children.
+ *
+ * @return the ordered children
+ */
+ public final List<XMLObject> getOrderedChildren() {
+ return null;
+ }
- @Override
- public int hashCode() {
- throw new UnsupportedOperationException("hashCode method not implemented");
- }
+ @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
index c5331e8f4..59e349f9f 100644
--- 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
@@ -30,16 +30,18 @@ import eu.stork.peps.auth.engine.core.SPSector;
*/
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());
- }
+ /**
+ * 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
index cbb05c6e5..e671cee03 100644
--- 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
@@ -27,16 +27,16 @@ import eu.stork.peps.auth.engine.core.SPSector;
*/
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);
- }
+ /**
+ * 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
index 80796ea86..1cd5fb761 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
@@ -64,8 +64,6 @@ 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;
@@ -74,395 +72,324 @@ import eu.stork.peps.exceptions.SAMLEngineException;
* The Class HWSign. Module of sign.
*
* @author fjquevedo
+ * @author advania
*/
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);
+ /** 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;
+ /**
+ * The soft trust key store.
+ */
+ private SignSW swTrustStore = 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;
}
- }
-
-
- /**
- * @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<String> 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;
+
+ /** 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);
+ /**
+ * Init the soft keystore to validate with. trustStoreConfig is read from the SignModule config file and should refer to the keystore containing trusted certificates.
+ */
+ swTrustStore = new SignSW();
+ swTrustStore.init(properties.getProperty("trustStoreConfig"));
+ swTrustStore.loadCryptServiceProvider();
+ }
+ }
+
+ /**
+ * @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<String> 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.X509equals(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);
+ */
+ signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256);
+
+ 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);
+
+ // 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.");
+ 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<Assertion> 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");
+ 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);
}
-
- }
-
- 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);*/
- signature.setSignatureAlgorithm(
- SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256);
-
-
-
- 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);
-
- //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.");
- 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<Assertion> 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");
- 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;
}
- 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<Credential> trustedCred = new ArrayList<Credential>();
-
- for (final Enumeration<String> 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<X509Certificate> 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);
+ /**
+ * @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 HW.");
+ /*
+ * we are using the soft signature class to validate the signatures. This way we use the same key store code and validation that is used there.
+ */
+ try {
+ swTrustStore.validateSignature(tokenSaml);
+ } catch (Exception e) {
+ LOG.error("SW ValidationException.", e);
+ throw new SAMLEngineException(e);
+ }
+ return tokenSaml;
}
- 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);
+
+ /**
+ * 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));
+ 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), pkcs11Provider);
+
+ } 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
index c37074eab..66d0201d5 100644
--- 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
@@ -30,35 +30,35 @@ import eu.stork.peps.exceptions.STORKSAMLEngineException;
public final class SignModuleFactory {
- /** The Constant LOG. */
- private static final Logger LOG = LoggerFactory
- .getLogger(SignModuleFactory.class.getName());
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory.getLogger(SignModuleFactory.class.getName());
- /**
- * Instantiates a new module sign factory.
- */
- private SignModuleFactory() {
+ /**
+ * 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);
}
- }
+ /**
+ * 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
index 06e80dc14..d5f01a4cc 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
@@ -41,6 +41,7 @@ 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;
@@ -74,26 +75,21 @@ 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.
+ * 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());
-
+ 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.
*
@@ -107,7 +103,8 @@ public final class SignP12 implements SAMLEngineSignI {
/**
* Sets the trust store.
*
- * @param newTrustStore the new trust store
+ * @param newTrustStore
+ * the new trust store
*/
public void setTrustStore(final KeyStore newTrustStore) {
this.trustStore = newTrustStore;
@@ -123,8 +120,6 @@ public final class SignP12 implements SAMLEngineSignI {
return properties;
}
-
-
/**
* Gets the p12 store.
*
@@ -134,23 +129,21 @@ public final class SignP12 implements SAMLEngineSignI {
return p12Store;
}
-
-
/**
* Sets the p12 store.
*
- * @param newP12Store the new 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
+ * @param newProperties
+ * the new properties
*/
public void setProperties(final Properties newProperties) {
this.properties = newProperties;
@@ -159,13 +152,14 @@ public final class SignP12 implements SAMLEngineSignI {
/** The SW sign prop. */
private Properties properties = null;
-
/**
* Initialize the file configuration.
*
- * @param fileConf name of the file configuration
+ * @param fileConf
+ * name of the file configuration
*
- * @throws SAMLEngineException error at the load from file configuration
+ * @throws SAMLEngineException
+ * error at the load from file configuration
*/
@Override
public void init(final String fileConf) throws SAMLEngineException {
@@ -173,25 +167,25 @@ public final class SignP12 implements SAMLEngineSignI {
properties = new Properties();
try {
try {
- LOG.debug("Fichero a cargar " + fileConf);
+ LOG.debug("Loading " + fileConf);
fileProperties = new FileInputStream(fileConf);
properties.loadFromXML(fileProperties);
} catch (Exception e) {
- LOG.error("Fallo al cargar el recurso externo. Se reintenta como fichero interno.");
+ LOG.error("Failed to load external resource. Retrieving internal file.");
fileProperties = SignP12.class.getResourceAsStream("/" + fileConf);
if (fileProperties == null) {
fileProperties = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileConf);
if (fileProperties == null) {
Enumeration<URL> files = ClassLoader.getSystemClassLoader().getResources(fileConf);
if (files != null && files.hasMoreElements()) {
- LOG.info("Se han encontrado recurso/s. Se toma el primero.");
+ LOG.info("Found /s.");
fileProperties = ClassLoader.getSystemClassLoader().getResourceAsStream(files.nextElement().getFile());
} else {
- throw new IOException("No se pudo recuperar el fichero: " + fileConf, e);
+ throw new IOException("Could not load file: " + fileConf, e);
}
}
}
- LOG.debug("Recuperados " + fileProperties.available() + " bytes");
+ LOG.debug("Recovered " + fileProperties.available() + " bytes");
properties.loadFromXML(fileProperties);
}
} catch (InvalidPropertiesFormatException e) {
@@ -209,7 +203,7 @@ public final class SignP12 implements SAMLEngineSignI {
* Gets the certificate.
*
* @return the X509Certificate
- *
+ *
*/
@Override
public X509Certificate getCertificate() {
@@ -219,16 +213,17 @@ public final class SignP12 implements SAMLEngineSignI {
/**
* Sign the token SAML.
*
- * @param tokenSaml token SAML
+ * @param tokenSaml
+ * token SAML
*
* @return the X509Certificate signed.
*
- * @throws SAMLEngineException error at sign SAML token
+ * @throws SAMLEngineException
+ * error at sign SAML token
*
*/
@Override
- public SAMLObject sign(final SignableSAMLObject tokenSaml)
- throws SAMLEngineException {
+ public SAMLObject sign(final SignableSAMLObject tokenSaml) throws SAMLEngineException {
LOG.info("Start Sign process");
try {
@@ -240,30 +235,24 @@ public final class SignP12 implements SAMLEngineSignI {
X509Certificate certificate;
boolean find = false;
- for (final Enumeration<String> e = p12Store.aliases(); e
- .hasMoreElements() && !find;) {
+ for (final Enumeration<String> e = p12Store.aliases(); e.hasMoreElements() && !find;) {
aliasCert = e.nextElement();
- certificate = (X509Certificate) p12Store
- .getCertificate(aliasCert);
+ certificate = (X509Certificate) p12Store.getCertificate(aliasCert);
- final String serialNum = certificate.getSerialNumber()
- .toString(16);
+ 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)){
+ if (serialNum.equalsIgnoreCase(serialNumber) && X509PrincipalUtil.X509equals(issuerDN, issuerDNConf)) {
alias = aliasCert;
find = true;
}
}
- certificate = (X509Certificate) p12Store
- .getCertificate(alias);
- final PrivateKey privateKey = (PrivateKey) p12Store.getKey(
- alias, properties.getProperty("keyPassword").toCharArray());
+ 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();
@@ -275,102 +264,73 @@ public final class SignP12 implements SAMLEngineSignI {
credential.setPrivateKey(privateKey);
LOG.debug("Begin signature with openSaml");
- final Signature signature = (Signature) org.opensaml.xml.Configuration
- .getBuilderFactory().getBuilder(
- Signature.DEFAULT_ELEMENT_NAME).buildObject(
- Signature.DEFAULT_ELEMENT_NAME);
+ final Signature signature = (Signature) org.opensaml.xml.Configuration.getBuilderFactory().getBuilder(Signature.DEFAULT_ELEMENT_NAME).buildObject(Signature.DEFAULT_ELEMENT_NAME);
signature.setSigningCredential(credential);
- /*signature.setSignatureAlgorithm(
- SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);*/
- signature.setSignatureAlgorithm(
- SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256);
-
- final SecurityConfiguration secConfiguration = org.opensaml.xml.Configuration
- .getGlobalSecurityConfiguration();
- final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration
- .getKeyInfoGeneratorManager();
- final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager
- .getDefaultManager();
- final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager
- .getFactory(credential);
- final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac
- .newInstance();
+ /*
+ * signature.setSignatureAlgorithm( SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);
+ */
+ signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256);
+
+ final SecurityConfiguration secConfiguration = org.opensaml.xml.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);
-
- //Create a second signature which will be used when signing assertion and response
- final Signature signature2 = (Signature) org.opensaml.xml.Configuration
- .getBuilderFactory().getBuilder(
- Signature.DEFAULT_ELEMENT_NAME).buildObject(
- Signature.DEFAULT_ELEMENT_NAME);
- final SecurityConfiguration secConfiguration2 = org.opensaml.xml.Configuration
- .getGlobalSecurityConfiguration();
- final NamedKeyInfoGeneratorManager keyInfoManager2 = secConfiguration2
- .getKeyInfoGeneratorManager();
- final KeyInfoGeneratorManager keyInfoGenManager2 = keyInfoManager2
- .getDefaultManager();
- final KeyInfoGeneratorFactory keyInfoGenFac2 = keyInfoGenManager2
- .getFactory(credential);
- final KeyInfoGenerator keyInfoGenerator2 = keyInfoGenFac2
- .newInstance();
+ signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
+
+ // Create a second signature which will be used when signing assertion and response
+ final Signature signature2 = (Signature) org.opensaml.xml.Configuration.getBuilderFactory().getBuilder(Signature.DEFAULT_ELEMENT_NAME).buildObject(Signature.DEFAULT_ELEMENT_NAME);
+ final SecurityConfiguration secConfiguration2 = org.opensaml.xml.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.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256);
signature2.setKeyInfo(keyInfo2);
- signature2.setCanonicalizationAlgorithm(
- SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
-
+ signature2.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
LOG.info("Marshall samlToken.");
String qn = tokenSaml.getElementQName().toString();
- if (qn.endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME))
- {
+ 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;
+ } else if (qn.endsWith(Response.DEFAULT_ELEMENT_LOCAL_NAME) && !qn.contains(LogoutResponse.DEFAULT_ELEMENT_LOCAL_NAME)) {
+ Response res = (Response) tokenSaml;
List<Assertion> asserts = res.getAssertions();
- //If multiple assertions we just sign the response and not the assertion
- if (asserts.size() > 1)
- {
+ // If multiple assertions we just sign the response and not the assertion
+ if (asserts.size() > 1) {
tokenSaml.setSignature(signature);
- org.opensaml.xml.Configuration.getMarshallerFactory().getMarshaller(tokenSaml)
- .marshall(tokenSaml);
+ org.opensaml.xml.Configuration.getMarshallerFactory().getMarshaller(tokenSaml).marshall(tokenSaml);
LOG.info("Sign samlToken.");
Signer.signObject(signature);
}
- //If single assertion we sign the assertion and response
- else
- {
+ // If single assertion we sign the assertion and response
+ else {
Assertion assertion = asserts.get(0);
- assertion.setSignature(signature);
+ assertion.setSignature(signature);
tokenSaml.setSignature(signature2);
- org.opensaml.xml.Configuration.getMarshallerFactory().getMarshaller(tokenSaml)
- .marshall(tokenSaml);
+ org.opensaml.xml.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
- {
+ // Normally we just sign the total saml response
+ else {
tokenSaml.setSignature(signature);
- org.opensaml.xml.Configuration.getMarshallerFactory().getMarshaller(tokenSaml)
- .marshall(tokenSaml);
+ org.opensaml.xml.Configuration.getMarshallerFactory().getMarshaller(tokenSaml).marshall(tokenSaml);
LOG.info("Sign samlToken.");
Signer.signObject(signature);
}
@@ -401,22 +361,22 @@ public final class SignP12 implements SAMLEngineSignI {
/**
* Validate signature.
*
- * @param tokenSaml token SAML
+ * @param tokenSaml
+ * token SAML
*
* @return the SAMLObject validated.
*
- * @throws SAMLEngineException error validate signature
+ * @throws SAMLEngineException
+ * error validate signature
*
*/
@Override
- public SAMLObject validateSignature(final SignableSAMLObject tokenSaml)
- throws SAMLEngineException {
+ public SAMLObject validateSignature(final SignableSAMLObject tokenSaml) throws SAMLEngineException {
LOG.info("Start signature validation.");
try {
// Validate structure signature
- final SAMLSignatureProfileValidator sigProfValidator =
- new SAMLSignatureProfileValidator();
+ final SAMLSignatureProfileValidator sigProfValidator = new SAMLSignatureProfileValidator();
try {
// Indicates signature id conform to SAML Signature profile
sigProfValidator.validate(tokenSaml.getSignature());
@@ -430,64 +390,43 @@ public final class SignP12 implements SAMLEngineSignI {
final List<Credential> trustCred = new ArrayList<Credential>();
- for (final Enumeration<String> e = trustStore.aliases(); e
- .hasMoreElements();)
- {
+ for (final Enumeration<String> e = trustStore.aliases(); e.hasMoreElements();) {
aliasCert = e.nextElement();
final BasicX509Credential credential = new BasicX509Credential();
- certificate = (X509Certificate) trustStore
- .getCertificate(aliasCert);
+ 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 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);
+ 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);
- /* A better use of PKI based validation but not wanted for STORK...
- boolean trusted = false;
-
- for (final Enumeration<String> 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.");*/
+ /*
+ * A better use of PKI based validation but not wanted for STORK... boolean trusted = false;
+ *
+ * for (final Enumeration<String> 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))
- {
+ 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);
+ final SignatureValidator sigValidator = new SignatureValidator(entityX509Cred);
sigValidator.validate(tokenSaml.getSignature());
} catch (ValidationException e) {
@@ -503,11 +442,11 @@ public final class SignP12 implements SAMLEngineSignI {
return tokenSaml;
}
-
/**
* Load cryptographic service provider.
*
- * @throws SAMLEngineException the SAML engine exception
+ * @throws SAMLEngineException
+ * the SAML engine exception
*/
@Override
public void loadCryptServiceProvider() throws SAMLEngineException {
@@ -517,48 +456,38 @@ public final class SignP12 implements SAMLEngineSignI {
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());
+ // 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 {
+ 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
index 0984bb9ca..1ca857e9e 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
@@ -12,17 +12,34 @@
* Licence for the specific language governing permissions and limitations under
* the Licence.
*/
-
package eu.stork.peps.auth.engine.core.impl;
-import eu.stork.peps.auth.engine.X509PrincipalUtil;
-import eu.stork.peps.auth.engine.core.CustomAttributeQuery;
-import eu.stork.peps.auth.engine.core.SAMLEngineSignI;
-import eu.stork.peps.exceptions.SAMLEngineException;
+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.CertificateExpiredException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateNotYetValidException;
+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 org.apache.commons.io.IOUtils;
import org.apache.commons.lang.NotImplementedException;
import org.bouncycastle.jce.X509Principal;
-//import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.opensaml.Configuration;
import org.opensaml.common.SAMLObject;
import org.opensaml.common.SignableSAMLObject;
@@ -41,491 +58,426 @@ 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.*;
+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 java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.*;
-import java.security.cert.CertificateExpiredException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CertificateNotYetValidException;
-import java.security.cert.X509Certificate;
-import java.util.*;
+import eu.stork.peps.auth.engine.X509PrincipalUtil;
+import eu.stork.peps.auth.engine.core.CustomAttributeQuery;
+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.
+ * 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;
- // 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 += "/";
- }
- } else {
- base = "/";
- }
-
- try {
- if (null != base)
- fileProperties = new FileInputStream(base + fileConf);
- else
- 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);
- }
- }
-
- /**
- * @return the X509Certificate
- * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate()
- */
- 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<String> e = storkOwnKeyStore.aliases(); e
- .hasMoreElements() && !find; ) {
- aliasCert = e.nextElement();
- certificate = (X509Certificate) storkOwnKeyStore
- .getCertificate(aliasCert);
-
- final String serialNum = certificate.getSerialNumber()
- .toString(16);
-
- try {
- X509Principal issuerDN = new X509Principal(certificate.getIssuerDN().getName());
- X509Principal issuerDNConf = new X509Principal(issuer);
-
- if (serialNum.equalsIgnoreCase(serialNumber)
- && X509PrincipalUtil.equals(issuerDN, issuerDNConf)) {
- alias = aliasCert;
- find = true;
- }
- } catch (Exception ex) {
- LOG.error("Exception during signing: " + ex.getMessage()); // Added as a workaround for Bouncycastle email error
- }
- }
- 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_SHA256);
- //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);
-
- //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.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);
- signature2.setKeyInfo(keyInfo2);
- signature2.setCanonicalizationAlgorithm(
- SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
-
-
- 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<Assertion> 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 (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;
- }
-
- /**
- * @param tokenSaml token SAML
- * @return the SAMLObject validated.
- * @throws SAMLEngineException error validate signature
- * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(org.opensaml.common.SignableSAMLObject)
- */
- 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<Credential> trustCred = new ArrayList<Credential>();
-
- for (final Enumeration<String> 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);
-
- try {
- cert.checkValidity();
- } catch (CertificateExpiredException exp) {
- throw new SAMLEngineException("Certificate expired.");
- } catch (CertificateNotYetValidException exp) {
- throw new SAMLEngineException("Certificate not yet valid.");
- }
-
- /* A better use of PKI based validation but not wanted for STORK...
- boolean trusted = false;
-
- for (final Enumeration<String> 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 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(
- 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);
- }
- }
+ /**
+ * 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;
+ // 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 += "/";
+ }
+ } else {
+ base = "/";
+ }
+
+ try {
+ if (null != base)
+ fileProperties = new FileInputStream(base + fileConf);
+ else
+ 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);
+ }
+ }
+
+ /**
+ * @return the X509Certificate
+ * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#getCertificate()
+ */
+ 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<String> 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.X509equals(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_SHA256);
+ // 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);
+
+ // 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.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);
+ signature2.setKeyInfo(keyInfo2);
+ signature2.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
+
+ 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<Assertion> 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 (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;
+ }
+
+ /**
+ * @param tokenSaml
+ * token SAML
+ * @return the SAMLObject validated.
+ * @throws SAMLEngineException
+ * error validate signature
+ * @see eu.stork.peps.auth.engine.core.SAMLEngineSignI#validateSignature(org.opensaml.common.SignableSAMLObject)
+ */
+ public final SAMLObject validateSignature(final SignableSAMLObject tokenSaml) throws SAMLEngineException {
+ LOG.info("Start signature validation SW.");
+ 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<Credential> trustCred = new ArrayList<Credential>();
+
+ for (final Enumeration<String> 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);
+
+ try {
+ cert.checkValidity();
+ } catch (CertificateExpiredException exp) {
+ throw new SAMLEngineException("Certificate expired.");
+ } catch (CertificateNotYetValidException exp) {
+ throw new SAMLEngineException("Certificate not yet valid.");
+ }
+
+ /*
+ * A better use of PKI based validation but not wanted for STORK... boolean trusted = false;
+ *
+ * for (final Enumeration<String> 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 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(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
index a60515593..332882a03 100644
--- 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
@@ -26,16 +26,15 @@ import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes;
* @author fjquevedo
*/
public final class VIDPAuthenticationAttributesBuilder extends AbstractSAMLObjectBuilder<VIDPAuthenticationAttributes> {
-
- /** {@inheritDoc} */
- public VIDPAuthenticationAttributes buildObject() {
- return buildObject(SAMLCore.STORK10P_NS.getValue(), VIDPAuthenticationAttributes.DEF_LOCAL_NAME, SAMLCore.STORK10P_PREFIX.getValue());
- }
+ /** {@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);
+ }
- /** {@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
index 25737e307..bfb85e357 100644
--- 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
@@ -33,100 +33,96 @@ import org.slf4j.LoggerFactory;
*
* @author fjquevedo
*/
-public final class VIDPAuthenticationAttributesImpl extends AbstractSignableSAMLObject implements
-VIDPAuthenticationAttributes {
+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;
+ 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);
+ }
/**
- * 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() {
+ * 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<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
-
- children.add(citizenCountryCode);
- children.add(spInformation);
-
- if (getSignature() != null) {
- children.add(getSignature());
+ /**
+ * Gets the ordered children.
+ *
+ * @return the ordered children
+ *
+ */
+ public List<XMLObject> getOrderedChildren() {
+ final ArrayList<XMLObject> children = new ArrayList<XMLObject>();
+
+ children.add(citizenCountryCode);
+ children.add(spInformation);
+
+ if (getSignature() != null) {
+ children.add(getSignature());
+ }
+
+ return Collections.unmodifiableList(children);
+
}
-
- 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);
+
+ /**
+ * 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);
}
- @Override
- public int hashCode() {
- LOGGER.warn("Hashcode has been called, passed to super. Nothing foreseen here");
- return super.hashCode();
- }
+ /**
+ * Sets the SP information.
+ *
+ * @param newSPInformation
+ * the new SP information
+ *
+ */
+ public void setSPInformation(SPInformation newSPInformation) {
+ this.spInformation = prepareForAssignment(this.spInformation, newSPInformation);
+ }
}
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
index 5635ddd6b..73e0ca6f5 100644
--- 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
@@ -24,10 +24,10 @@ import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
*/
public class VIDPAuthenticationAttributesMarshaller extends AbstractSAMLObjectMarshaller {
- /**
- * Instantiates a new vIDP authentication attributes marshaller.
- */
- public VIDPAuthenticationAttributesMarshaller() {
- super();
- }
+ /**
+ * 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
index ba4a4fe3a..dadf86254 100644
--- 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
@@ -28,28 +28,29 @@ import eu.stork.peps.auth.engine.core.VIDPAuthenticationAttributes;
*
* @author fjquevedo
*/
-public class VIDPAuthenticationAttributesUnmarshaller extends
- AbstractSAMLObjectUnmarshaller {
+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;
+ /**
+ * 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);
- }
- }
+ 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/validator/CustomAttributeQueryValidator.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/CustomAttributeQueryValidator.java
index 4fce4df3f..a4015eed1 100644
--- 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
@@ -7,13 +7,15 @@ import org.opensaml.xml.validation.Validator;
import eu.stork.peps.auth.engine.core.CustomAttributeQuery;
public class CustomAttributeQueryValidator implements Validator<CustomAttributeQuery> {
-
+
/**
* Validate action.
*
- * @param attrQuery the attribute query to validate
+ * @param attrQuery
+ * the attribute query to validate
*
- * @throws ValidationException the validation exception
+ * @throws ValidationException
+ * the validation exception
*/
public final void validate(final CustomAttributeQuery attrQuery) throws ValidationException {
validateAssertion(attrQuery);
@@ -21,45 +23,54 @@ public class CustomAttributeQueryValidator implements Validator<CustomAttributeQ
validateDestination(attrQuery);
}
-
/**
* Validate assertion.
*
- * @param attrQuery the attribute query
+ * @param attrQuery
+ * the attribute query
*
- * @throws ValidationException the validation exception
+ * @throws ValidationException
+ * the validation exception
*/
- protected final void validateAssertion(final CustomAttributeQuery attrQuery)
- throws ValidationException {
+ 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
- * @param query the attribute query to validate
- * @throws ValidationException the validation exception
- */
+ *
+ * @param query
+ * the attribute query to validate
+ * @throws ValidationException
+ * the validation exception
+ */
protected void validateSubject(CustomAttributeQuery query) throws ValidationException {
- if (query.getSubject() == null)
- throw new ValidationException("Subject is required");
- }
-
+ if (query.getSubject() == null)
+ throw new ValidationException("Subject is required");
+ }
+
/**
* Validate the destination
- * @param query the query to validate
- * @throws ValidationException the validation exception
+ *
+ * @param query
+ * the query to validate
+ * @throws ValidationException
+ * the validation exception
*/
protected void validateDestination(CustomAttributeQuery query) throws ValidationException {
- if (query.getDestination() == null)
- throw new ValidationException("Destination is required");
- }
-
+ if (query.getDestination() == null)
+ throw new ValidationException("Destination is required");
+ }
+
/**
* Validate the destination
- * @param query the query to validate
- * @throws ValidationException the validation exception
+ *
+ * @param query
+ * the query to validate
+ * @throws ValidationException
+ * the validation exception
*/
protected void validateTime(CustomAttributeQuery query) throws ValidationException {
if (query.getIssueInstant().minusMinutes(5).isAfterNow())
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
index 491549aac..6a709a7bc 100644
--- 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
@@ -31,31 +31,29 @@ import eu.stork.peps.auth.engine.core.QAAAttribute;
*/
public class ExtensionsSchemaValidator implements Validator<Extensions> {
+ /**
+ * 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<XMLObject> qaa = extensions.getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME);
+
+ if (qaa.size() == 1) {
+ final Validator<QAAAttribute> validatorQaa = new QAAAttributeSchemaValidator();
+ validatorQaa.validate((QAAAttribute) qaa.get(0));
+ } else {
+ throw new ValidationException("Extensions must contain only one element QAALevel.");
+ }
- /**
- * 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<XMLObject> qaa = extensions.getUnknownXMLObjects(QAAAttribute.DEF_ELEMENT_NAME);
-
- if (qaa.size() == 1) {
- final Validator<QAAAttribute> 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/MultipleAssertionResponseValidator.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/MultipleAssertionResponseValidator.java
index 7e1242a88..9c8c1e6a1 100644
--- a/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/MultipleAssertionResponseValidator.java
+++ b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/validator/MultipleAssertionResponseValidator.java
@@ -4,63 +4,73 @@ import org.opensaml.saml2.core.Response;
import org.opensaml.xml.validation.ValidationException;
import org.opensaml.xml.validation.Validator;
-
public class MultipleAssertionResponseValidator implements Validator<Response> {
-
+
/**
* Validate action.
*
- * @param response the response to validate
+ * @param response
+ * the response to validate
*
- * @throws ValidationException the validation exception
+ * @throws ValidationException
+ * the validation exception
*/
public final void validate(final Response response) throws ValidationException {
validateAssertion(response);
validateConsent(response);
- validateDestination(response);
+ validateDestination(response);
validateTime(response);
validateId(response);
}
-
/**
* Validate assertion.
*
- * @param response the attribute query
+ * @param response
+ * the attribute query
*
- * @throws ValidationException the validation exception
+ * @throws ValidationException
+ * the validation exception
*/
- protected final void validateAssertion(final Response response)
- throws ValidationException {
+ protected final void validateAssertion(final Response response) throws ValidationException {
if (response.getAssertions() == null || response.getAssertions().size() < 2) {
throw new ValidationException("Multiple assertions must be specified.");
}
}
-
+
/**
* Validate the Consent
- * @param response the response to validate
- * @throws ValidationException the validation exception
+ *
+ * @param response
+ * the response to validate
+ * @throws ValidationException
+ * the validation exception
*/
protected void validateConsent(Response response) throws ValidationException {
- if (response.getConsent() == null)
- throw new ValidationException("Consent is required");
- }
-
+ if (response.getConsent() == null)
+ throw new ValidationException("Consent is required");
+ }
+
/**
* Validate the destination
- * @param response the response to validate
- * @throws ValidationException the validation exception
+ *
+ * @param response
+ * the response to validate
+ * @throws ValidationException
+ * the validation exception
*/
protected void validateDestination(Response response) throws ValidationException {
- if (response.getDestination() == null)
- throw new ValidationException("Destination is required");
- }
-
+ if (response.getDestination() == null)
+ throw new ValidationException("Destination is required");
+ }
+
/**
* Validate issue times
- * @param response the response to validate
- * @throws ValidationException the validation exception
+ *
+ * @param response
+ * the response to validate
+ * @throws ValidationException
+ * the validation exception
*/
protected void validateTime(Response response) throws ValidationException {
if (response.getIssueInstant().minusMinutes(5).isAfterNow())
@@ -69,12 +79,15 @@ public class MultipleAssertionResponseValidator implements Validator<Response> {
/**
* Validate ids
- * @param response the response to validate
- * @throws ValidationException the validation exception
+ *
+ * @param response
+ * the response to validate
+ * @throws ValidationException
+ * the validation exception
*/
- protected void validateId(Response response) throws ValidationException {
- if (response.getID() == null || response.getInResponseTo() == null)
- throw new ValidationException("Id and response id is required");
- }
+ protected void validateId(Response response) throws ValidationException {
+ if (response.getID() == null || response.getInResponseTo() == null)
+ throw new ValidationException("Id and response id is required");
+ }
}
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
index 44c9db380..04ff153d3 100644
--- 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
@@ -28,37 +28,41 @@ import eu.stork.peps.auth.engine.core.QAAAttribute;
*/
public class QAAAttributeSchemaValidator implements Validator<QAAAttribute> {
-
/**
* Validate action.
*
- * @param qaa the quality authentication assurance level attribute
+ * @param qaa
+ * the quality authentication assurance level attribute
*
- * @throws ValidationException the validation exception
+ * @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.
+ * @param qaaAttribute
+ * the quality authentication assurance level attribute.
*
- * @throws ValidationException the validation exception
+ * @throws ValidationException
+ * the validation exception
*/
- protected final void validateAction(final QAAAttribute qaaAttribute)
- throws ValidationException {
+ 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());
+ int qaa = 0;
+ try {
+ qaa = Integer.valueOf(qaaAttribute.getQaaLevel());
+ } catch (Exception e) {
+ throw new ValidationException("QAALevel is not a valid number!");
+ }
if (qaa < QAAAttribute.MIN_VALUE || qaa > QAAAttribute.MAX_VALUE) {
- throw new ValidationException(
- "QAALevel label must be greater than 0.");
+ throw new ValidationException("QAALevel label must be greater than 0.");
}
}
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 c53e18662..e513c6add 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
@@ -12,14 +12,8 @@
* Licence for the specific language governing permissions and limitations under
* the Licence.
*/
-
package eu.stork.peps.configuration;
-import eu.stork.peps.exceptions.STORKSAMLEngineException;
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -28,6 +22,12 @@ 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.
*
@@ -35,108 +35,100 @@ import java.util.Properties;
*/
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<String, Map<String, Object>> createConfiguration(
- final Map<String, InstanceEngine> instanceConfs) throws STORKSAMLEngineException {
-
- final HashMap<String, Map<String, Object>> instances =
- new HashMap<String, Map<String, Object>>();
-
- LOGGER.info("Create configuration.");
- try {
- // Only create instances for SAMLEngine configuration.
- // INSTANCE
- for (Map.Entry<String, InstanceEngine> entry : instanceConfs
- .entrySet()) {
- final InstanceEngine iEngine = entry.getValue();
-
- final Map<String, Object> intance = new HashMap<String, Object>();
-
- // 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 {
- InputStream fileEngineProp = null;
-
- // 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 += "/";
- }
- } else {
- base = "/";
- }
-
- LOGGER.info("Create file configuration properties to Stork Saml Engine: " + base + fileName);
-
- try {
-
- if (null != base)
- fileEngineProp = new FileInputStream(base + fileName);
- else
- fileEngineProp = ConfigurationCreator.class
- .getResourceAsStream(base + 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: " + base + fileName);
- throw new STORKSAMLEngineException(e);
- } finally {
- IOUtils.closeQuietly(fileEngineProp);
- }
- }
-
- /**
- * Instantiates a new instance creator.
- */
- private 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<String, Map<String, Object>> createConfiguration(final Map<String, InstanceEngine> instanceConfs) throws STORKSAMLEngineException {
+
+ final HashMap<String, Map<String, Object>> instances = new HashMap<String, Map<String, Object>>();
+
+ LOGGER.info("Create configuration.");
+ try {
+ // Only create instances for SAMLEngine configuration.
+ // INSTANCE
+ for (Map.Entry<String, InstanceEngine> entry : instanceConfs.entrySet()) {
+ final InstanceEngine iEngine = entry.getValue();
+
+ final Map<String, Object> intance = new HashMap<String, Object>();
+
+ // 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: " + fileName);
+ InputStream fileEngineProp = null;
+
+ // 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 += "/";
+ }
+ } else {
+ base = "/";
+ }
+
+ LOGGER.info("Create file configuration properties to Stork Saml Engine: " + base + fileName);
+
+ try {
+
+ if (null != base)
+ fileEngineProp = new FileInputStream(base + fileName);
+ else
+ fileEngineProp = ConfigurationCreator.class.getResourceAsStream(base + fileName);
+
+ final Properties configuration = new Properties();
+ configuration.loadFromXML(fileEngineProp);
+ return configuration;
+ } catch (InvalidPropertiesFormatException e) {
+ LOGGER.error("Invalid properties format: " + fileName);
+ 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
index d9e7e467a..9dbed386e 100644
--- 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
@@ -24,46 +24,48 @@ import java.util.Map;
*/
public class ConfigurationEngine {
- /** The name of the configuration file. */
- private String name;
+ /** The name of the configuration file. */
+ private String name;
- /** The parameters. */
- private Map<String, String> parameters;
+ /** The parameters. */
+ private Map<String, String> parameters;
- /**
- * Gets the name.
- *
- * @return the name
- */
- public final String getName() {
- return name;
- }
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public final String getName() {
+ return name;
+ }
- /**
- * Gets the parameters.
- *
- * @return the parameters
- */
- public final Map<String, String> getParameters() {
- return parameters;
- }
+ /**
+ * Gets the parameters.
+ *
+ * @return the parameters
+ */
+ public final Map<String, String> getParameters() {
+ return parameters;
+ }
- /**
- * Sets the name.
- *
- * @param newName the new name
- */
- public final void setName(final String newName) {
- this.name = newName;
- }
+ /**
+ * 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<String, String> newParameters) {
- this.parameters = newParameters;
- }
+ /**
+ * Sets the parameters.
+ *
+ * @param newParameters
+ * the parameters
+ */
+ public final void setParameters(final Map<String, String> 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
index 7968c77ff..f68060154 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
@@ -46,189 +46,172 @@ import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException;
*/
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<String, String> generateParam(
- final Element configurationNode) {
-
- final HashMap<String, String> parameters = new HashMap<String, String>();
-
- 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<String, InstanceEngine> readConfiguration()
- throws SAMLEngineException {
-
- // 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<String, InstanceEngine> instanceConfs =
- new HashMap<String, InstanceEngine>();
-
- 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();
-
- if (null != base)
- engineConf = new FileInputStream(base + ENGINE_CONF_FILE);
- else
- 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.");
+ /** 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<String, String> generateParam(final Element configurationNode) {
+
+ final HashMap<String, String> parameters = new HashMap<String, String>();
+
+ 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());
+ }
}
- instanceConf.setName(instanceName.trim());
+ return parameters;
+ }
+
+ /**
+ * Read configuration.
+ *
+ * @return the map< string, instance engine>
+ *
+ * @throws SAMLEngineException
+ * the STORKSAML engine runtime exception
+ */
+ public static Map<String, InstanceEngine> readConfiguration() throws SAMLEngineException {
- final NodeList confNodes = element
- .getElementsByTagName(NODE_CONF);
+ // 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 += "/";
- for (int indexNode = 0; indexNode < confNodes.getLength(); ++indexNode) {
+ LOGGER.info("Init reader: " + base + ENGINE_CONF_FILE);
+ final Map<String, InstanceEngine> instanceConfs = new HashMap<String, InstanceEngine>();
- final Element configurationNode = (Element) confNodes
- .item(indexNode);
+ Document document = null;
+ // Load configuration file
+ final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder;
- final String configurationName = configurationNode
- .getAttribute(NODE_CONF_NAME);
+ InputStream engineConf = null;
+ try {
- if (StringUtils.isBlank(configurationName)) {
- throw new STORKSAMLEngineRuntimeException(
- "Error reader configuration name.");
- }
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
- final ConfigurationEngine confSamlEngine =
- new ConfigurationEngine();
+ builder = factory.newDocumentBuilder();
- // Set configuration name.
- confSamlEngine.setName(configurationName.trim());
+ if (null != base)
+ engineConf = new FileInputStream(base + ENGINE_CONF_FILE);
+ else
+ engineConf = ConfigurationReader.class.getResourceAsStream("/" + ENGINE_CONF_FILE);
- // Read every parameter for this configuration.
- final Map<String, String> parameters =
- generateParam(configurationNode);
+ document = builder.parse(engineConf);
- // Set parameters
- confSamlEngine.setParameters(parameters);
+ // Read instance
+ final NodeList list = document.getElementsByTagName(NODE_INSTANCE);
- // Add parameters to the configuration.
- instanceConf.getConfiguration().add(confSamlEngine);
+ 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<String, String> 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);
}
- // 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;
}
- return instanceConfs;
- }
+ /**
+ * Instantiates a new configuration reader.
+ */
+ private ConfigurationReader() {
- /**
- * 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
index d00607853..4a382fe99 100644
--- 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
@@ -31,44 +31,44 @@ import eu.stork.peps.exceptions.STORKSAMLEngineRuntimeException;
*/
public final class ConfigurationSingleton {
- /** The instance of every engine SAML. */
- private static Map<String, InstanceEngine> instanceConfigs;
+ /** The instance of every engine SAML. */
+ private static Map<String, InstanceEngine> instanceConfigs;
- /** The instances of SAML engine. */
- private static Map<String, Map<String, Object>> instances;
+ /** The instances of SAML engine. */
+ private static Map<String, Map<String, Object>> instances;
- /** The Constant LOGGER. */
- private static final Logger LOGGER = LoggerFactory
- .getLogger(ConfigurationSingleton.class.getName());
+ /** 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);
+ 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<String, Map<String, Object>> getInstance(
- final String fileName) throws STORKSAMLEngineException {
- return ConfigurationCreator.createConfiguration(instanceConfigs);
- }
+ /**
+ * 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<String, Map<String, Object>> getInstance(final String fileName) throws STORKSAMLEngineException {
+ return ConfigurationCreator.createConfiguration(instanceConfigs);
+ }
- /**
- * Instantiates a new instance creator.
- */
- private ConfigurationSingleton() {
- }
+ /**
+ * 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
index 4d9bba8e7..0343d915a 100644
--- 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
@@ -25,46 +25,48 @@ import java.util.List;
*/
public class InstanceEngine {
- /** The configuration. */
- private List<ConfigurationEngine> configuration = new ArrayList<ConfigurationEngine>();
+ /** The configuration. */
+ private List<ConfigurationEngine> configuration = new ArrayList<ConfigurationEngine>();
- /** The name. */
- private String name;
+ /** The name. */
+ private String name;
- /**
- * Gets the parameters.
- *
- * @return the parameters
- */
- public final List<ConfigurationEngine> getConfiguration() {
- return this.configuration;
- }
+ /**
+ * Gets the parameters.
+ *
+ * @return the parameters
+ */
+ public final List<ConfigurationEngine> getConfiguration() {
+ return this.configuration;
+ }
- /**
- * Gets the name.
- *
- * @return the name
- */
- public final String getName() {
- return name;
- }
+ /**
+ * 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<ConfigurationEngine> newConfiguration) {
- this.configuration = newConfiguration;
- }
+ /**
+ * Sets the parameters.
+ *
+ * @param newConfiguration
+ * the new parameters
+ */
+ public final void setConfiguration(final List<ConfigurationEngine> newConfiguration) {
+ this.configuration = newConfiguration;
+ }
- /**
- * Sets the name.
- *
- * @param newName the new name
- */
- public final void setName(final String newName) {
- this.name = newName;
- }
+ /**
+ * 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
index 344368e03..e6676342d 100644
--- 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
@@ -17,3 +17,4 @@
* 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/SAMLEngineException.java b/id/server/stork2-saml-engine/src/main/java/eu/stork/peps/exceptions/SAMLEngineException.java
index ac46f73e4..cc3bf3676 100644
--- 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
@@ -22,36 +22,39 @@ package eu.stork.peps.exceptions;
*/
public class SAMLEngineException extends Exception {
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 2611361164977849837L;
+ /** 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 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
+ */
+ 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);
- }
+ /**
+ * 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
index bddcbd1b3..d0d9d721d 100644
--- 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
@@ -22,114 +22,119 @@ package eu.stork.peps.exceptions;
*/
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;
- }
+ /** 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
index fb01fd5aa..f43c1bd78 100644
--- 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
@@ -22,35 +22,38 @@ package eu.stork.peps.exceptions;
*/
public class STORKSAMLEngineRuntimeException extends RuntimeException {
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 5829810358581493517L;
+ /** 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);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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);
- }
+ /**
+ * 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/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
index eb885eea9..b421dce8c 100644
--- 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
@@ -44,130 +44,130 @@ 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);
+
+ /** 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));
}
- return bytes;
- }
+ /**
+ * 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
index c52b8a779..bdb8780c3 100644
--- 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
@@ -22,43 +22,42 @@ 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.
+ * The Class SimpleBaseTest. Defines a set of test the initialization of the SAML engine.
*/
@SuppressWarnings("deprecation")
public class SimpleBaseTest extends TestCase {
- /**
- * Test SAML engine correct configuration name.
- */
-
+ /**
+ * Test SAML engine correct configuration name.
+ */
+
@Test
- public final void testSamlEngineCorrectInit() {
- Assert.assertNotNull(STORKSAMLEngine.getInstance("CONF1"));
- }
+ 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 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 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 "));
+ }
- /**
- * 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
index 0eda1bfbf..4f22df7fb 100644
--- 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
@@ -20,845 +20,833 @@ 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<String> ages = new ArrayList<String>();
- 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";
- //spName = "University of Oxford";
- spSector = "EDU001";
- spInstitution = "OXF001";
- spApplication = "APP001";
- spCountry = "IS";
-
- spId = "EDU001-OXF001-APP001";
-
- }
-
- /** 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 assertion consumer URL. */
- private String assertConsumerUrl;
-
- /** 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);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
- request.setSpCountry(spCountry);
-
- 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"));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+
+ /** 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<String> ages = new ArrayList<String>();
+ 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);
+
+ final PersonalAttribute fiscalNumber = new PersonalAttribute();
+ fiscalNumber.setName("fiscalNumber");
+ fiscalNumber.setIsRequired(true);
+ fiscalNumber.setValue(Arrays.asList("fiscalNumber"));
+ pal.add(fiscalNumber);
+
+ final PersonalAttribute LPFiscalNumber = new PersonalAttribute();
+ LPFiscalNumber.setName("LPFiscalNumber");
+ LPFiscalNumber.setIsRequired(true);
+ LPFiscalNumber.setValue(Arrays.asList("LPFiscalNumber"));
+ pal.add(LPFiscalNumber);
+
+ destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest";
+ assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
+ // spName = "University of Oxford";
+ spSector = "EDU001";
+ spInstitution = "OXF001";
+ spApplication = "APP001";
+ spCountry = "IS";
+
+ spId = "EDU001-OXF001-APP001";
+
}
- try {
- output.write(reqByte);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+
+ /** 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 assertion consumer URL. */
+ private String assertConsumerUrl;
+
+ /** 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);
}
-
- 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.
+ *
+ * @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);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+ request.setSpCountry(spCountry);
+
+ 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"));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ output.write(reqByte);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ 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 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 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 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 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 service provider sector null.
- */
- @Test
- public final void testGenerateAttrQueryRequestSectorErr() {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- 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("IS");
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ /**
+ * 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 institution null.
- */
- @Test
- public final void testGenerateAttrQueryRequestDestinationErr() {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(null);
- 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);
- fail("generateSTORKAttrQueryRequest(...) 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);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // 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 application null.
- */
- @Test
- public final void testGenerateAttrQueryRequestApplicationErr() {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- 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("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 testGenerateAttrQueryRequestDestinationErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(null);
+ 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);
+ fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!");
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
}
- }
-
- /**
- * 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);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(null);
- 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 service provider application null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestApplicationErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ 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("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);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(null);
+ 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 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 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");
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ 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 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 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/AttrQueryRequest1.xml");
+
+ try {
+ engine.validateSTORKAttrQueryRequest(bytes);
+ fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error(e.getMessage());
+ }
}
- }
-
- /**
- * 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 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 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 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);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+
+ final byte[] authReqNotTrust = engineNotTrusted.generateSTORKAttrQueryRequest(request).getTokenSaml();
+
+ engine.validateSTORKAttrQueryRequest(authReqNotTrust);
+ fail("validateSTORKAttrQueryRequestNotTrusted(...) should have 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");
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- 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/AttrQueryRequest1.xml");
-
- try {
- engine.validateSTORKAttrQueryRequest(bytes);
- fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error(e.getMessage());
+
+ /**
+ * 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);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest(request).getTokenSaml();
+
+ // engine ("CONF1") no have trust certificate from "CONF2"
+ engine.validateSTORKAttrQueryRequest(authReqNotTrust);
+
}
- }
- /**
- * Test validate file authentication request tag delete.
- *
- * @throws Exception the exception
- */
- @Test
- public final void testValidateFileAttrRequestTagDelete() throws Exception {
+ /**
+ * 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);
- final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml");
+ try {
- try {
- engine.validateSTORKAttrQueryRequest(bytes);
- fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error(e.getMessage());
+ engine.validateSTORKAttrQueryRequest(attrRequest);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
}
- }
-
- /**
- * 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);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
-
- final byte[] authReqNotTrust = engineNotTrusted
- .generateSTORKAttrQueryRequest(request).getTokenSaml();
-
- engine.validateSTORKAttrQueryRequest(authReqNotTrust);
- fail("validateSTORKAttrQueryRequestNotTrusted(...) should have thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * 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);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- 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");
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ 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 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");
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- 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");
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- 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");
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- STORKAttrQueryRequest req = new STORKAttrQueryRequest();
-
- req = engine3.generateSTORKAttrQueryRequest(request);
- req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml());
- String prufa = req.getAlias();
- 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-demo2"));
- }*/
-
- @Test
- public final void testGenerateAttrQueryRequestSignDoc() throws STORKSAMLEngineException {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- PersonalAttributeList pal0 = new PersonalAttributeList();
-
- final PersonalAttribute signDoc = new PersonalAttribute();
- signDoc.setName("docRequest");
- signDoc.setIsRequired(true);
- signDoc.setValue(Arrays.asList("IS/IS/fbea6e68-0393-401b-b616-f767fff9418c"));
- pal0.add(signDoc);
-
- request.setPersonalAttributeList(pal0);
-
- // new parameters
- /*request.setEIDSectorShare(false);
- request.setEIDCrossSectorShare(false);
- request.setEIDCrossBorderShare(false);*/
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
- request.setSpCountry(spCountry);
-
- STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request);
- byte[] reqByte = req1.getTokenSaml();
- FileOutputStream output = null;
-
- STORKAttrQueryRequest req2 = engine0.validateSTORKAttrQueryRequest(reqByte);
- //reqByte = req2.getTokenSaml();
-
- try {
- //output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml"));
- FileOutputStream fos;
- File outputDir = new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine");
- File saveFile = new File(outputDir, "AttrQueryRequestSdoc.xml");
- fos = new FileOutputStream(saveFile);
- fos.write(reqByte);
- fos.flush();
- fos.close();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+
+ /**
+ * 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");
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ 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"));
+
}
- try {
- output.write(reqByte);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+
+ /**
+ * 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"); request.setAssertionConsumerServiceURL(assertConsumerUrl);
+ *
+ * STORKAttrQueryRequest req = new STORKAttrQueryRequest();
+ *
+ * req = engine3.generateSTORKAttrQueryRequest(request); req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml()); String prufa = req.getAlias();
+ * 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-demo2")); }
+ */
+
+ @Test
+ public final void testGenerateAttrQueryRequestSignDoc() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ PersonalAttributeList pal0 = new PersonalAttributeList();
+
+ final PersonalAttribute signDoc = new PersonalAttribute();
+ signDoc.setName("docRequest");
+ signDoc.setIsRequired(true);
+ signDoc.setValue(Arrays.asList("IS/IS/fbea6e68-0393-401b-b616-f767fff9418c"));
+ pal0.add(signDoc);
+
+ request.setPersonalAttributeList(pal0);
+
+ // new parameters
+ /*
+ * request.setEIDSectorShare(false); request.setEIDCrossSectorShare(false); request.setEIDCrossBorderShare(false);
+ */
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+ request.setSpCountry(spCountry);
+
+ STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request);
+ byte[] reqByte = req1.getTokenSaml();
+ FileOutputStream output = null;
+
+ STORKAttrQueryRequest req2 = engine0.validateSTORKAttrQueryRequest(reqByte);
+ // reqByte = req2.getTokenSaml();
+
+ try {
+ // output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml"));
+ FileOutputStream fos;
+ File outputDir = new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine");
+ File saveFile = new File(outputDir, "AttrQueryRequestSdoc.xml");
+ fos = new FileOutputStream(saveFile);
+ fos.write(reqByte);
+ fos.flush();
+ fos.close();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ output.write(reqByte);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
+
+ request.setCitizenCountryCode("IS");
+ LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
}
-
- LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
-
- request.setCitizenCountryCode("IS");
- LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
- }
-
+
}
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
index a98d5b7c3..0ecca1eab 100644
--- 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
@@ -36,842 +36,763 @@ 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<String> ages = new ArrayList<String>();
- 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");
- List<String> eid = Arrays.asList("IS/IS/1234567890");
- eIDNumber.setValue(eid);
- 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);
-
- // new 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");
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+
+ /**
+ * Gets the engine.
+ *
+ * @return the engine
+ */
+ public static STORKSAMLEngine getEngine() {
+ return engine;
}
- 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<String>();
-
- 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<String> date = new ArrayList<String>();
- 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<String> idNumber = new ArrayList<String>();
- 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<String, String> address = new HashMap<String, String>();
-
- 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<String, String> values = new HashMap<String, String>();
-
- 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();
+ /**
+ * Sets the engine.
+ *
+ * @param newEngine
+ * the new engine
+ */
+ public static void setEngine(final STORKSAMLEngine newEngine) {
+ StorkAttrQueryResponseTest.engine = newEngine;
}
- try {
- output.write(attrQueryResponse);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+
+ /** 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();
}
-
- 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");
+
+ /** 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<String> ages = new ArrayList<String>();
+ 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");
+ List<String> eid = Arrays.asList("IS/IS/1234567890");
+ eIDNumber.setValue(eid);
+ 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);
+
+ // new 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<String>();
+
+ 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<String> date = new ArrayList<String>();
+ 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<String> idNumber = new ArrayList<String>();
+ 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<String, String> address = new HashMap<String, String>();
+
+ 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<String, String> values = new HashMap<String, String>();
+
+ 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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<PersonalAttribute> 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 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<PersonalAttribute> 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 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 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 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<String> ages = new ArrayList<String>();
+ 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<String> date = new ArrayList<String>();
+ 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<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789PÑ");
+
+ final HashMap<String, String> complex = new HashMap<String, String>();
+ 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<String, String> address = new HashMap<String, String>();
+
+ 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 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 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 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<String> ages = new ArrayList<String>();
- 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<String> date = new ArrayList<String>();
- 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<String> idNumber = new ArrayList<String>();
- idNumber.add("123456789PÑ");
-
- final HashMap<String, String> complex = new HashMap<String, String>();
- 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<String, String> address = new HashMap<String, String>();
-
- 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
*
@@ -879,8 +800,7 @@ public class StorkAttrQueryResponseTest {
* the STORKSAML engine exception
*/
@Test
- public final void testGenerateAttrQueryResponseWithSignedDoc()
- throws STORKSAMLEngineException {
+ public final void testGenerateAttrQueryResponseWithSignedDoc() throws STORKSAMLEngineException {
String signedDocResponse = "<dss:SignResponse xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"123456\"> <dss:Result> <dss:ResultMajor>urn:oasis:names:tc:dss:1.0:resultmajor:Success</dss:ResultMajor> </dss:Result> <dss:SignatureObject> <dss:Base64Signature Type=\"urn:ietf:rfc:3275\">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+</dss:Base64Signature> </dss:SignatureObject> </dss:SignResponse>";
@@ -909,117 +829,107 @@ public class StorkAttrQueryResponseTest {
response.setPersonalAttributeList(palist);
- final STORKAttrQueryResponse storkResponse = getEngine()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
- destinationUrl, isNotHashing);
+ final STORKAttrQueryResponse storkResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress, destinationUrl, isNotHashing);
attrQueryResponse = storkResponse.getTokenSaml();
- attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
- ipAddress);
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, ipAddress);
- assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse
- .getPersonalAttributeList().get("signedDoc").getValue().get(0)
- .equals(signedDocResponse));
+ assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse.getPersonalAttributeList().get("signedDoc").getValue().get(0).equals(signedDocResponse));
}
-
+
@Test
public final void testEncodeDecode() {
- STORKAttrQueryRequest attrRequest = new STORKAttrQueryRequest();
- STORKAttrQueryRequest request;
- IPersonalAttributeList list = null;
- boolean outcome = false;
-
- try {
- //STEP 1: Create the STORKAttrQueryRequest and get the SAML bytes
- attrRequest.setSpSector("NOT AVAILABLE");
- attrRequest.setSpInstitution("NOT AVAILABLE");
- attrRequest.setSpApplication("NOT AVAILABLE");
- attrRequest.setSpCountry("NOT AVAILABLE");
-
- attrRequest.setIssuer("123");
- attrRequest.setDestination("456");
- attrRequest.setAssertionConsumerServiceURL("789");
- attrRequest.setQaa(2);
- attrRequest.setPersonalAttributeList(pal);
-
- System.out.println("Original PAL:");
- System.out.println(pal.toString());
-
- attrRequest = engine.generateSTORKAttrQueryRequest(attrRequest);
-
- byte[] saml = attrRequest.getTokenSaml();
-
- //STEP 2: RE-Create the STORKAttrQueryRequest from the SAML bytes
- request = engine.validateSTORKAttrQueryRequest(saml);
-
- System.out.println("STORKAttrQueryRequest Issuer: " + request.getIssuer());
- System.out.println("STORKAttrQueryRequest Destination: " + request.getDestination());
- System.out.println("STORKAttrQueryRequest ServiceURL: " + request.getAssertionConsumerServiceURL());
- System.out.println("STORKAttrQueryRequest Attributes: " + request.getPersonalAttributeList().toString());
- System.out.println("STORKAttrQueryRequest QAA: " + request.getQaa());
- //------------------------------
- list = request.getPersonalAttributeList();
-
- List<String> values = new ArrayList<String>();
- values.add("test1");
- values.add("test2");
- values.add("test3");
- list.get("newAttribute2").setValue(values);
-
- System.out.println("Values added in newAttribute2 PAL:");
- System.out.println(list.toString());
-
- //////////////////////////////////////////////////////////////////////////
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setPersonalAttributeList(list);
-
- final STORKAttrQueryResponse storkResponse =
- engine.generateSTORKAttrQueryResponse(request, response, "127.0.0.1",
- request.getAssertionConsumerServiceURL(), false);
-
- byte[] samlBytes = storkResponse.getTokenSaml();
-
- //STEP 3: RE-Create the STORKAttrQueryResponse from the SAML bytes
- STORKAttrQueryResponse attrResponse = null;
- attrResponse =
- engine.validateSTORKAttrQueryResponse(samlBytes, "127.0.0.1");
-
- System.out.println("Response decoded PAL:");
- System.out.println(attrResponse.getPersonalAttributeList().toString());
-
- values = attrResponse.getPersonalAttributeList().get("newAttribute2").getValue();
- if ( values.contains("test1") && values.contains("test2") && values.contains("test3") )
- outcome = true;
- } catch (final STORKSAMLEngineException e) {
- LOG.error("Errror genereating SAML Token for Authentication Request", e);
- }
-
- assertTrue(outcome);
+ STORKAttrQueryRequest attrRequest = new STORKAttrQueryRequest();
+ STORKAttrQueryRequest request;
+ IPersonalAttributeList list = null;
+ boolean outcome = false;
+
+ try {
+ // STEP 1: Create the STORKAttrQueryRequest and get the SAML bytes
+ attrRequest.setSpSector("NOT AVAILABLE");
+ attrRequest.setSpInstitution("NOT AVAILABLE");
+ attrRequest.setSpApplication("NOT AVAILABLE");
+ attrRequest.setSpCountry("NOT AVAILABLE");
+
+ attrRequest.setIssuer("123");
+ attrRequest.setDestination("456");
+ attrRequest.setAssertionConsumerServiceURL("789");
+ attrRequest.setQaa(2);
+ attrRequest.setPersonalAttributeList(pal);
+
+ System.out.println("Original PAL:");
+ System.out.println(pal.toString());
+
+ attrRequest = engine.generateSTORKAttrQueryRequest(attrRequest);
+
+ byte[] saml = attrRequest.getTokenSaml();
+
+ // STEP 2: RE-Create the STORKAttrQueryRequest from the SAML bytes
+ request = engine.validateSTORKAttrQueryRequest(saml);
+
+ System.out.println("STORKAttrQueryRequest Issuer: " + request.getIssuer());
+ System.out.println("STORKAttrQueryRequest Destination: " + request.getDestination());
+ System.out.println("STORKAttrQueryRequest ServiceURL: " + request.getAssertionConsumerServiceURL());
+ System.out.println("STORKAttrQueryRequest Attributes: " + request.getPersonalAttributeList().toString());
+ System.out.println("STORKAttrQueryRequest QAA: " + request.getQaa());
+ // ------------------------------
+ list = request.getPersonalAttributeList();
+
+ List<String> values = new ArrayList<String>();
+ values.add("test1");
+ values.add("test2");
+ values.add("test3");
+ list.get("newAttribute2").setValue(values);
+
+ System.out.println("Values added in newAttribute2 PAL:");
+ System.out.println(list.toString());
+
+ // ////////////////////////////////////////////////////////////////////////
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(list);
+
+ final STORKAttrQueryResponse storkResponse = engine.generateSTORKAttrQueryResponse(request, response, "127.0.0.1", request.getAssertionConsumerServiceURL(), false);
+
+ byte[] samlBytes = storkResponse.getTokenSaml();
+
+ // STEP 3: RE-Create the STORKAttrQueryResponse from the SAML bytes
+ STORKAttrQueryResponse attrResponse = null;
+ attrResponse = engine.validateSTORKAttrQueryResponse(samlBytes, "127.0.0.1");
+
+ System.out.println("Response decoded PAL:");
+ System.out.println(attrResponse.getPersonalAttributeList().toString());
+
+ values = attrResponse.getPersonalAttributeList().get("newAttribute2").getValue();
+ if (values.contains("test1") && values.contains("test2") && values.contains("test3"))
+ outcome = true;
+ } catch (final STORKSAMLEngineException e) {
+ LOG.error("Errror genereating SAML Token for Authentication Request", e);
+ }
+
+ assertTrue(outcome);
}
-
+
@Test
- public final void testGenerateAttrRequestWithMultipleAssertions()
- throws STORKSAMLEngineException {
+ public final void testGenerateAttrRequestWithMultipleAssertions() throws STORKSAMLEngineException {
STORKAttrQueryRequest req = null;
STORKAttrQueryResponse res0 = null;
STORKAttrQueryResponse res1 = null;
STORKAttrQueryResponse res2 = null;
STORKAttrQueryResponse res = null;
STORKAttrQueryResponse restotal = null;
-
+
try {
req = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest);
-
- attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest);
-
+
+ attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest);
+
} catch (STORKSAMLEngineException e) {
- fail("Error validating STORKAuthnRequest");
+ fail("Error validating STORKAuthnRequest");
}
-
+
IPersonalAttributeList pList = req.getPersonalAttributeList();
- for (int i =0; i < pList.size(); i++)
- {
+ for (int i = 0; i < pList.size(); i++) {
PersonalAttribute attr = pList.get("dateOfBirth");
attr.setValue(Arrays.asList("19820919"));
pList.remove("dateOfBirth");
@@ -1031,37 +941,30 @@ public class StorkAttrQueryResponseTest {
PersonalAttribute attr2 = pList.get("isAgeOver");
attr2.setValue(Arrays.asList("true"));
pList.remove("isAgeOver");
- pList.add(attr2);
+ pList.add(attr2);
}
-
+
res = new STORKAttrQueryResponse();
res.setPersonalAttributeList(pList);
-
- STORKAttrQueryResponse storkResponse = getEngine()
- .generateSTORKAttrQueryResponse(req, res, ipAddress,
- destinationUrl, isNotHashing);
-
+
+ STORKAttrQueryResponse storkResponse = getEngine().generateSTORKAttrQueryResponse(req, res, ipAddress, destinationUrl, isNotHashing);
+
res0 = getEngine().validateSTORKAttrQueryResponse(storkResponse.getTokenSaml(), ipAddress);
-
- storkResponse = getEngine()
- .generateSTORKAttrQueryResponse(req, res, ipAddress,
- destinationUrl, isNotHashing);
+
+ storkResponse = getEngine().generateSTORKAttrQueryResponse(req, res, ipAddress, destinationUrl, isNotHashing);
res1 = getEngine().validateSTORKAttrQueryResponse(storkResponse.getTokenSaml(), ipAddress);
-
- storkResponse = getEngine()
- .generateSTORKAttrQueryResponse(req, res, ipAddress,
- destinationUrl, isNotHashing);
+
+ storkResponse = getEngine().generateSTORKAttrQueryResponse(req, res, ipAddress, destinationUrl, isNotHashing);
res2 = getEngine().validateSTORKAttrQueryResponse(storkResponse.getTokenSaml(), ipAddress);
-
+
List<STORKAttrQueryResponse> responses = new ArrayList();
responses.add(res0);
responses.add(res1);
responses.add(res2);
-
+
STORKAttrQueryResponse resfinal = new STORKAttrQueryResponse();
- storkResponse = getEngine().generateSTORKAttrQueryResponseWithAssertions(req, resfinal, responses,
- ipAddress, destinationUrl, isNotHashing);
-
+ storkResponse = getEngine().generateSTORKAttrQueryResponseWithAssertions(req, resfinal, responses, ipAddress, destinationUrl, isNotHashing);
+
attrQueryResponse = storkResponse.getTokenSaml();
FileOutputStream output = null;
try {
@@ -1076,7 +979,7 @@ public class StorkAttrQueryResponseTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
res = null;
res = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, ipAddress);
System.out.println(res.getTotalPersonalAttributeList().toString());
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
index 02a8a6fab..d476ad26e 100644
--- 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
@@ -21,15 +21,12 @@ import java.util.ArrayList;
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.PersonalAttribute;
-import eu.stork.peps.auth.commons.PersonalAttributeList;
-import eu.stork.peps.auth.commons.STORKAuthnRequest;
+import eu.stork.peps.*;
+import eu.stork.peps.auth.commons.*;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
@@ -38,869 +35,855 @@ import eu.stork.peps.exceptions.STORKSAMLEngineException;
*/
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<String> ages = new ArrayList<String>();
- 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);
-
+ /** 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<String> ages = new ArrayList<String>();
+ 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");
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ pal.add(eIDNumber);
+
+ final PersonalAttribute LPFiscalNumber = new PersonalAttribute();
+ LPFiscalNumber.setName("LPFiscalNumber");
+ LPFiscalNumber.setIsRequired(true);
+ pal.add(LPFiscalNumber);
+
+ 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";
+
}
- }
-
-
-
- /**
- * 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");
+
+ /** 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 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!");
+
+ /**
+ * 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()));
}
- catch (STORKSAMLEngineException e)
- {
- LOG.error("Error");
+
+ /**
+ * 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 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 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 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 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 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 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 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 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 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);
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
+
+ /**
+ * 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 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 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 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 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);
+ LOG.error("Error");
+ 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 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 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 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 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 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.
- *
- * @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 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 file authentication request tag delete.
- *
- * @throws Exception the exception
- */
- @Test
- public final void testValidateFileAuthnRequestTagDelete() throws Exception {
+ /**
+ * 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);
- final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml");
+ // 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);
- try {
- engine.validateSTORKAuthnRequest(bytes);
- fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error(e.getMessage());
+ assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false);
+ assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false);
+ assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false);
}
- }
-
- /**
- * 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);
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+
+ /**
+ * 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 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-cert"));
-
- req = engine2.generateSTORKAuthnRequest(request);
- req = engine2.validateSTORKAuthnRequest(req.getTokenSaml());
- assertTrue("The alias should match this value", req.getAlias().equals("local-demo-cert"));
-
-
-
- }
-
+
+ /**
+ * 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);
+
+ } 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 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-cert"));
+
+ req = engine2.generateSTORKAuthnRequest(request);
+ req = engine2.validateSTORKAuthnRequest(req.getTokenSaml());
+ assertTrue("The alias should match this value", req.getAlias().equals("local-demo-cert"));
+
+ }
+
/**
* Test generating/validating request with signedDoc
*
@@ -908,8 +891,7 @@ public class StorkAuthRequestTest {
* the STORKSAML engine exception
*/
@Test
- public final void testGenerateAuthnRequestWithSignedDoc()
- throws STORKSAMLEngineException {
+ public final void testGenerateAuthnRequestWithSignedDoc() throws STORKSAMLEngineException {
String signedDocRequest = "<dss:SignRequest xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"_d96b62a87d18f1095170c1f44c90b5fd\"><dss:InputDocuments><dss:Document><dss:Base64Data MimeType=\"text/plain\">VGVzdCB0ZXh0</dss:Base64Data></dss:Document></dss:InputDocuments></dss:SignRequest>";
@@ -958,10 +940,7 @@ public class StorkAuthRequestTest {
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));
-
+ 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/StorkLogoutRequestTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkLogoutRequestTest.java
index 46904788f..e05c660ea 100644
--- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkLogoutRequestTest.java
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkLogoutRequestTest.java
@@ -15,75 +15,74 @@ import eu.stork.peps.auth.commons.STORKLogoutRequest;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
-
public class StorkLogoutRequestTest {
-
- /** 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");
-
- public StorkLogoutRequestTest() {
- destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
- spUserId = "IS/IS/1234567890";
- }
-
- /** The destination. */
- private String destination;
-
- /** The user id. */
- private String spUserId;
-
- /** The logout request. */
- private static byte[] logoutRequest;
-
- /** The Constant LOG. */
- private static final Logger LOG = LoggerFactory
- .getLogger(StorkLogoutRequestTest.class.getName());
-
- /** Parser manager used to parse XML. */
- private static BasicParserPool parser;
-
- static {
+
+ /** 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");
+
+ public StorkLogoutRequestTest() {
+ destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+ spUserId = "IS/IS/1234567890";
+ }
+
+ /** The destination. */
+ private String destination;
+
+ /** The user id. */
+ private String spUserId;
+
+ /** The logout request. */
+ private static byte[] logoutRequest;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory.getLogger(StorkLogoutRequestTest.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 testGenerateLogoutRequest() throws STORKSAMLEngineException {
-
- final STORKLogoutRequest request = new STORKLogoutRequest();
-
- request.setDestination(destination);
-
- request.setSpProvidedId(spUserId);
-
- STORKLogoutRequest req1 = engine0.generateSTORKLogoutRequest(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/LogoutRequest.xml"));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
- try {
- output.write(reqByte);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+
+ /**
+ * Test generate authentication request.
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateLogoutRequest() throws STORKSAMLEngineException {
+
+ final STORKLogoutRequest request = new STORKLogoutRequest();
+
+ request.setDestination(destination);
+
+ request.setSpProvidedId(spUserId);
+
+ STORKLogoutRequest req1 = engine0.generateSTORKLogoutRequest(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/LogoutRequest.xml"));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ output.write(reqByte);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKLogoutRequest(request).getTokenSaml()));
+
+ LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKLogoutRequest(request).getTokenSaml()));
}
-
- LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKLogoutRequest(request).getTokenSaml()));
-
- LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKLogoutRequest(request).getTokenSaml()));
- }
}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkLogoutResponseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkLogoutResponseTest.java
index 2d05e04aa..b9907002a 100644
--- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkLogoutResponseTest.java
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkLogoutResponseTest.java
@@ -19,124 +19,123 @@ import eu.stork.peps.auth.commons.STORKLogoutResponse;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
-
public class StorkLogoutResponseTest {
-
- /** 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");
-
- public StorkLogoutResponseTest() {
- destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
- spUserId = "IS/IS/1234567890";
- }
-
- /** The destination. */
- private String destination;
-
- /** The user id. */
- private String spUserId;
-
- /** The logout request. */
- private static byte[] logoutRequest;
-
- /** The logout response. */
- private static byte[] logoutResponse;
-
- /** The Constant LOG. */
- private static final Logger LOG = LoggerFactory
- .getLogger(StorkLogoutResponseTest.class.getName());
-
- /** Parser manager used to parse XML. */
- private static BasicParserPool parser;
-
- static {
+
+ /** 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");
+
+ public StorkLogoutResponseTest() {
+ destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+ spUserId = "IS/IS/1234567890";
+ }
+
+ /** The destination. */
+ private String destination;
+
+ /** The user id. */
+ private String spUserId;
+
+ /** The logout request. */
+ private static byte[] logoutRequest;
+
+ /** The logout response. */
+ private static byte[] logoutResponse;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory.getLogger(StorkLogoutResponseTest.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 testGenerateLogoutRequest() throws STORKSAMLEngineException {
-
- final STORKLogoutRequest request = new STORKLogoutRequest();
-
- final STORKLogoutResponse response = new STORKLogoutResponse();
-
- request.setDestination(destination);
- response.setDestination(destination);
-
- request.setSpProvidedId(spUserId);
-
- STORKLogoutRequest req1 = engine0.generateSTORKLogoutRequest(request);
-
- STORKLogoutResponse res = engine0.generateSTORKLogoutResponse(req1, response);
-
- byte[] reqByte = res.getTokenSaml();
- FileOutputStream output = null;
-
- try {
- output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/LogoutResponse.xml"));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- output.write(reqByte);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
-
-
+
+ /**
+ * Test generate authentication request.
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateLogoutRequest() throws STORKSAMLEngineException {
+
+ final STORKLogoutRequest request = new STORKLogoutRequest();
+
+ final STORKLogoutResponse response = new STORKLogoutResponse();
+
+ request.setDestination(destination);
+ response.setDestination(destination);
+
+ request.setSpProvidedId(spUserId);
+
+ STORKLogoutRequest req1 = engine0.generateSTORKLogoutRequest(request);
+
+ STORKLogoutResponse res = engine0.generateSTORKLogoutResponse(req1, response);
+
+ byte[] reqByte = res.getTokenSaml();
+ FileOutputStream output = null;
+
+ try {
+ output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/LogoutResponse.xml"));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ output.write(reqByte);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
assertNotNull(reqByte);
- }
-
- /**
- * Test generate authentication request.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateLogoutRequestFail() throws STORKSAMLEngineException {
-
- final STORKLogoutRequest request = new STORKLogoutRequest();
-
- final STORKLogoutResponse response = new STORKLogoutResponse();
-
- request.setDestination(destination);
- response.setDestination(destination);
- response.setStatusMessage("User not found.");
- response.setStatusCode("1234");
- request.setSpProvidedId(spUserId);
-
- STORKLogoutRequest req1 = engine0.generateSTORKLogoutRequest(request);
-
- STORKLogoutResponse res = engine0.generateSTORKLogoutResponseFail(req1, response);
-
- byte[] reqByte = res.getTokenSaml();
- FileOutputStream output = null;
-
- try {
- output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/LogoutResponseFail.xml"));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- output.write(reqByte);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
-
+
+ /**
+ * Test generate authentication request.
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateLogoutRequestFail() throws STORKSAMLEngineException {
+
+ final STORKLogoutRequest request = new STORKLogoutRequest();
+
+ final STORKLogoutResponse response = new STORKLogoutResponse();
+
+ request.setDestination(destination);
+ response.setDestination(destination);
+ response.setStatusMessage("User not found.");
+ response.setStatusCode("1234");
+ request.setSpProvidedId(spUserId);
+
+ STORKLogoutRequest req1 = engine0.generateSTORKLogoutRequest(request);
+
+ STORKLogoutResponse res = engine0.generateSTORKLogoutResponseFail(req1, response);
+
+ byte[] reqByte = res.getTokenSaml();
+ FileOutputStream output = null;
+
+ try {
+ output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/LogoutResponseFail.xml"));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ output.write(reqByte);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
assertNotNull(reqByte);
- }
+ }
}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkNewResponseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkNewResponseTest.java
index 62e9cfb18..876c2c14d 100644
--- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkNewResponseTest.java
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkNewResponseTest.java
@@ -27,382 +27,370 @@ import eu.stork.peps.auth.commons.STORKStatusCode;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
-
public class StorkNewResponseTest {
/** The engine. */
- private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
- private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0");
-
- /**
- * Gets the engine.
- *
- * @return the engine
- */
- public static STORKSAMLEngine getEngine() {
- return engine;
- }
-
- public static STORKSAMLEngine getEngine2() {
- return engine0;
- }
-
- /**
- * Sets the engine.
- *
- * @param newEngine the new engine
- */
- public static void setEngine(final STORKSAMLEngine newEngine) {
- StorkNewResponseTest.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 List of Personal Attributes. */
- private static IPersonalAttributeList pal2;
-
- /** 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 StorkNewResponseTest() {
- 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;
-
- /** The attribute query request. */
- private static STORKAttrQueryRequest attrQueryenRequest;
-
- /** The attribute query response. */
- private static STORKAttrQueryResponse attrQeuryenResponse;
-
- /** The attribute query request. */
- private static byte[] attrQueryRequest;
-
- /** The attribute query response. */
- private static byte[] attrQueryResponse;
-
-
-
- static {
- parser = new BasicParserPool();
- parser.setNamespaceAware(true);
-
- pal = new PersonalAttributeList();
- pal2 = new PersonalAttributeList();
-
- PersonalAttribute isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(false);
- ArrayList<String> ages = new ArrayList<String>();
- 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);
-
- PersonalAttribute hasDegree = new PersonalAttribute();
- hasDegree.setName("hasDegree");
- List<String> vals = new ArrayList<String>();
- vals.add("Engineering");
- vals.add("Computer Science");
- hasDegree.setValue(vals);
- pal2.add(hasDegree);
-
- PersonalAttribute mandate = new PersonalAttribute();
- mandate.setName("mandateContent");
- List<String> manvalues = new ArrayList<String>();
- manvalues.add("Powers");
- mandate.setValue(manvalues);
- pal2.add(mandate);
-
- 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");
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+ private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0");
+
+ /**
+ * Gets the engine.
+ *
+ * @return the engine
+ */
+ public static STORKSAMLEngine getEngine() {
+ return engine;
+ }
+
+ public static STORKSAMLEngine getEngine2() {
+ return engine0;
}
- ipAddress = "111.222.333.444";
-
- pal = new PersonalAttributeList();
-
- isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(true);
- ages = new ArrayList<String>();
-
- 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<String> date = new ArrayList<String>();
- 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<String> idNumber = new ArrayList<String>();
- idNumber.add("123456789PA");
- 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<String, String> address = new HashMap<String, String>();
-
- 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<String, String> values = new HashMap<String, String>();
-
- values.put("value1", "value1");
- values.put("value2", "value2");
- values.put("value3", "value3");
- values.put("value4", "value4");
-
- newAttribute.setComplexValue(values);
- pal.add(newAttribute);
-
- final STORKAttrQueryRequest arequest = new STORKAttrQueryRequest();
- arequest.setDestination(destination);
- //request.setProviderName(spName);
- arequest.setQaa(QAAL);
- arequest.setPersonalAttributeList(pal2);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- arequest.setSpSector(spSector);
- arequest.setSpInstitution(spInstitution);
- arequest.setSpApplication(spApplication);
- arequest.setSpCountry(spCountry);
- arequest.setSPID(spId);
- arequest.setCitizenCountryCode("IS");
- arequest.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- try {
- attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(arequest)
- .getTokenSaml();
-
- attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest);
-
- } catch (STORKSAMLEngineException e) {
- fail("Error create STORKAuthnRequest");
+ /**
+ * Sets the engine.
+ *
+ * @param newEngine
+ * the new engine
+ */
+ public static void setEngine(final STORKSAMLEngine newEngine) {
+ StorkNewResponseTest.engine = newEngine;
}
-
- }
-
- /**
- * Test generate authentication request without errors.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAuthnResponseWithSimpleRes() throws STORKSAMLEngineException {
-
- //Create the response holding pal
+
+ /** 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 List of Personal Attributes. */
+ private static IPersonalAttributeList pal2;
+
+ /** 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 StorkNewResponseTest() {
+ 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;
+
+ /** The attribute query request. */
+ private static STORKAttrQueryRequest attrQueryenRequest;
+
+ /** The attribute query response. */
+ private static STORKAttrQueryResponse attrQeuryenResponse;
+
+ /** The attribute query request. */
+ private static byte[] attrQueryRequest;
+
+ /** The attribute query response. */
+ private static byte[] attrQueryResponse;
+
+ static {
+ parser = new BasicParserPool();
+ parser.setNamespaceAware(true);
+
+ pal = new PersonalAttributeList();
+ pal2 = new PersonalAttributeList();
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(false);
+ ArrayList<String> ages = new ArrayList<String>();
+ 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);
+
+ PersonalAttribute hasDegree = new PersonalAttribute();
+ hasDegree.setName("hasDegree");
+ List<String> vals = new ArrayList<String>();
+ vals.add("Engineering");
+ vals.add("Computer Science");
+ hasDegree.setValue(vals);
+ pal2.add(hasDegree);
+
+ PersonalAttribute mandate = new PersonalAttribute();
+ mandate.setName("mandateContent");
+ List<String> manvalues = new ArrayList<String>();
+ manvalues.add("Powers");
+ mandate.setValue(manvalues);
+ pal2.add(mandate);
+
+ 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<String>();
+
+ 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<String> date = new ArrayList<String>();
+ 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<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789PA");
+ 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<String, String> address = new HashMap<String, String>();
+
+ 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<String, String> values = new HashMap<String, String>();
+
+ values.put("value1", "value1");
+ values.put("value2", "value2");
+ values.put("value3", "value3");
+ values.put("value4", "value4");
+
+ newAttribute.setComplexValue(values);
+ pal.add(newAttribute);
+
+ final STORKAttrQueryRequest arequest = new STORKAttrQueryRequest();
+ arequest.setDestination(destination);
+ // request.setProviderName(spName);
+ arequest.setQaa(QAAL);
+ arequest.setPersonalAttributeList(pal2);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ arequest.setSpSector(spSector);
+ arequest.setSpInstitution(spInstitution);
+ arequest.setSpApplication(spApplication);
+ arequest.setSpCountry(spCountry);
+ arequest.setSPID(spId);
+ arequest.setCitizenCountryCode("IS");
+ arequest.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ try {
+ attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(arequest).getTokenSaml();
+
+ attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest);
+
+ } catch (STORKSAMLEngineException e) {
+ fail("Error create STORKAuthnRequest");
+ }
+
+ }
+
+ /**
+ * Test generate authentication request without errors.
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnResponseWithSimpleRes() throws STORKSAMLEngineException {
+
+ // Create the response holding pal
final STORKAuthnResponse response = new STORKAuthnResponse();
response.setPersonalAttributeList(pal);
-
- //List of query responses
+
+ // List of query responses
List<STORKAttrQueryResponse> resList = new ArrayList<STORKAttrQueryResponse>();
-
+
final STORKAttrQueryResponse aResponse1 = new STORKAttrQueryResponse();
aResponse1.setPersonalAttributeList(pal2);
-
- final STORKAttrQueryResponse aStorkResponse1 = getEngine2()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse1, ipAddress,
- destination, isNotHashing);
-
+
+ final STORKAttrQueryResponse aStorkResponse1 = getEngine2().generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse1, ipAddress, destination, isNotHashing);
+
attrQueryResponse = aStorkResponse1.getTokenSaml();
-
+
resList.add(getEngine2().validateSTORKAttrQueryResponse(attrQueryResponse, ipAddress));
-
+
final STORKAttrQueryResponse aResponse2 = new STORKAttrQueryResponse();
aResponse2.setPersonalAttributeList(pal2);
-
- final STORKAttrQueryResponse aStorkResponse2 = getEngine()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse2, ipAddress,
- destination, isNotHashing);
-
+
+ final STORKAttrQueryResponse aStorkResponse2 = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse2, ipAddress, destination, isNotHashing);
+
attrQueryResponse = aStorkResponse2.getTokenSaml();
-
+
resList.add(getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, ipAddress));
-
- //Create the final response containing query responses
- final STORKAuthnResponse storkResponse = getEngine()
- .generateSTORKAuthnResponseAfterQuery(authenRequest, response, ipAddress,
- isNotHashing, resList);
+
+ // Create the final response containing query responses
+ final STORKAuthnResponse storkResponse = getEngine().generateSTORKAuthnResponseAfterQuery(authenRequest, response, ipAddress, isNotHashing, resList);
authResponse = storkResponse.getTokenSaml();
-
- //Validate, write out and print out the attribute lists a
+
+ // Validate, write out and print out the attribute lists a
STORKAuthnResponse finalResponse = getEngine().validateSTORKAuthnResponseWithQuery(authResponse, ipAddress);
System.out.println("The original pal: " + finalResponse.getPersonalAttributeList().toString());
- for (int i = 0; i < finalResponse.getPersonalAttributeLists().size(); i++)
- {
- System.out.println("Pal "+ Integer.toString(i) + ": " + finalResponse.getPersonalAttributeLists().get(i).toString());
+ for (int i = 0; i < finalResponse.getPersonalAttributeLists().size(); i++) {
+ System.out.println("Pal " + Integer.toString(i) + ": " + finalResponse.getPersonalAttributeLists().get(i).toString());
}
System.out.println("The total pal: " + finalResponse.getTotalPersonalAttributeList().toString());
-
+
FileOutputStream output = null;
-
+
try {
output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthAttrQResponse.xml"));
} catch (FileNotFoundException e) {
@@ -415,107 +403,96 @@ public class StorkNewResponseTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
- }
-
- /**
- * Test generate authentication request without errors.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAuthnResponseWithComplexRes() throws STORKSAMLEngineException {
-
- //Create the response holding pal
+ }
+
+ /**
+ * Test generate authentication request without errors.
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnResponseWithComplexRes() throws STORKSAMLEngineException {
+
+ // Create the response holding pal
final STORKAuthnResponse response = new STORKAuthnResponse();
response.setPersonalAttributeList(pal);
-
- //Create a list for the attribute query responses we have
+
+ // Create a list for the attribute query responses we have
List<STORKAttrQueryResponse> resList = new ArrayList<STORKAttrQueryResponse>();
-
- //Create the first attribute query response
+
+ // Create the first attribute query response
final STORKAttrQueryResponse aResponse1 = new STORKAttrQueryResponse();
aResponse1.setPersonalAttributeList(pal2);
-
- //Generate the first response
- final STORKAttrQueryResponse aStorkResponse1 = getEngine2()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse1, ipAddress,
- destination, isNotHashing);
-
+
+ // Generate the first response
+ final STORKAttrQueryResponse aStorkResponse1 = getEngine2().generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse1, ipAddress, destination, isNotHashing);
+
attrQueryResponse = aStorkResponse1.getTokenSaml();
-
- //Validate it and add to the response list
+
+ // Validate it and add to the response list
resList.add(getEngine2().validateSTORKAttrQueryResponse(attrQueryResponse, ipAddress));
-
- //Create a second response like the first
+
+ // Create a second response like the first
final STORKAttrQueryResponse aResponse2 = new STORKAttrQueryResponse();
aResponse2.setPersonalAttributeList(pal2);
-
- final STORKAttrQueryResponse aStorkResponse2 = getEngine()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse2, ipAddress,
- destination, isNotHashing);
-
+
+ final STORKAttrQueryResponse aStorkResponse2 = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse2, ipAddress, destination, isNotHashing);
+
attrQueryResponse = aStorkResponse2.getTokenSaml();
-
+
resList.add(getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, ipAddress));
-
- //Create a attribute query response which contains multiple assertions from an AP
+
+ // Create a attribute query response which contains multiple assertions from an AP
final STORKAttrQueryResponse aResponseMulti = new STORKAttrQueryResponse();
aResponseMulti.setPersonalAttributeList(pal2);
-
- //Create a list for the responses which the multiple assertion response will hold
+
+ // Create a list for the responses which the multiple assertion response will hold
List<STORKAttrQueryResponse> multiResponses = new ArrayList();
-
- //Create two more simple responses which the multi assertion response will hold
+
+ // Create two more simple responses which the multi assertion response will hold
final STORKAttrQueryResponse aResponse3 = new STORKAttrQueryResponse();
aResponse3.setPersonalAttributeList(pal2);
-
- final STORKAttrQueryResponse aStorkResponse3 = getEngine2()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse3, ipAddress,
- destination, isNotHashing);
-
+
+ final STORKAttrQueryResponse aStorkResponse3 = getEngine2().generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse3, ipAddress, destination, isNotHashing);
+
attrQueryResponse = aStorkResponse3.getTokenSaml();
- //Validate and add to the multi response
+ // Validate and add to the multi response
multiResponses.add(getEngine2().validateSTORKAttrQueryResponse(attrQueryResponse, ipAddress));
-
+
final STORKAttrQueryResponse aResponse4 = new STORKAttrQueryResponse();
aResponse4.setPersonalAttributeList(pal2);
-
- final STORKAttrQueryResponse aStorkResponse4 = getEngine()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse4, ipAddress,
- destination, isNotHashing);
-
+
+ final STORKAttrQueryResponse aStorkResponse4 = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, aResponse4, ipAddress, destination, isNotHashing);
+
attrQueryResponse = aStorkResponse4.getTokenSaml();
-
+
multiResponses.add(getEngine2().validateSTORKAttrQueryResponse(attrQueryResponse, ipAddress));
-
- //Generate the multi assertion query response
- final STORKAttrQueryResponse aStorkResponseMulti = getEngine()
- .generateSTORKAttrQueryResponseWithAssertions(attrQueryenRequest, aResponseMulti, multiResponses,
- ipAddress, destination, isNotHashing);
-
+
+ // Generate the multi assertion query response
+ final STORKAttrQueryResponse aStorkResponseMulti = getEngine().generateSTORKAttrQueryResponseWithAssertions(attrQueryenRequest, aResponseMulti, multiResponses, ipAddress, destination,
+ isNotHashing);
+
attrQueryResponse = aStorkResponseMulti.getTokenSaml();
-
- //Add to the list of query responses
+
+ // Add to the list of query responses
resList.add(getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, ipAddress));
-
- //Generate the stork response with all the query responses
- final STORKAuthnResponse storkResponse = getEngine()
- .generateSTORKAuthnResponseAfterQuery(authenRequest, response, ipAddress,
- isNotHashing, resList);
+
+ // Generate the stork response with all the query responses
+ final STORKAuthnResponse storkResponse = getEngine().generateSTORKAuthnResponseAfterQuery(authenRequest, response, ipAddress, isNotHashing, resList);
authResponse = storkResponse.getTokenSaml();
-
- //Validate it, write out and print out the personal attribute lists
+
+ // Validate it, write out and print out the personal attribute lists
STORKAuthnResponse finalResponse = getEngine().validateSTORKAuthnResponseWithQuery(authResponse, ipAddress);
System.out.println("The original pal: " + finalResponse.getPersonalAttributeList().toString());
- for (int i = 0; i < finalResponse.getPersonalAttributeLists().size(); i++)
- {
- System.out.println("Pal "+ Integer.toString(i) + ": " + finalResponse.getPersonalAttributeLists().get(i).toString());
+ for (int i = 0; i < finalResponse.getPersonalAttributeLists().size(); i++) {
+ System.out.println("Pal " + Integer.toString(i) + ": " + finalResponse.getPersonalAttributeLists().get(i).toString());
}
System.out.println("The total pal: " + finalResponse.getTotalPersonalAttributeList().toString());
-
+
FileOutputStream output = null;
-
+
try {
output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthAttrQMultiAssertResponse.xml"));
} catch (FileNotFoundException e) {
@@ -529,5 +506,5 @@ public class StorkNewResponseTest {
e.printStackTrace();
}
assertNotNull(finalResponse);
- }
+ }
}
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
index fe6fcd4f6..d09ed7648 100644
--- 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
@@ -49,839 +49,783 @@ 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<String> ages = new ArrayList<String>();
- 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");
+
+ /** 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<String> ages = new ArrayList<String>();
+ 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<String>();
+
+ 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<String> date = new ArrayList<String>();
+ 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<String> idNumber = new ArrayList<String>();
+ 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<String, String> address = new HashMap<String, String>();
+
+ 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<String, String> values = new HashMap<String, String>();
+
+ 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));
+
}
- ipAddress = "111.222.333.444";
-
- pal = new PersonalAttributeList();
-
- isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(true);
- ages = new ArrayList<String>();
-
- 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<String> date = new ArrayList<String>();
- 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<String> idNumber = new ArrayList<String>();
- 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<String, String> address = new HashMap<String, String>();
-
- 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<String, String> values = new HashMap<String, String>();
-
- 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 is fail.
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseIsFail() throws STORKSAMLEngineException {
+ if (authResponse == null)
+ testGenerateAuthnResponse();
+
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, ipAddress);
+
+ assertFalse("Generate incorrect response: ", authnResponse.isFail());
}
- }
-
-
- /**
- * 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 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 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 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<PersonalAttribute> 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 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 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 validate authentication response is fail.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthenticationResponseIsFail()
- throws STORKSAMLEngineException {
- if (authResponse == null)
- testGenerateAuthnResponse();
-
- authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
- ipAddress);
-
- assertFalse("Generate incorrect response: ", authnResponse.isFail());
- }
-
- /**
- * 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<PersonalAttribute> 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 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 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 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 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 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<String> ages = new ArrayList<String>();
+ 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<String> date = new ArrayList<String>();
+ 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<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789PÑ");
+
+ final HashMap<String, String> complex = new HashMap<String, String>();
+ 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<String, String> address = new HashMap<String, String>();
+
+ 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 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 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 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<String> ages = new ArrayList<String>();
- 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<String> date = new ArrayList<String>();
- 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<String> idNumber = new ArrayList<String>();
- idNumber.add("123456789PÑ");
-
- final HashMap<String, String> complex = new HashMap<String, String>();
- 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<String, String> address = new HashMap<String, String>();
-
- 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
*
@@ -889,8 +833,7 @@ public class StorkResponseTest {
* the STORKSAML engine exception
*/
@Test
- public final void testGenerateAuthenResponseWithSignedDoc()
- throws STORKSAMLEngineException {
+ public final void testGenerateAuthenResponseWithSignedDoc() throws STORKSAMLEngineException {
String signedDocResponse = "<dss:SignResponse xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"123456\"> <dss:Result> <dss:ResultMajor>urn:oasis:names:tc:dss:1.0:resultmajor:Success</dss:ResultMajor> </dss:Result> <dss:SignatureObject> <dss:Base64Signature Type=\"urn:ietf:rfc:3275\">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+</dss:Base64Signature> </dss:SignatureObject> </dss:SignResponse>";
@@ -919,17 +862,12 @@ public class StorkResponseTest {
response.setPersonalAttributeList(palist);
- final STORKAuthnResponse storkResponse = getEngine()
- .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
- isNotHashing);
+ final STORKAuthnResponse storkResponse = getEngine().generateSTORKAuthnResponse(authenRequest, response, ipAddress, isNotHashing);
authResponse = storkResponse.getTokenSaml();
- authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
- ipAddress);
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse, ipAddress);
- assertTrue("SignedDoc response should be the same: ", authnResponse
- .getPersonalAttributeList().get("signedDoc").getValue().get(0)
- .equals(signedDocResponse));
+ 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/resources/SamlEngine.xml b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml
index 171e05f12..fadef82b2 100644
--- a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml
@@ -1,67 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<instances>
- <!-- Configuration name -->
- <instance name="CONF0">
- <!-- Configurations parameters StorkSamlEngine -->
- <configuration name="SamlEngineConf">
- <parameter name="fileConfiguration" value="StorkSamlEngine_Conf0.xml" />
- </configuration>
+ <!-- Configuration name -->
+ <instance name="CONF0">
+ <!-- Configurations parameters StorkSamlEngine -->
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf0.xml" />
+ </configuration>
- <!-- Settings module signature -->
- <configuration name="SignatureConf">
- <!-- Specific signature module -->
- <parameter name="class"
- value="eu.stork.peps.auth.engine.core.impl.SignSW" />
- <!-- Settings specific module -->
- <parameter name="fileConfiguration" value="SignModule_Conf0.xml" />
- </configuration>
- </instance>
+ <!-- Settings module signature -->
+ <configuration name="SignatureConf">
+ <!-- Specific signature module -->
+ <parameter name="class"
+ value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <!-- Settings specific module -->
+ <parameter name="fileConfiguration" value="SignModule_Conf0.xml" />
+ <parameter name="softTrustStoreConfig" value="SignModule_Conf0.xml" />
+ </configuration>
+ </instance>
- <!-- ******************** CONF1 ******************** -->
- <!-- Configuration name -->
- <instance name="CONF1">
- <!-- Configurations parameters StorkSamlEngine -->
- <configuration name="SamlEngineConf">
- <parameter name="fileConfiguration" value="StorkSamlEngine_Conf1.xml" />
- </configuration>
+ <!-- ******************** CONF1 ******************** -->
+ <!-- Configuration name -->
+ <instance name="CONF1">
+ <!-- Configurations parameters StorkSamlEngine -->
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf1.xml" />
+ </configuration>
- <!-- Settings module signature -->
- <configuration name="SignatureConf">
- <!-- Specific signature module -->
- <parameter name="class"
- value="eu.stork.peps.auth.engine.core.impl.SignSW" />
- <!-- Settings specific module -->
- <parameter name="fileConfiguration" value="SignModule_Conf1.xml" />
- </configuration>
- </instance>
+ <!-- Settings module signature -->
+ <configuration name="SignatureConf">
+ <!-- Specific signature module -->
+ <parameter name="class"
+ value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <!-- Settings specific module -->
+ <parameter name="fileConfiguration" value="SignModule_Conf1.xml" />
+ </configuration>
+ </instance>
- <!-- ******************** CONF2 ******************** -->
+ <!-- ******************** CONF2 ******************** -->
- <instance name="CONF2">
- <configuration name="SamlEngineConf">
- <parameter name="fileConfiguration" value="StorkSamlEngine_Conf2.xml" />
- </configuration>
+ <instance name="CONF2">
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf2.xml" />
+ </configuration>
- <configuration name="SignatureConf">
- <parameter name="class"
- value="eu.stork.peps.auth.engine.core.impl.SignSW" />
- <parameter name="fileConfiguration" value="SignModule_Conf2.xml" />
- </configuration>
- </instance>
+ <configuration name="SignatureConf">
+ <parameter name="class"
+ value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <parameter name="fileConfiguration" value="SignModule_Conf2.xml" />
+ </configuration>
+ </instance>
- <!-- ******************** CONF3 ******************** -->
+ <!-- ******************** CONF3 ******************** -->
- <instance name="CONF3">
- <configuration name="SamlEngineConf">
- <parameter name="fileConfiguration" value="StorkSamlEngine_Conf3.xml" />
- </configuration>
+ <instance name="CONF3">
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf3.xml" />
+ </configuration>
- <configuration name="SignatureConf">
- <parameter name="class"
- value="eu.stork.peps.auth.engine.core.impl.SignSW" />
- <parameter name="fileConfiguration" value="SignModule_Conf3.xml" />
- </configuration>
- </instance>
+ <configuration name="SignatureConf">
+ <parameter name="class"
+ value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <parameter name="fileConfiguration" value="SignModule_Conf3.xml" />
+ </configuration>
+ </instance>
+
+ <!-- ******************** CONF4 ******************** -->
+ <instance name="CONF4">
+ <!-- Configurations parameters StorkSamlEngine -->
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf0.xml" />
+ </configuration>
+
+ <!-- Settings module signature -->
+ <configuration name="SignatureConf">
+ <!-- Specific signature module -->
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignHW" />
+ <!-- Settings specific module -->
+ <parameter name="fileConfiguration" value="SignModule_P11.xml" />
+ <parameter name="softTrustStoreConfig" value="SignModule_Conf0.xml" />
+ </configuration>
+ </instance>
</instances> \ 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
index a9f2038b8..295258bb2 100644
--- a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml
@@ -2,20 +2,20 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<!-- properties>
- <comment>SWModule sign with JKS.</comment>
- <entry key="keystorePath">C:\opt\keystores\keyStoreCountry0.jks</entry>
- <entry key="keyStorePassword">local-demo</entry>
- <entry key="keyPassword">local-demo</entry>
- <entry key="issuer">CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS</entry>
- <entry key="serialNumber">524D4C6C</entry>
- <entry key="keystoreType">JKS</entry>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">C:\opt\keystores\keyStoreCountry0.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS</entry>
+ <entry key="serialNumber">524D4C6C</entry>
+ <entry key="keystoreType">JKS</entry>
</properties-->
<properties>
- <comment>SWModule sign with JKS.</comment>
- <entry key="keystorePath">C:\opt\keystores\storkDemoKeysTest.jks</entry>
- <entry key="keyStorePassword">local-demo</entry>
- <entry key="keyPassword">local-demo</entry>
- <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
- <entry key="serialNumber">4BA89DB2</entry>
- <entry key="keystoreType">JKS</entry>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">C:\opt\keystores\storkDemoKeysTest.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">4BA89DB2</entry>
+ <entry key="keystoreType">JKS</entry>
</properties> \ 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
index e556a7331..ffd41cb61 100644
--- a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml
@@ -2,11 +2,11 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <comment>SWModule sign with JKS.</comment>
- <entry key="keystorePath">C:\opt\keystores\storkDemoKeysTest.jks</entry>
- <entry key="keyStorePassword">local-demo</entry>
- <entry key="keyPassword">local-demo</entry>
- <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
- <entry key="serialNumber">4BA89DB2</entry>
- <entry key="keystoreType">JKS</entry>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">C:\opt\keystores\storkDemoKeysTest.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">4BA89DB2</entry>
+ <entry key="keystoreType">JKS</entry>
</properties> \ 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
index 3da1e33df..21b73d49d 100644
--- a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml
@@ -2,11 +2,11 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <comment>SWModule sign with JKS.</comment>
- <entry key="keystorePath">C:\opt\keystores\keyStoreCountry2.jks</entry>
- <entry key="keyStorePassword">local-demo</entry>
- <entry key="keyPassword">local-demo</entry>
- <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
- <entry key="serialNumber">4BA89DB2</entry>
- <entry key="keystoreType">JKS</entry>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">C:\opt\keystores\keyStoreCountry2.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">4BA89DB2</entry>
+ <entry key="keystoreType">JKS</entry>
</properties> \ 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
index 4c14a1711..f9ebc85cc 100644
--- a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml
@@ -2,11 +2,11 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <comment>SWModule sign with JKS.</comment>
- <entry key="keystorePath">C:\opt\keystores\keyStoreCountry3.jks</entry>
- <entry key="keyStorePassword">local-demo</entry>
- <entry key="keyPassword">local-demo</entry>
- <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
- <entry key="serialNumber">4BA89DB2</entry>
- <entry key="keystoreType">JKS</entry>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">C:\opt\keystores\keyStoreCountry3.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">4BA89DB2</entry>
+ <entry key="keystoreType">JKS</entry>
</properties> \ 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
index c683d97c3..0e95da1f2 100644
--- a/id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml
@@ -2,10 +2,11 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <comment>HWModule sign with interface PKCS11.</comment>
- <entry key="configurationFile">p11Config.cfg</entry>
- <entry key="keyPassword">*******</entry>
- <entry key="issuer">CN=XXXXXXXXX</entry>
- <entry key="serialNumber">xxxxxxxxxxxxxx</entry>
- <entry key="keystoreType">PKCS11</entry>
+ <comment>HWModule sign with interface PKCS11.</comment>
+ <entry key="configurationFile">p11Conf.cfg</entry>
+ <entry key="keyPassword">12345</entry>
+ <entry key="issuer">CN=Test Certificate</entry>
+ <entry key="serialNumber">147d4b07db8</entry>
+ <entry key="keystoreType">PKCS11</entry>
+ <entry key="trustStoreConfig">SignModule_Conf0.xml</entry>
</properties> \ 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
index 8c3a94601..2a266a975 100644
--- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml
@@ -2,86 +2,111 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <comment>SAML constants for AuthnRequests and Responses.</comment>
-
- <!-- Types of consent obtained from the user for this authentication and
- data transfer. Allow values: 'unspecified'. -->
- <entry key="consentAuthnRequest">unspecified</entry>
-
- <!-- Allow values: 'obtained', 'prior', 'current-implicit', 'current-explicit',
- 'unspecified'. -->
- <entry key="consentAuthnResponse">obtained</entry>
-
- <!--URI representing the classification of the identifier Allow values:
- 'entity'. -->
- <entry key="formatEntity">entity</entry>
-
- <!--Only HTTP-POST binding is only supported for inter PEPS -->
- <!--The SOAP binding is only supported for direct communication between
- SP-MW and VIdP -->
- <entry key="protocolBinding">HTTP-POST</entry>
-
-
-
-
- <!--URI representing the classification of the identifier Allow values:
- 'entity'. <entry key="eIDSectorShare">true</entry> <entry key="eIDCrossSectorShare">true</entry>
- <entry key="eIDCrossBorderShare">true</entry> -->
-
-
-
- <!-- A friendly name for the attribute that can be displayed to a user -->
- <entry key="friendlyName">false</entry>
-
- <!-- A friendly name for the attribute that can be displayed to a user -->
- <entry key="isRequired">true</entry>
-
- <!--PEPS in the Service Provider's country -->
- <entry key="requester">http://S-PEPS.gov.xx</entry>
-
- <!--PEPS in the citizen's origin country -->
- <entry key="responder">http://C-PEPS.gov.xx</entry>
-
- <!--Subject cannot be confirmed on or after this seconds time (positive
- number) -->
- <entry key="timeNotOnOrAfter">300</entry>
-
- <!--Validation IP of the response -->
- <entry key="ipAddrValidation">false</entry>
-
-
- <!--Subject Attribute Definitions -->
- <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry>
- <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry>
- <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry>
- <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry>
- <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry>
- <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry>
- <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry>
- <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry>
- <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry>
- <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry>
- <entry key="residenceAddress">http://www.stork.gov.eu/1.0/residenceAddress</entry>
- <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry>
- <entry key="academicTitle">http://www.stork.gov.eu/1.0/academicTitle</entry>
- <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry>
- <entry key="age">http://www.stork.gov.eu/1.0/age</entry>
- <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry>
-
- <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry>
- <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry>
-
- <entry key="title">http://www.stork.gov.eu/1.0/title</entry>
- <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry>
-
- <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry>
- <entry key="citizen509Certificate">http://www.stork.gov.eu/1.0/citizen509Certificate</entry>
-
- <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry>
- <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry>
- <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
- <entry key="mandateContent">http://www.stork.gov.eu/1.0/mandateContent</entry>
-
- <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry>
+ <comment>SAML constants for AuthnRequests and Responses.</comment>
+
+ <!-- Types of consent obtained from the user for this authentication and
+ data transfer. Allow values: 'unspecified'. -->
+ <entry key="consentAuthnRequest">unspecified</entry>
+
+ <!-- Allow values: 'obtained', 'prior', 'current-implicit', 'current-explicit',
+ 'unspecified'. -->
+ <entry key="consentAuthnResponse">obtained</entry>
+
+ <!--URI representing the classification of the identifier Allow values:
+ 'entity'. -->
+ <entry key="formatEntity">entity</entry>
+
+ <!--Only HTTP-POST binding is only supported for inter PEPS -->
+ <!--The SOAP binding is only supported for direct communication between
+ SP-MW and VIdP -->
+ <entry key="protocolBinding">HTTP-POST</entry>
+
+
+
+
+ <!--URI representing the classification of the identifier Allow values:
+ 'entity'. <entry key="eIDSectorShare">true</entry> <entry key="eIDCrossSectorShare">true</entry>
+ <entry key="eIDCrossBorderShare">true</entry> -->
+
+
+
+ <!-- A friendly name for the attribute that can be displayed to a user -->
+ <entry key="friendlyName">false</entry>
+
+ <!-- A friendly name for the attribute that can be displayed to a user -->
+ <entry key="isRequired">true</entry>
+
+ <!--PEPS in the Service Provider's country -->
+ <entry key="requester">http://S-PEPS.gov.xx</entry>
+
+ <!--PEPS in the citizen's origin country -->
+ <entry key="responder">http://C-PEPS.gov.xx</entry>
+
+ <!-- Format -->
+ <entry key="format">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</entry>
+
+ <!--Subject cannot be confirmed on or after this seconds time (positive
+ number) -->
+ <entry key="timeNotOnOrAfter">300</entry>
+
+ <!--Validation IP of the response -->
+ <entry key="ipAddrValidation">false</entry>
+
+
+ <!--Subject Attribute Definitions-->
+ <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry>
+ <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry>
+ <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry>
+ <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry>
+ <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry>
+ <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry>
+ <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry>
+ <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry>
+ <entry key="placeOfBirth">http://www.stork.gov.eu/1.0/placeOfBirth</entry>
+ <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry>
+ <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry>
+ <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry>
+ <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry>
+ <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry>
+ <entry key="title">http://www.stork.gov.eu/1.0/title</entry>
+ <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry>
+ <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry>
+ <entry key="age">http://www.stork.gov.eu/1.0/age</entry>
+ <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry>
+ <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry>
+ <entry key="citizenQAALevel">http://www.stork.gov.eu/1.0/citizenQAALevel</entry>
+ <entry key="fiscalNumber">http://www.stork.gov.eu/1.0/fiscalNumber</entry>
+ <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry>
+ <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry>
+ <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry>
+ <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
+
+ <entry key="diplomaSupplement">http://www.stork.gov.eu/1.0/diplomaSupplement</entry>
+ <entry key="currentStudiesSupplement">http://www.stork.gov.eu/1.0/currentStudiesSupplement</entry>
+ <entry key="isStudent">http://www.stork.gov.eu/1.0/isStudent</entry>
+ <entry key="isAcademicStaff">http://www.stork.gov.eu/1.0/isAcademicStaff</entry>
+ <entry key="isTeacherOf">http://www.stork.gov.eu/1.0/isTeacherOf</entry>
+ <entry key="isCourseCoordinator">http://www.stork.gov.eu/1.0/isCourseCoordinator</entry>
+ <entry key="isAdminStaff">http://www.stork.gov.eu/1.0/isAdminStaff</entry>
+ <entry key="habilitation">http://www.stork.gov.eu/1.0/habilitation</entry>
+ <entry key="Title">http://www.stork.gov.eu/1.0/Title</entry>
+ <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
+ <entry key="hasAccountInBank">http://www.stork.gov.eu/1.0/hasAccountInBank</entry>
+ <entry key="isHealthCareProfessional">http://www.stork.gov.eu/1.0/isHealthCareProfessional</entry>
+
+ <entry key="eLPIdentifier">http://www.stork.gov.eu/1.0/eLPIdentifier</entry>
+ <entry key="legalName">http://www.stork.gov.eu/1.0/legalName</entry>
+ <entry key="alternativeName">http://www.stork.gov.eu/1.0/alternativeName</entry>
+ <entry key="type">http://www.stork.gov.eu/1.0/type</entry>
+ <entry key="translatableType">http://www.stork.gov.eu/1.0/translatableType</entry>
+ <entry key="status">http://www.stork.gov.eu/1.0/status</entry>
+ <entry key="activity">http://www.stork.gov.eu/1.0/activity</entry>
+ <entry key="registeredAddress">http://www.stork.gov.eu/1.0/registeredAddress</entry>
+ <entry key="registeredCanonicalAddress">http://www.stork.gov.eu/1.0/registeredCanonicalAddress</entry>
+ <entry key="contactInformation">http://www.stork.gov.eu/1.0/contactInformation</entry>
+ <entry key="LPFiscalNumber">http://www.stork.gov.eu/1.0/LPFiscalNumber</entry>
+ <entry key="mandate">http://www.stork.gov.eu/1.0/mandate</entry>
+ <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry>
+
</properties> \ 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
index ad04cc3df..a65717a05 100644
--- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml
@@ -2,84 +2,110 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <comment>SAML constants for AuthnRequests and Responses.</comment>
-
- <!-- Types of consent obtained from the user for this authentication and
- data transfer. Allow values: 'unspecified'. -->
- <entry key="consentAuthnRequest">unspecified</entry>
-
- <!-- Allow values: 'obtained', 'prior', 'current-implicit', 'current-explicit',
- 'unspecified'. -->
- <entry key="consentAuthnResponse">obtained</entry>
-
- <!--URI representing the classification of the identifier Allow values:
- 'entity'. -->
- <entry key="formatEntity">entity</entry>
-
- <!--Only HTTP-POST binding is only supported for inter PEPS -->
- <!--The SOAP binding is only supported for direct communication between
- SP-MW and VIdP -->
- <entry key="protocolBinding">HTTP-POST</entry>
-
-
-
-
- <!--URI representing the classification of the identifier Allow values:
- 'entity'. <entry key="eIDSectorShare">true</entry> <entry key="eIDCrossSectorShare">true</entry>
- <entry key="eIDCrossBorderShare">true</entry> -->
-
-
-
- <!-- A friendly name for the attribute that can be displayed to a user -->
- <entry key="friendlyName">false</entry>
-
- <!-- A friendly name for the attribute that can be displayed to a user -->
- <entry key="isRequired">true</entry>
-
- <!--PEPS in the Service Provider's country -->
- <entry key="requester">http://S-PEPS.gov.xx</entry>
-
- <!--PEPS in the citizen's origin country -->
- <entry key="responder">http://C-PEPS.gov.xx</entry>
-
- <!--Subject cannot be confirmed on or after this seconds time (positive
- number) -->
- <entry key="timeNotOnOrAfter">300</entry>
-
- <!--Validation IP of the response -->
- <entry key="ipAddrValidation">false</entry>
-
-
- <!--Subject Attribute Definitions -->
- <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry>
- <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry>
- <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry>
- <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry>
- <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry>
- <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry>
- <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry>
- <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry>
- <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry>
- <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry>
- <entry key="residenceAddress">http://www.stork.gov.eu/1.0/residenceAddress</entry>
- <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry>
- <entry key="academicTitle">http://www.stork.gov.eu/1.0/academicTitle</entry>
- <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry>
- <entry key="age">http://www.stork.gov.eu/1.0/age</entry>
- <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry>
-
- <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry>
- <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry>
-
- <entry key="title">http://www.stork.gov.eu/1.0/title</entry>
- <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry>
-
- <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry>
- <entry key="citizen509Certificate">http://www.stork.gov.eu/1.0/citizen509Certificate</entry>
-
- <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry>
- <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry>
- <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
- <entry key="mandateContent">http://www.stork.gov.eu/1.0/mandateContent</entry>
+ <comment>SAML constants for AuthnRequests and Responses.</comment>
+
+ <!-- Types of consent obtained from the user for this authentication and
+ data transfer. Allow values: 'unspecified'. -->
+ <entry key="consentAuthnRequest">unspecified</entry>
+
+ <!-- Allow values: 'obtained', 'prior', 'current-implicit', 'current-explicit',
+ 'unspecified'. -->
+ <entry key="consentAuthnResponse">obtained</entry>
+
+ <!--URI representing the classification of the identifier Allow values:
+ 'entity'. -->
+ <entry key="formatEntity">entity</entry>
+
+ <!--Only HTTP-POST binding is only supported for inter PEPS -->
+ <!--The SOAP binding is only supported for direct communication between
+ SP-MW and VIdP -->
+ <entry key="protocolBinding">HTTP-POST</entry>
+
+
+
+
+ <!--URI representing the classification of the identifier Allow values:
+ 'entity'. <entry key="eIDSectorShare">true</entry> <entry key="eIDCrossSectorShare">true</entry>
+ <entry key="eIDCrossBorderShare">true</entry> -->
+
+
+
+ <!-- A friendly name for the attribute that can be displayed to a user -->
+ <entry key="friendlyName">false</entry>
+
+ <!-- A friendly name for the attribute that can be displayed to a user -->
+ <entry key="isRequired">true</entry>
+
+ <!--PEPS in the Service Provider's country -->
+ <entry key="requester">http://S-PEPS.gov.xx</entry>
+
+ <!--PEPS in the citizen's origin country -->
+ <entry key="responder">http://C-PEPS.gov.xx</entry>
+
+ <!-- Format -->
+ <entry key="format">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</entry>
+
+ <!--Subject cannot be confirmed on or after this seconds time (positive
+ number) -->
+ <entry key="timeNotOnOrAfter">300</entry>
+
+ <!--Validation IP of the response -->
+ <entry key="ipAddrValidation">false</entry>
+
+
+ <!--Subject Attribute Definitions-->
+ <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry>
+ <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry>
+ <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry>
+ <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry>
+ <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry>
+ <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry>
+ <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry>
+ <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry>
+ <entry key="placeOfBirth">http://www.stork.gov.eu/1.0/placeOfBirth</entry>
+ <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry>
+ <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry>
+ <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry>
+ <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry>
+ <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry>
+ <entry key="title">http://www.stork.gov.eu/1.0/title</entry>
+ <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry>
+ <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry>
+ <entry key="age">http://www.stork.gov.eu/1.0/age</entry>
+ <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry>
+ <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry>
+ <entry key="citizenQAALevel">http://www.stork.gov.eu/1.0/citizenQAALevel</entry>
+ <entry key="fiscalNumber">http://www.stork.gov.eu/1.0/fiscalNumber</entry>
+ <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry>
+ <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry>
+ <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry>
+ <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
+
+ <entry key="diplomaSupplement">http://www.stork.gov.eu/1.0/diplomaSupplement</entry>
+ <entry key="currentStudiesSupplement">http://www.stork.gov.eu/1.0/currentStudiesSupplement</entry>
+ <entry key="isStudent">http://www.stork.gov.eu/1.0/isStudent</entry>
+ <entry key="isAcademicStaff">http://www.stork.gov.eu/1.0/isAcademicStaff</entry>
+ <entry key="isTeacherOf">http://www.stork.gov.eu/1.0/isTeacherOf</entry>
+ <entry key="isCourseCoordinator">http://www.stork.gov.eu/1.0/isCourseCoordinator</entry>
+ <entry key="isAdminStaff">http://www.stork.gov.eu/1.0/isAdminStaff</entry>
+ <entry key="habilitation">http://www.stork.gov.eu/1.0/habilitation</entry>
+ <entry key="Title">http://www.stork.gov.eu/1.0/Title</entry>
+ <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
+ <entry key="hasAccountInBank">http://www.stork.gov.eu/1.0/hasAccountInBank</entry>
+ <entry key="isHealthCareProfessional">http://www.stork.gov.eu/1.0/isHealthCareProfessional</entry>
+
+ <entry key="eLPIdentifier">http://www.stork.gov.eu/1.0/eLPIdentifier</entry>
+ <entry key="legalName">http://www.stork.gov.eu/1.0/legalName</entry>
+ <entry key="alternativeName">http://www.stork.gov.eu/1.0/alternativeName</entry>
+ <entry key="type">http://www.stork.gov.eu/1.0/type</entry>
+ <entry key="translatableType">http://www.stork.gov.eu/1.0/translatableType</entry>
+ <entry key="status">http://www.stork.gov.eu/1.0/status</entry>
+ <entry key="activity">http://www.stork.gov.eu/1.0/activity</entry>
+ <entry key="registeredAddress">http://www.stork.gov.eu/1.0/registeredAddress</entry>
+ <entry key="registeredCanonicalAddress">http://www.stork.gov.eu/1.0/registeredCanonicalAddress</entry>
+ <entry key="contactInformation">http://www.stork.gov.eu/1.0/contactInformation</entry>
+ <entry key="LPFiscalNumber">http://www.stork.gov.eu/1.0/LPFiscalNumber</entry>
+ <entry key="mandate">http://www.stork.gov.eu/1.0/mandate</entry>
+ <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry>
</properties> \ 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
index fd1db92ac..a0a5bea10 100644
--- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml
@@ -2,59 +2,100 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <comment>SAML constants for AuthnRequests and Responses.</comment>
-
- <!-- Types of consent obtained from the user for this authentication and
- data transfer. Allow values: 'unspecified'. -->
- <entry key="consentAuthnRequest">unspecified</entry>
- <!-- Allow values: 'obtained', 'prior', 'curent-implicit', 'curent-explicit',
- 'unspecified'. -->
- <entry key="consentAuthnResponse">obtained</entry>
-
- <!--URI representing the classification of the identifier Allow values:
- 'entity'. -->
- <entry key="formatEntity">entity</entry>
-
- <!--Only HTTP-POST binding is only supported for inter PEPS -->
- <!--The SOAP binding is only supported for direct communication between
- SP-MW and VIdP -->
- <entry key="protocolBinding">HTTP-POST</entry>
-
- <entry key="eIDSectorShare">false</entry>
- <entry key="eIDCrossSectorShare">false</entry>
- <entry key="eIDCrossBorderShare">false</entry>
-
- <!--PEPS in the Service Provider's country -->
- <entry key="requester">http://S-PEPS.gov.xx</entry>
-
- <!--PEPS in the citizen's origin country -->
- <entry key="responder">http://C-PEPS.gov.xx</entry>
-
- <!--Subject cannot be confirmed on or after this seconds time -->
- <entry key="timeNotOnOrAfter">300</entry>
-
- <!--Validation IP of the response -->
- <entry key="ipAddrValidation">false</entry>
-
- <!-- A friendly name for the attribute that can be displayed to a user -->
- <entry key="isRequired">false</entry>
-
-
- <!--Subject Attribute Definitions -->
- <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry>
- <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry>
- <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry>
- <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry>
- <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry>
- <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry>
- <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry>
- <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry>
- <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry>
- <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry>
- <entry key="residenceAddress">http://www.stork.gov.eu/1.0/residenceAddress</entry>
- <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry>
- <entry key="academicTitle">http://www.stork.gov.eu/1.0/academicTitle</entry>
- <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry>
- <entry key="age">http://www.stork.gov.eu/1.0/age</entry>
- <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry>
+ <comment>SAML constants for AuthnRequests and Responses.</comment>
+
+ <!-- Types of consent obtained from the user for this authentication and
+ data transfer. Allow values: 'unspecified'. -->
+ <entry key="consentAuthnRequest">unspecified</entry>
+ <!-- Allow values: 'obtained', 'prior', 'curent-implicit', 'curent-explicit',
+ 'unspecified'. -->
+ <entry key="consentAuthnResponse">obtained</entry>
+
+ <!--URI representing the classification of the identifier Allow values:
+ 'entity'. -->
+ <entry key="formatEntity">entity</entry>
+
+ <!--Only HTTP-POST binding is only supported for inter PEPS -->
+ <!--The SOAP binding is only supported for direct communication between
+ SP-MW and VIdP -->
+ <entry key="protocolBinding">HTTP-POST</entry>
+
+ <entry key="eIDSectorShare">false</entry>
+ <entry key="eIDCrossSectorShare">false</entry>
+ <entry key="eIDCrossBorderShare">false</entry>
+
+ <!--PEPS in the Service Provider's country -->
+ <entry key="requester">http://S-PEPS.gov.xx</entry>
+
+ <!--PEPS in the citizen's origin country -->
+ <entry key="responder">http://C-PEPS.gov.xx</entry>
+
+ <!-- Format -->
+ <entry key="format">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</entry>
+
+ <!--Subject cannot be confirmed on or after this seconds time -->
+ <entry key="timeNotOnOrAfter">300</entry>
+
+ <!--Validation IP of the response -->
+ <entry key="ipAddrValidation">false</entry>
+
+ <!-- A friendly name for the attribute that can be displayed to a user -->
+ <entry key="isRequired">false</entry>
+
+
+ <!--Subject Attribute Definitions-->
+ <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry>
+ <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry>
+ <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry>
+ <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry>
+ <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry>
+ <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry>
+ <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry>
+ <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry>
+ <entry key="placeOfBirth">http://www.stork.gov.eu/1.0/placeOfBirth</entry>
+ <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry>
+ <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry>
+ <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry>
+ <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry>
+ <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry>
+ <entry key="title">http://www.stork.gov.eu/1.0/title</entry>
+ <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry>
+ <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry>
+ <entry key="age">http://www.stork.gov.eu/1.0/age</entry>
+ <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry>
+ <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry>
+ <entry key="citizenQAALevel">http://www.stork.gov.eu/1.0/citizenQAALevel</entry>
+ <entry key="fiscalNumber">http://www.stork.gov.eu/1.0/fiscalNumber</entry>
+ <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry>
+ <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry>
+ <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry>
+ <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
+
+ <entry key="diplomaSupplement">http://www.stork.gov.eu/1.0/diplomaSupplement</entry>
+ <entry key="currentStudiesSupplement">http://www.stork.gov.eu/1.0/currentStudiesSupplement</entry>
+ <entry key="isStudent">http://www.stork.gov.eu/1.0/isStudent</entry>
+ <entry key="isAcademicStaff">http://www.stork.gov.eu/1.0/isAcademicStaff</entry>
+ <entry key="isTeacherOf">http://www.stork.gov.eu/1.0/isTeacherOf</entry>
+ <entry key="isCourseCoordinator">http://www.stork.gov.eu/1.0/isCourseCoordinator</entry>
+ <entry key="isAdminStaff">http://www.stork.gov.eu/1.0/isAdminStaff</entry>
+ <entry key="habilitation">http://www.stork.gov.eu/1.0/habilitation</entry>
+ <entry key="Title">http://www.stork.gov.eu/1.0/Title</entry>
+ <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
+ <entry key="hasAccountInBank">http://www.stork.gov.eu/1.0/hasAccountInBank</entry>
+ <entry key="isHealthCareProfessional">http://www.stork.gov.eu/1.0/isHealthCareProfessional</entry>
+
+ <entry key="eLPIdentifier">http://www.stork.gov.eu/1.0/eLPIdentifier</entry>
+ <entry key="legalName">http://www.stork.gov.eu/1.0/legalName</entry>
+ <entry key="alternativeName">http://www.stork.gov.eu/1.0/alternativeName</entry>
+ <entry key="type">http://www.stork.gov.eu/1.0/type</entry>
+ <entry key="translatableType">http://www.stork.gov.eu/1.0/translatableType</entry>
+ <entry key="status">http://www.stork.gov.eu/1.0/status</entry>
+ <entry key="activity">http://www.stork.gov.eu/1.0/activity</entry>
+ <entry key="registeredAddress">http://www.stork.gov.eu/1.0/registeredAddress</entry>
+ <entry key="registeredCanonicalAddress">http://www.stork.gov.eu/1.0/registeredCanonicalAddress</entry>
+ <entry key="contactInformation">http://www.stork.gov.eu/1.0/contactInformation</entry>
+ <entry key="LPFiscalNumber">http://www.stork.gov.eu/1.0/LPFiscalNumber</entry>
+ <entry key="mandate">http://www.stork.gov.eu/1.0/mandate</entry>
+ <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry>
+
</properties> \ 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
index bea40d274..61c6cd6d6 100644
--- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml
@@ -2,56 +2,96 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <comment>SAML constants for AuthnRequests and Responses.</comment>
-
- <!-- Types of consent obtained from the user for this authentication and
- data transfer. Allow values: 'unspecified'. -->
- <entry key="consentAuthnRequest">unspecified</entry>
- <!-- Allow values: 'obtained', 'prior', 'curent-implicit', 'curent-explicit',
- 'unspecified'. -->
- <entry key="consentAuthnResponse">obtained</entry>
-
- <!--URI representing the classification of the identifier Allow values:
- 'entity'. -->
- <entry key="formatEntity">entity</entry>
-
- <!--Only HTTP-POST binding is only supported for inter PEPS -->
- <!--The SOAP binding is only supported for direct communication between
- SP-MW and VIdP -->
- <entry key="protocolBinding">HTTP-POST</entry>
-
- <entry key="eIDSectorShare">false</entry>
- <entry key="eIDCrossSectorShare">false</entry>
- <entry key="eIDCrossBorderShare">false</entry>
-
- <!--PEPS in the Service Provider's country -->
- <entry key="requester">http://S-PEPS.gov.xx</entry>
-
- <!--PEPS in the citizen's origin country -->
- <entry key="responder">http://C-PEPS.gov.xx</entry>
-
- <!--Subject cannot be confirmed on or after this seconds time -->
- <entry key="timeNotOnOrAfter">300</entry>
-
- <!--Validation IP of the response -->
- <entry key="ipAddrValidation">false</entry>
-
- <!--Subject Attribute Definitions -->
- <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry>
- <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry>
- <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry>
- <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry>
- <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry>
- <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry>
- <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry>
- <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry>
- <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry>
- <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry>
- <entry key="residenceAddress">http://www.stork.gov.eu/1.0/residenceAddress</entry>
- <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry>
- <entry key="academicTitle">http://www.stork.gov.eu/1.0/academicTitle</entry>
- <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry>
- <entry key="age">http://www.stork.gov.eu/1.0/age</entry>
- <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry>
- <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry>
+ <comment>SAML constants for AuthnRequests and Responses.</comment>
+
+ <!-- Types of consent obtained from the user for this authentication and
+ data transfer. Allow values: 'unspecified'. -->
+ <entry key="consentAuthnRequest">unspecified</entry>
+ <!-- Allow values: 'obtained', 'prior', 'curent-implicit', 'curent-explicit',
+ 'unspecified'. -->
+ <entry key="consentAuthnResponse">obtained</entry>
+
+ <!--URI representing the classification of the identifier Allow values:
+ 'entity'. -->
+ <entry key="formatEntity">entity</entry>
+
+ <!--Only HTTP-POST binding is only supported for inter PEPS -->
+ <!--The SOAP binding is only supported for direct communication between
+ SP-MW and VIdP -->
+ <entry key="protocolBinding">HTTP-POST</entry>
+
+ <entry key="eIDSectorShare">false</entry>
+ <entry key="eIDCrossSectorShare">false</entry>
+ <entry key="eIDCrossBorderShare">false</entry>
+
+ <!--PEPS in the Service Provider's country -->
+ <entry key="requester">http://S-PEPS.gov.xx</entry>
+
+ <!--PEPS in the citizen's origin country -->
+ <entry key="responder">http://C-PEPS.gov.xx</entry>
+
+ <!-- Format -->
+ <entry key="format">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</entry>
+
+ <!--Subject cannot be confirmed on or after this seconds time -->
+ <entry key="timeNotOnOrAfter">300</entry>
+
+ <!--Validation IP of the response -->
+ <entry key="ipAddrValidation">false</entry>
+
+ <!--Subject Attribute Definitions-->
+ <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry>
+ <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry>
+ <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry>
+ <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry>
+ <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry>
+ <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry>
+ <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry>
+ <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry>
+ <entry key="placeOfBirth">http://www.stork.gov.eu/1.0/placeOfBirth</entry>
+ <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry>
+ <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry>
+ <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry>
+ <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry>
+ <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry>
+ <entry key="title">http://www.stork.gov.eu/1.0/title</entry>
+ <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry>
+ <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry>
+ <entry key="age">http://www.stork.gov.eu/1.0/age</entry>
+ <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry>
+ <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry>
+ <entry key="citizenQAALevel">http://www.stork.gov.eu/1.0/citizenQAALevel</entry>
+ <entry key="fiscalNumber">http://www.stork.gov.eu/1.0/fiscalNumber</entry>
+ <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry>
+ <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry>
+ <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry>
+ <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
+
+ <entry key="diplomaSupplement">http://www.stork.gov.eu/1.0/diplomaSupplement</entry>
+ <entry key="currentStudiesSupplement">http://www.stork.gov.eu/1.0/currentStudiesSupplement</entry>
+ <entry key="isStudent">http://www.stork.gov.eu/1.0/isStudent</entry>
+ <entry key="isAcademicStaff">http://www.stork.gov.eu/1.0/isAcademicStaff</entry>
+ <entry key="isTeacherOf">http://www.stork.gov.eu/1.0/isTeacherOf</entry>
+ <entry key="isCourseCoordinator">http://www.stork.gov.eu/1.0/isCourseCoordinator</entry>
+ <entry key="isAdminStaff">http://www.stork.gov.eu/1.0/isAdminStaff</entry>
+ <entry key="habilitation">http://www.stork.gov.eu/1.0/habilitation</entry>
+ <entry key="Title">http://www.stork.gov.eu/1.0/Title</entry>
+ <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry>
+ <entry key="hasAccountInBank">http://www.stork.gov.eu/1.0/hasAccountInBank</entry>
+ <entry key="isHealthCareProfessional">http://www.stork.gov.eu/1.0/isHealthCareProfessional</entry>
+
+ <entry key="eLPIdentifier">http://www.stork.gov.eu/1.0/eLPIdentifier</entry>
+ <entry key="legalName">http://www.stork.gov.eu/1.0/legalName</entry>
+ <entry key="alternativeName">http://www.stork.gov.eu/1.0/alternativeName</entry>
+ <entry key="type">http://www.stork.gov.eu/1.0/type</entry>
+ <entry key="translatableType">http://www.stork.gov.eu/1.0/translatableType</entry>
+ <entry key="status">http://www.stork.gov.eu/1.0/status</entry>
+ <entry key="activity">http://www.stork.gov.eu/1.0/activity</entry>
+ <entry key="registeredAddress">http://www.stork.gov.eu/1.0/registeredAddress</entry>
+ <entry key="registeredCanonicalAddress">http://www.stork.gov.eu/1.0/registeredCanonicalAddress</entry>
+ <entry key="contactInformation">http://www.stork.gov.eu/1.0/contactInformation</entry>
+ <entry key="LPFiscalNumber">http://www.stork.gov.eu/1.0/LPFiscalNumber</entry>
+ <entry key="mandate">http://www.stork.gov.eu/1.0/mandate</entry>
+ <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry>
+
</properties> \ 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 3764389e4..d4f6f89da 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,82 +1,68 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
- xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
- xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
- Destination="http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest" ID="_939726f0a02072f40b548de378612a50"
- IssueInstant="2013-10-04T16:57:55.547Z" Version="2.0">
- <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
- <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
- <ds:SignedInfo>
- <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
- <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
- <ds:Reference URI="#_939726f0a02072f40b548de378612a50">
- <ds:Transforms>
- <ds:Transform
- Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
- <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
- <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"
- PrefixList="xs" />
- </ds:Transform>
- </ds:Transforms>
- <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
- <ds:DigestValue>BgPDTVCv7BhiWIs6HsC06jaHaag=</ds:DigestValue>
- </ds:Reference>
- </ds:SignedInfo>
- <ds:SignatureValue>dIC61bGi6Jqp1zSVojpjaVq9WaZcDtNImXgo1Dyze5/hJA07Sy4TaHu+/IuLEC99aLjM6rxh2UUNqpPaQCFlF5eVkVv/c4gHEZVyevhjJKTidqmnuhlI78PGMx2thfxFsHsPcqHqOzy1Z6w18K1ds6APQP+aXI9TNKis+pykn4nJititYuiSseD0VY0F4QnXx+U6k3raoi1CAFE5fe7EuI/KfxuhhQLAbLq90Vm8R94ITBjfSS25mXstXNe9zppTSjDB42ld1TjDovDwXAn5OxiZasIEb5m68sRlxgoQ/2/+ZdYNNINFLAwkCbb8MiCbGASd626Bme0Kx+ropeWdxw==</ds:SignatureValue>
- <ds:KeyInfo>
- <ds:X509Data>
- <ds:X509Certificate>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=</ds:X509Certificate>
- </ds:X509Data>
- </ds:KeyInfo>
- </ds:Signature>
- <saml2p:Extensions>
- <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
- <storkp:eIDSectorShare>false</storkp:eIDSectorShare>
- <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare>
- <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare>
- <storkp:RequestedAttributes>
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="false" />
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true">
- <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">16</stork:AttributeValue>
- <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">18</stork:AttributeValue>
- </stork:RequestedAttribute>
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true">
- <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">Sveinbjorn</stork:AttributeValue>
- </stork:RequestedAttribute>
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true">
- <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">ES/IS/1234567890</stork:AttributeValue>
- </stork:RequestedAttribute>
- </storkp:RequestedAttributes>
- </saml2p:Extensions>
- <saml2:Subject>
- <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" />
- </saml2:Subject>
+<?xml version="1.0" encoding="UTF-8"?><saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" xmlns:xs="http://www.w3.org/2001/XMLSchema" AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest" ID="_bf999e47edabb47770eb406a5d37f24e" IssueInstant="2014-04-25T12:49:39.398Z" Version="2.0">
+ <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
+ <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+ <ds:SignedInfo>
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
+ <ds:Reference URI="#_bf999e47edabb47770eb406a5d37f24e">
+ <ds:Transforms>
+ <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
+ <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="xs"/>
+ </ds:Transform>
+ </ds:Transforms>
+ <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
+ <ds:DigestValue>NwBXMUys6XjoR7Ddbr6JI5gB+O8=</ds:DigestValue>
+ </ds:Reference>
+ </ds:SignedInfo>
+ <ds:SignatureValue>MFoAC5mncGKFyvZKygSIH7+9JrXWMJ18jolBHZ0WisxpIrDldS+K+Mf6uwOirL5mal2uktpIT2RRiT1Twk+fS5t94wnobaLpktpv+uoZCzd2BAqFpBBHnImwC/UEy7hCF9htsW8CCx97wRXHA4IGx5OX9Fg4f+ZJdPPFLrGpdfJ3bJXvQeQPwGLqhjWio/XnAYwJYQ8YGQvRywZDDodTZDWHsKMHAsrIdmNJz93wmMPceRtgcUceZdN4jDkPE8SPNrApe2ksd3dEKauyyJQ2DR5jryVQpGM7sJzQhP9Z57XIJta+c/nJ7bttw+M+QsZn/E+CLQpcI8MeuuhBb1+mGA==</ds:SignatureValue>
+ <ds:KeyInfo>
+ <ds:X509Data>
+ <ds:X509Certificate>MIIDIjCCAgqgAwIBAgIES6idsjANBgkqhkiG9w0BAQUFADBTMQswCQYDVQQGEwJFUzEOMAwGA1UE
+ CAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxvY2Fs
+ LWRlbW8wHhcNMTMwODI4MTY0NzM1WhcNMTUwODI4MTY0NzM1WjBTMQswCQYDVQQGEwJFUzEOMAwG
+ A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxv
+ Y2FsLWRlbW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx+7zEQUbt8Ot9dByR5TuY
+ NPmTwaKhECtnkxYAx9tl+Ga3kFiv+dOSeDoQOhxkICG1ZMaG0Gtk0EQWjscC1cLwDXpAOdhOm5xh
+ ndFHxa3V3Y3zomFZA7A3nwP8wt17wDrc1xi2Ye8VrwO7Vjb/F8Rgutlcrvq+LF4g9nQLoRiKUq8w
+ NFvDlvhBbLr8hMVBMY/jY7tSQ85qLqKUkWRcoDttJjgWZoO1vpBS4m+FywtYdOoHnN6fv4Dvf1r2
+ rNLgebgBvSfwznxiulwW6FBLasYX0rYKP7RfwG8TJ+FumOgAjADj2LdwK25RZNg44XU2V1z1Fp37
+ fNXhfo08LpdD1ueFAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBADMRGTWOmadZyCoJNluV+M7LopjC
+ 9WpFUj76X0cAoNXmt12zYqYe8hjRmBr6l2V/FXT3/TyWET1nILG46zwwAxslw3b2LvkhU+9QcuB8
+ yC8TCJJ0kgsTZ/EUZPSbwUG7Nn2jkMiyjlyKcjSCQOzEKQyR1xYwyZG40+BPeGbYjmRgm6kcmCxY
+ USWoPwNyfke9gNT80f0pUj7wJ9YwWbTIz1rhf/h7rxoMYypXo+JXwaXW/Ra8v1uDcwfKpE5ZgwAU
+ nubLXF4A+H7/N7ZvB5XDwJ4W+99nuPsKfwacD8m1sflTXcEPzzhOq6iQ9anJT94/pMctnp827zXA
+ y66jvDrin5I=</ds:X509Certificate>
+ </ds:X509Data>
+ </ds:KeyInfo>
+ </ds:Signature>
+ <saml2p:Extensions>
+ <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
+ <stork:spCountry>IS</stork:spCountry>
+ <storkp:eIDSectorShare>false</storkp:eIDSectorShare>
+ <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare>
+ <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare>
+ <storkp:RequestedAttributes>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true">
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">ES/IS/1234567890</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true">
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">Sveinbjorn</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="false"/>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/fiscalNumber" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true">
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">fiscalNumber</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true">
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">16</stork:AttributeValue>
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">18</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/LPFiscalNumber" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true">
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">LPFiscalNumber</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ </storkp:RequestedAttributes>
+ </saml2p:Extensions>
+ <saml2:Subject>
+ <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+ </saml2:Subject>
</saml2p:AttributeQuery> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml
index d64572829..fadc86d14 100644
--- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml
@@ -1,15 +1,54 @@
-<?xml version="1.0" encoding="UTF-8"?><saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" xmlns:xs="http://www.w3.org/2001/XMLSchema" AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest" ID="_334488599e0c2781ff34857c4964debb" IssueInstant="2014-02-06T22:09:18.113Z" Version="2.0"><saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI="#_334488599e0c2781ff34857c4964debb"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="xs"/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>X1nUVB6qXdoKbJzNekiSo9ExLdw=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>ExCPHHC/9OhdhOl1Ou+43Qw1nvskpbMYMu9vqa7m16doxM2PIUmK7LUw7hZiKtjIdBxuhpca3OrjO8O6MuTDN1FksWoj+7B1KTLFtmspucT5O7Cu2OqhK5WIVuCaLuA7CD0N2UfFouRwR5NlLHyzn9Trd7IM5OjA41dGb5jqYl7Ir+62+MgjhZRlLooDzb5fDAczbxv9LHGiKRBpgnk40w3gDAvoSPNdEuKhZi8LPQWWNBvVi3N5ZmJmAIacZWBqePywXTjygmChWAc8p7ptAX6tw0hpBxyxoW3aaZZzWQNcwobTRYbn89fcM11gqIz/YK7VXtiQ7WEQt1enQD/GAA==</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIIDIjCCAgqgAwIBAgIES6idsjANBgkqhkiG9w0BAQUFADBTMQswCQYDVQQGEwJFUzEOMAwGA1UE
-CAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxvY2Fs
-LWRlbW8wHhcNMTMwODI4MTY0NzM1WhcNMTUwODI4MTY0NzM1WjBTMQswCQYDVQQGEwJFUzEOMAwG
-A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxv
-Y2FsLWRlbW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx+7zEQUbt8Ot9dByR5TuY
-NPmTwaKhECtnkxYAx9tl+Ga3kFiv+dOSeDoQOhxkICG1ZMaG0Gtk0EQWjscC1cLwDXpAOdhOm5xh
-ndFHxa3V3Y3zomFZA7A3nwP8wt17wDrc1xi2Ye8VrwO7Vjb/F8Rgutlcrvq+LF4g9nQLoRiKUq8w
-NFvDlvhBbLr8hMVBMY/jY7tSQ85qLqKUkWRcoDttJjgWZoO1vpBS4m+FywtYdOoHnN6fv4Dvf1r2
-rNLgebgBvSfwznxiulwW6FBLasYX0rYKP7RfwG8TJ+FumOgAjADj2LdwK25RZNg44XU2V1z1Fp37
-fNXhfo08LpdD1ueFAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBADMRGTWOmadZyCoJNluV+M7LopjC
-9WpFUj76X0cAoNXmt12zYqYe8hjRmBr6l2V/FXT3/TyWET1nILG46zwwAxslw3b2LvkhU+9QcuB8
-yC8TCJJ0kgsTZ/EUZPSbwUG7Nn2jkMiyjlyKcjSCQOzEKQyR1xYwyZG40+BPeGbYjmRgm6kcmCxY
-USWoPwNyfke9gNT80f0pUj7wJ9YwWbTIz1rhf/h7rxoMYypXo+JXwaXW/Ra8v1uDcwfKpE5ZgwAU
-nubLXF4A+H7/N7ZvB5XDwJ4W+99nuPsKfwacD8m1sflTXcEPzzhOq6iQ9anJT94/pMctnp827zXA
-y66jvDrin5I=</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature><saml2p:Extensions><stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel><stork:spCountry>IS</stork:spCountry><storkp:eIDSectorShare>false</storkp:eIDSectorShare><storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare><storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare><storkp:RequestedAttributes><stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/docRequest" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"><stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">IS/IS/fbea6e68-0393-401b-b616-f767fff9418c</stork:AttributeValue></stork:RequestedAttribute></storkp:RequestedAttributes></saml2p:Extensions><saml2:Subject><saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/></saml2:Subject></saml2p:AttributeQuery> \ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" xmlns:xs="http://www.w3.org/2001/XMLSchema" AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest" ID="_0b74cf761d490383ac5127629a39a458" IssueInstant="2014-04-25T12:49:39.848Z" Version="2.0">
+ <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
+ <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+ <ds:SignedInfo>
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
+ <ds:Reference URI="#_0b74cf761d490383ac5127629a39a458">
+ <ds:Transforms>
+ <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
+ <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="xs"/>
+ </ds:Transform>
+ </ds:Transforms>
+ <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
+ <ds:DigestValue>2WMvsIXoH1VpwqbNiXG8lWS2ZPc=</ds:DigestValue>
+ </ds:Reference>
+ </ds:SignedInfo>
+ <ds:SignatureValue>nMfUZiYHyHgSky4NHfDGch8a6UxWupS1Dhk2mu3L065Vq2eKLfDwWjgNkKPDoLcEkgAiDpNlLsS0+nDk8IexAMSq+T54Mlt4AhMRIrDP3SlWya5mqQ0VnxFENGlhi7kSKK2oIMfkiaeIBART7QBZggSZFnk0mw/BzmJM5bJ4Dipymndx7tv98BDlWFZEKH7iSc9uUuMpVygTNDxtEsdMcBKpqYiyVyTln8/xKsqXSL4RA10MYmqfvFsMZWUwQUgdl5tor910/XrAXHXJY50zH0CwekUXszOdvO7s3WvrG4lt3goqq2WDcaeDzizV93+Ih+lVl9PebTtMxCyO4fxw7Q==</ds:SignatureValue>
+ <ds:KeyInfo>
+ <ds:X509Data>
+ <ds:X509Certificate>MIIDIjCCAgqgAwIBAgIES6idsjANBgkqhkiG9w0BAQUFADBTMQswCQYDVQQGEwJFUzEOMAwGA1UE
+ CAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxvY2Fs
+ LWRlbW8wHhcNMTMwODI4MTY0NzM1WhcNMTUwODI4MTY0NzM1WjBTMQswCQYDVQQGEwJFUzEOMAwG
+ A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxv
+ Y2FsLWRlbW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx+7zEQUbt8Ot9dByR5TuY
+ NPmTwaKhECtnkxYAx9tl+Ga3kFiv+dOSeDoQOhxkICG1ZMaG0Gtk0EQWjscC1cLwDXpAOdhOm5xh
+ ndFHxa3V3Y3zomFZA7A3nwP8wt17wDrc1xi2Ye8VrwO7Vjb/F8Rgutlcrvq+LF4g9nQLoRiKUq8w
+ NFvDlvhBbLr8hMVBMY/jY7tSQ85qLqKUkWRcoDttJjgWZoO1vpBS4m+FywtYdOoHnN6fv4Dvf1r2
+ rNLgebgBvSfwznxiulwW6FBLasYX0rYKP7RfwG8TJ+FumOgAjADj2LdwK25RZNg44XU2V1z1Fp37
+ fNXhfo08LpdD1ueFAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBADMRGTWOmadZyCoJNluV+M7LopjC
+ 9WpFUj76X0cAoNXmt12zYqYe8hjRmBr6l2V/FXT3/TyWET1nILG46zwwAxslw3b2LvkhU+9QcuB8
+ yC8TCJJ0kgsTZ/EUZPSbwUG7Nn2jkMiyjlyKcjSCQOzEKQyR1xYwyZG40+BPeGbYjmRgm6kcmCxY
+ USWoPwNyfke9gNT80f0pUj7wJ9YwWbTIz1rhf/h7rxoMYypXo+JXwaXW/Ra8v1uDcwfKpE5ZgwAU
+ nubLXF4A+H7/N7ZvB5XDwJ4W+99nuPsKfwacD8m1sflTXcEPzzhOq6iQ9anJT94/pMctnp827zXA
+ y66jvDrin5I=</ds:X509Certificate>
+ </ds:X509Data>
+ </ds:KeyInfo>
+ </ds:Signature>
+ <saml2p:Extensions>
+ <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
+ <stork:spCountry>IS</stork:spCountry>
+ <storkp:eIDSectorShare>false</storkp:eIDSectorShare>
+ <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare>
+ <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare>
+ <storkp:RequestedAttributes>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/docRequest" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true">
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">IS/IS/fbea6e68-0393-401b-b616-f767fff9418c</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ </storkp:RequestedAttributes>
+ </saml2p:Extensions>
+ <saml2:Subject>
+ <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+ </saml2:Subject>
+</saml2p:AttributeQuery> \ 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
index becc689fe..5c04f5c93 100644
--- 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
@@ -1,66 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
- xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
- xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
- Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" ID="_f6c8fc355b9f125cb5283f038e1b3cdf"
- IssueInstant="2013-10-03T10:28:15.449Z" Version="2.0">
- <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
- <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
- <ds:SignatureValue>hhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==</ds:SignatureValue>
- <ds:KeyInfo>
- <ds:X509Data>
- <ds:X509Certificate>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==</ds:X509Certificate>
- </ds:X509Data>
- </ds:KeyInfo>
- </ds:Signature>
- <saml2p:Extensions>
- <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
- <storkp:eIDSectorShare>false</storkp:eIDSectorShare>
- <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare>
- <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare>
- <storkp:RequestedAttributes>
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="false" />
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true">
- <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">16</stork:AttributeValue>
- <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">18</stork:AttributeValue>
- </stork:RequestedAttribute>
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true">
- <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">Sveinbjörn</stork:AttributeValue>
- </stork:RequestedAttribute>
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true">
- <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">ES/IS/1234567890</stork:AttributeValue>
- </stork:RequestedAttribute>
- </storkp:RequestedAttributes>
- </saml2p:Extensions>
- <saml2:Subject>
- <saml2:SubjectConfirmation
- Method="urn:oasis:names:tc:SAML:1.0:cm:sender-vouches" />
- </saml2:Subject>
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
+ xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
+ Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" ID="_f6c8fc355b9f125cb5283f038e1b3cdf"
+ IssueInstant="2013-10-03T10:28:15.449Z" Version="2.0">
+ <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
+ <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+ <ds:SignatureValue>hhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==</ds:SignatureValue>
+ <ds:KeyInfo>
+ <ds:X509Data>
+ <ds:X509Certificate>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==</ds:X509Certificate>
+ </ds:X509Data>
+ </ds:KeyInfo>
+ </ds:Signature>
+ <saml2p:Extensions>
+ <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
+ <storkp:eIDSectorShare>false</storkp:eIDSectorShare>
+ <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare>
+ <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare>
+ <storkp:RequestedAttributes>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="false" />
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true">
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">16</stork:AttributeValue>
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">18</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true">
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">Sveinbjörn</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true">
+ <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">ES/IS/1234567890</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ </storkp:RequestedAttributes>
+ </saml2p:Extensions>
+ <saml2:Subject>
+ <saml2:SubjectConfirmation
+ Method="urn:oasis:names:tc:SAML:1.0:cm:sender-vouches" />
+ </saml2:Subject>
</saml2p:AttributeQuery> \ 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 7ea486812..79c59f5ed 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,124 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<saml2p:Response xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
- xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
- xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:obtained"
- Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" ID="_483140d440fc4eef8e949ace49669f2e"
- InResponseTo="_0a22c1120bf2de912714c24e99dd38ed" IssueInstant="2013-10-08T09:11:17.255Z"
- Version="2.0">
- <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://C-PEPS.gov.xx</saml2:Issuer>
- <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
- <ds:SignedInfo>
- <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
- <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
- <ds:Reference URI="#_483140d440fc4eef8e949ace49669f2e">
- <ds:Transforms>
- <ds:Transform
- Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
- <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
- <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"
- PrefixList="xs" />
- </ds:Transform>
- </ds:Transforms>
- <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
- <ds:DigestValue>yMOVS1T/yRiVh3L6IBM9rR9Ie3w=</ds:DigestValue>
- </ds:Reference>
- </ds:SignedInfo>
- <ds:SignatureValue>d8e/RyNNPmnHRIzTIuRSnW6B60oWGBGxjRua/HvNxTuod0qSarYJxEedhY9Wl1Z9WYXlry28FuKjp3DA3HhzNaVd7A7QpFqNC4dnizSVWFjxlhmoE/Uv3Y/ha9P/fk6nbtHCSKW4kHSX7QfFLeggcLmUG0IULRF8UmRdQ0WerCl0aSZZeSp8J3LsFBPeWCRSwXgfiLn+RehggzZmQU6g0ssxrpnsYEAtjAiOli+YVQGuumsZGaJ8zHA/DgJ2FTGovNUyfuSUFLhd9nLlSqFs2Avnx0Ck7Q1dxDO5truOm6e285YLHqLaGdetFyPQAj/Z4w4RJ5u5X6d7rhBjTfRAAw==</ds:SignatureValue>
- <ds:KeyInfo>
- <ds:X509Data>
- <ds:X509Certificate>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==</ds:X509Certificate>
- </ds:X509Data>
- </ds:KeyInfo>
- </ds:Signature>
- <saml2p:Status>
- <saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
- <saml2p:StatusMessage>urn:oasis:names:tc:SAML:2.0:status:Success</saml2p:StatusMessage>
- </saml2p:Status>
- <saml2:Assertion ID="_9ed05849dee5c154e62fa9e3ba53e9f3"
- IssueInstant="2013-10-08T09:11:17.255Z" Version="2.0">
- <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://C-PEPS.gov.xx</saml2:Issuer>
- <saml2:Subject>
- <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
- NameQualifier="http://C-PEPS.gov.xx">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</saml2:NameID>
- <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
- <saml2:SubjectConfirmationData
- Address="111.222.333.444" InResponseTo="_0a22c1120bf2de912714c24e99dd38ed"
- NotOnOrAfter="2013-10-08T09:16:17.255Z" />
- </saml2:SubjectConfirmation>
- </saml2:Subject>
- <saml2:Conditions NotBefore="2013-10-08T09:11:17.255Z"
- NotOnOrAfter="2013-10-08T09:16:17.255Z">
- <saml2:AudienceRestriction>
- <saml2:Audience>http://S-PEPS.gov.xx</saml2:Audience>
- </saml2:AudienceRestriction>
- <saml2:OneTimeUse />
- </saml2:Conditions>
- <saml2:AuthnStatement AuthnInstant="2013-10-08T09:11:17.255Z">
- <saml2:SubjectLocality Address="111.222.333.444" />
- <saml2:AuthnContext>
- <saml2:AuthnContextDecl />
- </saml2:AuthnContext>
- </saml2:AuthnStatement>
- <saml2:AttributeStatement>
- <saml2:Attribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- stork:AttributeStatus="Available">
- <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">16/12/2008</saml2:AttributeValue>
- </saml2:Attribute>
- <saml2:Attribute
- Name="http://www.stork.gov.eu/1.0/canonicalResidenceAddress"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- stork:AttributeStatus="Available">
- <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">
- <stork:postalCode xsi:type="xs:anyType">105</stork:postalCode>
- <stork:state xsi:type="xs:anyType">IS</stork:state>
- <stork:streetNumber xsi:type="xs:anyType">10</stork:streetNumber>
- <stork:streetName xsi:type="xs:anyType">Gudrunartun</stork:streetName>
- <stork:town xsi:type="xs:anyType">Reykjavik</stork:town>
- </saml2:AttributeValue>
- </saml2:Attribute>
- <saml2:Attribute Name="http://www.stork.gov.eu/1.0/newAttribute2"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- stork:AttributeStatus="Available">
- <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">
- <stork:value3 xsi:type="xs:anyType">value3</stork:value3>
- <stork:value4 xsi:type="xs:anyType">value4</stork:value4>
- <stork:value1 xsi:type="xs:anyType">value1</stork:value1>
- <stork:value2 xsi:type="xs:anyType">value2</stork:value2>
- </saml2:AttributeValue>
- </saml2:Attribute>
- <saml2:Attribute Name="http://www.stork.gov.eu/1.0/isAgeOver"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- stork:AttributeStatus="Available">
- <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">16</saml2:AttributeValue>
- <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">18</saml2:AttributeValue>
- </saml2:Attribute>
- <saml2:Attribute Name="http://www.stork.gov.eu/1.0/eIdentifier"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- stork:AttributeStatus="Available">
- <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:anyType">123456789IS</saml2:AttributeValue>
- </saml2:Attribute>
- </saml2:AttributeStatement>
- </saml2:Assertion>
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
+ xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:obtained"
+ Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" ID="_483140d440fc4eef8e949ace49669f2e"
+ InResponseTo="_0a22c1120bf2de912714c24e99dd38ed" IssueInstant="2013-10-08T09:11:17.255Z"
+ Version="2.0">
+ <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://C-PEPS.gov.xx</saml2:Issuer>
+ <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+ <ds:SignedInfo>
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
+ <ds:Reference URI="#_483140d440fc4eef8e949ace49669f2e">
+ <ds:Transforms>
+ <ds:Transform
+ Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
+ <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"
+ PrefixList="xs" />
+ </ds:Transform>
+ </ds:Transforms>
+ <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
+ <ds:DigestValue>yMOVS1T/yRiVh3L6IBM9rR9Ie3w=</ds:DigestValue>
+ </ds:Reference>
+ </ds:SignedInfo>
+ <ds:SignatureValue>d8e/RyNNPmnHRIzTIuRSnW6B60oWGBGxjRua/HvNxTuod0qSarYJxEedhY9Wl1Z9WYXlry28FuKjp3DA3HhzNaVd7A7QpFqNC4dnizSVWFjxlhmoE/Uv3Y/ha9P/fk6nbtHCSKW4kHSX7QfFLeggcLmUG0IULRF8UmRdQ0WerCl0aSZZeSp8J3LsFBPeWCRSwXgfiLn+RehggzZmQU6g0ssxrpnsYEAtjAiOli+YVQGuumsZGaJ8zHA/DgJ2FTGovNUyfuSUFLhd9nLlSqFs2Avnx0Ck7Q1dxDO5truOm6e285YLHqLaGdetFyPQAj/Z4w4RJ5u5X6d7rhBjTfRAAw==</ds:SignatureValue>
+ <ds:KeyInfo>
+ <ds:X509Data>
+ <ds:X509Certificate>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==</ds:X509Certificate>
+ </ds:X509Data>
+ </ds:KeyInfo>
+ </ds:Signature>
+ <saml2p:Status>
+ <saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
+ <saml2p:StatusMessage>urn:oasis:names:tc:SAML:2.0:status:Success</saml2p:StatusMessage>
+ </saml2p:Status>
+ <saml2:Assertion ID="_9ed05849dee5c154e62fa9e3ba53e9f3"
+ IssueInstant="2013-10-08T09:11:17.255Z" Version="2.0">
+ <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://C-PEPS.gov.xx</saml2:Issuer>
+ <saml2:Subject>
+ <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
+ NameQualifier="http://C-PEPS.gov.xx">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</saml2:NameID>
+ <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
+ <saml2:SubjectConfirmationData
+ Address="111.222.333.444" InResponseTo="_0a22c1120bf2de912714c24e99dd38ed"
+ NotOnOrAfter="2013-10-08T09:16:17.255Z" />
+ </saml2:SubjectConfirmation>
+ </saml2:Subject>
+ <saml2:Conditions NotBefore="2013-10-08T09:11:17.255Z"
+ NotOnOrAfter="2013-10-08T09:16:17.255Z">
+ <saml2:AudienceRestriction>
+ <saml2:Audience>http://S-PEPS.gov.xx</saml2:Audience>
+ </saml2:AudienceRestriction>
+ <saml2:OneTimeUse />
+ </saml2:Conditions>
+ <saml2:AuthnStatement AuthnInstant="2013-10-08T09:11:17.255Z">
+ <saml2:SubjectLocality Address="111.222.333.444" />
+ <saml2:AuthnContext>
+ <saml2:AuthnContextDecl />
+ </saml2:AuthnContext>
+ </saml2:AuthnStatement>
+ <saml2:AttributeStatement>
+ <saml2:Attribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ stork:AttributeStatus="Available">
+ <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">16/12/2008</saml2:AttributeValue>
+ </saml2:Attribute>
+ <saml2:Attribute
+ Name="http://www.stork.gov.eu/1.0/canonicalResidenceAddress"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ stork:AttributeStatus="Available">
+ <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">
+ <stork:postalCode xsi:type="xs:anyType">105</stork:postalCode>
+ <stork:state xsi:type="xs:anyType">IS</stork:state>
+ <stork:streetNumber xsi:type="xs:anyType">10</stork:streetNumber>
+ <stork:streetName xsi:type="xs:anyType">Gudrunartun</stork:streetName>
+ <stork:town xsi:type="xs:anyType">Reykjavik</stork:town>
+ </saml2:AttributeValue>
+ </saml2:Attribute>
+ <saml2:Attribute Name="http://www.stork.gov.eu/1.0/newAttribute2"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ stork:AttributeStatus="Available">
+ <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">
+ <stork:value3 xsi:type="xs:anyType">value3</stork:value3>
+ <stork:value4 xsi:type="xs:anyType">value4</stork:value4>
+ <stork:value1 xsi:type="xs:anyType">value1</stork:value1>
+ <stork:value2 xsi:type="xs:anyType">value2</stork:value2>
+ </saml2:AttributeValue>
+ </saml2:Attribute>
+ <saml2:Attribute Name="http://www.stork.gov.eu/1.0/isAgeOver"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ stork:AttributeStatus="Available">
+ <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">16</saml2:AttributeValue>
+ <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">18</saml2:AttributeValue>
+ </saml2:Attribute>
+ <saml2:Attribute Name="http://www.stork.gov.eu/1.0/eIdentifier"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ stork:AttributeStatus="Available">
+ <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:anyType">123456789IS</saml2:AttributeValue>
+ </saml2:Attribute>
+ </saml2:AttributeStatement>
+ </saml2:Assertion>
</saml2p:Response> \ 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
index c48bfde95..93e778113 100644
--- 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
@@ -1,72 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<saml2p:AuthnRequest xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
- xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
- xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
- AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse"
- Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest"
- ForceAuthn="true" ID="_e54eee285e7b8e2772875c406ec39674" IsPassive="false"
- IssueInstant="2010-06-08T07:37:54.533Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
- ProviderName="University of Oxford" Version="2.0">
- <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
- <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
- <ds:SignedInfo>
- <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
- <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
- <ds:Reference URI="#_e54eee285e7b8e2772875c406ec39674">
- <ds:Transforms>
- <ds:Transform
- Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
- <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
- <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"
- PrefixList="ds saml2 saml2p stork storkp xs" />
- </ds:Transform>
- </ds:Transforms>
- <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
- <ds:DigestValue>yzsqaxBNicOrixBUno5cL0CBOpE=</ds:DigestValue>
- </ds:Reference>
- </ds:SignedInfo>
- <ds:SignatureValue>
- Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC
- wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi
- YIN/BUEtXkoYTjPtkmA=
- </ds:SignatureValue>
- <ds:KeyInfo>
- <ds:X509Data>
- <ds:X509Certificate>MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw
- MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG
- 9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu
- h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r
- /WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk
- 3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K
- eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq
- KAoZgbUK0Zld3Dsheg==</ds:X509Certificate>
- </ds:X509Data>
- </ds:KeyInfo>
- </ds:Signature>
- <saml2p:Extensions>
- <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
- <stork:spSector>EDU001</stork:spSector>
- <stork:spInstitution>OXF001</stork:spInstitution>
- <stork:spApplication>APP001</stork:spApplication>
- <stork:spCountry>EN</stork:spCountry>
- <storkp:eIDSectorShare>true</storkp:eIDSectorShare>
- <storkp:eIDCrossSectorShare>true</storkp:eIDCrossSectorShare>
- <storkp:eIDCrossBorderShare>true</storkp:eIDCrossBorderShare>
- <storkp:RequestedAttributes>
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true">
- <stork:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">16</stork:AttributeValue>
- <stork:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">18</stork:AttributeValue>
- </stork:RequestedAttribute>
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="false" />
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true" />
- </storkp:RequestedAttributes>
- </saml2p:Extensions>
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
+ xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
+ AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse"
+ Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest"
+ ForceAuthn="true" ID="_e54eee285e7b8e2772875c406ec39674" IsPassive="false"
+ IssueInstant="2010-06-08T07:37:54.533Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+ ProviderName="University of Oxford" Version="2.0">
+ <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
+ <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+ <ds:SignedInfo>
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
+ <ds:Reference URI="#_e54eee285e7b8e2772875c406ec39674">
+ <ds:Transforms>
+ <ds:Transform
+ Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
+ <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"
+ PrefixList="ds saml2 saml2p stork storkp xs" />
+ </ds:Transform>
+ </ds:Transforms>
+ <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
+ <ds:DigestValue>yzsqaxBNicOrixBUno5cL0CBOpE=</ds:DigestValue>
+ </ds:Reference>
+ </ds:SignedInfo>
+ <ds:SignatureValue>
+ Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC
+ wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi
+ YIN/BUEtXkoYTjPtkmA=
+ </ds:SignatureValue>
+ <ds:KeyInfo>
+ <ds:X509Data>
+ <ds:X509Certificate>MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw
+ MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG
+ 9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu
+ h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r
+ /WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk
+ 3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K
+ eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq
+ KAoZgbUK0Zld3Dsheg==</ds:X509Certificate>
+ </ds:X509Data>
+ </ds:KeyInfo>
+ </ds:Signature>
+ <saml2p:Extensions>
+ <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
+ <stork:spSector>EDU001</stork:spSector>
+ <stork:spInstitution>OXF001</stork:spInstitution>
+ <stork:spApplication>APP001</stork:spApplication>
+ <stork:spCountry>EN</stork:spCountry>
+ <storkp:eIDSectorShare>true</storkp:eIDSectorShare>
+ <storkp:eIDCrossSectorShare>true</storkp:eIDCrossSectorShare>
+ <storkp:eIDCrossBorderShare>true</storkp:eIDCrossBorderShare>
+ <storkp:RequestedAttributes>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true">
+ <stork:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">16</stork:AttributeValue>
+ <stork:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">18</stork:AttributeValue>
+ </stork:RequestedAttribute>
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="false" />
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true" />
+ </storkp:RequestedAttributes>
+ </saml2p:Extensions>
</saml2p:AuthnRequest> \ 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
index 8766f9a8b..cca0dbc27 100644
--- 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
@@ -1,47 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<saml2p:AuthnRequest xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
- xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
- xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:stork" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
- AssertionConsumerServiceURL="http://localhost:8080/SP/ReturnPage"
- Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://locahost:8080/PEPS/ServiceProvider"
- ForceAuthn="true" ID="_0c64ff85-1323-4618-847b-12d1983b86e4" IsPassive="false"
- IssueInstant="2010-04-07T16:45:03.593Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
- ProviderName="PT-SP" Version="2.0">
- <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
- <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
- <ds:SignatureValue>
- S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR
- Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC
- Xt8p8tK3EoMocZse2hw=
- </ds:SignatureValue>
- <ds:KeyInfo>
- <ds:X509Data>
- <ds:X509Certificate>MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw
- OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA
- A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl
- lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK
- ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl
- r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w
- kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS
- 3cyl/wz8</ds:X509Certificate>
- </ds:X509Data>
- </ds:KeyInfo>
- </ds:Signature>
- <saml2p:Extensions>
- <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
- <storkp:eIDSectorShare>false</storkp:eIDSectorShare>
- <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare>
- <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare>
- <storkp:RequestedAttributes>
- <stork:RequestedAttribute
- Name="http://www.stork.gov.eu/1.0/nationalityCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true" />
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true" />
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true" />
- </storkp:RequestedAttributes>
- </saml2p:Extensions>
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
+ xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:stork" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
+ AssertionConsumerServiceURL="http://localhost:8080/SP/ReturnPage"
+ Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://locahost:8080/PEPS/ServiceProvider"
+ ForceAuthn="true" ID="_0c64ff85-1323-4618-847b-12d1983b86e4" IsPassive="false"
+ IssueInstant="2010-04-07T16:45:03.593Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+ ProviderName="PT-SP" Version="2.0">
+ <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
+ <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+ <ds:SignatureValue>
+ S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR
+ Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC
+ Xt8p8tK3EoMocZse2hw=
+ </ds:SignatureValue>
+ <ds:KeyInfo>
+ <ds:X509Data>
+ <ds:X509Certificate>MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw
+ OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA
+ A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl
+ lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK
+ ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl
+ r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w
+ kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS
+ 3cyl/wz8</ds:X509Certificate>
+ </ds:X509Data>
+ </ds:KeyInfo>
+ </ds:Signature>
+ <saml2p:Extensions>
+ <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
+ <storkp:eIDSectorShare>false</storkp:eIDSectorShare>
+ <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare>
+ <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare>
+ <storkp:RequestedAttributes>
+ <stork:RequestedAttribute
+ Name="http://www.stork.gov.eu/1.0/nationalityCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true" />
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true" />
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true" />
+ </storkp:RequestedAttributes>
+ </saml2p:Extensions>
</saml2p:AuthnRequest> \ 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
index 1b1e1646c..db606145c 100644
--- 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
@@ -1,47 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<saml2p:AuthnRequest xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
- xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
- xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:stork" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
- AssertionConsumerServiceURL="http://localhost:8080/SP/ReturnPage"
- Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://localhost:8080/PEPS/ServiceProvider"
- ForceAuthn="true" ID="_0c64ff85-1323-4618-847b-12d1983b86e4" IsPassive="false"
- IssueInstant="2010-04-07T16:45:03.593Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
- ProviderName="PT-SP" Version="2.0">
- <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
- <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
- <ds:SignatureValue>
- S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR
- Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC
- Xt8p8tK3EoMocZse2hw=
- </ds:SignatureValue>
- <ds:KeyInfo>
- <ds:X509Data>
- <ds:X509Certificate>MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw
- OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA
- A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl
- lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK
- ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl
- r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w
- kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS
- 3cyl/wz8</ds:X509Certificate>
- </ds:X509Data>
- </ds:KeyInfo>
- </ds:Signature>
- <saml2p:Extensions>
- <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
- <storkp:eIDSectorShare>false</storkp:eIDSectorShare>
- <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare>
- <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare>
- <storkp:RequestedAttributes>
- <stork:RequestedAttribute
- Name="http://www.stork.gov.eu/1.0/nationalityCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true" />
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true" />
- <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName"
- NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
- isRequired="true" />
- </storkp:RequestedAttributes>
- </saml2p:Extensions>
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
+ xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:stork" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol"
+ AssertionConsumerServiceURL="http://localhost:8080/SP/ReturnPage"
+ Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://localhost:8080/PEPS/ServiceProvider"
+ ForceAuthn="true" ID="_0c64ff85-1323-4618-847b-12d1983b86e4" IsPassive="false"
+ IssueInstant="2010-04-07T16:45:03.593Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+ ProviderName="PT-SP" Version="2.0">
+ <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer>
+ <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+ <ds:SignatureValue>
+ S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR
+ Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC
+ Xt8p8tK3EoMocZse2hw=
+ </ds:SignatureValue>
+ <ds:KeyInfo>
+ <ds:X509Data>
+ <ds:X509Certificate>MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw
+ OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA
+ A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl
+ lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK
+ ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl
+ r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w
+ kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS
+ 3cyl/wz8</ds:X509Certificate>
+ </ds:X509Data>
+ </ds:KeyInfo>
+ </ds:Signature>
+ <saml2p:Extensions>
+ <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel>
+ <storkp:eIDSectorShare>false</storkp:eIDSectorShare>
+ <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare>
+ <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare>
+ <storkp:RequestedAttributes>
+ <stork:RequestedAttribute
+ Name="http://www.stork.gov.eu/1.0/nationalityCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true" />
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true" />
+ <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName"
+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
+ isRequired="true" />
+ </storkp:RequestedAttributes>
+ </saml2p:Extensions>
</saml2p:AuthnRequest> \ No newline at end of file
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
index 99d7d353a..84d48c00e 100644
--- a/id/server/stork2-saml-engine/src/test/resources/logback-test.xml
+++ b/id/server/stork2-saml-engine/src/test/resources/logback-test.xml
@@ -2,20 +2,20 @@
<!-- Basic configuration used until the IdP can load the real configuration -->
<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
- </Pattern>
- </layout>
- </appender>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+ </Pattern>
+ </layout>
+ </appender>
- <logger name="eu.stork">
- <level value="DEBUG" />
- </logger>
+ <logger name="eu.stork">
+ <level value="DEBUG" />
+ </logger>
- <root>
- <appender-ref ref="STDOUT" />
- <level value="INFO" />
- </root>
+ <root>
+ <appender-ref ref="STDOUT" />
+ <level value="INFO" />
+ </root>
</configuration> \ 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
index bd9f357ce..84f7050d1 100644
--- a/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg
+++ b/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg
@@ -1,21 +1,15 @@
-//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
+name=OpenDNSSEC
+library = /usr/lib/softhsm/libsofthsm.so
+slot = 0
+attributes(generate, *, *) = {
+ CKA_TOKEN = true
+}
+attributes(generate, CKO_CERTIFICATE, *) = {
+ CKA_PRIVATE = false
+}
+attributes(generate, CKO_PUBLIC_KEY, *) = {
+ CKA_PRIVATE = false
+}
attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={
CKA_VERIFY=true
}