aboutsummaryrefslogtreecommitdiff
path: root/id/server/legacy-backup/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/legacy-backup/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java')
-rw-r--r--id/server/legacy-backup/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/id/server/legacy-backup/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java b/id/server/legacy-backup/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java
new file mode 100644
index 000000000..7f2013ca8
--- /dev/null
+++ b/id/server/legacy-backup/stork2-saml-engine/src/main/java/eu/stork/peps/auth/engine/core/impl/CustomAttributeQueryMarshaller.java
@@ -0,0 +1,50 @@
+package eu.stork.peps.auth.engine.core.impl;
+
+import org.opensaml.Configuration;
+import org.opensaml.saml2.core.RequestAbstractType;
+import org.opensaml.saml2.core.impl.SubjectQueryMarshaller;
+import org.opensaml.xml.XMLObject;
+import org.opensaml.xml.io.MarshallingException;
+import org.w3c.dom.Element;
+
+import eu.stork.peps.auth.engine.core.CustomRequestAbstractType;
+
+public class CustomAttributeQueryMarshaller extends SubjectQueryMarshaller {
+
+ /** {@inheritDoc} */
+ protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
+ CustomRequestAbstractType req = (CustomRequestAbstractType) samlObject;
+
+ if (req.getVersion() != null) {
+ domElement.setAttributeNS(null, RequestAbstractType.VERSION_ATTRIB_NAME, req.getVersion().toString());
+ }
+
+ if (req.getID() != null) {
+ domElement.setAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, req.getID());
+ domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true);
+ }
+
+ if (req.getVersion() != null) {
+ domElement.setAttributeNS(null, RequestAbstractType.VERSION_ATTRIB_NAME, req.getVersion().toString());
+ }
+
+ if (req.getIssueInstant() != null) {
+ String iiStr = Configuration.getSAMLDateFormatter().print(req.getIssueInstant());
+ domElement.setAttributeNS(null, RequestAbstractType.ISSUE_INSTANT_ATTRIB_NAME, iiStr);
+ }
+
+ if (req.getDestination() != null) {
+ domElement.setAttributeNS(null, RequestAbstractType.DESTINATION_ATTRIB_NAME, req.getDestination());
+ }
+
+ if (req.getAssertionConsumerServiceURL() != null) {
+ domElement.setAttributeNS(null, CustomRequestAbstractType.ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME, req.getAssertionConsumerServiceURL());
+ }
+
+ if (req.getConsent() != null) {
+ domElement.setAttributeNS(null, RequestAbstractType.CONSENT_ATTRIB_NAME, req.getConsent());
+ }
+ }
+
+
+}