changeset 5949:0a0b4bfdf372

Add TicketValidator.checkTicket(InputStream) method.
author Bernhard Herzog <bh@intevation.de>
date Wed, 08 May 2013 17:56:14 +0200
parents d7b9b3e3c61a
children 38d161edba77
files gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/TicketValidator.java
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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.

http://dive4elements.wald.intevation.org