001: /*
002: * $Id: WSSPolicyGenerator.java,v 1.3 2006/09/29 12:05:01 kumarjayanti Exp $
003: */
004:
005: /*
006: * The contents of this file are subject to the terms
007: * of the Common Development and Distribution License
008: * (the License). You may not use this file except in
009: * compliance with the License.
010: *
011: * You can obtain a copy of the license at
012: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
013: * See the License for the specific language governing
014: * permissions and limitations under the License.
015: *
016: * When distributing Covered Code, include this CDDL
017: * Header Notice in each file and include the License file
018: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
019: * If applicable, add the following below the CDDL Header,
020: * with the fields enclosed by brackets [] replaced by
021: * you own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
025: */
026:
027: package com.sun.xml.wss.impl.policy.mls;
028:
029: //import com.sun.xml.wss.impl.policy.SSLPolicy;
030: import com.sun.xml.wss.impl.policy.MLSPolicy;
031: import com.sun.xml.wss.impl.policy.SecurityPolicy;
032: import com.sun.xml.wss.impl.policy.SecurityPolicyGenerator;
033: import com.sun.xml.wss.impl.policy.PolicyGenerationException;
034:
035: /**
036: * This class is a Factory for generating the various Security Policy primitives
037: * that are understood and processed by XWS-Security.
038: * A <code>DynamicSecurityPolicy</code> can obtain an instance of this class to
039: * create instances of SecurityPolicies at runtime.
040: */
041: public class WSSPolicyGenerator implements SecurityPolicyGenerator {
042:
043: MessagePolicy configuration = new MessagePolicy();
044:
045: /**
046: * Default constructor
047: */
048: public WSSPolicyGenerator() {
049: }
050:
051: /**
052: * return a new concrete MLSPolicy instance
053: * @return MLSPolicy
054: * @exception PolicyGenerationException
055: */
056: public MLSPolicy newMLSPolicy() throws PolicyGenerationException {
057: throw new PolicyGenerationException("Unsupported Operation");
058: }
059:
060: /**
061: * return a new TimestampPolicy instance
062: * @return TimestampPolicy
063: * @exception PolicyGenerationException
064: */
065: public TimestampPolicy newTimestampPolicy()
066: throws PolicyGenerationException {
067: TimestampPolicy policy = new TimestampPolicy();
068:
069: configuration.append(policy);
070:
071: return policy;
072: }
073:
074: /**
075: * return a new SignaturePolicy instance
076: * @return SignaturePolicy
077: * @exception PolicyGenerationException
078: */
079: public SignaturePolicy newSignaturePolicy()
080: throws PolicyGenerationException {
081: SignaturePolicy policy = new SignaturePolicy();
082:
083: configuration.append(policy);
084:
085: return policy;
086: }
087:
088: /**
089: * return a new EncryptionPolicy instance
090: * @return EncryptionPolicy
091: * @exception PolicyGenerationException
092: */
093: public EncryptionPolicy newEncryptionPolicy()
094: throws PolicyGenerationException {
095: EncryptionPolicy policy = new EncryptionPolicy();
096:
097: configuration.append(policy);
098:
099: return policy;
100: }
101:
102: /**
103: * return a new AuthenticationTokenPolicy instance
104: * @return AuthenticationTokenPolicy
105: * @exception PolicyGenerationException
106: */
107: public AuthenticationTokenPolicy newAuthenticationTokenPolicy()
108: throws PolicyGenerationException {
109: AuthenticationTokenPolicy policy = new AuthenticationTokenPolicy();
110:
111: configuration.append(policy);
112:
113: return policy;
114: }
115:
116: /**
117: * return a SecurityPolicy that represents a configuration
118: * @return SecurityPolicy
119: * @exception PolicyGenerationException
120: */
121: public SecurityPolicy configuration()
122: throws PolicyGenerationException {
123: return configuration;
124: }
125: }
|