001: /*
002: * $Id: DeclarativeSecurityConfiguration.java,v 1.5 2007/08/24 09:12:51 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.config;
028:
029: import com.sun.xml.wss.impl.policy.SecurityPolicy;
030: import com.sun.xml.wss.impl.PolicyTypeUtil;
031: import com.sun.xml.wss.impl.configuration.*;
032: import com.sun.xml.wss.impl.policy.mls.MessagePolicy;
033:
034: /**
035: * Represents an XWS-Security configuration object, corresponding to the
036: * <code>xwss:SecurityConfiguration</code> element (as defined in XWS-Security,
037: * configuration schema, xwssconfig.xsd).
038: */
039:
040: public class DeclarativeSecurityConfiguration implements SecurityPolicy {
041:
042: private MessagePolicy senderSettings = new MessagePolicy();
043: private MessagePolicy receiverSettings = new MessagePolicy();
044:
045: private boolean retainSecHeader = false;
046:
047: /*
048: *@param doDumpMessages set it to true to enable dumping of messages
049: */
050: public void setDumpMessages(boolean doDumpMessages) {
051: senderSettings.dumpMessages(doDumpMessages);
052: receiverSettings.dumpMessages(doDumpMessages);
053: }
054:
055: /*
056: *@param flag set it to true to enable DynamicPolicyCallbacks for sender side Policies
057: */
058: public void enableDynamicPolicy(boolean flag) {
059: senderSettings.enableDynamicPolicy(flag);
060: receiverSettings.enableDynamicPolicy(flag);
061: }
062:
063: /**
064: *@return the <code>MessagePolicy</code> applicable for outgoing requests.
065: */
066: public MessagePolicy senderSettings() {
067: return senderSettings;
068: }
069:
070: /**
071: *@return the <code>MessagePolicy</code> applicable for incoming requests.
072: */
073: public MessagePolicy receiverSettings() {
074: return receiverSettings;
075: }
076:
077: /*
078: *@param bspFlag set it to true of the BSP conformance flag was specified in the configuration
079: */
080: public void isBSP(boolean bspFlag) {
081: //senderSettings.isBSP(bspFlag);
082: //enabling this to allow Backward Compatibility with XWSS11
083: //Currently XWSS11 with its old xmlsec cannot handle prefixList in
084: // Signature CanonicalizationMethod
085: senderSettings.isBSP(bspFlag);
086: receiverSettings.isBSP(bspFlag);
087: }
088:
089: /*
090: *@return the Retain Security Header Config Property
091: */
092: public boolean retainSecurityHeader() {
093: return retainSecHeader;
094: }
095:
096: /*
097: *@param arg, set the retainSecurityHeader flag.
098: */
099: public void retainSecurityHeader(boolean arg) {
100: this .retainSecHeader = arg;
101: }
102:
103: /**
104: * @return the type of the policy
105: */
106: public String getType() {
107: return PolicyTypeUtil.DECL_SEC_CONFIG_TYPE;
108: }
109: }
|