001: /*
002: * $Id: BinarySecret.java,v 1.2 2007/05/29 22:11:30 ofung Exp $
003: */
004:
005: /*
006: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
007: *
008: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
009: *
010: * The contents of this file are subject to the terms of either the GNU
011: * General Public License Version 2 only ("GPL") or the Common Development
012: * and Distribution License("CDDL") (collectively, the "License"). You
013: * may not use this file except in compliance with the License. You can obtain
014: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
015: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
016: * language governing permissions and limitations under the License.
017: *
018: * When distributing the software, include this License Header Notice in each
019: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
020: * Sun designates this particular file as subject to the "Classpath" exception
021: * as provided by Sun in the GPL Version 2 section of the License file that
022: * accompanied this code. If applicable, add the following below the License
023: * Header, with the fields enclosed by brackets [] replaced by your own
024: * identifying information: "Portions Copyrighted [year]
025: * [name of copyright owner]"
026: *
027: * Contributor(s):
028: *
029: * If you wish your version of this file to be governed by only the CDDL or
030: * only the GPL Version 2, indicate your decision by adding "[Contributor]
031: * elects to include this software in this distribution under the [CDDL or GPL
032: * Version 2] license." If you don't indicate a single choice of license, a
033: * recipient has the option to distribute your version of this file under
034: * either the CDDL, the GPL Version 2 or to extend the choice of license to
035: * its licensees as provided above. However, if you add GPL Version 2 code
036: * and therefore, elected the GPL Version 2 license, then the option applies
037: * only if the new code is made subject to such option by the copyright
038: * holder.
039: */
040:
041: package com.sun.xml.ws.security.trust.elements;
042:
043: import com.sun.xml.ws.security.trust.WSTrustConstants;
044:
045: import java.util.Map;
046: import javax.xml.namespace.QName;
047:
048: /**
049: * @author WS-Trust Implementation Team
050: */
051: public interface BinarySecret {
052:
053: /** Predefined constants for the Type of BinarySecret desired in the Security Token
054: * Values for the wst:BinarySecret/@Type parameter
055: */
056: public static final String ASYMMETRIC_KEY_TYPE = WSTrustConstants.WST_NAMESPACE
057: + "/AsymmetricKey";
058: public static final String SYMMETRIC_KEY_TYPE = WSTrustConstants.WST_NAMESPACE
059: + "/SymmetricKey";
060: public static final String NONCE_KEY_TYPE = WSTrustConstants.WST_NAMESPACE
061: + "/Nonce";
062:
063: /**
064: * Gets a map that contains attributes that aren't bound to any typed property on this class.
065: *
066: * <p>
067: * the map is keyed by the name of the attribute and
068: * the value is the string value of the attribute.
069: *
070: * the map returned by this method is live, and you can add new attribute
071: * by updating the map directly. Because of this design, there's no setter.
072: *
073: *
074: * @return
075: * always non-null
076: */
077: Map<QName, String> getOtherAttributes();
078:
079: /**
080: * Gets the value of the type property. This is a URI that indicates the
081: * type of secret being encoded.
082: *
083: * @return {@link String }
084: *
085: */
086: String getType();
087:
088: /**
089: * Gets the decoded value or the raw bytes of the binary secret.
090: *
091: * @return {@link byte[]}
092: *
093: */
094: byte[] getRawValue();
095:
096: /**
097: * Gets the encoded value of the binary secret. This represents the
098: * base64 encoded BinarySecret.
099: *
100: * @return {@link String}
101: * @see {getRawValue}
102: *
103: */
104: String getTextValue();
105:
106: /**
107: * Sets the value of the type property indicating the type of
108: * secret being encoded.
109: *
110: * @param type {@link String }
111: *
112: */
113: void setType(String type);
114:
115: /**
116: * Sets the value of the Binary Secret element.
117: * This is the base64 encoded value of the raw BinarySecret.
118: *
119: * @param encodedText {@link String }
120: */
121: void setTextValue(String encodedText);
122:
123: /**
124: * Sets the value of the binary secret as raw bytes.
125: * The value that appears in the element will be encoded appropriately.
126: *
127: * @param rawText {@link byte[]}
128: *
129: */
130: void setRawValue(byte[] rawText);
131:
132: }
|