Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/SamlNamespaceContext.java @ 5938:231a834d4e28
Add NamespaceContext for SAML handling.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Wed, 08 May 2013 17:56:13 +0200 |
parents | |
children | 7b0db743f074 |
comparison
equal
deleted
inserted
replaced
5937:302b3497677c | 5938:231a834d4e28 |
---|---|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9 package org.dive4elements.river.client.server.auth.saml; | |
10 | |
11 import java.util.Iterator; | |
12 | |
13 import javax.xml.XMLConstants; | |
14 import javax.xml.namespace.NamespaceContext; | |
15 | |
16 | |
17 /** | |
18 * The namespace context for SAML documents. | |
19 */ | |
20 public class SamlNamespaceContext implements NamespaceContext | |
21 { | |
22 /** | |
23 * The URI of the namespace of SAML assertions. | |
24 */ | |
25 public static final String SAML_NS_ASSERT = | |
26 "urn:oasis:names:tc:SAML:1.0:assertion"; | |
27 | |
28 /** | |
29 * The URI of the namespace of the SAML protocol. | |
30 */ | |
31 public static final String SAML_NS_PROTO = | |
32 "urn:oasis:names:tc:SAML:1.0:protocol"; | |
33 | |
34 /** | |
35 * The URI of the namespace for XML signatures. | |
36 */ | |
37 public static final String XML_SIG_NS = | |
38 "http://www.w3.org/2000/09/xmldsig#"; | |
39 | |
40 /** | |
41 * Final instance to be easily used to avoid creation | |
42 * of instances. | |
43 */ | |
44 public static final SamlNamespaceContext INSTANCE = | |
45 new SamlNamespaceContext(); | |
46 | |
47 | |
48 /** | |
49 * The default constructor. | |
50 */ | |
51 public SamlNamespaceContext() { | |
52 } | |
53 | |
54 | |
55 /** | |
56 * @see javax.xml.namespace.NamespaceContext#getNamespaceURI(String) | |
57 * @param prefix The prefix | |
58 * @return The corresponing URI | |
59 */ | |
60 public String getNamespaceURI(String prefix) { | |
61 | |
62 if (prefix == null) { | |
63 throw new NullPointerException("Null prefix"); | |
64 } | |
65 | |
66 if ("saml".equals(prefix)) { | |
67 return SAML_NS_ASSERT; | |
68 } | |
69 | |
70 if ("samlp".equals(prefix)) { | |
71 return SAML_NS_PROTO; | |
72 } | |
73 | |
74 if ("ds".equals(prefix)) { | |
75 return XML_SIG_NS; | |
76 } | |
77 | |
78 if ("xml".equals(prefix)) { | |
79 return XMLConstants.XML_NS_URI; | |
80 } | |
81 | |
82 return XMLConstants.NULL_NS_URI; | |
83 } | |
84 | |
85 | |
86 /** | |
87 * @see javax.xml.namespace.NamespaceContext#getPrefix(String) | |
88 * @param uri The URI | |
89 * @return nothing. | |
90 * @throws java.lang.UnsupportedOperationException | |
91 */ | |
92 public String getPrefix(String uri) { | |
93 throw new UnsupportedOperationException(); | |
94 } | |
95 | |
96 | |
97 /** | |
98 * @see javax.xml.namespace.NamespaceContext#getPrefixes(java.lang.String) | |
99 * @param uri The URI | |
100 * @return nothing | |
101 * @throws java.lang.UnsupportedOperationException | |
102 */ | |
103 public Iterator getPrefixes(String uri) { | |
104 throw new UnsupportedOperationException(); | |
105 } | |
106 } |