comparison gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/TicketValidator.java @ 5949:0a0b4bfdf372

Add TicketValidator.checkTicket(InputStream) method.
author Bernhard Herzog <bh@intevation.de>
date Wed, 08 May 2013 17:56:14 +0200
parents c1806821860b
children 7b0db743f074
comparison
equal deleted inserted replaced
5948:d7b9b3e3c61a 5949:0a0b4bfdf372
8 8
9 package org.dive4elements.river.client.server.auth.saml; 9 package org.dive4elements.river.client.server.auth.saml;
10 10
11 import java.io.FileInputStream; 11 import java.io.FileInputStream;
12 import java.io.IOException; 12 import java.io.IOException;
13 import java.io.InputStream;
13 import java.security.Key; 14 import java.security.Key;
14 import java.util.Iterator; 15 import java.util.Iterator;
15 import java.util.Date; 16 import java.util.Date;
16 import javax.security.cert.X509Certificate; 17 import javax.security.cert.X509Certificate;
17 import javax.security.cert.CertificateException; 18 import javax.security.cert.CertificateException;
25 import org.apache.log4j.Logger; 26 import org.apache.log4j.Logger;
26 27
27 import org.w3c.dom.Element; 28 import org.w3c.dom.Element;
28 import org.w3c.dom.Node; 29 import org.w3c.dom.Node;
29 import org.w3c.dom.NodeList; 30 import org.w3c.dom.NodeList;
31
32 import org.dive4elements.artifacts.httpclient.utils.XMLUtils;
33
30 34
31 /** 35 /**
32 * Validator for SAML tickets. 36 * Validator for SAML tickets.
33 */ 37 */
34 public class TicketValidator { 38 public class TicketValidator {
112 116
113 return assertion; 117 return assertion;
114 } 118 }
115 119
116 /** 120 /**
121 * Check the ticket read from an InputStream containing a SAML
122 * document.
123 * @param xml InputStream with the SAML ticket as XML
124 * @return The assertion element from the signed data.
125 */
126 public Assertion checkTicket(InputStream in) throws Exception {
127 return checkTicket(XMLUtils.readDocument(in).getDocumentElement());
128 }
129
130 /**
117 * Mark the AssertionID attribute of SAML Assertion elements as ID 131 * Mark the AssertionID attribute of SAML Assertion elements as ID
118 * attribute, so that the signature checker can resolve the 132 * attribute, so that the signature checker can resolve the
119 * references properly and find the signed data. 133 * references properly and find the signed data.
120 */ 134 */
121 private void markAssertionIdAttributes(Element root) { 135 private void markAssertionIdAttributes(Element root) {

http://dive4elements.wald.intevation.org