From 1626ac9867cd5406b83e73651080e33c11fb98d1 Mon Sep 17 00:00:00 2001 From: kstranacher_eGovL Date: Thu, 12 Jul 2012 11:27:13 +0000 Subject: Integration of STORK git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1285 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../stork/mw/messages/saml/STORKAuthnRequest.java | 139 ++ .../eu/stork/mw/messages/saml/STORKResponse.java | 52 + .../messages/builder/STORKMessagesBuilder.java | 1367 ++++++++++++++++++++ .../stork/vidp/messages/common/STORKBootstrap.java | 73 ++ .../stork/vidp/messages/common/STORKConstants.java | 176 +++ .../vidp/messages/exception/SAMLException.java | 60 + .../exception/SAMLValidationException.java | 60 + .../stork/vidp/messages/saml/STORKAttribute.java | 65 + .../vidp/messages/saml/STORKAttributeValue.java | 51 + .../stork/vidp/messages/saml/STORKExtensions.java | 78 ++ .../messages/saml/STORKRequestedAttribute.java | 53 + .../messages/saml/impl/STORKAttributeBuilder.java | 60 + .../messages/saml/impl/STORKAttributeImpl.java | 63 + .../saml/impl/STORKAttributeMarshaller.java | 56 + .../saml/impl/STORKAttributeUnmarshaller.java | 58 + .../saml/impl/STORKAuthnRequestBuilder.java | 48 + .../messages/saml/impl/STORKAuthnRequestImpl.java | 170 +++ .../saml/impl/STORKAuthnRequestMarshaller.java | 44 + .../saml/impl/STORKAuthnRequestUnmarshaller.java | 137 ++ .../messages/saml/impl/STORKExtensionsBuilder.java | 45 + .../messages/saml/impl/STORKExtensionsImpl.java | 74 ++ .../saml/impl/STORKExtensionsMarshaller.java | 32 + .../saml/impl/STORKExtensionsUnmarshaller.java | 58 + .../saml/impl/STORKRequestedAttributeBuilder.java | 57 + .../saml/impl/STORKRequestedAttributeImpl.java | 66 + .../impl/STORKRequestedAttributeUnmarshaller.java | 64 + .../messages/saml/impl/STORKResponseBuilder.java | 48 + .../vidp/messages/saml/impl/STORKResponseImpl.java | 59 + .../saml/impl/STORKResponseMarshaller.java | 44 + .../saml/impl/STORKResponseUnmarshaller.java | 51 + .../messages/stork/AuthenticationAttributes.java | 55 + .../vidp/messages/stork/CitizenCountryCode.java | 48 + .../vidp/messages/stork/EIDCrossBorderShare.java | 54 + .../vidp/messages/stork/EIDCrossSectorShare.java | 54 + .../stork/vidp/messages/stork/EIDSectorShare.java | 54 + .../stork/QualityAuthenticationAssuranceLevel.java | 48 + .../vidp/messages/stork/RequestedAttributes.java | 58 + .../stork/vidp/messages/stork/SPAuthRequest.java | 46 + .../eu/stork/vidp/messages/stork/SPCertEnc.java | 44 + .../eu/stork/vidp/messages/stork/SPCertSig.java | 44 + .../eu/stork/vidp/messages/stork/SPCertType.java | 49 + .../java/eu/stork/vidp/messages/stork/SPID.java | 48 + .../stork/vidp/messages/stork/SPInformation.java | 67 + .../stork/vidp/messages/stork/SpApplication.java | 48 + .../eu/stork/vidp/messages/stork/SpCountry.java | 48 + .../stork/vidp/messages/stork/SpInstitution.java | 48 + .../eu/stork/vidp/messages/stork/SpSector.java | 48 + .../stork/VIDPAuthenticationAttributes.java | 60 + .../impl/AuthenticationAttributesBuilder.java | 46 + .../stork/impl/AuthenticationAttributesImpl.java | 74 ++ .../impl/AuthenticationAttributesMarshaller.java | 35 + .../impl/AuthenticationAttributesUnmarshaller.java | 52 + .../stork/impl/CitizenCountryCodeBuilder.java | 46 + .../stork/impl/CitizenCountryCodeImpl.java | 60 + .../stork/impl/CitizenCountryCodeMarshaller.java | 45 + .../stork/impl/CitizenCountryCodeUnmarshaller.java | 45 + .../stork/impl/EIDCrossBorderShareBuilder.java | 46 + .../stork/impl/EIDCrossBorderShareImpl.java | 80 ++ .../stork/impl/EIDCrossBorderShareMarshaller.java | 45 + .../impl/EIDCrossBorderShareUnmarshaller.java | 45 + .../stork/impl/EIDCrossSectorShareBuilder.java | 46 + .../stork/impl/EIDCrossSectorShareImpl.java | 80 ++ .../stork/impl/EIDCrossSectorShareMarshaller.java | 45 + .../impl/EIDCrossSectorShareUnmarshaller.java | 45 + .../messages/stork/impl/EIDSectorShareBuilder.java | 46 + .../messages/stork/impl/EIDSectorShareImpl.java | 80 ++ .../stork/impl/EIDSectorShareMarshaller.java | 45 + .../stork/impl/EIDSectorShareUnmarshaller.java | 45 + ...QualityAuthenticationAssuranceLevelBuilder.java | 46 + .../QualityAuthenticationAssuranceLevelImpl.java | 60 + ...lityAuthenticationAssuranceLevelMarshaller.java | 45 + ...tyAuthenticationAssuranceLevelUnmarshaller.java | 45 + .../stork/impl/RequestedAttributesBuilder.java | 58 + .../stork/impl/RequestedAttributesImpl.java | 88 ++ .../stork/impl/RequestedAttributesMarshaller.java | 40 + .../impl/RequestedAttributesUnmarshaller.java | 55 + .../messages/stork/impl/SPAuthRequestBuilder.java | 50 + .../messages/stork/impl/SPAuthRequestImpl.java | 76 ++ .../stork/impl/SPAuthRequestMarshaller.java | 57 + .../stork/impl/SPAuthRequestUnmarshaller.java | 70 + .../vidp/messages/stork/impl/SPCertEncBuilder.java | 46 + .../vidp/messages/stork/impl/SPCertEncImpl.java | 39 + .../messages/stork/impl/SPCertEncMarshaller.java | 34 + .../messages/stork/impl/SPCertEncUnmarshaller.java | 33 + .../vidp/messages/stork/impl/SPCertSigBuilder.java | 46 + .../vidp/messages/stork/impl/SPCertSigImpl.java | 39 + .../messages/stork/impl/SPCertSigMarshaller.java | 34 + .../messages/stork/impl/SPCertSigUnmarshaller.java | 33 + .../vidp/messages/stork/impl/SPCertTypeImpl.java | 72 ++ .../messages/stork/impl/SPCertTypeMarshaller.java | 34 + .../stork/impl/SPCertTypeUnmarshaller.java | 53 + .../vidp/messages/stork/impl/SPIDBuilder.java | 46 + .../stork/vidp/messages/stork/impl/SPIDImpl.java | 60 + .../vidp/messages/stork/impl/SPIDMarshaller.java | 45 + .../vidp/messages/stork/impl/SPIDUnmarshaller.java | 45 + .../messages/stork/impl/SPInformationBuilder.java | 46 + .../messages/stork/impl/SPInformationImpl.java | 121 ++ .../stork/impl/SPInformationMarshaller.java | 35 + .../stork/impl/SPInformationUnmarshaller.java | 61 + .../messages/stork/impl/SpApplicationBuilder.java | 46 + .../messages/stork/impl/SpApplicationImpl.java | 60 + .../stork/impl/SpApplicationMarshaller.java | 45 + .../stork/impl/SpApplicationUnmarshaller.java | 45 + .../vidp/messages/stork/impl/SpCountryBuilder.java | 46 + .../vidp/messages/stork/impl/SpCountryImpl.java | 60 + .../messages/stork/impl/SpCountryMarshaller.java | 45 + .../messages/stork/impl/SpCountryUnmarshaller.java | 45 + .../messages/stork/impl/SpInstitutionBuilder.java | 46 + .../messages/stork/impl/SpInstitutionImpl.java | 60 + .../stork/impl/SpInstitutionMarshaller.java | 45 + .../stork/impl/SpInstitutionUnmarshaller.java | 45 + .../vidp/messages/stork/impl/SpSectorBuilder.java | 47 + .../vidp/messages/stork/impl/SpSectorImpl.java | 60 + .../messages/stork/impl/SpSectorMarshaller.java | 45 + .../messages/stork/impl/SpSectorUnmarshaller.java | 45 + .../impl/VIDPAuthenticationAttributesBuilder.java | 46 + .../impl/VIDPAuthenticationAttributesImpl.java | 91 ++ .../VIDPAuthenticationAttributesMarshaller.java | 35 + .../VIDPAuthenticationAttributesUnmarshaller.java | 55 + .../java/eu/stork/vidp/messages/util/SAMLUtil.java | 405 ++++++ .../java/eu/stork/vidp/messages/util/XMLUtil.java | 143 ++ .../validation/StorkAssertionValidator.java | 91 ++ .../validation/StorkAttributeValidator.java | 204 +++ .../StorkAudienceRestrictionValidator.java | 56 + .../StorkAuthenticationAttributesValidator.java | 57 + .../validation/StorkAuthnRequestValidator.java | 137 ++ .../validation/StorkAuthnStatementValidator.java | 62 + .../StorkCitizenCountryCodeValidator.java | 63 + .../validation/StorkConditionsValidator.java | 70 + .../validation/StorkEIDSectorShareValidator.java | 51 + .../StorkEncryptedAttributeValidator.java | 50 + .../validation/StorkEncryptedIdValidator.java | 51 + .../validation/StorkExtensionsValidator.java | 66 + .../messages/validation/StorkIssuerValidator.java | 61 + .../messages/validation/StorkNameIDValidator.java | 67 + .../validation/StorkNameIdPolicyValidator.java | 52 + ...alityAuthenticationAssuranceLevelValidator.java | 54 + .../StorkRequestedAttributeValidator.java | 92 ++ .../StorkRequestedAttributesValidator.java | 45 + .../validation/StorkResponseValidator.java | 137 ++ .../messages/validation/StorkSPIDValidator.java | 64 + .../validation/StorkSPInformationValidator.java | 49 + .../validation/StorkSpApplicationValidator.java | 63 + .../validation/StorkSpCountryValidator.java | 58 + .../validation/StorkSpInstitutionValidator.java | 62 + .../validation/StorkSpSectorValidator.java | 65 + .../validation/StorkStatusCodeValidator.java | 139 ++ .../messages/validation/StorkStatusValidator.java | 55 + .../StorkSubjectConfirmationValidator.java | 128 ++ .../validation/StorkSubjectLocalityValidator.java | 47 + .../messages/validation/StorkSubjectValidator.java | 60 + ...StorkVIDPAuthenticationAttributesValidator.java | 57 + .../src/main/resources/saml2-post-binding-moa.vm | 38 + .../src/main/resources/saml2-stork-config.xml | 242 ++++ 154 files changed, 11145 insertions(+) create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKAuthnRequest.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKResponse.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/builder/STORKMessagesBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKBootstrap.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKConstants.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLException.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLValidationException.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttribute.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttributeValue.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKExtensions.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKRequestedAttribute.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/AuthenticationAttributes.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/CitizenCountryCode.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossBorderShare.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossSectorShare.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDSectorShare.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/QualityAuthenticationAssuranceLevel.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/RequestedAttributes.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPAuthRequest.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertEnc.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertSig.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertType.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPID.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPInformation.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpApplication.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpCountry.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpInstitution.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpSector.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/VIDPAuthenticationAttributes.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesBuilder.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesImpl.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesMarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesUnmarshaller.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/SAMLUtil.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/XMLUtil.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAssertionValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAttributeValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAudienceRestrictionValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthenticationAttributesValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnRequestValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnStatementValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkCitizenCountryCodeValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkConditionsValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEIDSectorShareValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedAttributeValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedIdValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkExtensionsValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkIssuerValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIDValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIdPolicyValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkQualityAuthenticationAssuranceLevelValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributeValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributesValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkResponseValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPIDValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPInformationValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpApplicationValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpCountryValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpInstitutionValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpSectorValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusCodeValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectConfirmationValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectLocalityValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectValidator.java create mode 100644 id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkVIDPAuthenticationAttributesValidator.java create mode 100644 id/server/stork-saml-engine/src/main/resources/saml2-post-binding-moa.vm create mode 100644 id/server/stork-saml-engine/src/main/resources/saml2-stork-config.xml (limited to 'id/server/stork-saml-engine/src') diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKAuthnRequest.java b/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKAuthnRequest.java new file mode 100644 index 000000000..b84721ff5 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKAuthnRequest.java @@ -0,0 +1,139 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.mw.messages.saml; + +import java.security.cert.X509Certificate; +import java.util.List; + +import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.metadata.RequestedAttribute; +import org.opensaml.xml.XMLObject; + +/** + * Interface extending a SAML AuthnRequest by additional attributes required by STORK + * @author bzwattendorfer + * + */ +public interface STORKAuthnRequest extends AuthnRequest { + + /** + * Sets the ID of the requesting Service Provider + * @param spID ID of the Service Provider + */ + public void setSPID(String spID); + + /** + * Gets the ID of the Service Provider + * @return ID of the Service Provider + */ + public String getSPID(); + + /** + * Sets the citizen country code + * @param citizenCountryCode citizen country code + */ + public void setCitizenCountryCode(String citizenCountryCode); + + /** + * Gets the citizen country code + * @return citizen country code + */ + public String getCitizenCountryCode(); + + /** + * Sets the final redirect URL + * @param finalRedirectURL Final redirect URL + */ + public void setFinalRedirectURL(String finalRedirectURL); + + /** + * Gets the final redirect URL + * @return final redirect URL + */ + public String getFinalRedirectURL(); + + /** + * Sets the signing certificate of the service provider + * @param signingCertificate Signing certificate of the SP + */ + public void setSPCertSig(X509Certificate signingCertificate); + + /** + * Gets the signing certificate of the service provider + * @return signing certificate of the service provider + */ + public X509Certificate getSPCertSig(); + + /** + * Sets the encryption certificate of the service provider + * @param encryptionCertificate encryption certificate of the SP + */ + public void setSPCertEnc(X509Certificate encryptionCertificate); + + /** + * Gets the encryption certificate of the service provider + * @return encryption certificate of the SP + */ + public X509Certificate getSPCertEnc(); + + + /** + * Sets the original authentication request of the service provider + * @param spAuthRequest original SP authentication request + */ + public void setOriginalSPAuthRequest(XMLObject spAuthRequest); + + /** + * Gets the original authentication request of the service provider + * @return original SP authentication request + */ + public XMLObject getOriginalSPAuthRequest(); + + /** + * Sets the requested STORK QAA level + * @param authLevel Requested STORK QAA level + */ + public void setQAALevel(int authLevel); + + /** + * Gets the requested STORK QAA level + * @return Requested STORK QAA level + */ + public int getQAALevel(); + + /** + * Gets a list of requested attributes + * @return List containg all requested attributes + */ + public List getRequestedAttributes(); + + /** + * Sets the requested attributes + * @param requestedAttributesList List containg all requested attributes + */ + public void setRequestedAttributes(List requestedAttributesList); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKResponse.java b/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKResponse.java new file mode 100644 index 000000000..28de6068b --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/mw/messages/saml/STORKResponse.java @@ -0,0 +1,52 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.mw.messages.saml; + +import org.opensaml.saml2.core.Response; + +/** + * Interface extending a SAML Response by attributes required by STORK + * @author bzwattendorfer + * + */ +public interface STORKResponse extends Response { + + /** + * Sets the QAA level by which the user has been authenticated + * @param authLevel STORK QAA level used for authentication + */ + public void setQAALevel(int authLevel); + + /** + * Gets the QAA level by which the user has been authenticated + * @return STORK QAA level used for authentication + */ + public int getQAALevel(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/builder/STORKMessagesBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/builder/STORKMessagesBuilder.java new file mode 100644 index 000000000..2f9a19620 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/builder/STORKMessagesBuilder.java @@ -0,0 +1,1367 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.builder; + +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateEncodingException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.commons.lang.StringUtils; +import org.joda.time.DateTime; +import org.opensaml.Configuration; +import org.opensaml.common.IdentifierGenerator; +import org.opensaml.common.SAMLObject; +import org.opensaml.common.SAMLObjectBuilder; +import org.opensaml.common.SAMLVersion; +import org.opensaml.common.impl.SecureRandomIdentifierGenerator; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.AttributeStatement; +import org.opensaml.saml2.core.AttributeValue; +import org.opensaml.saml2.core.Audience; +import org.opensaml.saml2.core.AudienceRestriction; +import org.opensaml.saml2.core.AuthnContext; +import org.opensaml.saml2.core.AuthnStatement; +import org.opensaml.saml2.core.Conditions; +import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.NameID; +import org.opensaml.saml2.core.OneTimeUse; +import org.opensaml.saml2.core.Status; +import org.opensaml.saml2.core.StatusCode; +import org.opensaml.saml2.core.StatusDetail; +import org.opensaml.saml2.core.StatusMessage; +import org.opensaml.saml2.core.Subject; +import org.opensaml.saml2.core.SubjectConfirmation; +import org.opensaml.saml2.core.SubjectConfirmationData; +import org.opensaml.saml2.core.SubjectLocality; +import org.opensaml.saml2.metadata.RequestedAttribute; +import org.opensaml.ws.soap.common.SOAPObject; +import org.opensaml.ws.soap.common.SOAPObjectBuilder; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.XMLObjectBuilder; +import org.opensaml.xml.schema.XSAny; +import org.opensaml.xml.schema.XSString; +import org.opensaml.xml.schema.impl.XSAnyBuilder; +import org.opensaml.xml.schema.impl.XSStringBuilder; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.signature.X509Data; +import org.opensaml.xml.util.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.stork.mw.messages.saml.STORKAuthnRequest; +import eu.stork.mw.messages.saml.STORKResponse; +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.saml.STORKAttribute; +import eu.stork.vidp.messages.saml.STORKAttributeValue; +import eu.stork.vidp.messages.saml.STORKExtensions; +import eu.stork.vidp.messages.saml.STORKRequestedAttribute; +import eu.stork.vidp.messages.stork.AuthenticationAttributes; +import eu.stork.vidp.messages.stork.CitizenCountryCode; +import eu.stork.vidp.messages.stork.EIDCrossBorderShare; +import eu.stork.vidp.messages.stork.EIDCrossSectorShare; +import eu.stork.vidp.messages.stork.EIDSectorShare; +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; +import eu.stork.vidp.messages.stork.RequestedAttributes; +import eu.stork.vidp.messages.stork.SPAuthRequest; +import eu.stork.vidp.messages.stork.SPCertEnc; +import eu.stork.vidp.messages.stork.SPCertSig; +import eu.stork.vidp.messages.stork.SPCertType; +import eu.stork.vidp.messages.stork.SPID; +import eu.stork.vidp.messages.stork.SPInformation; +import eu.stork.vidp.messages.stork.SpApplication; +import eu.stork.vidp.messages.stork.SpCountry; +import eu.stork.vidp.messages.stork.SpInstitution; +import eu.stork.vidp.messages.stork.SpSector; +import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; + +/** + * Class providing several methods for SAML Object generation + * @author bzwattendorfer + * + */ +public class STORKMessagesBuilder { + + final static Logger log = LoggerFactory.getLogger(STORKMessagesBuilder.class); + + /** + * Builds an arbitrary OpenSAML XML object + * @param OpenSAML XMLObject + * @param objectQName QName of the XML element + * @return Builded OpenSAML XMLObject + */ + @SuppressWarnings("unchecked") + public static T buildXMLObject(QName objectQName) { + + try { + XMLObjectBuilder builder = (XMLObjectBuilder) Configuration.getBuilderFactory().getBuilder(objectQName); + return builder.buildObject(objectQName.getNamespaceURI(), objectQName.getLocalPart(), objectQName.getPrefix()); + } catch (Exception e) { + log.error("Cannot build XML Object {}: {}", objectQName.getLocalPart(), e); + throw new RuntimeException(e); + } + + } + + /** + * Builds a SOAP object + * @param SOAP Object or any extensions + * @param objectQName QName of the XML element + * @return SOAP Object or any extensions + */ + @SuppressWarnings("unchecked") + public static T buildSOAPObject(QName objectQName) { + + try { + SOAPObjectBuilder builder = (SOAPObjectBuilder) Configuration.getBuilderFactory().getBuilder(objectQName); + return builder.buildObject(); + } catch (Exception e) { + log.error("Cannot build SOAP Object {}: {}", objectQName.getLocalPart(), e); + throw new RuntimeException(e); + } + + } + + /** + * Builds an arbitrary OpenSAML SAML object + * @param OpenSAML SAML Object + * @param objectQName QName of the SAML element + * @return Builded OpenSAML SAML Object + */ + @SuppressWarnings("unchecked") + public static T buildSAMLObject(QName objectQName) { + + try { + SAMLObjectBuilder builder = (SAMLObjectBuilder) Configuration.getBuilderFactory().getBuilder(objectQName); + return builder.buildObject(); + } catch (Exception e) { + log.error("Cannot build SAML Object {}: {}", objectQName.getLocalPart(), e); + throw new RuntimeException(e); + } + + } + + + + /** + * Builds SAML Issuer object + * @param issuerValue Value for the issuer element + * @return Issuer object + */ + public static Issuer buildIssuer(String issuerValue) { + if (StringUtils.isEmpty(issuerValue)) + return null; + + Issuer issuer = buildXMLObject(Issuer.DEFAULT_ELEMENT_NAME); + issuer.setValue(issuerValue); + issuer.setFormat(Issuer.ENTITY); + + return issuer; + } + + /** + * Builds a QualityAuthenticationAssuranceLevel object + * @param qaaValue QAALevel (1 to 4) + * @return QualityAuthenticationAssuranceLevel object + */ + public static QualityAuthenticationAssuranceLevel buildQualityAuthenticationAssuranceLevel(int qaaValue) { + if (qaaValue < 1 || qaaValue > 4) { + log.error("QAA Level must be between 1 and 4."); + return null; + } + + QualityAuthenticationAssuranceLevel qaaLevel = buildXMLObject(QualityAuthenticationAssuranceLevel.DEFAULT_ELEMENT_NAME); + qaaLevel.setValue(qaaValue); + return qaaLevel; + } + + /** + * Builds a STORK RequestedAttribute object + * @param name Name of the RequesteAttribute + * @param isRequired true or false if RequestedAttribute is required + * @param value Value of RequestedAttribute + * @return STORK RequestedAttribute object + */ + public static RequestedAttribute buildRequestedAttribute(String name, boolean isRequired, String value) { + + RequestedAttribute reqAttribute = buildXMLObject(STORKRequestedAttribute.DEFAULT_ELEMENT_NAME); + reqAttribute.setName(name); + reqAttribute.setNameFormat(STORKRequestedAttribute.URI_REFERENCE); + reqAttribute.setIsRequired(isRequired); + + if (!StringUtils.isEmpty(value)) { + XSString stringValue = buildXSString(STORKAttributeValue.DEFAULT_ELEMENT_NAME); + stringValue.setValue(value); + reqAttribute.getAttributeValues().add(stringValue); + } + + return reqAttribute; + } + + /** + * Builds XML String type object with given QName + * @param qname QName for object to build + * @return XML object as String type + */ + public static XSString buildXSString(QName qname) { + XSStringBuilder stringBuilder = (XSStringBuilder) Configuration.getBuilderFactory().getBuilder(XSString.TYPE_NAME); + return stringBuilder.buildObject(qname, XSString.TYPE_NAME); + } + + /** + * Builds XML Any type object with given QName + * @param qname QName for object to build + * @return XML object as Any type + */ + public static XSAny buildXSAny(QName qname) { + XSAnyBuilder anyBuilder = (XSAnyBuilder) Configuration.getBuilderFactory().getBuilder(XSAny.TYPE_NAME); + return anyBuilder.buildObject(qname, XSAny.TYPE_NAME); + } + + /** + * Builds a List of RequestedAttribute + * @param requestedAttributeArguments RequestedAttributes + * @return List of RequestedAttribute + */ + public static RequestedAttributes buildRequestedAttributes(RequestedAttribute... requestedAttributeArguments) { + + if (requestedAttributeArguments == null) + return null; + + RequestedAttributes reqAttributes = buildXMLObject(RequestedAttributes.DEFAULT_ELEMENT_NAME); + + for (RequestedAttribute reqAttr : requestedAttributeArguments) { + reqAttributes.getRequestedAttributes().add(reqAttr); + } + + return reqAttributes; + } + + /** + * Builds RequestedAttributes object out of list of RequestedAttribute + * @param requestedAttributeList List of RequestedAttribute + * @return RequestedAttributes object + */ + public static RequestedAttributes buildRequestedAttributes(List requestedAttributeList) { + if (requestedAttributeList == null) + return null; + + RequestedAttributes reqAttributes = buildXMLObject(RequestedAttributes.DEFAULT_ELEMENT_NAME); + reqAttributes.getRequestedAttributes().addAll(requestedAttributeList); + + return reqAttributes; + } + + /** + * Builds a STORK CitizenCountryCode object + * @param ccc ISO country code + * @return CitizenCountryCode object + */ + public static CitizenCountryCode buildCitizenCountryCode(String ccc) { + if (StringUtils.isEmpty(ccc)) { + log.error("CitizenCountryCode must have a value."); + return null; + } + + CitizenCountryCode citizenCountryCode = buildXMLObject(CitizenCountryCode.DEFAULT_ELEMENT_NAME); + citizenCountryCode.setValue(ccc); + + return citizenCountryCode; + } + + /** + * Builds a SPID object + * @param spIDString String to be used as SPID + * @return SPID object + */ + public static SPID buildSPID(String spIDString) { + if (StringUtils.isEmpty(spIDString)) { + log.error("SPID must have a value."); + return null; + } + + SPID spID = buildXMLObject(SPID.DEFAULT_ELEMENT_NAME); + spID.setValue(spIDString); + + return spID; + } + + /** + * Builds SPCertType + * @param cert X509Certificate + * @return SPCertType + */ + private static SPCertType buildSPCertType(X509Certificate cert) { + SPCertType spCertType = buildXMLObject(SPCertType.TYPE_NAME); + KeyInfo keyInfo = buildXMLObject(KeyInfo.DEFAULT_ELEMENT_NAME); + X509Data x509DataElem = buildXMLObject(X509Data.DEFAULT_ELEMENT_NAME); + org.opensaml.xml.signature.X509Certificate x509CertElem = buildXMLObject(org.opensaml.xml.signature.X509Certificate.DEFAULT_ELEMENT_NAME); + + try { + x509CertElem.setValue(Base64.encodeBytes(cert.getEncoded())); + } catch (CertificateEncodingException e) { + log.error("Cannot encode certificate.", e); + throw new RuntimeException(e); + } + + x509DataElem.getX509Certificates().add(x509CertElem); + keyInfo.getX509Datas().add(x509DataElem); + spCertType.setKeyInfo(keyInfo); + return spCertType; + } + + /** + * Builds SPCertSig object + * @param cert X509Certificate + * @return SPCertSig + */ + public static SPCertSig buildSPCertSig(X509Certificate cert) { + return (SPCertSig) buildSPCertType(cert); + } + + /** + * Builds SPCertEnc object + * @param cert X509Certificate + * @return SPCertEnc + */ + public static SPCertEnc buildSPCertEnc(X509Certificate cert) { + return (SPCertEnc) buildSPCertType(cert); + } + + /** + * Builds SPAuthRequest object + * @param xmlObject Abritrary XML object + * @return SPAuthRequest + */ + public static SPAuthRequest buildSPAuthRequest(XMLObject xmlObject) { + SPAuthRequest authRequest = buildXMLObject(SPAuthRequest.DEFAULT_ELEMENT_NAME); + authRequest.getUnknownXMLObjects().add(xmlObject); + return authRequest; + } + + /** + * Builds SPInformation object + * @param spIDString SPID + * @param sigCert SP signature certificate + * @param encCert SP encryption certificate + * @param spAuthRequest Original SP AuthnRequest + * @return SPInformations + */ + public static SPInformation buildSPInformation(String spIDString, X509Certificate sigCert, X509Certificate encCert, XMLObject spAuthRequest) { + + SPInformation spInformation = buildXMLObject(SPInformation.DEFAULT_ELEMENT_NAME); + + SPID spID = buildSPID(spIDString); + spInformation.setSPID(spID); + + if (sigCert != null) { + SPCertSig spCertSig = buildSPCertSig(sigCert); + spInformation.setSPCertSig(spCertSig); + } + + if (encCert != null) { + SPCertEnc spCertEnc = buildSPCertEnc(encCert); + spInformation.setSPCertEnc(spCertEnc); + } + + if (spAuthRequest != null) { + SPAuthRequest spAuthRequestElem = buildSPAuthRequest(spAuthRequest); + spInformation.setSPAuthRequest(spAuthRequestElem); + } + + return spInformation; + + } + + /** + * Builds VIDPAuthenticationAttributes objext + * @param ccc ISO citizen country code + * @param spIDString SPID + * @param sigCert SP signature certificate + * @param encCert SP encryption certificate + * @param spAuthRequest Original SP AuthnRequest + * @return VIDPAuthenticationAttributes + */ + public static VIDPAuthenticationAttributes buildVIDPAuthenticationAttributes(String ccc, String spIDString, X509Certificate sigCert, X509Certificate encCert, XMLObject spAuthRequest) { + VIDPAuthenticationAttributes vidpAuthenticationAttributes = buildXMLObject(VIDPAuthenticationAttributes.DEFAULT_ELEMENT_NAME); + + CitizenCountryCode citizenCountryCode = buildCitizenCountryCode(ccc); + SPInformation spInformation = buildSPInformation(spIDString, sigCert, encCert, spAuthRequest); + + vidpAuthenticationAttributes.setCitizenCountryCode(citizenCountryCode); + vidpAuthenticationAttributes.setSPInformation(spInformation); + + return vidpAuthenticationAttributes; + } + + /** + * Builds AuthenticationAttributes object + * @param ccc ISO citizen country code + * @param spIDString SPID + * @param sigCert SP signature certificate + * @param encCert SP encryption certificate + * @param spAuthRequest Original SP AuthnRequest + * @return AuthenticationAttributes + */ + public static AuthenticationAttributes buildAuthenticationAttributes(String ccc, String spIDString, X509Certificate sigCert, X509Certificate encCert, XMLObject spAuthRequest) { + AuthenticationAttributes authenticationAttributes = buildXMLObject(AuthenticationAttributes.DEFAULT_ELEMENT_NAME); + + VIDPAuthenticationAttributes vidpAuthenticationAttributes = buildVIDPAuthenticationAttributes(ccc, spIDString, sigCert, encCert, spAuthRequest); + + authenticationAttributes.setVIDPAuthenticationAttributes(vidpAuthenticationAttributes); + return authenticationAttributes; + + } + + /** + * Builds SpSector object + * @param spSector Value SPSector value + * @return SpSector + */ + public static SpSector buildSpSector(String spSectorValue) { + + SpSector spSector = buildXMLObject(SpSector.DEFAULT_ELEMENT_NAME); + spSector.setValue(spSectorValue); + + return spSector; + } + + /** + * Builds SpInstitution object + * @param spInstitutionValue Value for SpInstitution + * @return SpInstitution + */ + public static SpInstitution buildSpInstitution(String spInstitutionValue) { + + SpInstitution spInstitution = buildXMLObject(SpInstitution.DEFAULT_ELEMENT_NAME); + spInstitution.setValue(spInstitutionValue); + + return spInstitution; + } + + + /** + * Builds SpApplication object + * @param spApplicationValue Value for SpApplication + * @return SpApplication + */ + public static SpApplication buildSpApplication(String spApplicationValue) { + + SpApplication spApplication = buildXMLObject(SpApplication.DEFAULT_ELEMENT_NAME); + spApplication.setValue(spApplicationValue); + + return spApplication; + } + + /** + * Builds SpCountry object + * @param spCountryValue ISO Code Value for SpCountry + * @return SpCountry + */ + public static SpCountry buildSpCountry(String spCountryValue) { + + SpCountry spCountry = buildXMLObject(SpCountry.DEFAULT_ELEMENT_NAME); + spCountry.setValue(spCountryValue); + + return spCountry; + } + + /** + * Generates secured randomized ID for SAML Messages + * @return secured randomized ID + */ + public static String generateID() { + try { + IdentifierGenerator idGenerator = new SecureRandomIdentifierGenerator(); + return idGenerator.generateIdentifier(); + } catch (NoSuchAlgorithmException e) { + log.error("Cannot generate id", e); + throw new RuntimeException(e); + + } + + } + + /** + * Builds STORKAuthnRequest object + * @param destination Endpoint for AuthnRequest + * @param acsURL Endpoint where STORK response wants to be received + * @param providerName Provider Name + * @param issuerValue Value for Issuer element + * @param qaaLevel STORK QAALevel + * @param requestedAttributes Attributes to be requested + * @param spSector SPSector + * @param spInstitution SPInstitution + * @param spApplication SPApplication + * @param spCountry SPCountry + * @return STORKAuthnRequest + */ + public static STORKAuthnRequest buildSTORKAuthnRequest( + String destination, + String acsURL, + String providerName, + String issuerValue, + QualityAuthenticationAssuranceLevel qaaLevel, + RequestedAttributes requestedAttributes, + String spSector, + String spInstitution, + String spApplication, + String spCountry) { + + //fixed values + String consent = STORKAuthnRequest.UNSPECIFIED_CONSENT; + boolean forceAuthn = true; + boolean isPassive = false; + String binding = SAMLConstants.SAML2_POST_BINDING_URI; + boolean eIDSectorShare = true; + boolean eIDCrossSectorShare = true; + boolean eIDCrossBorderShare = false; + + STORKAuthnRequest authnRequest = buildXMLObject(STORKAuthnRequest.DEFAULT_ELEMENT_NAME); + + authnRequest.setVersion(SAMLVersion.VERSION_20); + authnRequest.setID(generateID()); + authnRequest.setIssueInstant(new DateTime()); + + authnRequest.setConsent(consent); + authnRequest.setForceAuthn(forceAuthn); + authnRequest.setIsPassive(isPassive); + authnRequest.setProtocolBinding(binding); + + authnRequest.setDestination(destination); + authnRequest.setAssertionConsumerServiceURL(acsURL); + authnRequest.setProviderName(providerName); + authnRequest.setIssuer(buildIssuer(issuerValue)); + + STORKExtensions extensions = buildSTORKExtensions(); + + authnRequest.setQAALevel(qaaLevel.getValue()); + extensions.setQAALevel(qaaLevel); + + authnRequest.setRequestedAttributes(requestedAttributes.getRequestedAttributes()); + extensions.setRequestedAttributes(requestedAttributes); + + EIDSectorShare eidSectorShareObj = buildXMLObject(EIDSectorShare.DEFAULT_ELEMENT_NAME); + eidSectorShareObj.setValue(eIDSectorShare); + + EIDCrossSectorShare eidCrossSectorShareObj = buildXMLObject(EIDCrossSectorShare.DEFAULT_ELEMENT_NAME); + eidCrossSectorShareObj.setValue(eIDCrossSectorShare); + + EIDCrossBorderShare eidCrossBorderShareObj = buildXMLObject(EIDCrossBorderShare.DEFAULT_ELEMENT_NAME); + eidCrossBorderShareObj.setValue(eIDCrossBorderShare); + + SpSector spSectorObj = buildSpSector(spSector); + SpInstitution spInstitutionObj = buildSpInstitution(spInstitution); + SpApplication spApplicationObj = buildSpApplication(spApplication); + SpCountry spCountryObj = buildSpCountry(spCountry); + + + extensions.getUnknownXMLObjects().add(qaaLevel); + extensions.getUnknownXMLObjects().add(spSectorObj); + extensions.getUnknownXMLObjects().add(spInstitutionObj); + extensions.getUnknownXMLObjects().add(spApplicationObj); + extensions.getUnknownXMLObjects().add(spCountryObj); + extensions.getUnknownXMLObjects().add(eidSectorShareObj); + extensions.getUnknownXMLObjects().add(eidCrossSectorShareObj); + extensions.getUnknownXMLObjects().add(eidCrossBorderShareObj); + extensions.getUnknownXMLObjects().add(requestedAttributes); + + authnRequest.setExtensions(extensions); + + return authnRequest; + } + + /** + * Builds STORKAuthnRequest object + * @param destination Endpoint for AuthnRequest + * @param acsURL Endpoint where STORK response wants to be received + * @param providerName Provider Name + * @param issuerValue Value for Issuer element + * @param qaaLevel STORK QAALevel + * @param requestedAttributeList List of STORK attributes to be requested + * @param ccc ISO citizen country code + * @param spIDString SPID + * @param sigCert SP signature certificate + * @param encCert SP encryption certificate + * @param spAuthRequest Original SP AuthnRequest + * @param spSector SPSector + * @param spInstitution SPInstitution + * @param spApplication SPApplication + * @param spCountry SPCountry + * @return STORKAuthnRequest + */ + public static STORKAuthnRequest buildSTORKAuthnRequest( + String destination, + String acsURL, + String providerName, + String issuerValue, + int qaaLevel, + List requestedAttributeList, + String ccc, + String spID, + X509Certificate sigCert, + X509Certificate encCert, + XMLObject spAuthRequest, + String spSector, + String spInstitution, + String spApplication, + String spCountry) { + + //fixed values via config + String consent = STORKAuthnRequest.UNSPECIFIED_CONSENT; + boolean forceAuthn = true; + boolean isPassive = false; + String binding = SAMLConstants.SAML2_POST_BINDING_URI; + boolean eIDSectorShare = true; + boolean eIDCrossSectorShare = true; + boolean eIDCrossBorderShare = false; + + return buildSTORKAuthnRequest(consent, forceAuthn, isPassive, binding, eIDSectorShare, eIDCrossSectorShare, eIDCrossBorderShare, destination, acsURL, providerName, issuerValue, qaaLevel, requestedAttributeList, ccc, spID, sigCert, encCert, spAuthRequest, spSector, spInstitution, spApplication, spCountry); + + } + + /** + * Builds STORKAuthnRequest object + * @param consent Consent for the request + * @param forceAuthn forceAuthn + * @param isPassive isPassive + * @param binding Binding the request is sent over + * @param eIDSectorShare Should eIdentifier be shared? + * @param eIDCrossSectorShare Should eIdentifier be shared across sectors? + * @param eIDCrossBorderShare Should eIdentifier be shared across borders? + * @param destination Endpoint for AuthnRequest + * @param acsURL Endpoint where STORK response wants to be received + * @param providerName Provider Name + * @param issuerValue Value for Issuer element + * @param qaaLevel STORK QAALevel + * @param requestedAttributeList List of STORK attributes to be requested + * @param ccc ISO citizen country code + * @param spIDString SPID + * @param sigCert SP signature certificate + * @param encCert SP encryption certificate + * @param spAuthRequest Original SP AuthnRequest + * @param spSector SPSector + * @param spInstitution SPInstitution + * @param spApplication SPApplication + * @param spCountry SPCountry + * @return STORKAuthnRequest + */ + public static STORKAuthnRequest buildSTORKAuthnRequest( + String consent, + boolean forceAuthn, + boolean isPassive, + String binding, + boolean eIDSectorShare, + boolean eIDCrossSectorShare, + boolean eIDCrossBorderShare, + String destination, + String acsURL, + String providerName, + String issuerValue, + int qaaLevel, + List requestedAttributeList, + String ccc, + String spID, + X509Certificate sigCert, + X509Certificate encCert, + XMLObject spAuthRequest, + String spSector, + String spInstitution, + String spApplication, + String spCountry) { + + STORKAuthnRequest authnRequest = buildXMLObject(STORKAuthnRequest.DEFAULT_ELEMENT_NAME); + + authnRequest.setVersion(SAMLVersion.VERSION_20); + authnRequest.setID(generateID()); + authnRequest.setIssueInstant(new DateTime()); + + authnRequest.setDestination(destination); + authnRequest.setAssertionConsumerServiceURL(acsURL); + authnRequest.setProviderName(providerName); + authnRequest.setIssuer(buildIssuer(issuerValue)); + authnRequest.setQAALevel(qaaLevel); + authnRequest.setRequestedAttributes(requestedAttributeList); + authnRequest.setCitizenCountryCode(ccc); + authnRequest.setSPID(spID); + authnRequest.setSPCertSig(sigCert); + authnRequest.setSPCertEnc(encCert); + authnRequest.setOriginalSPAuthRequest(spAuthRequest); + + authnRequest.setConsent(consent); + authnRequest.setForceAuthn(forceAuthn); + authnRequest.setIsPassive(isPassive); + authnRequest.setProtocolBinding(binding); + + addSTORKExtensionsToAuthnRequest(authnRequest, qaaLevel, requestedAttributeList, ccc, spID, sigCert, encCert, spAuthRequest, eIDSectorShare, eIDCrossSectorShare, eIDCrossBorderShare, spSector, spInstitution, spApplication, spCountry); + + return authnRequest; + + } + + /** + * Adds STORK Extensions to STORKAuthnRequest + * @param authnRequest + * @param qaaLevel STORK QAALevel + * @param requestedAttributeList List of STORK attributes to be requested + * @param ccc ISO citizen country code + * @param spIDString SPID + * @param sigCert SP signature certificate + * @param encCert SP encryption certificate + * @param spAuthRequest Original SP AuthnRequest + * @param spSector SPSector + * @param spInstitution SPInstitution + * @param spApplication SPApplication + * @param spCountry SPCountry + */ + public static void addSTORKExtensionsToAuthnRequest( + STORKAuthnRequest authnRequest, + int qaaLevel, + List requestedAttributeList, + String ccc, + String spID, + X509Certificate sigCert, + X509Certificate encCert, + XMLObject spAuthRequest, + boolean eIDSectorShare, + boolean eIDCrossSectorShare, + boolean eIDCrossBorderShare, + String spSector, + String spInstitution, + String spApplication, + String spCountry) { + + STORKExtensions extensions = buildSTORKExtensions(); + authnRequest.setRequestedAttributes(requestedAttributeList); + + QualityAuthenticationAssuranceLevel qaaLevelObj = buildQualityAuthenticationAssuranceLevel(qaaLevel); + RequestedAttributes requestedAttributesObj = buildRequestedAttributes(requestedAttributeList); + AuthenticationAttributes authenticationAttributesObj = buildAuthenticationAttributes(ccc, spID, sigCert, encCert, spAuthRequest); + + EIDSectorShare eidSectorShareObj = buildXMLObject(EIDSectorShare.DEFAULT_ELEMENT_NAME); + eidSectorShareObj.setValue(eIDSectorShare); + + EIDCrossSectorShare eidCrossSectorShareObj = buildXMLObject(EIDCrossSectorShare.DEFAULT_ELEMENT_NAME); + eidCrossSectorShareObj.setValue(eIDCrossSectorShare); + + EIDCrossBorderShare eidCrossBorderShareObj = buildXMLObject(EIDCrossBorderShare.DEFAULT_ELEMENT_NAME); + eidCrossBorderShareObj.setValue(eIDCrossBorderShare); + + SpSector spSectorObj = buildSpSector(spSector); + SpApplication spApplicationObj = buildSpApplication(spApplication); + SpCountry spCountryObj = buildSpCountry(spCountry); + + extensions.setQAALevel(qaaLevelObj); + extensions.setRequestedAttributes(requestedAttributesObj); + extensions.setAuthenticationAttributes(authenticationAttributesObj); + + extensions.getUnknownXMLObjects().add(qaaLevelObj); + extensions.getUnknownXMLObjects().add(spSectorObj); + extensions.getUnknownXMLObjects().add(spApplicationObj); + extensions.getUnknownXMLObjects().add(spCountryObj); + extensions.getUnknownXMLObjects().add(eidSectorShareObj); + extensions.getUnknownXMLObjects().add(eidCrossSectorShareObj); + extensions.getUnknownXMLObjects().add(eidCrossBorderShareObj); + extensions.getUnknownXMLObjects().add(requestedAttributesObj); + extensions.getUnknownXMLObjects().add(authenticationAttributesObj); + + authnRequest.setExtensions(extensions); + + } + + + /** + * Builds STORKExtensions object + * @return STORKExtensions + */ + public static STORKExtensions buildSTORKExtensions() { + QName samlProtocolExtensions = new QName(SAMLConstants.SAML20P_NS, STORKExtensions.LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); + return buildXMLObject(samlProtocolExtensions); + } + + /** + * Builds STORKResponse + * @param destination Endpoint where the STORKResponse should be sent to + * @param inResponseTo ID of the corresponding AuthnRequest + * @param issuer Issuer value of the response + * @param status Status of the response (success, error, etc.) + * @param assertion SAML assertion to be included + * @return STORKResponse + */ + public static STORKResponse buildSTORKResponse( + String destination, + String inResponseTo, + Issuer issuer, + Status status, + Assertion assertion) { + + STORKResponse response = buildXMLObject(STORKResponse.DEFAULT_ELEMENT_NAME); + + response.setDestination(destination); + response.setInResponseTo(inResponseTo); + response.setConsent(STORKResponse.OBTAINED_CONSENT); + response.setID(generateID()); + response.setIssueInstant(new DateTime()); + response.setVersion(SAMLVersion.VERSION_20); + + response.setIssuer(issuer); + response.setStatus(status); + response.getAssertions().add(assertion); + + return response; + } + + /** + * Build STORKResponse + * @param destination Endpoint where the STORKResponse should be sent to + * @param inResponseTo ID of the corresponding AuthnRequest + * @param issuer Issuer value of the response + * @param status Status of the response (success, error, etc.) + * @param statusMessage Status message for the response + * @param assertion SAML assertion to be included + * @return STORKResponse + */ + public static STORKResponse buildSTORKResponse( + String destination, + String inResponseTo, + String issuerString, + String statusCode, + String statusMessage, + Assertion assertion) { + + Status status = buildStatus(statusCode, statusMessage); + Issuer issuer = buildIssuer(issuerString); + + return buildSTORKResponse(destination, inResponseTo, issuer, status, assertion); + } + + + /** + * Builds a STORKResponse containing no assertion + * @param destination Endpoint where the STORKResponse should be sent to + * @param inResponseTo ID of the corresponding AuthnRequest + * @param issuer Issuer value of the response + * @param status Status of the response (success, error, etc.) + * @param statusMessage Status message for the response + * @return STORKResponse + */ + public static STORKResponse buildSTORKErrorResponse( + String destination, + String inResponseTo, + String issuerString, + String statusCode, + String statusMessage) { + + return buildSTORKResponse(destination, inResponseTo, issuerString, statusCode, statusMessage, null); + } + + /** + * Builds Status object + * @param statusCodeValue StatusCode + * @param statusMessageValue StatusMessage + * @return Status + */ + public static Status buildStatus(String statusCodeValue, String statusMessageValue) { + return buildStatus(statusCodeValue, statusMessageValue, null); + } + + /** + * Builds Status object + * @param statusCodeValue StatusCode + * @param statusMessageValue StatusMessage + * @param detail Detail Message + * @return Status + */ + public static Status buildStatus(String statusCodeValue, String statusMessageValue, XMLObject detail) { + StatusCode statusCode = buildXMLObject(StatusCode.DEFAULT_ELEMENT_NAME); + statusCode.setValue(statusCodeValue); + + StatusMessage statusMessage = buildXMLObject(StatusMessage.DEFAULT_ELEMENT_NAME); + statusMessage.setMessage(statusMessageValue); + + StatusDetail statusDetail = buildXMLObject(StatusDetail.DEFAULT_ELEMENT_NAME); + statusDetail.getUnknownXMLObjects().add(detail); + + Status status = buildXMLObject(Status.DEFAULT_ELEMENT_NAME); + status.setStatusCode(statusCode); + status.setStatusMessage(statusMessage); + + return status; + + } + + /** + * Builds Assertion + * @param issuer Issuer value for assertion + * @param subject Subject of assertion + * @param conditions Conditions of assertion + * @param authnStatement AuthnStatement + * @param attributeStatement AttributeAtatement + * @return Assertion + */ + public static Assertion buildAssertion(Issuer issuer, + Subject subject, + Conditions conditions, + AuthnStatement authnStatement, + AttributeStatement attributeStatement) { + Assertion assertion = buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME); + + assertion.setID(generateID()); + assertion.setVersion(SAMLVersion.VERSION_20); + assertion.setIssueInstant(new DateTime()); + + assertion.setIssuer(issuer); + assertion.setSubject(subject); + assertion.setConditions(conditions); + assertion.getAuthnStatements().add(authnStatement); + assertion.getAttributeStatements().add(attributeStatement); + + return assertion; + } + + /** + * Builds Assertion object + * @param issuerValue Value of the issuer + * @param nameQualifier nameQualifier + * @param spNameQualifier spNameQualifier + * @param spProviderID spProviderID + * @param ipAddress IP address of the client + * @param inResponseTo ID of the corresponding AuthnRequest + * @param notBefore Time before assertion is not valid + * @param notOnOrAfter Time after assertion is not valid + * @param recipient Recipient of the assertion + * @param attributeList Attributes to be included in the assertion + * @return Assertion + */ + public static Assertion buildAssertion( + String issuerValue, + String nameQualifier, + String spNameQualifier, + String spProviderID, + String ipAddress, + String inResponseTo, + DateTime notBefore, + DateTime notOnOrAfter, + String recipient, + List attributeList) { + + Issuer issuer = buildIssuer(issuerValue); + NameID nameID = buildNameID(NameID.UNSPECIFIED, nameQualifier, spNameQualifier, spProviderID, NameID.UNSPECIFIED); + SubjectConfirmationData scData = buildSubjectConfirmationData(ipAddress, inResponseTo, notOnOrAfter, recipient); + SubjectConfirmation subjectConfirmation = buildSubjectConfirmation(SubjectConfirmation.METHOD_BEARER, scData); + Subject subject = buildSubject(nameID, subjectConfirmation); + + List audienceList = buildAudienceList(recipient); + Conditions conditions = buildConditions(notBefore, notOnOrAfter, audienceList); + AuthnStatement authnStatement = buildAuthnStatement(ipAddress); + AttributeStatement attributeStatement = buildAttributeStatement(attributeList); + + return buildAssertion(issuer, subject, conditions, authnStatement, attributeStatement); + } + + /** + * Builds List of Audience objects + * @param audiences Audience strings + * @return List of Audience + */ + public static List buildAudienceList(String... audiences) { + List audienceList = new ArrayList(); + + for (String audienceString : audiences) { + Audience audience = buildXMLObject(Audience.DEFAULT_ELEMENT_NAME); + audience.setAudienceURI(audienceString); + audienceList.add(audience); + } + + return audienceList; + } + + /** + * Builds NameID object + * @param format Format of the NameID + * @param nameQualifier nameQualifier + * @param spNameQualifier spNameQualifier + * @param spProviderID spProviderID + * @param value Value of the NameID + * @return NameID + */ + public static NameID buildNameID(String format, + String nameQualifier, + String spNameQualifier, + String spProviderID, + String value) { + + NameID nameID = buildXMLObject(NameID.DEFAULT_ELEMENT_NAME); + + nameID.setFormat(format); + nameID.setNameQualifier(nameQualifier); + nameID.setSPNameQualifier(spNameQualifier); + nameID.setSPProvidedID(spProviderID); + nameID.setValue(value); + + return nameID; + + } + + /** + * Builds SubjectConfirmation object + * @param method Method of SubjectConfirmation + * @param scData SubjectConfirmationData + * @return SubjectConfirmation + */ + public static SubjectConfirmation buildSubjectConfirmation(String method, SubjectConfirmationData scData) { + + SubjectConfirmation subjectConfirmation = buildXMLObject(SubjectConfirmation.DEFAULT_ELEMENT_NAME); + + subjectConfirmation.setMethod(method); + subjectConfirmation.setSubjectConfirmationData(scData); + + return subjectConfirmation; + } + + /** + * Builds SubjectConfirmationData object + * @param ipAddress IP address of the client + * @param inResponseTo ID of the corresponding AuthnRequest + * @param notOnOrAfter Time after subject is not valid + * @param recipient recipient of the assertion + * @return SubjectConfirmationData + */ + public static SubjectConfirmationData buildSubjectConfirmationData(String ipAddress, + String inResponseTo, + DateTime notOnOrAfter, + String recipient) { + + SubjectConfirmationData scData = buildXMLObject(SubjectConfirmationData.DEFAULT_ELEMENT_NAME); + + scData.setAddress(ipAddress); + scData.setInResponseTo(inResponseTo); + scData.setNotOnOrAfter(notOnOrAfter); + scData.setRecipient(recipient); + + return scData; + + } + + /** + * Builds Subject object + * @param nameID NameID object + * @param subjectConfirmation SubjectConfirmation + * @return Subject + */ + public static Subject buildSubject(NameID nameID, SubjectConfirmation subjectConfirmation) { + + Subject subject = buildXMLObject(Subject.DEFAULT_ELEMENT_NAME); + subject.setNameID(nameID); + subject.getSubjectConfirmations().add(subjectConfirmation); + + return subject; + } + + /** + * Build Conditions object + * @param notBefore Time before assertion is not valid + * @param notOnOrAfter Time after assertion is not valid + * @param audienceList List of audience + * @return Conditions + */ + public static Conditions buildConditions(DateTime notBefore, DateTime notOnOrAfter, List audienceList) { + Conditions conditions = buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME); + + conditions.setNotBefore(notBefore); + conditions.setNotOnOrAfter(notOnOrAfter); + + AudienceRestriction audienceRestriction = buildXMLObject(AudienceRestriction.DEFAULT_ELEMENT_NAME); + audienceRestriction.getAudiences().addAll(audienceList); + conditions.getAudienceRestrictions().add(audienceRestriction); + + OneTimeUse oneTimeUse = buildXMLObject(OneTimeUse.DEFAULT_ELEMENT_NAME); + conditions.getConditions().add(oneTimeUse); + + return conditions; + + } + + /** + * Build AuthnStatement object + * @param authInstant Time instant of authentication + * @param subjectLocality subjectLocality + * @param authnContext AuthnContext used + * @return AuthnStatement + */ + public static AuthnStatement buildAuthnStatement(DateTime authInstant, SubjectLocality subjectLocality, AuthnContext authnContext) { + AuthnStatement authnStatement = buildXMLObject(AuthnStatement.DEFAULT_ELEMENT_NAME); + + authnStatement.setAuthnInstant(authInstant); + authnStatement.setSubjectLocality(subjectLocality); + authnStatement.setAuthnContext(authnContext); + + return authnStatement; + } + + /** + * Build AuthnStatement object + * @param ipAddress IP address of the client + * @return AuthnStatement + */ + public static AuthnStatement buildAuthnStatement(String ipAddress) { + AuthnStatement authnStatement = buildXMLObject(AuthnStatement.DEFAULT_ELEMENT_NAME); + + authnStatement.setAuthnInstant(new DateTime()); + + SubjectLocality subjectLocality = buildXMLObject(SubjectLocality.DEFAULT_ELEMENT_NAME); + subjectLocality.setAddress(ipAddress); + authnStatement.setSubjectLocality(subjectLocality); + + AuthnContext authnContext = buildXMLObject(AuthnContext.DEFAULT_ELEMENT_NAME); + authnStatement.setAuthnContext(authnContext); + + return authnStatement; + } + + /** + * Builds AttributeStatement object + * @return AttributeStatement + */ + public static AttributeStatement buildAttributeStatement() { + return buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME); + } + + /** + * Builds AttributeStatement object + * @param attributeList List of attributes + * @return AttributeStatement + */ + public static AttributeStatement buildAttributeStatement(List attributeList) { + AttributeStatement attributeStatement = buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME); + attributeStatement.getAttributes().addAll(attributeList); + + return attributeStatement; + } + + /** + * Builds STORK String Attribute + * @param name Attribute Name + * @param friendlyName friendlyName of Attribute + * @param value Value of Attribute + * @param status STORK status of attribute + * @return STORK String Attribute + */ + public static Attribute buildSTORKStringAttribute(String name, String friendlyName, String value, String status) { + XSString xsString = buildXSString(AttributeValue.DEFAULT_ELEMENT_NAME); + xsString.setValue(value); + + return buildAttribute(name, friendlyName, status, xsString); + } + + /** + * Builds STORK XML Any Attribute + * @param name Attribute Name + * @param friendlyName friendlyName of Attribute + * @param value Value of Attribute + * @param status STORK status of attribute + * @return STORK XML Any Attribute + */ + public static Attribute buildSTORKXMLAttribute(String name, String friendlyName, XMLObject value, String status) { + XSAny xsAny = buildXMLObject(AttributeValue.DEFAULT_ELEMENT_NAME); + xsAny.getUnknownXMLObjects().add(value); + + return buildAttribute(name, friendlyName, status, xsAny); + } + + /** + * Builds STORK Attribute + * @param name Attribute Name + * @param friendlyName friendlyName of Attribute + * @param status STORK status of Attribute + * @param attributeValue Value of the Attribute + * @return Attribute + */ + public static Attribute buildAttribute(String name, String friendlyName, String status, XMLObject attributeValue) { + Attribute attribute = buildXMLObject(STORKAttribute.DEFAULT_ELEMENT_NAME); + + attribute.setNameFormat(STORKAttribute.URI_REFERENCE); + attribute.setFriendlyName(friendlyName); + attribute.setName(name); + attribute.getUnknownAttributes().put(STORKAttribute.DEFAULT_STORK_ATTRIBUTE_QNAME, status); + attribute.getAttributeValues().add(attributeValue); + + return attribute; + } + + /** + * Builds STORK String Attribute + * @param name Attribute Name + * @param friendlyName friendlyName of Attribute + * @param status STORK status of Attribute + * @param attributeValue Value of the Attribute + * @return String Attribute + */ + public static Attribute buildStringAttribute(String name, String friendlyName, String status, String attributeValue) { + Attribute attribute = buildXMLObject(STORKAttribute.DEFAULT_ELEMENT_NAME); + + attribute.setNameFormat(STORKAttribute.URI_REFERENCE); + attribute.setFriendlyName(friendlyName); + attribute.setName(name); + attribute.getUnknownAttributes().put(STORKAttribute.DEFAULT_STORK_ATTRIBUTE_QNAME, status); + + XSString xsString = buildXSString(AttributeValue.DEFAULT_ELEMENT_NAME); + xsString.setValue(attributeValue); + attribute.getAttributeValues().add(xsString); + + return attribute; + } + + /** + * Builds DSS signature request + * @param textToBeSigned Text to be included in the DSS request + * @param mimeType MimeType of the contents + * @return DSS signature request as String + */ + public static String buildSignatureRequestString(String textToBeSigned, String mimeType) { + //MimeType=\"text/plain\" + //MimeType=\"application/xhtml+xml\" + String sigRequestString = + "" + + "" + + "" + + "" + Base64.encodeBytes(textToBeSigned.getBytes()) + "" + + "" + + "" + + ""; + + return sigRequestString; + + } + + /** + * Builds STORK signedDoc RequestedAttribute + * @param textToBeSigned Text to be included in the DSS request + * @param mimeType MimeType of the contents + * @param isRequired true or false if signedDoc RequestedAttribute is required + * @return STORK signedDoc RequestedAttribute + */ + public static RequestedAttribute buildSignatureRequestRequestedAttribute(String textToBeSigned, String mimeType, boolean isRequired) { + return buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_SIGNEDDOC, isRequired, buildSignatureRequestString(textToBeSigned, mimeType)); + } + + /** + * Adds RequestedAttribute to STORKAuthnRequest + * @param authnRequest STORKAuthnRequest + * @param reqAttr RequestedAttribute + */ + public static void addRequestedAttribute(STORKAuthnRequest authnRequest, RequestedAttribute reqAttr) { + if (authnRequest != null) { + RequestedAttributes requestedAttributes = (RequestedAttributes) authnRequest.getExtensions().getUnknownXMLObjects(RequestedAttributes.DEFAULT_ELEMENT_NAME).get(0); + requestedAttributes.getRequestedAttributes().add(reqAttr); + } + } + + /** + * Adds several RequestedAttribute to STORKAuthnRequest + * @param authnRequest STORKAuthnRequest + * @param reqAttr RequestedAttribute + */ + public static void addRequestedAttributes(STORKAuthnRequest authnRequest, RequestedAttribute... reqAttrs) { + for (RequestedAttribute reqAttr : reqAttrs) { + addRequestedAttribute(authnRequest, reqAttr); + } + } + + /** + * Builds STORK signed doc attribute and adds it to STORKAuthnRequest + * @param authnRequest STORKAuthnRequest + * @param textToBeSigned Text to be included in the DSS request + * @param mimeType MimeType of the contents + * @param isRequired true or false if signedDoc RequestedAttribute is required + */ + public static void buildAndAddSignatureRequestToAuthnRequest(STORKAuthnRequest authnRequest, String textToBeSigned, String mimeType, boolean isRequired) { + if (authnRequest != null && !StringUtils.isEmpty(textToBeSigned)) { + addRequestedAttribute(authnRequest, buildSignatureRequestRequestedAttribute(textToBeSigned, mimeType, isRequired)); + } + + } + + /** + * Adds DSS siganture request as String to STORKAuthnRequest + * @param authnRequest STORKAuthnRequest + * @param dssSignatureRequest DSS signature request as String + * @param isRequired true or false if signedDoc RequestedAttribute is required + */ + public static void addSignatureRequestToAuthnRequest(STORKAuthnRequest authnRequest, String dssSignatureRequest, boolean isRequired) { + if (authnRequest != null && !StringUtils.isEmpty(dssSignatureRequest)) { + addRequestedAttribute(authnRequest, buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_SIGNEDDOC, isRequired, dssSignatureRequest)); + } + + } + + /** + * Adds Attribute to an assertion + * @param assertion Assertion + * @param attr Attribute + */ + public static void addAttribute(Assertion assertion, Attribute attr) { + if (assertion != null) { + if (!assertion.getAttributeStatements().isEmpty()) { + assertion.getAttributeStatements().get(0).getAttributes().add(attr); + } + } + } + + /** + * Adds several Attribute to an assertion + * @param assertion Assertion + * @param attr Attribute + */ + public static void addAttributes(Assertion assertion, Attribute... attrs) { + for (Attribute attr : attrs) { + addAttribute(assertion, attr); + } + } + + /** + * Adds several Attribute to first assertion in STORK response + * @param response STORK response + * @param attrs Attribute + */ + public static void addAttribute(STORKResponse response, Attribute... attrs) { + if (response != null) { + if (!response.getAssertions().isEmpty()) { + addAttributes(response.getAssertions().get(0), attrs); + } + } + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKBootstrap.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKBootstrap.java new file mode 100644 index 000000000..80556cfa5 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKBootstrap.java @@ -0,0 +1,73 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.common; + +import java.io.InputStream; + +import org.opensaml.DefaultBootstrap; +import org.opensaml.common.xml.SAMLSchemaBuilder; +import org.opensaml.xml.ConfigurationException; +import org.opensaml.xml.XMLConfigurator; + +/** + * Class extending the default bootstrap mechanism of OpenSAML + * @author bzwattendorfer + * + */ +public class STORKBootstrap extends DefaultBootstrap { + + /** + * Extends the default bootstrap mechanism of OpenSAML + * Adds STORK schemata and extension elements + * @throws ConfigurationException + */ + public static synchronized void bootstrap() throws ConfigurationException { + + SAMLSchemaBuilder.addExtensionSchema("stork-schema-assertion-1.0.xsd"); + SAMLSchemaBuilder.addExtensionSchema("stork-schema-protocol-1.0.xsd"); + + DefaultBootstrap.bootstrap(); + + initStorkConfig("saml2-stork-config.xml"); + + } + + /** + * Initializes OpenSAML with config + * @param xmlConfig XML Config for STORK and SAML2 + * @throws ConfigurationException + */ + private static void initStorkConfig(String xmlConfig) throws ConfigurationException { + + XMLConfigurator configurator = new XMLConfigurator(); + + InputStream is = STORKBootstrap.class.getClassLoader().getResourceAsStream(xmlConfig); + + configurator.load(is); + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKConstants.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKConstants.java new file mode 100644 index 000000000..5a63e2dcd --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/common/STORKConstants.java @@ -0,0 +1,176 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.common; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * Interface encapuslating relevant STORK constants such as namespace, attribute names, etc. + * @author bzwattendorfer + * + */ +public interface STORKConstants { + + /** + * STORK namespace + */ + public static final String STORK10_NS = "urn:eu:stork:names:tc:STORK:1.0:assertion"; + + /** + * STORK namespace prefix + */ + public static final String STORK10_PREFIX = "stork"; + + /** + * STORK protocol namespace + */ + public static final String STORKP10_NS = "urn:eu:stork:names:tc:STORK:1.0:protocol"; + + /** + * STORK protocol namespace prefix + */ + public static final String STORKP10_PREFIX = "storkp"; + + /** + * STORK attribute name prefix + */ + final static String STORK_ATTRIBUTE_NAME_PREFIX = "http://www.stork.gov.eu/1.0/"; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_EIDENTIFIER = "eIdentifier"; + final static String STORK_ATTRIBUTE_EIDENTIFIER = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_EIDENTIFIER; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_GIVENAME = "givenName"; + final static String STORK_ATTRIBUTE_GIVENNAME = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_GIVENAME; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_SURNAME = "surname"; + final static String STORK_ATTRIBUTE_SURNAME = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_SURNAME; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_INHERITED_FAMILYNAME = "inheritedFamilyName"; + final static String STORK_ATTRIBUTE_INHERITED_FAMILYNAME = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_INHERITED_FAMILYNAME; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_ADOPTED_FAMILYNAME = "adoptedFamilyName"; + final static String STORK_ATTRIBUTE_ADOPTED_FAMILYNAME = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_ADOPTED_FAMILYNAME; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_GENDER = "gender"; + final static String STORK_ATTRIBUTE_GENDER = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_GENDER; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_DATEOFBIRTH = "dateOfBirth"; + final static String STORK_ATTRIBUTE_DATEOFBIRTH = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_DATEOFBIRTH; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_COUNTRYOFBIRTH = "countryCodeOfBirth"; + final static String STORK_ATTRIBUTE_COUNTRYCODEOFBIRTH = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_COUNTRYOFBIRTH; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_NATIONALITYCODE = "nationalityCode"; + final static String STORK_ATTRIBUTE_NATIONALITYCODE = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_NATIONALITYCODE; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_MARTIALSTATUS = "maritalStatus"; + final static String STORK_ATTRIBUTE_MARTIALSTATUS = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_MARTIALSTATUS; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_TEXT_RESIDENCE_ADDRESS = "textResidenceAddress"; + final static String STORK_ATTRIBUTE_TEXT_RESIDENCE_ADDRESS = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_TEXT_RESIDENCE_ADDRESS; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_CANONICAL_RESIDENCE_ADDRESS = "canonicalResidenceAddress"; + final static String STORK_ATTRIBUTE_TEXT_CANONICAL_ADDRESS = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_CANONICAL_RESIDENCE_ADDRESS; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_EMAIL = "eMail"; + final static String STORK_ATTRIBUTE_EMAIL = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_EMAIL; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_TITLE = "title"; + final static String STORK_ATTRIBUTE_TITLE = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_TITLE; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_RESIDENCE_PERMIT = "residencePermit"; + final static String STORK_ATTRIBUTE_RESIDENCE_PERMIT = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_RESIDENCE_PERMIT; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_PSEUDONYM = "pseudonym"; + final static String STORK_ATTRIBUTE_PSEUDONYM = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_PSEUDONYM; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_AGE = "age"; + final static String STORK_ATTRIBUTE_AGE = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_AGE; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_ISAGEOVER = "isAgeOver"; + final static String STORK_ATTRIBUTE_ISAGEOVER = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_ISAGEOVER; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_SIGNED_DOC = "signedDoc"; + final static String STORK_ATTRIBUTE_SIGNEDDOC = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_SIGNED_DOC; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_FISCALNUMBER = "fiscalNumber"; + final static String STORK_ATTRIBUTE_FISCALNUMBER = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_FISCALNUMBER; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_CITIZENQAALEVEL_OLD = "citizenQAAlevel"; + final static String STORK_ATTRIBUTE_CITIZENQAALEVEL_OLD = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_CITIZENQAALEVEL_OLD; + + final static String STORK_ATTRIBUTE_NAME_SUFFIX_CITIZENQAALEVEL = "citizenQAALevel"; + final static String STORK_ATTRIBUTE_CITIZENQAALEVEL = STORK_ATTRIBUTE_NAME_PREFIX + STORK_ATTRIBUTE_NAME_SUFFIX_CITIZENQAALEVEL; + + /** + * Full Set of accepted STORK attributes + */ + public final Set FULL_STORK_ATTRIBUTE_SET = new HashSet(Arrays.asList(new String[] {STORK_ATTRIBUTE_EIDENTIFIER, + STORK_ATTRIBUTE_GIVENNAME, + STORK_ATTRIBUTE_SURNAME, + STORK_ATTRIBUTE_INHERITED_FAMILYNAME, + STORK_ATTRIBUTE_ADOPTED_FAMILYNAME, + STORK_ATTRIBUTE_GENDER, + STORK_ATTRIBUTE_DATEOFBIRTH, + STORK_ATTRIBUTE_COUNTRYCODEOFBIRTH, + STORK_ATTRIBUTE_NATIONALITYCODE, + STORK_ATTRIBUTE_MARTIALSTATUS, + STORK_ATTRIBUTE_TEXT_RESIDENCE_ADDRESS, + STORK_ATTRIBUTE_TEXT_CANONICAL_ADDRESS, + STORK_ATTRIBUTE_TEXT_CANONICAL_ADDRESS, + STORK_ATTRIBUTE_EMAIL, + STORK_ATTRIBUTE_TITLE, + STORK_ATTRIBUTE_RESIDENCE_PERMIT, + STORK_ATTRIBUTE_PSEUDONYM, + STORK_ATTRIBUTE_AGE, + STORK_ATTRIBUTE_ISAGEOVER, + STORK_ATTRIBUTE_SIGNEDDOC, + STORK_ATTRIBUTE_FISCALNUMBER, + STORK_ATTRIBUTE_CITIZENQAALEVEL_OLD, + STORK_ATTRIBUTE_CITIZENQAALEVEL})); + + /** + * Default set of STORK attributes to be requested (without signedDoc) + */ + Set DEFAULT_STORK_REQUESTED_ATTRIBUTE_SET = new HashSet(Arrays.asList(new String[] { + STORK_ATTRIBUTE_EIDENTIFIER, + STORK_ATTRIBUTE_GIVENNAME, + STORK_ATTRIBUTE_SURNAME, + STORK_ATTRIBUTE_DATEOFBIRTH,})); + + /** + * Default required set of returned STORK attributes + */ + Set DEFAULT_STORK_RETURNED_ATTRIBUTE_SET = new HashSet(Arrays.asList(new String[] { + STORK_ATTRIBUTE_EIDENTIFIER, + STORK_ATTRIBUTE_GIVENNAME, + STORK_ATTRIBUTE_SURNAME, + STORK_ATTRIBUTE_DATEOFBIRTH, + STORK_ATTRIBUTE_SIGNEDDOC})); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLException.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLException.java new file mode 100644 index 000000000..33ee67313 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLException.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.exception; + +/** + * Exception thrown if exception occurs in SAML message processing + * @author bzwattendorfer + * + */ +public class SAMLException extends Exception { + + /** {@inheritDoc} */ + public SAMLException() { + super(); + } + + /** {@inheritDoc} */ + public SAMLException(String message, Throwable cause) { + super(message, cause); + } + + /** {@inheritDoc} */ + public SAMLException(String message) { + super(message); + } + + /** {@inheritDoc} */ + public SAMLException(Throwable cause) { + super(cause); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLValidationException.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLValidationException.java new file mode 100644 index 000000000..51520d968 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/exception/SAMLValidationException.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.exception; + +/** + * Exception thrown if error occurs in SAML message validation + * @author bzwattendorfer + * + */ +public class SAMLValidationException extends Exception { + + private static final long serialVersionUID = 1L; + + /** {@inheritDoc} */ + public SAMLValidationException() { + + super(); + } + + /** {@inheritDoc} */ + public SAMLValidationException(String s) { + + super(s); + } + + /** {@inheritDoc} */ + public SAMLValidationException(Exception e) { + + super(e); + } + + /** {@inheritDoc} */ + public SAMLValidationException(String m, Exception e) { + + super(m, e); + } +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttribute.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttribute.java new file mode 100644 index 000000000..ec8232704 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttribute.java @@ -0,0 +1,65 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.saml; + +import javax.xml.namespace.QName; + +import org.opensaml.saml2.core.Attribute; + +import eu.stork.vidp.messages.common.STORKConstants; + +/** + * Interface extending original SAML Attribute for STORK with the XML attributeStatus attribute + * {@inheritDoc} + * @author bzwattendorfer + * + */ +public interface STORKAttribute extends Attribute { + + public static final String STORK_ATTRIBUTE_STATUS_ATTTRIB_NAME = "AttributeStatus"; + + public static final QName DEFAULT_STORK_ATTRIBUTE_QNAME = new QName(STORKConstants.STORK10_NS, STORK_ATTRIBUTE_STATUS_ATTTRIB_NAME, STORKConstants.STORK10_PREFIX); + + public static final String ALLOWED_ATTRIBUTE_STATUS_AVAIL = "Available"; + public static final String ALLOWED_ATTRIBUTE_STATUS_NOT_AVAIL = "NotAvailable"; + public static final String ALLOWED_ATTRIBUTE_STATUS_WITHHELD = "Withheld"; + + /** + * Sets the STORK attributeStatus + * @param attributeStatus + */ + public void setAttributeStatus(String attributeStatus); + + /** + * Gets the STORK attributeStatus + * @return + */ + public String getAttributeStatus(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttributeValue.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttributeValue.java new file mode 100644 index 000000000..2d511d62a --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKAttributeValue.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.saml; + +import javax.xml.namespace.QName; + +import org.opensaml.saml2.core.AttributeValue; + +import eu.stork.vidp.messages.common.STORKConstants; + +/** + * {@inheritDoc} + * @author bzwattendorfer + * + */ +public interface STORKAttributeValue extends AttributeValue { + + /** Element name, no namespace. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "AttributeValue"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORK10_PREFIX); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKExtensions.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKExtensions.java new file mode 100644 index 000000000..b5e12ea75 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKExtensions.java @@ -0,0 +1,78 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml; + +import org.opensaml.saml2.common.Extensions; + +import eu.stork.vidp.messages.stork.AuthenticationAttributes; +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; +import eu.stork.vidp.messages.stork.RequestedAttributes; + +/** + * Extends the SAML Extension element with STORK related functionality + * {@inheritDoc} + * @author bzwattendorfer + * + */ +public interface STORKExtensions extends Extensions { + + /** + * Sets the QAALevel object + * @param authLevel QAALevel object + */ + public void setQAALevel(QualityAuthenticationAssuranceLevel authLevel); + + /** + * Gets the QAALevel object + * @return QAALevel object + */ + public QualityAuthenticationAssuranceLevel getQAALevel(); + + /** + * Gets the RequestedAttributes object + * @return RequestedAttributes object + */ + public RequestedAttributes getRequestedAttributes(); + + /** + * Sets RequestedAttributes + * @param requestedAttributes RequestedAttributes object + */ + public void setRequestedAttributes(RequestedAttributes requestedAttributes); + + /** + * Gets AuthenticationAttributes + * @return AuthenticationAttributes + */ + public AuthenticationAttributes getAuthenticationAttributes(); + + /** + * Sets AuthenticationAttributes + * @param authenticationAttributes AuthenticationAttributes object + */ + public void setAuthenticationAttributes(AuthenticationAttributes authenticationAttributes); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKRequestedAttribute.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKRequestedAttribute.java new file mode 100644 index 000000000..38149bea5 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/STORKRequestedAttribute.java @@ -0,0 +1,53 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.saml; + +import javax.xml.namespace.QName; + +import org.opensaml.saml2.metadata.RequestedAttribute; + +import eu.stork.vidp.messages.common.STORKConstants; + +/** + * {@inheritDoc} + * @author bzwattendorfer + * + */ +public interface STORKRequestedAttribute extends RequestedAttribute { + + + /** Default element name */ + public final static QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORK10_PREFIX); + + /** QName of the XSI type */ + public final static QName TYPE_NAME = new QName(STORKConstants.STORK10_NS, TYPE_LOCAL_NAME, + STORKConstants.STORK10_PREFIX); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeBuilder.java new file mode 100644 index 000000000..413b5f6d7 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeBuilder.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.impl.AttributeBuilder; + +import eu.stork.vidp.messages.saml.STORKAttribute; + +/** + * @author bzwattendorfer + * + */ +public class STORKAttributeBuilder extends AttributeBuilder { + + /** + * Constructor. + */ + public STORKAttributeBuilder() { + + } + + /** {@inheritDoc} */ + public STORKAttribute buildObject() { + return buildObject(SAMLConstants.SAML20_NS, Attribute.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX); + } + + /** {@inheritDoc} */ + public STORKAttribute buildObject(String namespaceURI, String localName, String namespacePrefix) { + return new STORKAttributeImpl(namespaceURI, localName, namespacePrefix); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeImpl.java new file mode 100644 index 000000000..89ad90eae --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeImpl.java @@ -0,0 +1,63 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.saml2.core.impl.AttributeImpl; + +import eu.stork.vidp.messages.saml.STORKAttribute; + +/** + * @author bzwattendorfer + * + */ +public class STORKAttributeImpl extends AttributeImpl implements STORKAttribute { + + private String attributeStatus; + + protected STORKAttributeImpl(String namespaceURI, String elementLocalName, + String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /* (non-Javadoc) + * @see eu.stork.mw.common.messages.saml.STORKAttribute#getAttributeStatus() + */ + public String getAttributeStatus() { + return attributeStatus; + } + + /* (non-Javadoc) + * @see eu.stork.mw.common.messages.saml.STORKAttribute#setAttributeStatus(java.lang.String) + */ + public void setAttributeStatus(String attributeStatus) { + this.attributeStatus = attributeStatus; + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeMarshaller.java new file mode 100644 index 000000000..ba8c2f1a3 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeMarshaller.java @@ -0,0 +1,56 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.saml2.core.impl.AttributeMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.saml.STORKAttribute; + +/** + * @author bzwattendorfer + * + */ +public class STORKAttributeMarshaller extends AttributeMarshaller { + + protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException { + STORKAttribute attribute = (STORKAttribute) samlElement; + + if (attribute.getAttributeStatus() != null) { + domElement.setAttributeNS(STORKConstants.STORK10_NS, STORKAttribute.STORK_ATTRIBUTE_STATUS_ATTTRIB_NAME, attribute.getName()); + } + + super.marshallAttributes(samlElement, domElement); + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeUnmarshaller.java new file mode 100644 index 000000000..5a74dab7d --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAttributeUnmarshaller.java @@ -0,0 +1,58 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + + +package eu.stork.vidp.messages.saml.impl; + +import javax.xml.namespace.QName; + +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.impl.AttributeUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; +import org.w3c.dom.Attr; + +import eu.stork.vidp.messages.saml.STORKAttribute; + +/** + * A thread-safe Unmarshaller for {@link org.opensaml.saml2.core.Attribute} objects. + */ +public class STORKAttributeUnmarshaller extends AttributeUnmarshaller { + + + protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { + + if (samlObject instanceof STORKAttribute) { + STORKAttribute attrib = (STORKAttribute) samlObject; + + if (attribute.getLocalName().equals(STORKAttribute.STORK_ATTRIBUTE_STATUS_ATTTRIB_NAME)) { + attrib.setAttributeStatus(attribute.getValue()); + } + } + + super.processAttribute(samlObject, attribute); + } + +} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestBuilder.java new file mode 100644 index 000000000..8836b6c8e --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestBuilder.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.core.impl.AuthnRequestBuilder; + +import eu.stork.mw.messages.saml.STORKAuthnRequest; + +public class STORKAuthnRequestBuilder extends AuthnRequestBuilder { + + /** {@inheritDoc} */ + + + public STORKAuthnRequest buildObject() { + return buildObject(SAMLConstants.SAML20P_NS, AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); + } + + /** {@inheritDoc} */ + public STORKAuthnRequest buildObject(String namespaceURI, String localName, String namespacePrefix) { + return new STORKAuthnRequestImpl(namespaceURI, localName, namespacePrefix); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestImpl.java new file mode 100644 index 000000000..c9375ceb9 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestImpl.java @@ -0,0 +1,170 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import java.security.cert.X509Certificate; +import java.util.List; + +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.impl.AuthnRequestImpl; +import org.opensaml.saml2.metadata.RequestedAttribute; +import org.opensaml.xml.XMLObject; + +import eu.stork.mw.messages.saml.STORKAuthnRequest; + +public class STORKAuthnRequestImpl extends AuthnRequestImpl implements STORKAuthnRequest { + + private int qaaLevel; + + private String ccc; + + private String finalRedirectURL; + + private String spID; + + private XMLObject originalSPAuthRequest; + + private X509Certificate spCertSig; + + private X509Certificate spCertEnc; + + //private XMLObjectChildrenList requestedAttributes; + private List requestedAttributes; + + protected STORKAuthnRequestImpl(String namespaceURI, String elementLocalName, + String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + //requestedAttributes = new IndexedXMLObjectChildrenList(this); + } + + public STORKAuthnRequestImpl() { + super(SAMLConstants.SAML20P_NS, STORKAuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); + } + + + + public int getQAALevel() { + return this.qaaLevel; + } + + public void setQAALevel(int authLevel) { + this.qaaLevel = authLevel; + + } + + public String getCitizenCountryCode() { + return ccc; + } + + public String getFinalRedirectURL() { + return finalRedirectURL; + } + + public XMLObject getOriginalSPAuthRequest() { + return originalSPAuthRequest; + } + + public X509Certificate getSPCertEnc() { + return spCertEnc; + } + + public X509Certificate getSPCertSig() { + return spCertSig; + } + + public String getSPID() { + return spID; + } + + public void setCitizenCountryCode(String citizenCountryCode) { + this.ccc = citizenCountryCode; + } + + public void setFinalRedirectURL(String finalRedirectURL) { + this.finalRedirectURL = finalRedirectURL; + } + + public void setOriginalSPAuthRequest(XMLObject spAuthRequest) { + this.originalSPAuthRequest = spAuthRequest; + } + + public void setSPCertEnc(X509Certificate encryptionCertificate) { + this.spCertEnc = encryptionCertificate; + } + + public void setSPCertSig(X509Certificate signingCertificate) { + this.spCertSig = signingCertificate; + } + + public void setSPID(String spID) { + this.spID = spID; + } + + public List getRequestedAttributes() { +// return (List) requestedAttributes.subList(new QName(STORKMessagesConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, STORKMessagesConstants.STORK10_PREFIX)); + return requestedAttributes; + } + + public void setRequestedAttributes(List requestedAttributesList) { + // this.requestedAttributes = (XMLObjectChildrenList) requestedAttributesList; + this.requestedAttributes = requestedAttributesList; + } + +// public List getOrderedChildren() { +// ArrayList children = new ArrayList(); +// +// if (super.getOrderedChildren() != null) { +// children.addAll(super.getOrderedChildren()); +// } +// +// if (qaaLevel != 0 ) { +// children.add(subject); +// } +// +// if (nameIDPolicy != null) { +// children.add(nameIDPolicy); +// } +// +// if (conditions != null) { +// children.add(conditions); +// } +// +// if (requestedAuthnContext != null) { +// children.add(requestedAuthnContext); +// } +// +// if (scoping != null) { +// children.add(scoping); +// } +// +// if (children.size() == 0) { +// return null; +// } +// +// return Collections.unmodifiableList(children); +// } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestMarshaller.java new file mode 100644 index 000000000..faad3a835 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestMarshaller.java @@ -0,0 +1,44 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.saml2.core.impl.AuthnRequestMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.w3c.dom.Element; + +import eu.stork.mw.messages.saml.STORKAuthnRequest; + +public class STORKAuthnRequestMarshaller extends AuthnRequestMarshaller { + + protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { + STORKAuthnRequest req = (STORKAuthnRequest) samlObject; + +// if (sr.getQAA() != -1) { +// //domElement.setAttributeNS(null, StatusResponseType.VERSION_ATTRIB_NAME, sr.getVersion().toString()); +// } + } +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestUnmarshaller.java new file mode 100644 index 000000000..7924400fa --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKAuthnRequestUnmarshaller.java @@ -0,0 +1,137 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; + +import org.opensaml.saml2.core.impl.AuthnRequestUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.signature.X509Data; +import org.opensaml.xml.util.Base64; + +import eu.stork.mw.messages.saml.STORKAuthnRequest; +import eu.stork.vidp.messages.saml.STORKExtensions; +import eu.stork.vidp.messages.stork.SPCertEnc; +import eu.stork.vidp.messages.stork.SPCertSig; +import eu.stork.vidp.messages.stork.SPCertType; +import eu.stork.vidp.messages.stork.SPInformation; +import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; + +public class STORKAuthnRequestUnmarshaller extends AuthnRequestUnmarshaller { + + protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) + throws UnmarshallingException { + STORKAuthnRequest req = (STORKAuthnRequest) parentSAMLObject; + + if (childSAMLObject instanceof STORKExtensions) { + STORKExtensions ext = (STORKExtensions) childSAMLObject; + req.setExtensions(ext); + + if (ext.getQAALevel() != null) + req.setQAALevel(ext.getQAALevel().getValue()); + + if (ext.getRequestedAttributes() != null) { + //List reqAttrList = new ArrayList(); +// for (RequestedAttribute reqAtt : ext.getRequestedAttributes().getRequestedAttributes()) { +// req.getRequestedAttributes().add(reqAtt); +// } + req.setRequestedAttributes(ext.getRequestedAttributes().getRequestedAttributes()); + + } + + if (ext.getAuthenticationAttributes() != null) { + VIDPAuthenticationAttributes vidpAuthAttributes = ext.getAuthenticationAttributes().getVIDPAuthenticationAttributes(); + if (vidpAuthAttributes != null) { + if (vidpAuthAttributes.getCitizenCountryCode() != null) + req.setCitizenCountryCode(vidpAuthAttributes.getCitizenCountryCode().getValue()); + + SPInformation spInformation = vidpAuthAttributes.getSPInformation(); + if (spInformation != null) { + if (spInformation.getSPID() != null) + req.setSPID(spInformation.getSPID().getValue()); + + if (spInformation.getSPCertSig() != null) { + SPCertSig spCertSig = spInformation.getSPCertSig(); + try { + req.setSPCertSig(getCertificateFromX509Data(spCertSig)); + } catch (Exception e) { + throw new UnmarshallingException("Error reading SP signing certificate"); + } + } + + if (spInformation.getSPCertEnc() != null) { + SPCertEnc spCertEnc = spInformation.getSPCertEnc(); + try { + req.setSPCertEnc(getCertificateFromX509Data(spCertEnc)); + } catch (Exception e) { + throw new UnmarshallingException("Error reading SP encryption certificate"); + } + } + + if (spInformation.getSPAuthRequest() != null) { + req.setOriginalSPAuthRequest(spInformation.getSPAuthRequest()); + } + + } + } + } + + } else { + super.processChildElement(parentSAMLObject, childSAMLObject); + } + } + + private X509Certificate getCertificateFromX509Data(SPCertType spCert) throws CertificateException { + if (spCert.getKeyInfo() != null) + if (!spCert.getKeyInfo().getX509Datas().isEmpty()) { + X509Data samlX509Data = spCert.getKeyInfo().getX509Datas().get(0); + + if (samlX509Data != null) { + if (!samlX509Data.getX509Certificates().isEmpty()) { + org.opensaml.xml.signature.X509Certificate samlX509Cert = samlX509Data.getX509Certificates().get(0); + if (samlX509Cert != null) { + if (samlX509Cert.getValue() != null && samlX509Cert.getValue().length() != 0) { + InputStream inStream = new ByteArrayInputStream( Base64.decode(samlX509Cert.getValue())); + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream); + return cert; + } + + } + + } + } + } + + return null; + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsBuilder.java new file mode 100644 index 000000000..96004871c --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsBuilder.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.common.impl.ExtensionsBuilder; +import org.opensaml.saml2.core.Response; + +import eu.stork.vidp.messages.saml.STORKExtensions; + +public class STORKExtensionsBuilder extends ExtensionsBuilder { + + public STORKExtensions buildObject() { + return buildObject(SAMLConstants.SAML20P_NS, Response.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); + } + + /** {@inheritDoc} */ + public STORKExtensions buildObject(String namespaceURI, String localName, String namespacePrefix) { + return new STORKExtensionsImpl(namespaceURI, localName, namespacePrefix); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsImpl.java new file mode 100644 index 000000000..5417481c7 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsImpl.java @@ -0,0 +1,74 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.saml2.common.impl.ExtensionsImpl; + +import eu.stork.vidp.messages.saml.STORKExtensions; +import eu.stork.vidp.messages.stork.AuthenticationAttributes; +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; +import eu.stork.vidp.messages.stork.RequestedAttributes; + +public class STORKExtensionsImpl extends ExtensionsImpl implements STORKExtensions { + + private QualityAuthenticationAssuranceLevel qaaLevel; + + private RequestedAttributes requestedAttributes; + + private AuthenticationAttributes authenticationAttributes; + + protected STORKExtensionsImpl(String namespaceURI, String elementLocalName, + String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public AuthenticationAttributes getAuthenticationAttributes() { + return authenticationAttributes; + } + + public QualityAuthenticationAssuranceLevel getQAALevel() { + return qaaLevel; + } + + public RequestedAttributes getRequestedAttributes() { + return requestedAttributes; + } + + public void setAuthenticationAttributes( + AuthenticationAttributes authenticationAttributes) { + this.authenticationAttributes = authenticationAttributes; + } + + public void setQAALevel(QualityAuthenticationAssuranceLevel authLevel) { + this.qaaLevel = authLevel; + } + + public void setRequestedAttributes(RequestedAttributes requestedAttributes) { + this.requestedAttributes = requestedAttributes; + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsMarshaller.java new file mode 100644 index 000000000..7aa86c2ed --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsMarshaller.java @@ -0,0 +1,32 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.saml2.common.impl.ExtensionsMarshaller; + +public class STORKExtensionsMarshaller extends ExtensionsMarshaller { + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsUnmarshaller.java new file mode 100644 index 000000000..a701c9e6f --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKExtensionsUnmarshaller.java @@ -0,0 +1,58 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.saml2.common.impl.ExtensionsUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.vidp.messages.saml.STORKExtensions; +import eu.stork.vidp.messages.stork.AuthenticationAttributes; +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; +import eu.stork.vidp.messages.stork.RequestedAttributes; + +public class STORKExtensionsUnmarshaller extends ExtensionsUnmarshaller { + + protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject) + throws UnmarshallingException { + STORKExtensions extensions = (STORKExtensions) parentXMLObject; + + if (childXMLObject instanceof QualityAuthenticationAssuranceLevel) { + QualityAuthenticationAssuranceLevel qaa = (QualityAuthenticationAssuranceLevel) childXMLObject; + extensions.setQAALevel(qaa); + } if (childXMLObject instanceof RequestedAttributes) { + RequestedAttributes requestedAttributes = (RequestedAttributes) childXMLObject; + extensions.setRequestedAttributes(requestedAttributes); + } if (childXMLObject instanceof AuthenticationAttributes) { + AuthenticationAttributes authenticationAttributes = (AuthenticationAttributes) childXMLObject; + extensions.setAuthenticationAttributes(authenticationAttributes); + } else { + super.processChildElement(parentXMLObject, childXMLObject); + } + +} + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeBuilder.java new file mode 100644 index 000000000..1e23a9f2b --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeBuilder.java @@ -0,0 +1,57 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectBuilder; +import org.opensaml.saml2.metadata.RequestedAttribute; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.saml.STORKRequestedAttribute; + +/** + * Builder for {@link org.opensaml.saml2.metadata.impl.RequestedAttributeImpl}. + */ +public class STORKRequestedAttributeBuilder extends AbstractSAMLObjectBuilder { + + /** Constructor */ + public STORKRequestedAttributeBuilder() { + + } + + /** {@inheritDoc} */ + public STORKRequestedAttribute buildObject() { + return buildObject(STORKConstants.STORK10_NS, STORKRequestedAttribute.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + + /** {@inheritDoc} */ + public STORKRequestedAttribute buildObject(String namespaceURI, String localName, String namespacePrefix) { + return new STORKRequestedAttributeImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeImpl.java new file mode 100644 index 000000000..e3921919a --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeImpl.java @@ -0,0 +1,66 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + + +/** + * + */ + +package eu.stork.vidp.messages.saml.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.saml2.metadata.impl.RequestedAttributeImpl; +import org.opensaml.xml.XMLObject; + +import eu.stork.vidp.messages.saml.STORKRequestedAttribute; + +/** + * Concrete implementation of {@link org.opensaml.saml2.metadata.RequestedAttribute} + */ +public class STORKRequestedAttributeImpl extends RequestedAttributeImpl implements STORKRequestedAttribute { + + /** + * Constructor + * + * @param namespaceURI + * @param elementLocalName + * @param namespacePrefix + */ + protected STORKRequestedAttributeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /** {@inheritDoc} */ + public List getOrderedChildren() { + ArrayList children = new ArrayList(); + + children.addAll(getAttributeValues()); + + return Collections.unmodifiableList(children); + } +} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeUnmarshaller.java new file mode 100644 index 000000000..6b7771c72 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKRequestedAttributeUnmarshaller.java @@ -0,0 +1,64 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + + +/** + * + */ + +package eu.stork.vidp.messages.saml.impl; + +import javax.xml.namespace.QName; + +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.metadata.impl.RequestedAttributeUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.vidp.messages.common.STORKConstants; + + +/** + * A thread-safe Unmarshaller for {@link org.opensaml.saml2.metadata.RequestedAttribute} objects. + */ +public class STORKRequestedAttributeUnmarshaller extends RequestedAttributeUnmarshaller { + + protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) + throws UnmarshallingException { + + Attribute attribute = (Attribute) parentSAMLObject; + + QName childQName = childSAMLObject.getElementQName(); + if (childQName.getLocalPart().equals("AttributeValue") + && childQName.getNamespaceURI().equals(STORKConstants.STORK10_NS)) { + attribute.getAttributeValues().add(childSAMLObject); + } else { + super.processChildElement(parentSAMLObject, childSAMLObject); + } +} + + +} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseBuilder.java new file mode 100644 index 000000000..24cebaef7 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseBuilder.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.Response; +import org.opensaml.saml2.core.impl.ResponseBuilder; + +import eu.stork.mw.messages.saml.STORKResponse; + +public class STORKResponseBuilder extends ResponseBuilder { + + /** {@inheritDoc} */ + + + public STORKResponse buildObject() { + return buildObject(SAMLConstants.SAML20P_NS, Response.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); + } + + /** {@inheritDoc} */ + public STORKResponse buildObject(String namespaceURI, String localName, String namespacePrefix) { + return new STORKResponseImpl(namespaceURI, localName, namespacePrefix); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseImpl.java new file mode 100644 index 000000000..08b5dc9bc --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseImpl.java @@ -0,0 +1,59 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.impl.ResponseImpl; + +import eu.stork.mw.messages.saml.STORKAuthnRequest; +import eu.stork.mw.messages.saml.STORKResponse; + +public class STORKResponseImpl extends ResponseImpl implements STORKResponse { + + private int qaaLevel; + + protected STORKResponseImpl(String namespaceURI, String elementLocalName, + String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + + + public STORKResponseImpl() { + super(SAMLConstants.SAML20P_NS, STORKResponse.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); + } + + + public int getQAALevel() { + return this.qaaLevel; + } + + public void setQAALevel(int authLevel) { + this.qaaLevel = authLevel; + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseMarshaller.java new file mode 100644 index 000000000..1a4654d01 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseMarshaller.java @@ -0,0 +1,44 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.saml2.core.impl.ResponseMarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.MarshallingException; +import org.w3c.dom.Element; + +import eu.stork.mw.messages.saml.STORKResponse; + +public class STORKResponseMarshaller extends ResponseMarshaller { + + protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { + STORKResponse sr = (STORKResponse) samlObject; + +// if (sr.getQAA() != -1) { +// //domElement.setAttributeNS(null, StatusResponseType.VERSION_ATTRIB_NAME, sr.getVersion().toString()); +// } + } +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseUnmarshaller.java new file mode 100644 index 000000000..c2a7bcef9 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/saml/impl/STORKResponseUnmarshaller.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.saml.impl; + +import org.opensaml.saml2.core.impl.ResponseUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.mw.messages.saml.STORKResponse; +import eu.stork.vidp.messages.saml.STORKExtensions; + +public class STORKResponseUnmarshaller extends ResponseUnmarshaller { + + protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) + throws UnmarshallingException { + STORKResponse resp = (STORKResponse) parentSAMLObject; + + if (childSAMLObject instanceof STORKExtensions) { + STORKExtensions ext = (STORKExtensions) childSAMLObject; + + if (ext.getQAALevel() != null) + resp.setQAALevel(ext.getQAALevel().getValue()); + } else { + super.processChildElement(parentSAMLObject, childSAMLObject); + } + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/AuthenticationAttributes.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/AuthenticationAttributes.java new file mode 100644 index 000000000..73f9cd503 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/AuthenticationAttributes.java @@ -0,0 +1,55 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface AuthenticationAttributes extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "AuthenticationAttributes"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + /** Local name of the XSI type. */ + public static final String TYPE_LOCAL_NAME = "AuthenticationAttributesType"; + + /** QName of the XSI type. */ + public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setVIDPAuthenticationAttributes(VIDPAuthenticationAttributes authenticationAttributes); + + public VIDPAuthenticationAttributes getVIDPAuthenticationAttributes(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/CitizenCountryCode.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/CitizenCountryCode.java new file mode 100644 index 000000000..8c7847dd7 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/CitizenCountryCode.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface CitizenCountryCode extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "CitizenCountryCode"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setValue(String citizenCountryCode); + + public String getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossBorderShare.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossBorderShare.java new file mode 100644 index 000000000..c0f7cb291 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossBorderShare.java @@ -0,0 +1,54 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +/** + * @author bzwattendorfer + * + */ +public interface EIDCrossBorderShare extends ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "eIDCrossBorderShare"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setValue(boolean value); + + public boolean getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossSectorShare.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossSectorShare.java new file mode 100644 index 000000000..a04376fb2 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDCrossSectorShare.java @@ -0,0 +1,54 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +/** + * @author bzwattendorfer + * + */ +public interface EIDCrossSectorShare extends ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "eIDCrossSectorShare"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setValue(boolean value); + + public boolean getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDSectorShare.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDSectorShare.java new file mode 100644 index 000000000..4fbd4a2d9 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/EIDSectorShare.java @@ -0,0 +1,54 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +/** + * @author bzwattendorfer + * + */ +public interface EIDSectorShare extends ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "eIDSectorShare"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setValue(boolean value); + + public boolean getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/QualityAuthenticationAssuranceLevel.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/QualityAuthenticationAssuranceLevel.java new file mode 100644 index 000000000..2869177b2 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/QualityAuthenticationAssuranceLevel.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface QualityAuthenticationAssuranceLevel extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "QualityAuthenticationAssuranceLevel"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORK10_PREFIX); + + public void setValue(int level); + + public int getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/RequestedAttributes.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/RequestedAttributes.java new file mode 100644 index 000000000..0dcb1964c --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/RequestedAttributes.java @@ -0,0 +1,58 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.opensaml.saml2.metadata.RequestedAttribute; +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface RequestedAttributes extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "RequestedAttributes"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + /** Local name of the XSI type. */ + public static final String TYPE_LOCAL_NAME = "RequestedAttributesType"; + + /** QName of the XSI type. */ + public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setRequestedAttributes(List requestedAttributes); + + public List getRequestedAttributes(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPAuthRequest.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPAuthRequest.java new file mode 100644 index 000000000..8a5fd8644 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPAuthRequest.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.ElementExtensibleXMLObject; +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +/** + * SAML 2.0 Extensions + */ +public interface SPAuthRequest extends ValidatingXMLObject, ElementExtensibleXMLObject { + + /** Local name, no namespace */ + public final static String LOCAL_NAME = "SPAuthRequest"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertEnc.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertEnc.java new file mode 100644 index 000000000..fd0ff31ae --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertEnc.java @@ -0,0 +1,44 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface SPCertEnc extends + SPCertType { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "SPCertEnc"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertSig.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertSig.java new file mode 100644 index 000000000..c54d23505 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertSig.java @@ -0,0 +1,44 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface SPCertSig extends + SPCertType { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "SPCertSig"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertType.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertType.java new file mode 100644 index 000000000..e24db06a7 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPCertType.java @@ -0,0 +1,49 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface SPCertType extends + ValidatingXMLObject { + + /** Local name of the XSI type. */ + public static final String TYPE_LOCAL_NAME = "SPCertType"; + + /** QName of the XSI type. */ + public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setKeyInfo(KeyInfo keyInfo); + + public KeyInfo getKeyInfo(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPID.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPID.java new file mode 100644 index 000000000..6c8122b88 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPID.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface SPID extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "SPID"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setValue(String spID); + + public String getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPInformation.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPInformation.java new file mode 100644 index 000000000..e0926cd65 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SPInformation.java @@ -0,0 +1,67 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface SPInformation extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "SPInformation"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + /** Local name of the XSI type. */ + public static final String TYPE_LOCAL_NAME = "SPInformationType"; + + /** QName of the XSI type. */ + public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setSPID(SPID spID); + + public SPID getSPID(); + + public void setSPCertSig(SPCertSig spCertSig); + + public SPCertSig getSPCertSig(); + + public void setSPCertEnc(SPCertEnc spCertEnc); + + public SPCertEnc getSPCertEnc(); + + public void setSPAuthRequest(SPAuthRequest spAuthRequest); + + public SPAuthRequest getSPAuthRequest(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpApplication.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpApplication.java new file mode 100644 index 000000000..c68a29297 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpApplication.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface SpApplication extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "spApplication"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORK10_PREFIX); + + public void setValue(String spApplication); + + public String getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpCountry.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpCountry.java new file mode 100644 index 000000000..d7708cb62 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpCountry.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface SpCountry extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "spCountry"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORK10_PREFIX); + + public void setValue(String spCountry); + + public String getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpInstitution.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpInstitution.java new file mode 100644 index 000000000..dddd9e599 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpInstitution.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface SpInstitution extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "spInstitution"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORK10_PREFIX); + + public void setValue(String spInstitution); + + public String getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpSector.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpSector.java new file mode 100644 index 000000000..f29bf02c8 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/SpSector.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface SpSector extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "spSector"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORK10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORK10_PREFIX); + + public void setValue(String spSector); + + public String getValue(); + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/VIDPAuthenticationAttributes.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/VIDPAuthenticationAttributes.java new file mode 100644 index 000000000..89c4bec61 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/VIDPAuthenticationAttributes.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.validation.ValidatingXMLObject; + +import eu.stork.vidp.messages.common.STORKConstants; + +public interface VIDPAuthenticationAttributes extends + ValidatingXMLObject { + + /** Element local name. */ + public static final String DEFAULT_ELEMENT_LOCAL_NAME = "VIDPAuthenticationAttributes"; + + /** Default element name. */ + public static final QName DEFAULT_ELEMENT_NAME = new QName(STORKConstants.STORKP10_NS, DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + /** Local name of the XSI type. */ + public static final String TYPE_LOCAL_NAME = "VIDPAuthenticationAttributesType"; + + /** QName of the XSI type. */ + public static final QName TYPE_NAME = new QName(STORKConstants.STORKP10_NS, TYPE_LOCAL_NAME, + STORKConstants.STORKP10_PREFIX); + + public void setCitizenCountryCode(CitizenCountryCode citizenCountryCode); + + public CitizenCountryCode getCitizenCountryCode(); + + public void setSPInformation(SPInformation spInformation); + + public SPInformation getSPInformation(); + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesBuilder.java new file mode 100644 index 000000000..7fb418f74 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.AuthenticationAttributes; + +public class AuthenticationAttributesBuilder extends + AbstractXMLObjectBuilder { + + @Override + public AuthenticationAttributes buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new AuthenticationAttributesImpl(namespaceURI, localName, namespacePrefix); + } + + public AuthenticationAttributes buildObject() { + return buildObject(STORKConstants.STORK10_NS, AuthenticationAttributes.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesImpl.java new file mode 100644 index 000000000..68e751fdc --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesImpl.java @@ -0,0 +1,74 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.AuthenticationAttributes; +import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; + +public class AuthenticationAttributesImpl extends + AbstractValidatingXMLObject implements + AuthenticationAttributes { + + private VIDPAuthenticationAttributes authenticationAttributes; + + + protected AuthenticationAttributesImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public VIDPAuthenticationAttributes getVIDPAuthenticationAttributes() { + return authenticationAttributes; + } + + public void setVIDPAuthenticationAttributes( + VIDPAuthenticationAttributes authenticationAttributes) { + this.authenticationAttributes = authenticationAttributes; + } + + + public List getOrderedChildren() { + ArrayList children = new ArrayList(); + + if (authenticationAttributes != null) { + children.add(authenticationAttributes); + } + + if (children.size() == 0) { + return null; + } + + return Collections.unmodifiableList(children); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesMarshaller.java new file mode 100644 index 000000000..05f1f9aec --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesMarshaller.java @@ -0,0 +1,35 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.io.BaseXMLObjectMarshaller; + +public class AuthenticationAttributesMarshaller extends + BaseXMLObjectMarshaller { + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesUnmarshaller.java new file mode 100644 index 000000000..564d62383 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/AuthenticationAttributesUnmarshaller.java @@ -0,0 +1,52 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.vidp.messages.stork.AuthenticationAttributes; +import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; + +public class AuthenticationAttributesUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processChildElement(XMLObject parentXMLObject, + XMLObject childXMLObject) throws UnmarshallingException { + AuthenticationAttributes attributes = (AuthenticationAttributes) parentXMLObject; + + if (childXMLObject instanceof VIDPAuthenticationAttributes) { + attributes.setVIDPAuthenticationAttributes((VIDPAuthenticationAttributes) childXMLObject); + } else { + super.processChildElement(parentXMLObject, childXMLObject); + } + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeBuilder.java new file mode 100644 index 000000000..de380d780 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.CitizenCountryCode; + +public class CitizenCountryCodeBuilder extends + AbstractXMLObjectBuilder { + + @Override + public CitizenCountryCode buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new CitizenCountryCodeImpl(namespaceURI, localName, namespacePrefix); + } + + public CitizenCountryCode buildObject() { + return buildObject(STORKConstants.STORK10_NS, CitizenCountryCode.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeImpl.java new file mode 100644 index 000000000..3de591116 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.CitizenCountryCode; + +public class CitizenCountryCodeImpl extends + AbstractValidatingXMLObject implements + CitizenCountryCode { + + private String citizenCountryCode; + + protected CitizenCountryCodeImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public String getValue() { + return citizenCountryCode; + } + + public void setValue(String citizenCountryCode) { + this.citizenCountryCode = citizenCountryCode; + } + + public List getOrderedChildren() { + return Collections.emptyList(); + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeMarshaller.java new file mode 100644 index 000000000..8d47d6117 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.CitizenCountryCode; + +public class CitizenCountryCodeMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { + CitizenCountryCode ccc = (CitizenCountryCode) xmlObject; + XMLHelper.appendTextContent(domElement, ccc.getValue()); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeUnmarshaller.java new file mode 100644 index 000000000..69bd4cdb1 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/CitizenCountryCodeUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.CitizenCountryCode; + +public class CitizenCountryCodeUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + CitizenCountryCode ccc = (CitizenCountryCode) xmlObject; + ccc.setValue(elementContent); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareBuilder.java new file mode 100644 index 000000000..d2b1bba08 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.EIDCrossBorderShare; + +public class EIDCrossBorderShareBuilder extends + AbstractXMLObjectBuilder { + + @Override + public EIDCrossBorderShare buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new EIDCrossBorderShareImpl(namespaceURI, localName, namespacePrefix); + } + + public EIDCrossBorderShare buildObject() { + return buildObject(STORKConstants.STORKP10_NS, EIDCrossBorderShare.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORKP10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareImpl.java new file mode 100644 index 000000000..e5182aff1 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareImpl.java @@ -0,0 +1,80 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.EIDCrossBorderShare; + +/** + * @author bzwattendorfer + * + */ +public class EIDCrossBorderShareImpl extends AbstractValidatingXMLObject implements + EIDCrossBorderShare { + + private boolean value; + + /** + * @param namespaceURI + * @param elementLocalName + * @param namespacePrefix + */ + public EIDCrossBorderShareImpl(String namespaceURI, String elementLocalName, + String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /* (non-Javadoc) + * @see eu.stork.mw.common.messages.stork.EIDSectorShare#getValue() + */ + public boolean getValue() { + return this.value; + } + + /* (non-Javadoc) + * @see eu.stork.mw.common.messages.stork.EIDSectorShare#setValue(boolean) + */ + public void setValue(boolean value) { + this.value = value; + + } + + /* (non-Javadoc) + * @see org.opensaml.xml.XMLObject#getOrderedChildren() + */ + public List getOrderedChildren() { + return Collections.emptyList(); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareMarshaller.java new file mode 100644 index 000000000..1b98e8a2b --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.EIDCrossBorderShare; + +public class EIDCrossBorderShareMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { + EIDCrossBorderShare cbs = (EIDCrossBorderShare) samlObject; + XMLHelper.appendTextContent(domElement, String.valueOf(cbs.getValue())); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareUnmarshaller.java new file mode 100644 index 000000000..bb7b9d762 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossBorderShareUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.EIDCrossBorderShare; + +public class EIDCrossBorderShareUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + EIDCrossBorderShare cbs = (EIDCrossBorderShare) xmlObject; + cbs.setValue(Boolean.parseBoolean(elementContent)); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareBuilder.java new file mode 100644 index 000000000..c02b11a7f --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.EIDCrossSectorShare; + +public class EIDCrossSectorShareBuilder extends + AbstractXMLObjectBuilder { + + @Override + public EIDCrossSectorShare buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new EIDCrossSectorShareImpl(namespaceURI, localName, namespacePrefix); + } + + public EIDCrossSectorShare buildObject() { + return buildObject(STORKConstants.STORKP10_NS, EIDCrossSectorShare.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORKP10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareImpl.java new file mode 100644 index 000000000..b58ee4c4b --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareImpl.java @@ -0,0 +1,80 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.EIDCrossSectorShare; + +/** + * @author bzwattendorfer + * + */ +public class EIDCrossSectorShareImpl extends AbstractValidatingXMLObject implements + EIDCrossSectorShare { + + private boolean value; + + /** + * @param namespaceURI + * @param elementLocalName + * @param namespacePrefix + */ + public EIDCrossSectorShareImpl(String namespaceURI, String elementLocalName, + String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /* (non-Javadoc) + * @see eu.stork.mw.common.messages.stork.EIDSectorShare#getValue() + */ + public boolean getValue() { + return this.value; + } + + /* (non-Javadoc) + * @see eu.stork.mw.common.messages.stork.EIDSectorShare#setValue(boolean) + */ + public void setValue(boolean value) { + this.value = value; + + } + + /* (non-Javadoc) + * @see org.opensaml.xml.XMLObject#getOrderedChildren() + */ + public List getOrderedChildren() { + return Collections.emptyList(); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareMarshaller.java new file mode 100644 index 000000000..bcffdad4a --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.EIDCrossSectorShare; + +public class EIDCrossSectorShareMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { + EIDCrossSectorShare css = (EIDCrossSectorShare) samlObject; + XMLHelper.appendTextContent(domElement, String.valueOf(css.getValue())); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareUnmarshaller.java new file mode 100644 index 000000000..a249c4628 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDCrossSectorShareUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.EIDCrossSectorShare; + +public class EIDCrossSectorShareUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + EIDCrossSectorShare css = (EIDCrossSectorShare) xmlObject; + css.setValue(Boolean.parseBoolean(elementContent)); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareBuilder.java new file mode 100644 index 000000000..79e0d1122 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.EIDSectorShare; + +public class EIDSectorShareBuilder extends + AbstractXMLObjectBuilder { + + @Override + public EIDSectorShare buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new EIDSectorShareImpl(namespaceURI, localName, namespacePrefix); + } + + public EIDSectorShare buildObject() { + return buildObject(STORKConstants.STORKP10_NS, EIDSectorShare.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORKP10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareImpl.java new file mode 100644 index 000000000..ae65ad36c --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareImpl.java @@ -0,0 +1,80 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.EIDSectorShare; + +/** + * @author bzwattendorfer + * + */ +public class EIDSectorShareImpl extends AbstractValidatingXMLObject implements + EIDSectorShare { + + private boolean value; + + /** + * @param namespaceURI + * @param elementLocalName + * @param namespacePrefix + */ + public EIDSectorShareImpl(String namespaceURI, String elementLocalName, + String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + /* (non-Javadoc) + * @see eu.stork.mw.common.messages.stork.EIDSectorShare#getValue() + */ + public boolean getValue() { + return this.value; + } + + /* (non-Javadoc) + * @see eu.stork.mw.common.messages.stork.EIDSectorShare#setValue(boolean) + */ + public void setValue(boolean value) { + this.value = value; + + } + + /* (non-Javadoc) + * @see org.opensaml.xml.XMLObject#getOrderedChildren() + */ + public List getOrderedChildren() { + return Collections.emptyList(); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareMarshaller.java new file mode 100644 index 000000000..ed18cfbd4 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.EIDSectorShare; + +public class EIDSectorShareMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { + EIDSectorShare ss = (EIDSectorShare) samlObject; + XMLHelper.appendTextContent(domElement, String.valueOf(ss.getValue())); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareUnmarshaller.java new file mode 100644 index 000000000..6631e1ac2 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/EIDSectorShareUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.EIDSectorShare; + +public class EIDSectorShareUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + EIDSectorShare ss = (EIDSectorShare) xmlObject; + ss.setValue(Boolean.parseBoolean(elementContent)); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelBuilder.java new file mode 100644 index 000000000..d536372e8 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; + +public class QualityAuthenticationAssuranceLevelBuilder extends + AbstractXMLObjectBuilder { + + @Override + public QualityAuthenticationAssuranceLevel buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new QualityAuthenticationAssuranceLevelImpl(namespaceURI, localName, namespacePrefix); + } + + public QualityAuthenticationAssuranceLevel buildObject() { + return buildObject(STORKConstants.STORKP10_NS, QualityAuthenticationAssuranceLevel.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORKP10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelImpl.java new file mode 100644 index 000000000..69548c149 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; + +public class QualityAuthenticationAssuranceLevelImpl extends + AbstractValidatingXMLObject implements + QualityAuthenticationAssuranceLevel { + + private int qaaLevel; + + protected QualityAuthenticationAssuranceLevelImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public int getValue() { + return this.qaaLevel; + } + + public void setValue(int level) { + this.qaaLevel = level; + + } + + public List getOrderedChildren() { + return Collections.emptyList(); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelMarshaller.java new file mode 100644 index 000000000..7f0d28895 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; + +public class QualityAuthenticationAssuranceLevelMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { + QualityAuthenticationAssuranceLevel qaa = (QualityAuthenticationAssuranceLevel) samlObject; + XMLHelper.appendTextContent(domElement, String.valueOf(qaa.getValue())); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelUnmarshaller.java new file mode 100644 index 000000000..f024261f8 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/QualityAuthenticationAssuranceLevelUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; + +public class QualityAuthenticationAssuranceLevelUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + QualityAuthenticationAssuranceLevel qaa = (QualityAuthenticationAssuranceLevel) xmlObject; + qaa.setValue(Integer.parseInt(elementContent)); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesBuilder.java new file mode 100644 index 000000000..d1e80abbb --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + + +/** + * + */ + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.RequestedAttributes; + +/** + * Builder for {@link org.opensaml.saml2.core.impl.AudienceRestrictionImpl} objects. + */ +public class RequestedAttributesBuilder extends AbstractXMLObjectBuilder { + + /** Constructor. */ + public RequestedAttributesBuilder() { + + } + + /** {@inheritDoc} */ + public RequestedAttributes buildObject() { + return buildObject(STORKConstants.STORK10_NS, RequestedAttributes.DEFAULT_ELEMENT_LOCAL_NAME, + STORKConstants.STORK10_PREFIX); + } + + /** {@inheritDoc} */ + public RequestedAttributes buildObject(String namespaceURI, String localName, String namespacePrefix) { + return new RequestedAttributesImpl(namespaceURI, localName, namespacePrefix); + } +} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesImpl.java new file mode 100644 index 000000000..cd2b4a490 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesImpl.java @@ -0,0 +1,88 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + + +/** + * + */ + +package eu.stork.vidp.messages.stork.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.saml2.metadata.RequestedAttribute; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.util.XMLObjectChildrenList; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.RequestedAttributes; + +/** + * Concrete implementation of {@link org.opensaml.saml2.core.AudienceRestriction}. + */ +public class RequestedAttributesImpl extends AbstractValidatingXMLObject implements RequestedAttributes { + + /** List of the audiences. */ + private XMLObjectChildrenList requestedAttributes; + + /** + * Constructor. + * + * @param namespaceURI the namespace the element is in + * @param elementLocalName the local name of the XML element this Object represents + * @param namespacePrefix the prefix for the given namespace + */ + protected RequestedAttributesImpl(String namespaceURI, String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + requestedAttributes = new XMLObjectChildrenList(this); + } + + /** {@inheritDoc} */ + public List getRequestedAttributes() { + return requestedAttributes; + } + + + /** {@inheritDoc} */ + public List getOrderedChildren() { + ArrayList children = new ArrayList(); + + children.addAll(requestedAttributes); + + return Collections.unmodifiableList(children); + } + + public void setRequestedAttributes( + List requestedAttributes) { + this.requestedAttributes = (XMLObjectChildrenList) requestedAttributes; + + } + + + + +} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesMarshaller.java new file mode 100644 index 000000000..8716c45a5 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesMarshaller.java @@ -0,0 +1,40 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + + +/** + * + */ + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.io.BaseXMLObjectMarshaller; + +/** + * A thread safe Marshaller for {@link org.opensaml.saml2.core.AudienceRestriction} objects. + */ +public class RequestedAttributesMarshaller extends BaseXMLObjectMarshaller { + +} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesUnmarshaller.java new file mode 100644 index 000000000..94e603bd9 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/RequestedAttributesUnmarshaller.java @@ -0,0 +1,55 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + + +/** + * + */ + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.saml2.metadata.RequestedAttribute; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.vidp.messages.stork.RequestedAttributes; + +/** + * A thread-safe Unmarshaller for {@link org.opensaml.saml2.core.AudienceRestriction} objects. + */ +public class RequestedAttributesUnmarshaller extends BaseXMLObjectUnmarshaller { + + /** {@inheritDoc} */ + protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException { + RequestedAttributes requestedAttributes = (RequestedAttributes) parentObject; + + if (childObject instanceof RequestedAttribute) { + requestedAttributes.getRequestedAttributes().add((RequestedAttribute) childObject); + } else { + super.processChildElement(parentObject, childObject); + } + } +} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestBuilder.java new file mode 100644 index 000000000..1febbf399 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestBuilder.java @@ -0,0 +1,50 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.SPAuthRequest; + +/** + * Builder of {@link org.opensaml.saml2.common.impl.ExtensionsImpl} objects. + */ +public class SPAuthRequestBuilder extends AbstractXMLObjectBuilder { + + /** + * {@inheritDoc} + */ + public SPAuthRequest buildObject() { + return buildObject(STORKConstants.STORK10_NS, SPAuthRequest.LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + + /** + * {@inheritDoc} + */ + public SPAuthRequest buildObject(String namespaceURI, String localName, String namespacePrefix) { + return new SPAuthRequestImpl(namespaceURI, localName, namespacePrefix); + } +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestImpl.java new file mode 100644 index 000000000..9ea20b9cc --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestImpl.java @@ -0,0 +1,76 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.util.IndexedXMLObjectChildrenList; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.SPAuthRequest; + +/** + * + */ +public class SPAuthRequestImpl extends AbstractValidatingXMLObject implements SPAuthRequest { + + /** "any" children */ + private final IndexedXMLObjectChildrenList unknownChildren; + + /** + * Constructor + * + * @param namespaceURI + * @param elementLocalName + * @param namespacePrefix + */ + protected SPAuthRequestImpl(String namespaceURI, String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + unknownChildren = new IndexedXMLObjectChildrenList(this); + } + + /** + * {@inheritDoc} + */ + public List getUnknownXMLObjects() { + return unknownChildren; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + public List getUnknownXMLObjects(QName typeOrName) { + return (List) unknownChildren.subList(typeOrName); + } + + /** {@inheritDoc} */ + public List getOrderedChildren() { + return Collections.unmodifiableList(unknownChildren); + } +} \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestMarshaller.java new file mode 100644 index 000000000..feb730935 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestMarshaller.java @@ -0,0 +1,57 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.AbstractXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.w3c.dom.Element; + +/** + * A thread-safe Marshaller for {@link org.opensaml.saml2.common.Extensions} objects. + */ +public class SPAuthRequestMarshaller extends AbstractXMLObjectMarshaller { + + /** + * Constructor + */ + public SPAuthRequestMarshaller() { + super(); + } + + /** + * {@inheritDoc} + */ + protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { + // no attributes + } + + /** + * {@inheritDoc} + */ + protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { + // no content + } +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestUnmarshaller.java new file mode 100644 index 000000000..7d5be220d --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPAuthRequestUnmarshaller.java @@ -0,0 +1,70 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.AbstractXMLObjectUnmarshaller; +import org.opensaml.xml.io.UnmarshallingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Attr; + +import eu.stork.vidp.messages.stork.SPAuthRequest; + +public class SPAuthRequestUnmarshaller extends AbstractXMLObjectUnmarshaller { + + /** Logger. */ + private final Logger log = LoggerFactory.getLogger(AbstractSAMLObjectUnmarshaller.class); + + /** Constructor. */ + public SPAuthRequestUnmarshaller() { + super(); + } + + /** + * {@inheritDoc} + */ + protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject) + throws UnmarshallingException { + SPAuthRequest spAuthRequest = (SPAuthRequest) parentXMLObject; + + spAuthRequest.getUnknownXMLObjects().add(childXMLObject); + } + + /** + * {@inheritDoc} + */ + protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException { + log.debug("Ignorning unknown attribute {}", attribute.getLocalName()); + } + + /** + * {@inheritDoc} + */ + protected void processElementContent(XMLObject xmlObject, String elementContent) { + log.debug("Ignoring element content {}", elementContent); + } +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncBuilder.java new file mode 100644 index 000000000..eb13ddf73 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.SPCertEnc; + +public class SPCertEncBuilder extends + AbstractXMLObjectBuilder { + + @Override + public SPCertEnc buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new SPCertEncImpl(namespaceURI, localName, namespacePrefix); + } + + public SPCertEnc buildObject() { + return buildObject(STORKConstants.STORK10_NS, SPCertEnc.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncImpl.java new file mode 100644 index 000000000..2ee08e1ec --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncImpl.java @@ -0,0 +1,39 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import eu.stork.vidp.messages.stork.SPCertEnc; + +public class SPCertEncImpl extends + SPCertTypeImpl implements + SPCertEnc { + + protected SPCertEncImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncMarshaller.java new file mode 100644 index 000000000..091676959 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncMarshaller.java @@ -0,0 +1,34 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + + +public class SPCertEncMarshaller extends + SPCertTypeMarshaller { + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncUnmarshaller.java new file mode 100644 index 000000000..3b6339609 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertEncUnmarshaller.java @@ -0,0 +1,33 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + + +public class SPCertEncUnmarshaller extends + SPCertTypeUnmarshaller { + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigBuilder.java new file mode 100644 index 000000000..5e75a0e2c --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.SPCertSig; + +public class SPCertSigBuilder extends + AbstractXMLObjectBuilder { + + @Override + public SPCertSig buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new SPCertSigImpl(namespaceURI, localName, namespacePrefix); + } + + public SPCertSig buildObject() { + return buildObject(STORKConstants.STORK10_NS, SPCertSig.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigImpl.java new file mode 100644 index 000000000..f98e3ede3 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigImpl.java @@ -0,0 +1,39 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import eu.stork.vidp.messages.stork.SPCertSig; + +public class SPCertSigImpl extends + SPCertTypeImpl implements + SPCertSig { + + protected SPCertSigImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigMarshaller.java new file mode 100644 index 000000000..e9f3d14da --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigMarshaller.java @@ -0,0 +1,34 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + + +public class SPCertSigMarshaller extends + SPCertTypeMarshaller { + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigUnmarshaller.java new file mode 100644 index 000000000..d706223cb --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertSigUnmarshaller.java @@ -0,0 +1,33 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + + +public class SPCertSigUnmarshaller extends + SPCertTypeUnmarshaller { + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeImpl.java new file mode 100644 index 000000000..a9a30dada --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeImpl.java @@ -0,0 +1,72 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.signature.KeyInfo; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.SPCertType; + +public class SPCertTypeImpl extends + AbstractValidatingXMLObject implements + SPCertType { + + private KeyInfo keyInfo; + + protected SPCertTypeImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public KeyInfo getKeyInfo() { + return keyInfo; + } + + public void setKeyInfo(KeyInfo keyInfo) { + this.keyInfo = keyInfo; + } + + public List getOrderedChildren() { + ArrayList children = new ArrayList(); + + if (keyInfo != null) { + children.add(keyInfo); + } + + if (children.size() == 0) { + return null; + } + + return Collections.unmodifiableList(children); + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeMarshaller.java new file mode 100644 index 000000000..0443a721a --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeMarshaller.java @@ -0,0 +1,34 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.io.BaseXMLObjectMarshaller; + +public class SPCertTypeMarshaller extends + BaseXMLObjectMarshaller { + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeUnmarshaller.java new file mode 100644 index 000000000..e23ff6b54 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPCertTypeUnmarshaller.java @@ -0,0 +1,53 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.signature.KeyInfo; + +import eu.stork.vidp.messages.stork.SPCertType; + +public class SPCertTypeUnmarshaller extends + BaseXMLObjectUnmarshaller { + + + @Override + protected void processChildElement(XMLObject parentXMLObject, + XMLObject childXMLObject) throws UnmarshallingException { + SPCertType spCertType = (SPCertType) parentXMLObject; + + if (childXMLObject instanceof KeyInfo) { + spCertType.setKeyInfo((KeyInfo) childXMLObject); + } else { + super.processChildElement(parentXMLObject, childXMLObject); + } + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDBuilder.java new file mode 100644 index 000000000..f892c88c3 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.SPID; + +public class SPIDBuilder extends + AbstractXMLObjectBuilder { + + @Override + public SPID buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new SPIDImpl(namespaceURI, localName, namespacePrefix); + } + + public SPID buildObject() { + return buildObject(STORKConstants.STORK10_NS, SPID.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDImpl.java new file mode 100644 index 000000000..34bde4caa --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.SPID; + +public class SPIDImpl extends + AbstractValidatingXMLObject implements + SPID { + + private String spID; + + protected SPIDImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public String getValue() { + return spID; + } + + public void setValue(String spID) { + this.spID = spID; + } + + public List getOrderedChildren() { + return Collections.emptyList(); + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDMarshaller.java new file mode 100644 index 000000000..8455d5033 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.SPID; + +public class SPIDMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { + SPID spID = (SPID) xmlObject; + XMLHelper.appendTextContent(domElement, spID.getValue()); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDUnmarshaller.java new file mode 100644 index 000000000..f2eb1eb00 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPIDUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.SPID; + +public class SPIDUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + SPID spID = (SPID) xmlObject; + spID.setValue(elementContent); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationBuilder.java new file mode 100644 index 000000000..1bc9c6ae8 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.SPInformation; + +public class SPInformationBuilder extends + AbstractXMLObjectBuilder { + + @Override + public SPInformation buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new SPInformationImpl(namespaceURI, localName, namespacePrefix); + } + + public SPInformation buildObject() { + return buildObject(STORKConstants.STORK10_NS, SPInformation.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationImpl.java new file mode 100644 index 000000000..e42c1cff5 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationImpl.java @@ -0,0 +1,121 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.SPAuthRequest; +import eu.stork.vidp.messages.stork.SPCertEnc; +import eu.stork.vidp.messages.stork.SPCertSig; +import eu.stork.vidp.messages.stork.SPID; +import eu.stork.vidp.messages.stork.SPInformation; + +public class SPInformationImpl extends + AbstractValidatingXMLObject implements + SPInformation { + + private SPID spID; + + private SPCertSig spCertSig; + + private SPCertEnc spCertEnc; + + private SPAuthRequest spAuthRequest; + + protected SPInformationImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public SPAuthRequest getSPAuthRequest() { + return spAuthRequest; + } + + public SPCertEnc getSPCertEnc() { + return spCertEnc; + } + + public SPCertSig getSPCertSig() { + return spCertSig; + } + + public SPID getSPID() { + return spID; + } + + public void setSPAuthRequest(SPAuthRequest spAuthRequest) { + this.spAuthRequest = spAuthRequest; + } + + public void setSPCertEnc(SPCertEnc spCertEnc) { + this.spCertEnc = spCertEnc; + } + + public void setSPCertSig(SPCertSig spCertSig) { + this.spCertSig = spCertSig; + } + + public void setSPID(SPID spID) { + this.spID = spID; + } + + public List getOrderedChildren() { + ArrayList children = new ArrayList(); + + if (spID != null) { + children.add(spID); + } + + if (spCertSig != null) { + children.add(spCertSig); + } + + if (spCertEnc != null) { + children.add(spCertEnc); + } + + if (spAuthRequest != null) { + children.add(spAuthRequest); + } + + if (children.size() == 0) { + return null; + } + + return Collections.unmodifiableList(children); + } + + + + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationMarshaller.java new file mode 100644 index 000000000..aea91af92 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationMarshaller.java @@ -0,0 +1,35 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.io.BaseXMLObjectMarshaller; + +public class SPInformationMarshaller extends + BaseXMLObjectMarshaller { + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationUnmarshaller.java new file mode 100644 index 000000000..e7f9bd98e --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SPInformationUnmarshaller.java @@ -0,0 +1,61 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.vidp.messages.stork.SPAuthRequest; +import eu.stork.vidp.messages.stork.SPCertEnc; +import eu.stork.vidp.messages.stork.SPCertSig; +import eu.stork.vidp.messages.stork.SPID; +import eu.stork.vidp.messages.stork.SPInformation; + +public class SPInformationUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processChildElement(XMLObject parentXMLObject, + XMLObject childXMLObject) throws UnmarshallingException { + SPInformation spInformation = (SPInformation) parentXMLObject; + + if (childXMLObject instanceof SPID) { + spInformation.setSPID((SPID) childXMLObject); + } else if (childXMLObject instanceof SPCertSig) { + spInformation.setSPCertSig((SPCertSig) childXMLObject); + } if (childXMLObject instanceof SPCertEnc) { + spInformation.setSPCertEnc((SPCertEnc) childXMLObject); + } if (childXMLObject instanceof SPAuthRequest) { + spInformation.setSPAuthRequest((SPAuthRequest) childXMLObject); + } else { + super.processChildElement(parentXMLObject, childXMLObject); + } + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationBuilder.java new file mode 100644 index 000000000..596d77908 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.SpApplication; + +public class SpApplicationBuilder extends + AbstractXMLObjectBuilder { + + @Override + public SpApplication buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new SpApplicationImpl(namespaceURI, localName, namespacePrefix); + } + + public SpApplication buildObject() { + return buildObject(STORKConstants.STORK10_NS, SpApplication.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationImpl.java new file mode 100644 index 000000000..d9c3b3ad2 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.SpApplication; + +public class SpApplicationImpl extends + AbstractValidatingXMLObject implements + SpApplication { + + private String spApplication; + + protected SpApplicationImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public String getValue() { + return spApplication; + } + + public void setValue(String spApplication) { + this.spApplication = spApplication; + } + + public List getOrderedChildren() { + return Collections.emptyList(); + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationMarshaller.java new file mode 100644 index 000000000..1b484e338 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.SpApplication; + +public class SpApplicationMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { + SpApplication spApplication = (SpApplication) xmlObject; + XMLHelper.appendTextContent(domElement, spApplication.getValue()); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationUnmarshaller.java new file mode 100644 index 000000000..70aef824a --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpApplicationUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.SpApplication; + +public class SpApplicationUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + SpApplication spSector = (SpApplication) xmlObject; + spSector.setValue(elementContent); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryBuilder.java new file mode 100644 index 000000000..29c765128 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.SpCountry; + +public class SpCountryBuilder extends + AbstractXMLObjectBuilder { + + @Override + public SpCountry buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new SpCountryImpl(namespaceURI, localName, namespacePrefix); + } + + public SpCountry buildObject() { + return buildObject(STORKConstants.STORK10_NS, SpCountry.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryImpl.java new file mode 100644 index 000000000..66e2e81a6 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.SpCountry; + +public class SpCountryImpl extends + AbstractValidatingXMLObject implements + SpCountry { + + private String spCountry; + + protected SpCountryImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public String getValue() { + return spCountry; + } + + public void setValue(String spCountry) { + this.spCountry = spCountry; + } + + public List getOrderedChildren() { + return Collections.emptyList(); + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryMarshaller.java new file mode 100644 index 000000000..60a1f7838 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.SpCountry; + +public class SpCountryMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { + SpCountry spCountry = (SpCountry) xmlObject; + XMLHelper.appendTextContent(domElement, spCountry.getValue()); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryUnmarshaller.java new file mode 100644 index 000000000..66558248b --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpCountryUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.SpCountry; + +public class SpCountryUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + SpCountry spCountry = (SpCountry) xmlObject; + spCountry.setValue(elementContent); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionBuilder.java new file mode 100644 index 000000000..4ddc48d53 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.SpInstitution; + +public class SpInstitutionBuilder extends + AbstractXMLObjectBuilder { + + @Override + public SpInstitution buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new SpInstitutionImpl(namespaceURI, localName, namespacePrefix); + } + + public SpInstitution buildObject() { + return buildObject(STORKConstants.STORK10_NS, SpInstitution.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionImpl.java new file mode 100644 index 000000000..8d9753328 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.SpInstitution; + +public class SpInstitutionImpl extends + AbstractValidatingXMLObject implements + SpInstitution { + + private String spInstitution; + + protected SpInstitutionImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public String getValue() { + return spInstitution; + } + + public void setValue(String spInstitution) { + this.spInstitution = spInstitution; + } + + public List getOrderedChildren() { + return Collections.emptyList(); + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionMarshaller.java new file mode 100644 index 000000000..ec150523d --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.SpInstitution; + +public class SpInstitutionMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { + SpInstitution spInstitution = (SpInstitution) xmlObject; + XMLHelper.appendTextContent(domElement, spInstitution.getValue()); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionUnmarshaller.java new file mode 100644 index 000000000..34fa89281 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpInstitutionUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.SpInstitution; + +public class SpInstitutionUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + SpInstitution spInstitution = (SpInstitution) xmlObject; + spInstitution.setValue(elementContent); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorBuilder.java new file mode 100644 index 000000000..08daa3c7b --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorBuilder.java @@ -0,0 +1,47 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.CitizenCountryCode; +import eu.stork.vidp.messages.stork.SpSector; + +public class SpSectorBuilder extends + AbstractXMLObjectBuilder { + + @Override + public SpSector buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new SpSectorImpl(namespaceURI, localName, namespacePrefix); + } + + public SpSector buildObject() { + return buildObject(STORKConstants.STORK10_NS, SpSector.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorImpl.java new file mode 100644 index 000000000..f52d2c83d --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.SpSector; + +public class SpSectorImpl extends + AbstractValidatingXMLObject implements + SpSector { + + private String spSector; + + protected SpSectorImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public String getValue() { + return spSector; + } + + public void setValue(String spSector) { + this.spSector = spSector; + } + + public List getOrderedChildren() { + return Collections.emptyList(); + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorMarshaller.java new file mode 100644 index 000000000..78772c956 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorMarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectMarshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.stork.SpSector; + +public class SpSectorMarshaller extends + BaseXMLObjectMarshaller { + + /** {@inheritDoc} */ + protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { + SpSector spSector = (SpSector) xmlObject; + XMLHelper.appendTextContent(domElement, spSector.getValue()); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorUnmarshaller.java new file mode 100644 index 000000000..ea65413a2 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/SpSectorUnmarshaller.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; + +import eu.stork.vidp.messages.stork.SpSector; + +public class SpSectorUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processElementContent(XMLObject xmlObject, + String elementContent) { + SpSector spSector = (SpSector) xmlObject; + spSector.setValue(elementContent); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesBuilder.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesBuilder.java new file mode 100644 index 000000000..a7827f652 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.AbstractXMLObjectBuilder; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; + +public class VIDPAuthenticationAttributesBuilder extends + AbstractXMLObjectBuilder { + + @Override + public VIDPAuthenticationAttributes buildObject(String namespaceURI, String localName, + String namespacePrefix) { + return new VIDPAuthenticationAttributesImpl(namespaceURI, localName, namespacePrefix); + } + + public VIDPAuthenticationAttributes buildObject() { + return buildObject(STORKConstants.STORK10_NS, VIDPAuthenticationAttributes.DEFAULT_ELEMENT_LOCAL_NAME, STORKConstants.STORK10_PREFIX); + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesImpl.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesImpl.java new file mode 100644 index 000000000..3c8d960db --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesImpl.java @@ -0,0 +1,91 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.AbstractValidatingXMLObject; + +import eu.stork.vidp.messages.stork.CitizenCountryCode; +import eu.stork.vidp.messages.stork.SPInformation; +import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; + +public class VIDPAuthenticationAttributesImpl extends + AbstractValidatingXMLObject implements + VIDPAuthenticationAttributes { + + private CitizenCountryCode citizenCountryCode; + + private SPInformation spInformation; + + protected VIDPAuthenticationAttributesImpl(String namespaceURI, + String elementLocalName, String namespacePrefix) { + super(namespaceURI, elementLocalName, namespacePrefix); + } + + public CitizenCountryCode getCitizenCountryCode() { + return citizenCountryCode; + } + + + public SPInformation getSPInformation() { + return spInformation; + } + + public void setCitizenCountryCode(CitizenCountryCode citizenCountryCode) { + this.citizenCountryCode = citizenCountryCode; + } + + + public void setSPInformation(SPInformation spInformation) { + this.spInformation = spInformation; + } + + public List getOrderedChildren() { + ArrayList children = new ArrayList(); + + if (citizenCountryCode != null) { + children.add(citizenCountryCode); + } + + + if (spInformation != null) { + children.add(spInformation); + } + + if (children.size() == 0) { + return null; + } + + return Collections.unmodifiableList(children); + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesMarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesMarshaller.java new file mode 100644 index 000000000..f21b492a9 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesMarshaller.java @@ -0,0 +1,35 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.io.BaseXMLObjectMarshaller; + +public class VIDPAuthenticationAttributesMarshaller extends + BaseXMLObjectMarshaller { + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesUnmarshaller.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesUnmarshaller.java new file mode 100644 index 000000000..3b7a1b20e --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/stork/impl/VIDPAuthenticationAttributesUnmarshaller.java @@ -0,0 +1,55 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.stork.impl; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.BaseXMLObjectUnmarshaller; +import org.opensaml.xml.io.UnmarshallingException; + +import eu.stork.vidp.messages.stork.CitizenCountryCode; +import eu.stork.vidp.messages.stork.SPInformation; +import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; + +public class VIDPAuthenticationAttributesUnmarshaller extends + BaseXMLObjectUnmarshaller { + + @Override + protected void processChildElement(XMLObject parentXMLObject, + XMLObject childXMLObject) throws UnmarshallingException { + VIDPAuthenticationAttributes attributes = (VIDPAuthenticationAttributes) parentXMLObject; + + if (childXMLObject instanceof CitizenCountryCode) { + attributes.setCitizenCountryCode((CitizenCountryCode) childXMLObject); + } else if (childXMLObject instanceof SPInformation) { + attributes.setSPInformation((SPInformation) childXMLObject); + } else { + super.processChildElement(parentXMLObject, childXMLObject); + } + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/SAMLUtil.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/SAMLUtil.java new file mode 100644 index 000000000..6a4ba1648 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/SAMLUtil.java @@ -0,0 +1,405 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.util; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.opensaml.Configuration; +import org.opensaml.common.SignableSAMLObject; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.AttributeStatement; +import org.opensaml.saml2.metadata.RequestedAttribute; +import org.opensaml.ws.message.encoder.MessageEncodingException; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.Marshaller; +import org.opensaml.xml.io.MarshallingException; +import org.opensaml.xml.io.Unmarshaller; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.schema.XSAny; +import org.opensaml.xml.schema.XSString; +import org.opensaml.xml.security.SecurityException; +import org.opensaml.xml.security.SecurityHelper; +import org.opensaml.xml.security.credential.Credential; +import org.opensaml.xml.signature.Signature; +import org.opensaml.xml.signature.SignatureConstants; +import org.opensaml.xml.signature.SignatureException; +import org.opensaml.xml.signature.Signer; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.ValidatorSuite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Element; + +import eu.stork.vidp.messages.builder.STORKMessagesBuilder; +import eu.stork.vidp.messages.exception.SAMLException; +import eu.stork.vidp.messages.exception.SAMLValidationException; +import eu.stork.vidp.messages.saml.STORKAttribute; + +/** + * + * Helper class for SAML message processing + * @author bzwattendorfer + * + */ +public class SAMLUtil { + + private final static Logger log = LoggerFactory.getLogger(SAMLUtil.class); + + /** + * Signs a SAML object + * @param samlObject SAML object to sign + * @param signingCredential Credentials to be used for signing + * @throws SAMLException + */ + public static void signSAMLObject(SignableSAMLObject samlObject, Credential signingCredential) throws SAMLException { + + log.trace("Signing " + samlObject.getElementQName()); + + Signature signature = STORKMessagesBuilder.buildXMLObject(Signature.DEFAULT_ELEMENT_NAME); + + signature.setSigningCredential(signingCredential); + + //TODO: Make signing algorithm configurable + signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); + signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + + try { + //TODO SecurityConfiguration, default signature credentials + SecurityHelper.prepareSignatureParams(signature, signingCredential, null, null); + } catch (SecurityException e) { + throw new SAMLException("Error preparing signature for signing", e); + } + + samlObject.setSignature(signature); + + Marshaller assertionMarshaller = Configuration.getMarshallerFactory().getMarshaller(samlObject); + try { + assertionMarshaller.marshall(samlObject); + Signer.signObject(signature); + } catch (MarshallingException e) { + throw new SAMLException("Unable to marshall " + samlObject.getElementQName() + " for signing", e); + } catch (SignatureException e) { + throw new SAMLException("Unable to sign " + samlObject.getElementQName(), e); + } + + } + + /** + * Validated SAML object according the given validation config + * @param samlObject SAML object to validaate + * @param validatorSuiteConfig Validation config + * @throws SAMLValidationException + */ + public static void verifySAMLObjectStandardValidation(SignableSAMLObject samlObject, String validatorSuiteConfig) throws SAMLValidationException { + + ValidatorSuite validatorSuite = Configuration.getValidatorSuite(validatorSuiteConfig); + try { + validatorSuite.validate(samlObject); + } catch (ValidationException e) { + log.error(e.getMessage(), e); + throw new SAMLValidationException("Could not validate " + samlObject.getElementQName(), e); + } + + } + + /** + * Gets the STORK attribute status from a SAML attribute + * @param attribute SAML attribute + * @return STORK attribute status + */ + public static String getStatusFromAttribute(Attribute attribute) { + return attribute.getUnknownAttributes().get(STORKAttribute.DEFAULT_STORK_ATTRIBUTE_QNAME); + } + + /** + * Gets the XML value of an XML object as String + * @param xmlObj XML object + * @return XML value as String + */ + public static String getStringValueFromXMLObject(XMLObject xmlObj) { + if (xmlObj instanceof XSString) { + return ((XSString) xmlObj).getValue(); + } else if (xmlObj instanceof XSAny) { + return ((XSAny) xmlObj).getTextContent(); + } + return null; + } + + /** + * Gets the attribute value as String of an attribute whereas the attribute is in a given list + * @param attrList List of attributes + * @param name Name of the attribute where the value should be extracted + * @return attribute value as String + */ + public static String getAttributeStringValue(List attrList, String name) { + XMLObject xmlObj = getAttributeValue(attrList, name); + return getStringValueFromXMLObject(xmlObj); + } + + /** + * Gets the attribute value as String of an attribute + * @param attribute Attribute + * @return attribute value as String + */ + public static String getAttributeStringValue(Attribute attribute) { + return ((XSString) attribute.getAttributeValues().get(0)).getValue(); + } + + /** + * Gets the attribute value as anyType of an attribute + * @param attribute Attribute + * @return value as anyType + */ + public static XSAny getAttributeXSAnyValue(Attribute attribute) { + return (XSAny) attribute.getAttributeValues().get(0); + } + + /** + * Gets the attribute value as anyType of an attribute whereas the attribute is in a given list + * @param attrList List of attributes + * @param name Name of the attribute where the value should be extracted + * @return attribute value as anyType + */ + public static XSAny getXSAnyAttributeValue(List attrList, String name) { + //XMLObject xmlObj = getAttributeValue(attrList, name); + return (XSAny) getAttributeValue(attrList, name); + } + + /** + * Gets the attribute value as XMLObject of an attribute whereas the attribute is in a given list + * @param attrList List of attributes + * @param name Name of the attribute where the value should be extracted + * @return attribute value as XMLObject + */ + public static XMLObject getAttributeValue(List attrList, String name) { + Attribute attribute = getAttribute(attrList, name); + return (attribute != null && !attribute.getAttributeValues().isEmpty()) ? attribute.getAttributeValues().get(0) : null; + } + + /** + * Gets the attribute specified by name out of a list + * @param attrList List of attributes + * @param name attribute name of the attribute to extract + * @return attribute + */ + public static Attribute getAttribute(List attrList, String name) { + for (Attribute attribute : attrList) { + if (attribute.getName().equals(name)) { + return attribute; + } + } + + return null; + } + + /** + * Gets the attribute specified by name out of a list and immediately removes it from the list + * @param attrList List of attributes + * @param name attribute name of the attribute to extract and remove + * @return attribute + */ + public static String getAttributeStringValueAndRemove(List attrList, String name) { + + Attribute attribute = getAttribute(attrList, name); + String value = getAttributeStringValue(attrList, name); + attrList.remove(attribute); + + return value; + } + + /** + * Checks if an attribute with a given name is present in a SAML assertion + * @param storkAssertion STORK SAML assertion + * @param attributeName attribute name + * @return true if attribute is present + */ + public static boolean containsAttribute(Assertion storkAssertion, String attributeName) { + AttributeStatement attrStatement = storkAssertion.getAttributeStatements().get(0); + + for (Attribute attribute : attrStatement.getAttributes()) { + if (attribute.getName().equals(attributeName) && (SAMLUtil.getStatusFromAttribute(attribute) == null || SAMLUtil.getStatusFromAttribute(attribute).equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_AVAIL))) { + return true; + } + } + + return false; + } + + /** + * Checks if an attribute with a given name is present in a List of attributes + * @param attributeList List of attributes + * @param attributeName attribute name + * @return true if attribute is present + */ + public static boolean containsAttribute(List attributeList, String attributeName) { + for (Attribute attr : attributeList) { + if (attr.getName().equals(attributeName)) + return true; + } + return false; + } + + /** + * Remeoves attribute with a given name from an attribute list + * @param attributeList List of attributes + * @param attributeName name of the attribute to be removed from list + */ + public static void removeAttribute(List attributeList, String attributeName) { + if (containsAttribute(attributeList, attributeName)) { + attributeList.remove(getAttribute(attributeList, attributeName)); + } + } + + /** + * Gets the String value of an XML object (Only if XMLObject contains String) + * @param xmlObj XMLObject + * @return String value of XMLObject + */ + public static String getXSStringValueFromXMLObject(XMLObject xmlObj) { + if (xmlObj instanceof XSString) + return ((XSString) xmlObj).getValue(); + + return null; + } + + + /** + * Marshalls an XMLObject to an XML element (DOM) + * @param message XMLObject + * @return DOM representation of XMLObject + */ + public static Element marshallMessage(XMLObject message) { + + try { + Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(message); + if (marshaller == null) { + log.error("Unable to marshall message, no marshaller registered for message object: " + + message.getElementQName()); + } + Element messageElem = marshaller.marshall(message); + return messageElem; + } catch (MarshallingException e) { + log.error("Encountered error marshalling message to its DOM representation", e); + throw new RuntimeException("Encountered error marshalling message into its DOM representation", e); + } + } + + /** + * Unmarshalls a DOM XML element into an OpenSAML XMLObject + * @param element DOM element + * @return OpenSAML XMLObject + * @throws MessageEncodingException + */ + public static XMLObject unmarshallMessage(Element element) throws MessageEncodingException { + + try { + Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(element); + if (unmarshaller == null) { + log.error("Unable to unmarshall element, no unmarshaller registered for message element: " + + element.getNodeName()); + } + + return unmarshaller.unmarshall(element); + } catch (UnmarshallingException e) { + log.error("Encountered error unmarshalling element to its XMLObject representation", e); + throw new MessageEncodingException("Encountered error unmarshalling element to its XMLObject representation", e); + } + } + + /** + * Releases the DOM element from an XML document + * @param xmlObjList List of XMLObjects to release + * @return List of released XMLObjects + */ + public static List releaseDOM(List xmlObjList) { + + List newXMLObjList = new ArrayList(); + Iterator it = xmlObjList.iterator(); + + while (it.hasNext()) { + XMLObject xmlObj = it.next(); + xmlObj.detach(); + newXMLObjList.add(xmlObj); + } + + return newXMLObjList; + + } + + /** + * Makes a union of two RequestedAttribute lists (first list has priority and overrides attributes in the second list if equal) + * @param priorityList Priority list if attributes might be equal + * @param list low priority list + * @return Union of both lists + */ + public static List buildRequestedAttributesUnion(List priorityList, List list) { + List reqAttrList = new ArrayList(); + + if (priorityList == null || list == null) + return reqAttrList; + + if (priorityList == null || priorityList.isEmpty()) { + if (list == null || list.isEmpty()) { + return reqAttrList; + } else { + reqAttrList.addAll((List) releaseDOM(list)); + return reqAttrList; + } + } else { + if (list == null || list.isEmpty()) { + reqAttrList.addAll((List) releaseDOM(priorityList)); + return reqAttrList; + } else { + reqAttrList.addAll((List) releaseDOM(priorityList)); + for (RequestedAttribute reqAttr : list) { + boolean found = false; + for (RequestedAttribute prioReqAttr : priorityList) { + if (!prioReqAttr.getName().equals(reqAttr.getName())) { + found = true; + } + } + if (!found) { + reqAttr.detach(); + reqAttrList.add(reqAttr); + log.debug("Adding additional requested attribute: {} , isRequired: {}", reqAttr.getName(), reqAttr.isRequired()); + } + } + } + } + + + + return reqAttrList; + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/XMLUtil.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/XMLUtil.java new file mode 100644 index 000000000..3ca38ec03 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/util/XMLUtil.java @@ -0,0 +1,143 @@ +/** + * + */ +package eu.stork.vidp.messages.util; + +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Helper class for XML processing + * @author bzwattendorfer + * + */ +public class XMLUtil { + + /** + * Transforms a string representation to a DOM representation + * @param xmlString XML as string + * @return DOM representation of String + * @throws ParserConfigurationException + * @throws SAXException + * @throws IOException + */ + public static Element stringToDOM(String xmlString) throws ParserConfigurationException, SAXException, IOException { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + + DocumentBuilder builder = dbf.newDocumentBuilder(); + + Reader reader = new StringReader(xmlString); + InputSource src = new InputSource(reader); + Document domDoc = builder.parse(src); + return domDoc.getDocumentElement(); + } + + /** + * Creates a new and empty XML document + * @return New XML document + * @throws ParserConfigurationException + */ + public static Document createNewDocument() throws ParserConfigurationException { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + + DocumentBuilder builder = dbf.newDocumentBuilder(); + return builder.newDocument(); + } + + /** + * Transforms an XML to a String + * @param node XML node + * @return String represenation of XML + */ + public static String printXML(Node node) { + TransformerFactory tfactory = TransformerFactory.newInstance(); + Transformer serializer; + try { + serializer = tfactory.newTransformer(); + + serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + serializer.setOutputProperty(OutputKeys.ENCODING,"UTF-8"); + + StringWriter output = new StringWriter(); + serializer.transform(new DOMSource(node), new StreamResult(output)); + return output.toString(); + } catch (TransformerException e) { + + throw new RuntimeException(e); + } + } + + /** + * Writes an XML element to a given file + * @param doc XML element + * @param filename Filename of the file where to write XML + */ + public static void writeXmlFile(Element doc, String filename) { + try { + + Source source = new DOMSource(doc); + File file = new File(filename); + Result result = new StreamResult(file); + + Transformer xformer = TransformerFactory.newInstance().newTransformer(); + xformer.transform(source, result); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Gets the first text value of a NodeList + * @param nList NodeList + * @return first text value of a NodeList + */ + public static String getFirstTextValueFromNodeList(NodeList nList) { + if (nList != null && nList.getLength() != 0) { + return nList.item(0).getTextContent(); + } + return null; + } + + /** + * Gets the first element of a Node + * @param parent Node + * @return first element of a Node + */ + public static Element getFirstElement(Node parent) { + Node n = parent.getFirstChild(); + while (n != null && n.getNodeType() != Node.ELEMENT_NODE) { + n = n.getNextSibling(); + } + if (n == null) { + return null; + } + return (Element)n; + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAssertionValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAssertionValidator.java new file mode 100644 index 000000000..c412ba6a0 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAssertionValidator.java @@ -0,0 +1,91 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.common.SAMLVersion; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.validator.AssertionSchemaValidator; +import org.opensaml.xml.validation.ValidationException; + +public class StorkAssertionValidator extends AssertionSchemaValidator { + + /** + * Constructor + * + */ + public StorkAssertionValidator() { + + super(); + } + + @Override + public void validate(Assertion assertion) throws ValidationException { + + super.validate(assertion); + + if(assertion.getID() == null) { + + throw new ValidationException("ID is required."); + } + + if(assertion.getVersion() == null || !assertion.getVersion().equals(SAMLVersion.VERSION_20)) { + + throw new ValidationException("Version of assertion not present or invalid."); + } + + if(assertion.getIssueInstant() == null) { + + throw new ValidationException("IssueInstant is required."); + } + + if(assertion.getSubject() == null) { + + throw new ValidationException("Subject is required."); + } + + if(assertion.getConditions() == null) { + + throw new ValidationException("Conditions is required."); + } + + if(assertion.getAuthnStatements() == null || + assertion.getAuthnStatements().size() != 1) { + + throw new ValidationException("Incorrect number of AuthnStatements."); + } + + if(assertion.getAttributeStatements() != null) { + + if(assertion.getAttributeStatements().size() != 0 && + assertion.getAttributeStatements().size() != 1) { + + throw new ValidationException("Incorrect number of AttributeStatements."); + } + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAttributeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAttributeValidator.java new file mode 100644 index 000000000..6e37725d1 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAttributeValidator.java @@ -0,0 +1,204 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import java.util.regex.Pattern; + +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; +import org.opensaml.saml2.core.Attribute; +import org.opensaml.saml2.core.validator.AttributeSchemaValidator; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSString; +import org.opensaml.xml.util.AttributeMap; +import org.opensaml.xml.validation.ValidationException; + +import eu.stork.vidp.messages.common.STORKConstants; +import eu.stork.vidp.messages.saml.STORKAttribute; + +public class StorkAttributeValidator extends AttributeSchemaValidator { + + private static final String PATTERN_EIDENTIFIER = "^[A-Z]{2}/[A-Z]{2}/[A-Za-z0-9+/=\r\n]+$"; + private static final String PATTERN_GENDER = "^[MF]{1}$"; + private static final String PATTERN_COUNTRYCODEOFBIRTH = "^[A-Z]{2}|[A-Z]{4}$"; + private static final String PATTERN_COUNTRYCODE = "^[A-Z]{2}$"; + private static final String PATTERN_MARTIALSTATUS = "^[SMPDW]{1}$"; + private static final String PATTERN_EMAIL = "^[-+.\\w]{1,64}@[-.\\w]{1,64}\\.[-.\\w]{2,6}$"; + private static final String PATTERN_AGE = "^[0-9]{1,3}$"; + private static final int MAX_AGE = 120; + private static final String PATTERN_ISAGEOVER = PATTERN_AGE; + private static final String PATTERN_CITIZENQAALEVEL = "^[1-4]{1}$"; + + + /** + * Constructor + * + */ + public StorkAttributeValidator() { + + super(); + } + + @Override + public void validate(Attribute attr) throws ValidationException { + + super.validate(attr); + + if(attr.getName() == null) { + + throw new ValidationException("Name is required."); + } + + if(attr.getNameFormat() == null) { + + throw new ValidationException("NameFormat is required."); + } + + + if(attr.getUnknownAttributes() != null) { + + AttributeMap map = attr.getUnknownAttributes(); + + String value = map.get(STORKAttribute.DEFAULT_STORK_ATTRIBUTE_QNAME); + + if (value == null || value.equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_AVAIL)) { + //if AttributeStatus not present, default is "Available" thus AttributeValue must be present + if (attr.getAttributeValues().isEmpty()) { + //isAgeOver can have no value + if (!attr.getName().equals(STORKConstants.STORK_ATTRIBUTE_ISAGEOVER)) { + throw new ValidationException("AttributeStatus indicates that attribute is available but no AttributeValue is present."); + } + } + + //throw new ValidationException("AttributeStatus not present."); + + } else if(!value.equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_AVAIL) && + !value.equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_NOT_AVAIL) && + !value.equals(STORKAttribute.ALLOWED_ATTRIBUTE_STATUS_WITHHELD)) { + + throw new ValidationException("AttributeStatus is invalid."); + } + + } + + if (!attr.getAttributeValues().isEmpty()) { + //validate individual attributes if present + XMLObject attrValueObject = attr.getAttributeValues().get(0); + + if (!(attrValueObject instanceof XSString)) { + //Only validate String attributes + return; + } + + String value = ((XSString) attr.getAttributeValues().get(0)).getValue(); + String attrName = attr.getName(); + + //only isAgeOver can be empty if provided + if (value == null) { + //only isAgeOver can be empty if provided + if (attrName.equals(STORKConstants.STORK_ATTRIBUTE_ISAGEOVER)) { + return; + } else { + throw new ValidationException("Provided AttributeValue is empty"); + } + } + + //validate eIdentifier + validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_EIDENTIFIER, PATTERN_EIDENTIFIER); + + //validate gender + validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_GENDER, PATTERN_GENDER); + + //validate dateOfBirth + if (attrName.equals(STORKConstants.STORK_ATTRIBUTE_DATEOFBIRTH)) { + verifyDate(value); + } + + //validate countryCode of birth + validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_COUNTRYCODEOFBIRTH, PATTERN_COUNTRYCODEOFBIRTH); + + //validate countryCode + validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_NATIONALITYCODE, PATTERN_COUNTRYCODE); + + //validate martialStatus + validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_MARTIALSTATUS, PATTERN_MARTIALSTATUS); + + //validate email + validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_EMAIL, PATTERN_EMAIL); + + //validate age and isAgeOver + validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_AGE, PATTERN_AGE); + validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_ISAGEOVER, PATTERN_ISAGEOVER); + if (attr.getName().equals(STORKConstants.STORK_ATTRIBUTE_AGE) || attr.getName().equals(STORKConstants.STORK_ATTRIBUTE_ISAGEOVER)) { + if (Integer.valueOf(((XSString) attr.getAttributeValues().get(0)).getValue()) > MAX_AGE) { + throw new ValidationException("Maximum age reached"); + } + } + + validateAttributeValueFormat(value, attrName, STORKConstants.STORK_ATTRIBUTE_CITIZENQAALEVEL, PATTERN_CITIZENQAALEVEL); + } + + } + + private void validateAttributeValueFormat(String value, String currentAttrName, String attrNameToTest, String pattern) throws ValidationException { + if (currentAttrName.equals(attrNameToTest)) { + if (!Pattern.matches(pattern, value)) { + throw new ValidationException(attrNameToTest + " has incorrect format."); + } + } + + } + + private static void verifyDate(String pepsDate) throws ValidationException { + DateTimeFormatter fmt = null; + + switch (pepsDate.length()) { + case 4: + fmt = DateTimeFormat.forPattern("yyyy"); + break; + case 6: + fmt = DateTimeFormat.forPattern("yyyyMM"); + break; + case 8: + fmt = DateTimeFormat.forPattern("yyyyMMdd"); + break; + default: + throw new ValidationException("Date has wrong format"); + } + + try { + fmt.parseDateTime(pepsDate); + } catch (IllegalArgumentException e) { + throw new ValidationException("Date has wrong format"); + } + + + } + + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAudienceRestrictionValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAudienceRestrictionValidator.java new file mode 100644 index 000000000..a561d4c33 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAudienceRestrictionValidator.java @@ -0,0 +1,56 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.AudienceRestriction; +import org.opensaml.saml2.core.validator.AudienceRestrictionSchemaValidator; +import org.opensaml.xml.validation.ValidationException; + +public class StorkAudienceRestrictionValidator extends + AudienceRestrictionSchemaValidator { + + /** + * Constructor + * + */ + public StorkAudienceRestrictionValidator() { + + super(); + } + + @Override + public void validate(AudienceRestriction res) throws ValidationException { + + super.validate(res); + + if(res.getAudiences() == null || res.getAudiences().size() < 1) { + + throw new ValidationException("Audience is required."); + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthenticationAttributesValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthenticationAttributesValidator.java new file mode 100644 index 000000000..1997da7b6 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthenticationAttributesValidator.java @@ -0,0 +1,57 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.AuthenticationAttributes; +import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; + +public class StorkAuthenticationAttributesValidator implements Validator { + + + public StorkAuthenticationAttributesValidator() { + + } + + public void validate(AuthenticationAttributes authenticationAttributes) throws ValidationException { + + //check AuthenticationAttributes for VIDPs + VIDPAuthenticationAttributes vidpAuthenticationAttributes = authenticationAttributes.getVIDPAuthenticationAttributes(); + + if(vidpAuthenticationAttributes == null) { + + throw new ValidationException("VIDPAuthenticationAttributes is required for sending requests to VIDPs."); + } + + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnRequestValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnRequestValidator.java new file mode 100644 index 000000000..0e8722d55 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnRequestValidator.java @@ -0,0 +1,137 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.common.SAMLVersion; +import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.core.validator.AuthnRequestSchemaValidator; +import org.opensaml.xml.util.XMLHelper; +import org.opensaml.xml.validation.ValidationException; + +import eu.stork.mw.messages.saml.STORKAuthnRequest; + +public class StorkAuthnRequestValidator extends AuthnRequestSchemaValidator { + + private static final String ALLOWED_CONSENT = "urn:oasis:names:tc:SAML:2.0:consent:unspecified"; + private static final String ALLOWED_PROTOCOL_BINDING_1 = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"; + private static final String ALLOWED_PROTOCOL_BINDING_2 = "urn:oasis:names:tc:SAML:2.0:bindings:SOAP"; + + private static final int MAX_SIZE = 131072; + + /** + * Constructor + * + */ + public StorkAuthnRequestValidator() { + + super(); + } + + @Override + public void validate(AuthnRequest req) throws ValidationException { + + if (XMLHelper.prettyPrintXML(req.getDOM()).getBytes().length > MAX_SIZE) { + throw new ValidationException("SAML AuthnRequest exceeds max size."); + } + + super.validate(req); + + STORKAuthnRequest request = (STORKAuthnRequest) req; + + if (request.getID() == null) { + + throw new ValidationException("ID is required."); + } + + if (request.getVersion() == null) { + + throw new ValidationException("Version is required."); + } else { + + if (!request.getVersion().equals(SAMLVersion.VERSION_20)) { + + throw new ValidationException("Version is invalid."); + } + } + + if (request.getIssueInstant() == null) { + + throw new ValidationException("IssueInstant is required."); + } + + if (request.getConsent() != null) { + + if (!request.getConsent().equals(ALLOWED_CONSENT)) { + + throw new ValidationException("Consent is invalid."); + } + } + + if (request.isForceAuthn() == null) { + + throw new ValidationException("ForceAuthn is required."); + } else if (!request.isForceAuthn()) { + + throw new ValidationException("ForceAuthn is invalid."); + } + + if (request.isPassive() == null) { + + throw new ValidationException("IsPassive is required."); + } else if (request.isPassive()) { + + throw new ValidationException("IsPassive is invalid."); + } + + if (request.getProtocolBinding() == null) { + + throw new ValidationException("ProtocolBinding is required."); + } else { + if (!request.getProtocolBinding() + .equals(ALLOWED_PROTOCOL_BINDING_1) + && !request.getProtocolBinding().equals( + ALLOWED_PROTOCOL_BINDING_2)) { + + throw new ValidationException("ProtocolBinding is invalid."); + } + + } + + if(request.getAssertionConsumerServiceURL() == null) { + + throw new ValidationException("AssertionConsumerServiceURL is required."); + } + + if(request.getProviderName() == null) { + + throw new ValidationException("ProviderName is required."); + } + + + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnStatementValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnStatementValidator.java new file mode 100644 index 000000000..b25b5621f --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkAuthnStatementValidator.java @@ -0,0 +1,62 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.AuthnStatement; +import org.opensaml.saml2.core.validator.AuthnStatementSchemaValidator; +import org.opensaml.xml.validation.ValidationException; + +public class StorkAuthnStatementValidator extends + AuthnStatementSchemaValidator { + + /** + * Constructor + * + */ + public StorkAuthnStatementValidator() { + + super(); + } + + @Override + public void validate(AuthnStatement stmnt) throws ValidationException { + + super.validate(stmnt); + + if(stmnt.getAuthnInstant() == null) { + + throw new ValidationException("AuthnInstant is required."); + } + + if(stmnt.getSubjectLocality() == null) { + + throw new ValidationException("SubjectLocality is required."); + } + + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkCitizenCountryCodeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkCitizenCountryCodeValidator.java new file mode 100644 index 000000000..15f8e2dd1 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkCitizenCountryCodeValidator.java @@ -0,0 +1,63 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import java.util.regex.Pattern; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.CitizenCountryCode; + +public class StorkCitizenCountryCodeValidator implements + Validator { + + public static final String REGEX_PATTERN = "^[A-Za-z]{2}$"; + + public StorkCitizenCountryCodeValidator() { + + } + + public void validate(CitizenCountryCode ccc) throws ValidationException { + + if(ccc == null) { + + throw new ValidationException("CitizenCountryCode is required."); + } + + if (ccc.getValue() == null) { + throw new ValidationException("CitizenCountryCode has no value"); + } + + + if (!Pattern.matches(REGEX_PATTERN, ccc.getValue())) { + throw new ValidationException("CitizenCountryCode not valid: " + ccc.getValue()); + } + + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkConditionsValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkConditionsValidator.java new file mode 100644 index 000000000..81b7957fd --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkConditionsValidator.java @@ -0,0 +1,70 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.Conditions; +import org.opensaml.saml2.core.validator.ConditionsSpecValidator; +import org.opensaml.xml.validation.ValidationException; + +public class StorkConditionsValidator extends ConditionsSpecValidator { + + /** + * Constructor + * + */ + public StorkConditionsValidator() { + + super(); + } + + @Override + public void validate(Conditions conditions) throws ValidationException { + + super.validate(conditions); + + if(conditions.getNotBefore() == null) { + + throw new ValidationException("NotBefore is required."); + } + + if(conditions.getNotOnOrAfter() == null) { + + throw new ValidationException("NotOnOrAfter is required."); + } + + if(conditions.getAudienceRestrictions() == null || conditions.getAudienceRestrictions().size() < 1) { + + throw new ValidationException("AudienceRestriction is required."); + } + + if(conditions.getOneTimeUse() == null) { + + throw new ValidationException("OneTimeUse is required."); + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEIDSectorShareValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEIDSectorShareValidator.java new file mode 100644 index 000000000..96555e660 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEIDSectorShareValidator.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/** + * + */ +package eu.stork.vidp.messages.validation; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.EIDSectorShare; + +/** + * @author bzwattendorfer + * + */ +public class StorkEIDSectorShareValidator implements Validator { + + public StorkEIDSectorShareValidator() { + + } + + public void validate(EIDSectorShare eidSectorShare) throws ValidationException { + + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedAttributeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedAttributeValidator.java new file mode 100644 index 000000000..48464b6ec --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedAttributeValidator.java @@ -0,0 +1,50 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.EncryptedAttribute; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +public class StorkEncryptedAttributeValidator implements + Validator { + + public StorkEncryptedAttributeValidator() { + + } + + public void validate(EncryptedAttribute encAttr) throws ValidationException { + + if(encAttr.getEncryptedData() == null) { + + throw new ValidationException("EncryptedData is required."); + } + + + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedIdValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedIdValidator.java new file mode 100644 index 000000000..79450b1dc --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkEncryptedIdValidator.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.EncryptedID; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +public class StorkEncryptedIdValidator implements Validator { + + /** + * Constructor + * + */ + public StorkEncryptedIdValidator() { + + } + + public void validate(EncryptedID encId) throws ValidationException { + + if(encId.getEncryptedData() == null) { + + throw new ValidationException("EncryptedData is required."); + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkExtensionsValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkExtensionsValidator.java new file mode 100644 index 000000000..21b247071 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkExtensionsValidator.java @@ -0,0 +1,66 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import java.util.List; + +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.saml.STORKExtensions; +import eu.stork.vidp.messages.stork.AuthenticationAttributes; +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; + +public class StorkExtensionsValidator implements Validator { + + + public StorkExtensionsValidator() { + + } + + public void validate(STORKExtensions ext) throws ValidationException { + + // check QAALevel + List qaaList = ext.getUnknownXMLObjects(QualityAuthenticationAssuranceLevel.DEFAULT_ELEMENT_NAME); + + if(qaaList == null || qaaList.size() != 1) { + + throw new ValidationException("QAALevel is required."); + } + + //check AuthenticationAttributes for VIDPs +// AuthenticationAttributes authenticationAttributes = ext.getAuthenticationAttributes(); +// +// if(authenticationAttributes == null) { +// +// throw new ValidationException("AuthenticationAttributes is required for sending requests to VIDPs."); +// } + + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkIssuerValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkIssuerValidator.java new file mode 100644 index 000000000..df32ee6ad --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkIssuerValidator.java @@ -0,0 +1,61 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.Issuer; +import org.opensaml.saml2.core.validator.IssuerSchemaValidator; +import org.opensaml.xml.validation.ValidationException; + +public class StorkIssuerValidator extends IssuerSchemaValidator { + + private static final String FORMAT_ALLOWED_VALUE = "urn:oasis:names:tc:SAML:2.0:nameid-format:entity"; + + /** + * Constructor + * + */ + public StorkIssuerValidator() { + + super(); + } + + @Override + public void validate(Issuer issuer) throws ValidationException { + + super.validate(issuer); + + // format is optional + if(issuer.getFormat() != null) { + + if(!issuer.getFormat().equals(FORMAT_ALLOWED_VALUE)) { + + throw new ValidationException("Format has an invalid value."); + } + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIDValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIDValidator.java new file mode 100644 index 000000000..85fbeff17 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIDValidator.java @@ -0,0 +1,67 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.NameID; +import org.opensaml.saml2.core.validator.NameIDSchemaValidator; +import org.opensaml.xml.validation.ValidationException; + +public class StorkNameIDValidator extends NameIDSchemaValidator { + + private static final String FORMAT_ALLOWED_VALUE = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"; + private static final String FORMAT_ALLOWED_VALUE_OLD = "urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified"; + + /** + * Constructor + * + */ + public StorkNameIDValidator() { + + super(); + } + + @Override + public void validate(NameID nameID) throws ValidationException { + + super.validate(nameID); + + if (nameID.getNameQualifier() == null) { + + throw new ValidationException("NameQualifier is required."); + } + + if (nameID.getFormat() == null) { + + throw new ValidationException("Format is required."); + + } else if(!(nameID.getFormat().equals(FORMAT_ALLOWED_VALUE) || nameID.getFormat().equals(FORMAT_ALLOWED_VALUE_OLD))) { + + throw new ValidationException("Format is invalid."); + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIdPolicyValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIdPolicyValidator.java new file mode 100644 index 000000000..7d98b5e60 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkNameIdPolicyValidator.java @@ -0,0 +1,52 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.NameIDPolicy; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +public class StorkNameIdPolicyValidator implements Validator { + + public StorkNameIdPolicyValidator() { + + } + + public void validate(NameIDPolicy nameIDPolicy) throws ValidationException { + + + if(nameIDPolicy.getAllowCreate() != null) { + + if(!nameIDPolicy.getAllowCreate()) { + + throw new ValidationException("AllowCreate is invalid."); + } + } + + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkQualityAuthenticationAssuranceLevelValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkQualityAuthenticationAssuranceLevelValidator.java new file mode 100644 index 000000000..5c23fe04b --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkQualityAuthenticationAssuranceLevelValidator.java @@ -0,0 +1,54 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; + +public class StorkQualityAuthenticationAssuranceLevelValidator implements + Validator { + + + private static final int MIN_VAL = 1; + private static final int MAX_VAL = 4; + + public StorkQualityAuthenticationAssuranceLevelValidator() { + + } + + public void validate(QualityAuthenticationAssuranceLevel qaaLevel) + throws ValidationException { + + if(qaaLevel.getValue() < MIN_VAL || qaaLevel.getValue() > MAX_VAL) { + + throw new ValidationException("QAALevel is invalid."); + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributeValidator.java new file mode 100644 index 000000000..b9b26a38a --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributeValidator.java @@ -0,0 +1,92 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import java.util.regex.Pattern; + +import org.opensaml.saml2.metadata.RequestedAttribute; +import org.opensaml.saml2.metadata.validator.RequestedAttributeSchemaValidator; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.schema.XSAny; +import org.opensaml.xml.schema.XSString; +import org.opensaml.xml.validation.ValidationException; + +import eu.stork.vidp.messages.common.STORKConstants; + +public class StorkRequestedAttributeValidator extends + RequestedAttributeSchemaValidator { + + private static final String PATTERN_ISAGEOVER = "^[0-9]{1,3}$"; + + public StorkRequestedAttributeValidator() { + + super(); + } + + @Override + public void validate(RequestedAttribute attr) throws ValidationException { + + super.validate(attr); + + if (attr.getName() == null) { + + throw new ValidationException("Name is required."); + } + + if (attr.getNameFormat() == null) { + + throw new ValidationException("NameFormat is required."); + } + + if (!STORKConstants.FULL_STORK_ATTRIBUTE_SET.contains(attr.getName()) && attr.isRequired()) { + throw new ValidationException("Unknown attribute " + attr.getName() + " requested mandatory."); + } + + if (attr.getName().equals(STORKConstants.STORK_ATTRIBUTE_ISAGEOVER)) { + if (attr.getAttributeValues().isEmpty()) { + throw new ValidationException("isAgeOver requires attribute value"); + } + + XMLObject attrValueObject = attr.getAttributeValues().get(0); + + if (attrValueObject instanceof XSString) { + if (!Pattern.matches(PATTERN_ISAGEOVER, ((XSString) attr.getAttributeValues().get(0)).getValue())) { + throw new ValidationException("Value for isAgeOver has incorrect format."); + } + } else if (attrValueObject instanceof XSAny) { + if (!Pattern.matches(PATTERN_ISAGEOVER, ((XSAny) attrValueObject).getTextContent())) { + throw new ValidationException("Value for isAgeOver has incorrect format."); + } + + } else { + throw new ValidationException("Value for isAgeOver has incorrect format."); + } + + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributesValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributesValidator.java new file mode 100644 index 000000000..0324079f3 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkRequestedAttributesValidator.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.RequestedAttributes; + +public class StorkRequestedAttributesValidator implements + Validator { + + public StorkRequestedAttributesValidator() { + + } + + public void validate(RequestedAttributes attrs) throws ValidationException { + + // empty so far + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkResponseValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkResponseValidator.java new file mode 100644 index 000000000..8028173fa --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkResponseValidator.java @@ -0,0 +1,137 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.common.SAMLVersion; +import org.opensaml.saml1.core.StatusCode; +import org.opensaml.saml2.core.Response; +import org.opensaml.saml2.core.validator.ResponseSchemaValidator; +import org.opensaml.xml.util.XMLHelper; +import org.opensaml.xml.validation.ValidationException; + +import eu.stork.mw.messages.saml.STORKResponse; + +public class StorkResponseValidator extends ResponseSchemaValidator { + + private static final String CONSENT_ALLOWED_VALUE_1 = "urn:oasis:names:tc:SAML:2.0:consent:obtained"; + private static final String CONSENT_ALLOWED_VALUE_2 = "urn:oasis:names:tc:SAML:2.0:consent:prior"; + private static final String CONSENT_ALLOWED_VALUE_3 = "urn:oasis:names:tc:SAML:2.0:consent:curent-implicit"; + private static final String CONSENT_ALLOWED_VALUE_4 = "urn:oasis:names:tc:SAML:2.0:consent:curent-explicit"; + private static final String CONSENT_ALLOWED_VALUE_5 = "urn:oasis:names:tc:SAML:2.0:consent:unspecified"; + + private static final int MAX_SIZE = 131072; + + /** + * Constructor + * + */ + public StorkResponseValidator() { + + super(); + } + + /** {@inheritDoc} */ + public void validate(Response response) throws ValidationException { + + if (XMLHelper.prettyPrintXML(response.getDOM()).getBytes().length > MAX_SIZE) { + throw new ValidationException("SAML Response exceeds max size."); + } + + super.validate(response); + + STORKResponse resp = (STORKResponse) response; + + if (resp.getID() == null) { + + throw new ValidationException("ID is required"); + } + + if (resp.getInResponseTo() == null) { + + throw new ValidationException("InResponseTo is required"); + } + + if (resp.getVersion() == null) { + + throw new ValidationException("Version is required."); + } else if(!resp.getVersion().equals(SAMLVersion.VERSION_20)) { + + throw new ValidationException("Version is invalid."); + } + + if (resp.getIssueInstant() == null) { + + throw new ValidationException("IssueInstant is required"); + } + + if (resp.getDestination() == null) { + + throw new ValidationException("Destination is required"); + } + + // Consent is optional + if (resp.getConsent() != null) { + + String consent = resp.getConsent(); + + if (!consent.equals(CONSENT_ALLOWED_VALUE_1) + && !consent.equals(CONSENT_ALLOWED_VALUE_2) + && !consent.equals(CONSENT_ALLOWED_VALUE_3) + && !consent.equals(CONSENT_ALLOWED_VALUE_4) + && !consent.equals(CONSENT_ALLOWED_VALUE_5)) { + + throw new ValidationException("Consent is invalid."); + } + } + + + if (resp.getIssuer() == null) { + + throw new ValidationException("Issuer is required."); + } + + if (resp.getStatus() == null) { + + throw new ValidationException("Status is required."); + } + + + if(resp.getSignature() == null) { + + throw new ValidationException("Signature is required."); + } + + + if (resp.getStatus().getStatusCode().getValue().equals(StatusCode.SUCCESS)) { + if (resp.getAssertions() == null || resp.getAssertions().size() == 0) { + + throw new ValidationException("Assertion is required"); + } + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPIDValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPIDValidator.java new file mode 100644 index 000000000..a42d7a453 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPIDValidator.java @@ -0,0 +1,64 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.SPID; + +public class StorkSPIDValidator implements Validator { + + public static final int MIN_SIZE = 1; + public static final int MAX_SIZE = 40; + + public StorkSPIDValidator() { + + } + + public void validate(SPID spid) throws ValidationException { + + + if(spid == null) { + + throw new ValidationException("SPID value is required."); + } + + if(spid != null) { + + if (spid.getValue() == null) { + throw new ValidationException("SPID has no value"); + } + + if (spid.getValue().length() <= MIN_SIZE || spid.getValue().length() > MAX_SIZE) { + throw new ValidationException("SPID has wrong size: " + spid.getValue().length()); + } + } + + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPInformationValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPInformationValidator.java new file mode 100644 index 000000000..9c54fd620 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSPInformationValidator.java @@ -0,0 +1,49 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.SPInformation; + +public class StorkSPInformationValidator implements Validator { + + public StorkSPInformationValidator() { + + } + + public void validate(SPInformation spi) throws ValidationException { + + if(spi.getSPID() == null) { + + throw new ValidationException("SPID is required."); + } + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpApplicationValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpApplicationValidator.java new file mode 100644 index 000000000..08551e03e --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpApplicationValidator.java @@ -0,0 +1,63 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.SpApplication; + +public class StorkSpApplicationValidator implements + Validator { + + public static final int MIN_SIZE = 1; + public static final int MAX_SIZE = 100; + //public static final String REGEX_PATTERN = "^[a-zA-Z0-9]{1,30}$"; + + public StorkSpApplicationValidator() { + + } + + public void validate(SpApplication spApplication) throws ValidationException { + + if(spApplication != null) { + + if (spApplication.getValue() == null) { + throw new ValidationException("spApplication has no value"); + } + +// if (!Pattern.matches(REGEX_PATTERN, spApplication.getValue())) { +// throw new ValidationException("spApplication has wrong format: " + spApplication.getValue()); +// } + + if (spApplication.getValue().length() < MIN_SIZE || spApplication.getValue().length() > MAX_SIZE) { + throw new ValidationException("spApplication has wrong size: " + spApplication.getValue().length()); + } + + } + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpCountryValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpCountryValidator.java new file mode 100644 index 000000000..e6ae0f1b7 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpCountryValidator.java @@ -0,0 +1,58 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import java.util.regex.Pattern; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.SpCountry; + +public class StorkSpCountryValidator implements + Validator { + + public static final String REGEX_PATTERN = "^[A-Z]{2}$"; + + public StorkSpCountryValidator() { + + } + + public void validate(SpCountry spCountry) throws ValidationException { + + if(spCountry != null) { + + if (spCountry.getValue() == null) { + throw new ValidationException("spCountry has no value"); + } + + if (!Pattern.matches(REGEX_PATTERN, spCountry.getValue())) { + throw new ValidationException("spCountry not valid: " + spCountry.getValue()); + } + } + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpInstitutionValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpInstitutionValidator.java new file mode 100644 index 000000000..9d50d9122 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpInstitutionValidator.java @@ -0,0 +1,62 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.SpInstitution; + +public class StorkSpInstitutionValidator implements + Validator { + + public static final int MIN_SIZE = 1; + public static final int MAX_SIZE = 50; + //public static final String REGEX_PATTERN = "^[a-zA-Z0-9]{1,50}$"; + + public StorkSpInstitutionValidator() { + + } + + public void validate(SpInstitution spInstitution) throws ValidationException { + + if(spInstitution != null) { + + if (spInstitution.getValue() == null) { + throw new ValidationException("spInstitution has no value"); + } + +// if (!Pattern.matches(REGEX_PATTERN, spApplication.getValue())) { +// throw new ValidationException("spApplication has wrong format: " + spApplication.getValue()); +// } + + if (spInstitution.getValue().length() < MIN_SIZE || spInstitution.getValue().length() > MAX_SIZE) { + throw new ValidationException("spInstitution has wrong size: " + spInstitution.getValue().length()); + } + } + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpSectorValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpSectorValidator.java new file mode 100644 index 000000000..2cfaa7a4c --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSpSectorValidator.java @@ -0,0 +1,65 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import java.util.regex.Pattern; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.SpSector; + +public class StorkSpSectorValidator implements + Validator { + + public static final int MIN_SIZE = 1; + public static final int MAX_SIZE = 20; + //public static final String REGEX_PATTERN = "^[a-zA-Z0-9]{1,30}$"; + + public StorkSpSectorValidator() { + + } + + public void validate(SpSector spSector) throws ValidationException { + + if(spSector != null) { + + if (spSector.getValue() == null) { + throw new ValidationException("spSector has no value"); + } + +// if (!Pattern.matches(REGEX_PATTERN, spSector.getValue())) { +// throw new ValidationException("spSector has wrong format: " + spSector.getValue()); +// } + + if (spSector.getValue().length() < MIN_SIZE || spSector.getValue().length() > MAX_SIZE) { + throw new ValidationException("spApplication has wrong size: " + spSector.getValue().length()); + } + + } + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusCodeValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusCodeValidator.java new file mode 100644 index 000000000..3ee214c46 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusCodeValidator.java @@ -0,0 +1,139 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.Status; +import org.opensaml.saml2.core.StatusCode; +import org.opensaml.saml2.core.validator.StatusCodeSchemaValidator; +import org.opensaml.xml.validation.ValidationException; + +public class StorkStatusCodeValidator extends StatusCodeSchemaValidator { + + // supported values according to SAML v2.0 specification + private static String[] ALLOWED_FIRST_LEVEL_STATUS_CODE_VALUES = new String[] { + "urn:oasis:names:tc:SAML:2.0:status:Success", + "urn:oasis:names:tc:SAML:2.0:status:Requester", + "urn:oasis:names:tc:SAML:2.0:status:Responder", + "urn:oasis:names:tc:SAML:2.0:status:VersionMismatch"}; + + private static String[] ALLOWED_SECOND_LEVEL_STATUS_CODE_VALUES = new String[] { + "urn:oasis:names:tc:SAML:2.0:status:AuthnFailed", + "urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue", + "urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy", + "urn:oasis:names:tc:SAML:2.0:status:NoAuthnContext", + "urn:oasis:names:tc:SAML:2.0:status:NoAvailableIDP", + "urn:oasis:names:tc:SAML:2.0:status:NoPassive", + "urn:oasis:names:tc:SAML:2.0:status:NoSupportedIDP", + "urn:oasis:names:tc:SAML:2.0:status:PartialLogout", + "urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded", + "urn:oasis:names:tc:SAML:2.0:status:RequestDenied", + "urn:oasis:names:tc:SAML:2.0:status:RequestUnsupported", + "urn:oasis:names:tc:SAML:2.0:status:RequestVersionDeprecated", + "urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooHigh", + "urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooLow", + "urn:oasis:names:tc:SAML:2.0:status:ResourceNotRecognized", + "urn:oasis:names:tc:SAML:2.0:status:TooManyResponses", + "urn:oasis:names:tc:SAML:2.0:status:UnknownAttrProfile", + "urn:oasis:names:tc:SAML:2.0:status:UnknownPrincipal", + "urn:oasis:names:tc:SAML:2.0:status:UnsupportedBinding", + "http://www.stork.gov.eu/saml20/statusCodes/QAANotSupported" + }; + + /** + * Constructor + * + */ + public StorkStatusCodeValidator() { + + super(); + } + + @Override + public void validate(StatusCode statusCode) throws ValidationException { + + super.validate(statusCode); + + + if(statusCode.getValue() == null) { + + throw new ValidationException("StatusCode is required"); + } + + boolean valid = false; + + if (statusCode.getParent() instanceof Status) { + //first level Status Codes + + String value = statusCode.getValue(); + + + + + for(String allowedVal : ALLOWED_FIRST_LEVEL_STATUS_CODE_VALUES) { + + if(value.equals(allowedVal)) { + + valid = true; + break; + } + } + + if(!valid) { + + throw new ValidationException("First Level StatusCode has an invalid value."); + } + } else { + //parent is status code + //second level Status Codes + + if(statusCode != null) { + + valid = false; + + String subVal = statusCode.getValue(); + + for(String allowedVal : ALLOWED_SECOND_LEVEL_STATUS_CODE_VALUES) { + + if(subVal.equals(allowedVal)) { + + valid = true; + break; + } + } + + if(!valid) { + + throw new ValidationException("Second Level StatusCode has an invalid value."); + } + + } + + } + } + + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusValidator.java new file mode 100644 index 000000000..36d7ffab5 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkStatusValidator.java @@ -0,0 +1,55 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.Status; +import org.opensaml.saml2.core.validator.StatusSchemaValidator; +import org.opensaml.xml.validation.ValidationException; + +public class StorkStatusValidator extends StatusSchemaValidator { + + /** + * Constructor + * + */ + public StorkStatusValidator() { + + super(); + } + + @Override + public void validate(Status status) throws ValidationException { + + super.validate(status); + + if(status.getStatusCode() == null) { + + throw new ValidationException("StatusCode is required."); + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectConfirmationValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectConfirmationValidator.java new file mode 100644 index 000000000..0f1fad295 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectConfirmationValidator.java @@ -0,0 +1,128 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.opensaml.saml2.core.SubjectConfirmation; +import org.opensaml.saml2.core.SubjectConfirmationData; +import org.opensaml.saml2.core.validator.SubjectConfirmationSchemaValidator; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.signature.X509Data; +import org.opensaml.xml.validation.ValidationException; + +public class StorkSubjectConfirmationValidator extends + SubjectConfirmationSchemaValidator { + + private static final String ALLOWED_METHOD_1 = "urn:oasis:names:tc:SAML:2.0:cm:bearer"; + private static final String ALLOWED_METHOD_2 = "oasis:names:tc:SAML:2.0:cm:holder-of-key"; + + /** + * Constructor + * + */ + public StorkSubjectConfirmationValidator() { + + super(); + } + + @Override + public void validate(SubjectConfirmation subjectConfirmation) + throws ValidationException { + + super.validate(subjectConfirmation); + + String method = subjectConfirmation.getMethod(); + + if (!(method.equals(ALLOWED_METHOD_1) || method.equals(ALLOWED_METHOD_2))) { + throw new ValidationException("Method is invalid."); + } + + if (subjectConfirmation.getSubjectConfirmationData() == null) { + throw new ValidationException("SubjectConfirmationData required."); + + } + + SubjectConfirmationData confData = subjectConfirmation.getSubjectConfirmationData(); + + + if (method.equals(ALLOWED_METHOD_1)) { + if (confData.getNotBefore() != null) { + throw new ValidationException("NotBefore in SubjectConfirmationData not allowed if confirmation method is \"bearer\"."); + } + + } + + if (confData.getNotOnOrAfter() == null) { + + throw new ValidationException("NotOnOrAfter is required."); + } + + if (confData.getRecipient() == null) { + + throw new ValidationException("Recipient is required."); + } + + if (confData.getInResponseTo() == null) { + + throw new ValidationException("InResponseTo is required."); + } + + if(method.equals(ALLOWED_METHOD_2)) { + + List childrenKeyInfo = confData.getUnknownXMLObjects(new QName("KeyInfo")); + + if(childrenKeyInfo.size() < 1) { + + throw new ValidationException("KeyInfo is required."); + } + + List childrenKeyData = confData.getUnknownXMLObjects(new QName("X509Data")); + + if(childrenKeyData.size() != 1) { + + throw new ValidationException("Invalid number of X509Data elements."); + } else { + + X509Data data = (X509Data)childrenKeyData.get(0); + + if(data.getX509Certificates() == null || data.getX509Certificates().size() < 1 ) { + + throw new ValidationException("X509Certificate is required."); + } + + } + + } + + + + } + + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectLocalityValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectLocalityValidator.java new file mode 100644 index 000000000..33c7b4478 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectLocalityValidator.java @@ -0,0 +1,47 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.SubjectLocality; +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +public class StorkSubjectLocalityValidator implements + Validator { + + public StorkSubjectLocalityValidator() { + + } + + public void validate(SubjectLocality sloc) throws ValidationException { + + if (sloc.getAddress() == null) { + + throw new ValidationException("Address is required."); + } + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectValidator.java new file mode 100644 index 000000000..077b6294a --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkSubjectValidator.java @@ -0,0 +1,60 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.saml2.core.Subject; +import org.opensaml.saml2.core.validator.SubjectSchemaValidator; +import org.opensaml.xml.validation.ValidationException; + +public class StorkSubjectValidator extends SubjectSchemaValidator { + + /** + * Constructor + * + */ + public StorkSubjectValidator() { + + super(); + } + + @Override + public void validate(Subject subject) throws ValidationException { + + super.validate(subject); + + if(subject.getNameID() == null && subject.getEncryptedID() == null) { + + throw new ValidationException("Neither NameID nor EncryptedID is provided."); + } + + if(subject.getSubjectConfirmations() == null || subject.getSubjectConfirmations().size() < 1) { + + throw new ValidationException("SubjectConfirmation is required."); + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkVIDPAuthenticationAttributesValidator.java b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkVIDPAuthenticationAttributesValidator.java new file mode 100644 index 000000000..88ff7bed4 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/java/eu/stork/vidp/messages/validation/StorkVIDPAuthenticationAttributesValidator.java @@ -0,0 +1,57 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * The Austrian STORK Modules have been developed by the E-Government + * Innovation Center EGIZ, a joint initiative of the Federal Chancellery + * Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package eu.stork.vidp.messages.validation; + +import org.opensaml.xml.validation.ValidationException; +import org.opensaml.xml.validation.Validator; + +import eu.stork.vidp.messages.stork.VIDPAuthenticationAttributes; + +public class StorkVIDPAuthenticationAttributesValidator implements + Validator { + + public StorkVIDPAuthenticationAttributesValidator() { + + } + + public void validate(VIDPAuthenticationAttributes attr) + throws ValidationException { + + + if(attr.getCitizenCountryCode() == null) { + + throw new ValidationException("CitizenCountryCode is required."); + } + + + if(attr.getSPInformation() == null) { + + throw new ValidationException("SPInformation is required."); + } + + } + +} diff --git a/id/server/stork-saml-engine/src/main/resources/saml2-post-binding-moa.vm b/id/server/stork-saml-engine/src/main/resources/saml2-post-binding-moa.vm new file mode 100644 index 000000000..cac0bda76 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/resources/saml2-post-binding-moa.vm @@ -0,0 +1,38 @@ +## +## Velocity Template for SAML 2 HTTP-POST binding +## +## Velocity context may contain the following properties +## action - String - the action URL for the form +## RelayState - String - the relay state for the message +## SAMLRequest - String - the Base64 encoded SAML Request +## SAMLResponse - String - the Base64 encoded SAML Response +## Contains target attribute to delegate PEPS authentication out of iFrame + + + + + + +
+
+ #if($RelayState)#end + + #if($SAMLRequest)#end + + #if($SAMLResponse)#end + +
+ +
+ + + \ No newline at end of file diff --git a/id/server/stork-saml-engine/src/main/resources/saml2-stork-config.xml b/id/server/stork-saml-engine/src/main/resources/saml2-stork-config.xml new file mode 100644 index 000000000..988480f55 --- /dev/null +++ b/id/server/stork-saml-engine/src/main/resources/saml2-stork-config.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3