01: /*
02: * The contents of this file are subject to the terms
03: * of the Common Development and Distribution License
04: * (the License). You may not use this file except in
05: * compliance with the License.
06: *
07: * You can obtain a copy of the license at
08: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
09: * See the License for the specific language governing
10: * permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL
13: * Header Notice in each file and include the License file
14: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
15: * If applicable, add the following below the CDDL Header,
16: * with the fields enclosed by brackets [] replaced by
17: * you own identifying information:
18: * "Portions Copyrighted [year] [name of copyright owner]"
19: *
20: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
21: */
22:
23: package com.sun.xml.wss.saml.util;
24:
25: import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
26: import com.sun.xml.wss.impl.MessageConstants;
27:
28: /**
29: *
30: * @author K.Venugopal@sun.com
31: */
32: public class WSSNamespacePrefixMapper extends NamespacePrefixMapper {
33:
34: /** Creates a new instance of NamespacePrefixMapper */
35: public WSSNamespacePrefixMapper() {
36: }
37:
38: public String getPreferredPrefix(String namespaceUri,
39: String suggestion, boolean requirePrefix) {
40: if (MessageConstants.WSSE_NS.equals(namespaceUri)) {
41: return MessageConstants.WSSE_PREFIX;
42: }
43:
44: if (MessageConstants.WSSE11_NS.equals(namespaceUri)) {
45: return MessageConstants.WSSE11_PREFIX;
46: }
47: if (MessageConstants.XENC_NS.equals(namespaceUri)) {
48: return MessageConstants.XENC_PREFIX;
49: }
50: if (MessageConstants.DSIG_NS.equals(namespaceUri)) {
51: return MessageConstants.DSIG_PREFIX;
52: }
53: if (MessageConstants.WSU_NS.equals(namespaceUri)) {
54: return MessageConstants.WSU_PREFIX;
55: }
56: if (MessageConstants.WSSC_NS.equals(namespaceUri)) {
57: return MessageConstants.WSSC_PREFIX;
58: }
59: if (MessageConstants.SAML_v1_1_NS.equals(namespaceUri)) {
60: return MessageConstants.SAML_PREFIX;
61: }
62: if (MessageConstants.SAML_v2_0_NS.equals(namespaceUri)) {
63: return MessageConstants.SAML2_PREFIX;
64: }
65: if ("http://www.w3.org/2001/10/xml-exc-c14n#"
66: .equals(namespaceUri)) {
67: return "exc14n";
68: }
69:
70: return null;
71: }
72:
73: public String[] getPreDeclaredNamespaceUris() {
74: return new String[] {};
75: }
76:
77: }
|