teichmann@5957: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde bh@5938: * Software engineering by Intevation GmbH bh@5938: * bh@5938: * This file is Free Software under the GNU AGPL (>=v3) bh@5938: * and comes with ABSOLUTELY NO WARRANTY! Check out the bh@5938: * documentation coming with Dive4Elements River for details. bh@5938: */ bh@5938: bh@5938: package org.dive4elements.river.client.server.auth.saml; bh@5938: bh@5938: import java.util.Iterator; bh@5938: bh@5938: import javax.xml.XMLConstants; bh@5938: import javax.xml.namespace.NamespaceContext; bh@5938: bh@5938: bh@5938: /** bh@5938: * The namespace context for SAML documents. bh@5938: */ bh@5938: public class SamlNamespaceContext implements NamespaceContext bh@5938: { bh@5938: /** bh@5938: * The URI of the namespace of SAML assertions. bh@5938: */ bh@5938: public static final String SAML_NS_ASSERT = bh@5938: "urn:oasis:names:tc:SAML:1.0:assertion"; bh@5938: bh@5938: /** bh@5938: * The URI of the namespace of the SAML protocol. bh@5938: */ bh@5938: public static final String SAML_NS_PROTO = bh@5938: "urn:oasis:names:tc:SAML:1.0:protocol"; bh@5938: bh@5938: /** bh@5938: * The URI of the namespace for XML signatures. bh@5938: */ bh@5938: public static final String XML_SIG_NS = bh@5938: "http://www.w3.org/2000/09/xmldsig#"; bh@5938: bh@5938: /** bh@5938: * Final instance to be easily used to avoid creation bh@5938: * of instances. bh@5938: */ bh@5938: public static final SamlNamespaceContext INSTANCE = bh@5938: new SamlNamespaceContext(); bh@5938: bh@5938: bh@5938: /** bh@5938: * The default constructor. bh@5938: */ bh@5938: public SamlNamespaceContext() { bh@5938: } bh@5938: bh@5938: bh@5938: /** bh@5938: * @see javax.xml.namespace.NamespaceContext#getNamespaceURI(String) bh@5938: * @param prefix The prefix bh@5938: * @return The corresponing URI bh@5938: */ bh@5938: public String getNamespaceURI(String prefix) { bh@5938: bh@5938: if (prefix == null) { bh@5938: throw new NullPointerException("Null prefix"); bh@5938: } bh@5938: bh@5938: if ("saml".equals(prefix)) { bh@5938: return SAML_NS_ASSERT; bh@5938: } bh@5938: bh@5938: if ("samlp".equals(prefix)) { bh@5938: return SAML_NS_PROTO; bh@5938: } bh@5938: bh@5938: if ("ds".equals(prefix)) { bh@5938: return XML_SIG_NS; bh@5938: } bh@5938: bh@5938: if ("xml".equals(prefix)) { bh@5938: return XMLConstants.XML_NS_URI; bh@5938: } bh@5938: bh@5938: return XMLConstants.NULL_NS_URI; bh@5938: } bh@5938: bh@5938: bh@5938: /** bh@5938: * @see javax.xml.namespace.NamespaceContext#getPrefix(String) bh@5938: * @param uri The URI bh@5938: * @return nothing. bh@5938: * @throws java.lang.UnsupportedOperationException bh@5938: */ bh@5938: public String getPrefix(String uri) { bh@5938: throw new UnsupportedOperationException(); bh@5938: } bh@5938: bh@5938: bh@5938: /** bh@5938: * @see javax.xml.namespace.NamespaceContext#getPrefixes(java.lang.String) bh@5938: * @param uri The URI bh@5938: * @return nothing bh@5938: * @throws java.lang.UnsupportedOperationException bh@5938: */ bh@5938: public Iterator getPrefixes(String uri) { bh@5938: throw new UnsupportedOperationException(); bh@5938: } bh@5938: }