001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package com.sun.xml.ws.policy.jaxws.impl;
038:
039: import com.sun.xml.ws.policy.PolicyAssertion;
040: import com.sun.xml.ws.policy.spi.PolicyAssertionValidator;
041: import com.sun.xml.ws.policy.spi.PolicyAssertionValidator.Fitness;
042: import java.util.ArrayList;
043: import javax.xml.namespace.QName;
044:
045: import com.sun.xml.ws.security.impl.policy.Constants;
046:
047: /**
048: * Implements SPI for selecting wsit related SUN's proprietary assertions.
049: *
050: * @author japod
051: */
052: public class SunProprietaryPolicySelector implements
053: PolicyAssertionValidator {
054:
055: private static final ArrayList<QName> supportedAssertions = new ArrayList<QName>();
056:
057: static {
058:
059: supportedAssertions.add(new QName(
060: Constants.SUN_WSS_SECURITY_SERVER_POLICY_NS,
061: "CertStore"));
062: supportedAssertions.add(new QName(
063: Constants.SUN_WSS_SECURITY_SERVER_POLICY_NS,
064: "CallbackHandlerConfiguration"));
065: supportedAssertions.add(new QName(
066: Constants.SUN_WSS_SECURITY_SERVER_POLICY_NS,
067: "CallbackHandler"));
068: supportedAssertions.add(new QName(
069: Constants.SUN_WSS_SECURITY_SERVER_POLICY_NS,
070: "ValidatorConfiguration"));
071: supportedAssertions.add(new QName(
072: Constants.SUN_WSS_SECURITY_SERVER_POLICY_NS,
073: "Validator"));
074: supportedAssertions.add(new QName(
075: Constants.SUN_WSS_SECURITY_SERVER_POLICY_NS,
076: "Timestamp"));
077: supportedAssertions.add(new QName(
078: Constants.SUN_WSS_SECURITY_CLIENT_POLICY_NS,
079: "CertStore"));
080: supportedAssertions.add(new QName(
081: Constants.SUN_WSS_SECURITY_CLIENT_POLICY_NS,
082: "CallbackHandlerConfiguration"));
083: supportedAssertions.add(new QName(
084: Constants.SUN_WSS_SECURITY_CLIENT_POLICY_NS,
085: "CallbackHandler"));
086: supportedAssertions.add(new QName(
087: Constants.SUN_WSS_SECURITY_CLIENT_POLICY_NS,
088: "ValidatorConfiguration"));
089: supportedAssertions.add(new QName(
090: Constants.SUN_WSS_SECURITY_CLIENT_POLICY_NS,
091: "Validator"));
092: supportedAssertions.add(new QName(
093: Constants.SUN_WSS_SECURITY_CLIENT_POLICY_NS,
094: "Timestamp"));
095: supportedAssertions.add(new QName(
096: Constants.SUN_SECURE_SERVER_CONVERSATION_POLICY_NS,
097: "SCConfiguration"));
098: supportedAssertions.add(new QName(
099: Constants.SUN_SECURE_SERVER_CONVERSATION_POLICY_NS,
100: "Lifetime"));
101: supportedAssertions.add(new QName(
102: Constants.SUN_SECURE_CLIENT_CONVERSATION_POLICY_NS,
103: "LifeTime"));
104: supportedAssertions.add(new QName(
105: Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS,
106: "Contract"));
107: supportedAssertions.add(new QName(
108: Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS,
109: "ServiceProviders"));
110: supportedAssertions.add(new QName(
111: Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS,
112: "ServiceProvider"));
113: supportedAssertions.add(new QName(
114: Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS,
115: "CertAlias"));
116: supportedAssertions.add(new QName(
117: Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS,
118: "TokenType"));
119: supportedAssertions.add(new QName(
120: Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS,
121: "KeyType"));
122: supportedAssertions
123: .add(new QName(
124: Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS,
125: "Issuer"));
126: supportedAssertions.add(new QName(
127: Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS,
128: "LifeTime"));
129: }
130:
131: /** Creates a new instance of SunProprietaryPolicySelector */
132: public SunProprietaryPolicySelector() {
133: // nothing to initialize
134: }
135:
136: public PolicyAssertionValidator.Fitness validateClientSide(
137: final PolicyAssertion assertion) {
138: return supportedAssertions.contains(assertion.getName()) ? Fitness.SUPPORTED
139: : Fitness.UNKNOWN;
140: }
141:
142: public PolicyAssertionValidator.Fitness validateServerSide(
143: final PolicyAssertion assertion) {
144: return Fitness.UNKNOWN;
145: }
146:
147: public String[] declareSupportedDomains() {
148: return new String[] {};
149: }
150:
151: }
|