[Dive4elements-commits] [PATCH 17 of 21] Add TicketValidator.checkTicket(InputStream) method

Wald Commits scm-commit at wald.intevation.org
Wed May 8 18:08:27 CEST 2013


# HG changeset patch
# User Bernhard Herzog <bh at intevation.de>
# Date 1368028574 -7200
# Node ID 0a0b4bfdf3721d036487989c008440a924171abf
# Parent  d7b9b3e3c61a8798b3ba21bbd6558a3880af50d0
Add TicketValidator.checkTicket(InputStream) method.

diff -r d7b9b3e3c61a -r 0a0b4bfdf372 gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/TicketValidator.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/TicketValidator.java	Wed May 08 17:56:14 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/TicketValidator.java	Wed May 08 17:56:14 2013 +0200
@@ -10,6 +10,7 @@
 
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.security.Key;
 import java.util.Iterator;
 import java.util.Date;
@@ -28,6 +29,9 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import org.dive4elements.artifacts.httpclient.utils.XMLUtils;
+
+
 /**
  * Validator for SAML tickets.
  */
@@ -114,6 +118,16 @@
     }
 
     /**
+     * Check the ticket read from an InputStream containing a SAML
+     * document.
+     * @param xml InputStream with the SAML ticket as XML
+     * @return The assertion element from the signed data.
+     */
+    public Assertion checkTicket(InputStream in) throws Exception {
+        return checkTicket(XMLUtils.readDocument(in).getDocumentElement());
+    }
+
+    /**
      * Mark the AssertionID attribute of SAML Assertion elements as ID
      * attribute, so that the signature checker can resolve the
      * references properly and find the signed data.


More information about the Dive4elements-commits mailing list