001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the License). You may not use this file except in
005: * compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * Header Notice in each file and include the License file
014: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
015: * If applicable, add the following below the CDDL Header,
016: * with the fields enclosed by brackets [] replaced by
017: * you own identifying information:
018: * "Portions Copyrighted [year] [name of copyright owner]"
019: *
020: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
021: */
022:
023: /*
024: * WSSKeyBindingExtension.java
025: *
026: * Created on August 31, 2005, 7:35 PM
027: *
028: * To change this template, choose Tools | Options and locate the template under
029: * the Source Creation and Management node. Right-click the template and choose
030: * Open. You can then make changes to the template in the Source Editor.
031: */
032:
033: package com.sun.xml.wss.impl.policy.mls;
034:
035: import com.sun.xml.wss.impl.policy.MLSPolicy;
036:
037: /**
038: *
039: * @author abhijit.das@Sun.COM
040: */
041: public abstract class WSSKeyBindingExtension extends WSSPolicy {
042:
043: /** Creates a new instance of WSSKeyBindingExtension */
044: public WSSKeyBindingExtension() {
045: }
046:
047: /**
048: * Create and set the KeyBinding for this WSSPolicy to an X509CertificateBinding
049: * @return a new X509CertificateBinding as a KeyBinding for this WSSPolicy
050: * @see SignaturePolicy
051: * @see EncryptionPolicy
052: * @see AuthenticationTokenPolicy
053: */
054: public MLSPolicy newX509CertificateKeyBinding() {
055: if (isReadOnly()) {
056: throw new RuntimeException(
057: "Can not create X509CertificateKeyBinding : Policy is Readonly");
058: }
059: this ._keyBinding = new AuthenticationTokenPolicy.X509CertificateBinding();
060: return _keyBinding;
061: }
062:
063: /**
064: * Create and set the KeyBinding for this WSSPolicy to a SAMLAssertionBinding
065: * @return a new SAMLAssertionBinding as a KeyBinding for this WSSPolicy
066: * @see SignaturePolicy
067: * @see EncryptionPolicy
068: * @see AuthenticationTokenPolicy
069: */
070: public MLSPolicy newSAMLAssertionKeyBinding() {
071: if (isReadOnly()) {
072: throw new RuntimeException(
073: "Can not create SAMLAssertionKeyBinding : Policy is Readonly");
074: }
075:
076: this ._keyBinding = new AuthenticationTokenPolicy.SAMLAssertionBinding();
077: return _keyBinding;
078: }
079:
080: /**
081: * Create and set the KeyBinding for this WSSPolicy to a SymmetricKeyBinding
082: * @return a new SymmetricKeyBinding as a KeyBinding for this WSSPolicy
083: * @see SignaturePolicy
084: * @see EncryptionPolicy
085: * @see AuthenticationTokenPolicy
086: */
087: public MLSPolicy newSymmetricKeyBinding() {
088: if (isReadOnly()) {
089: throw new RuntimeException(
090: "Can not create SymmetricKeyBinding : Policy is Readonly");
091: }
092:
093: this ._keyBinding = new SymmetricKeyBinding();
094: return _keyBinding;
095: }
096:
097: /**
098: * Create and set the KeyBinding for this WSSPolicy to a DerivedTokenKeyBinding
099: * @return a new DerivedTokenKeyBinding as a KeyBinding for this WSSPolicy
100: * @see SignaturePolicy
101: * @see EncryptionPolicy
102: * @see AuthenticationTokenPolicy
103: */
104: public MLSPolicy newDerivedTokenKeyBinding() {
105: if (isReadOnly()) {
106: throw new RuntimeException(
107: "Can not create DerivedTokenKeyBinding : Policy is Readonly");
108: }
109:
110: this ._keyBinding = new DerivedTokenKeyBinding();
111: return _keyBinding;
112: }
113:
114: /**
115: * Create and set the KeyBinding for this WSSPolicy to a IssuedTokenKeyBinding
116: * @return a new IssuedTokenKeyBinding as a KeyBinding for this WSSPolicy
117: * @see SignaturePolicy
118: * @see EncryptionPolicy
119: * @see AuthenticationTokenPolicy
120: */
121: public MLSPolicy newIssuedTokenKeyBinding() {
122: if (isReadOnly()) {
123: throw new RuntimeException(
124: "Can not create IssuedTokenKeyBinding : Policy is Readonly");
125: }
126:
127: this ._keyBinding = new IssuedTokenKeyBinding();
128: return _keyBinding;
129: }
130:
131: /**
132: * Create and set the KeyBinding for this WSSPolicy to a IssuedTokenKeyBinding
133: * @return a new IssuedTokenKeyBinding as a KeyBinding for this WSSPolicy
134: * @see SignaturePolicy
135: * @see EncryptionPolicy
136: * @see AuthenticationTokenPolicy
137: */
138: public MLSPolicy newSecureConversationTokenKeyBinding() {
139: if (isReadOnly()) {
140: throw new RuntimeException(
141: "Can not create SecureConversationKeyBinding : Policy is Readonly");
142: }
143:
144: this ._keyBinding = new SecureConversationTokenKeyBinding();
145: return _keyBinding;
146: }
147:
148: public MLSPolicy newUsernameTokenBindingKeyBinding() {
149: if (isReadOnly()) {
150: throw new RuntimeException(
151: "Can not create SAMLAssertionKeyBinding : Policy is Readonly");
152: }
153: this ._keyBinding = new AuthenticationTokenPolicy.UsernameTokenBinding();
154: return _keyBinding;
155: }
156: }
|