BinarySecurityToken.java revision 4a2f0f0be43dfd4c1b490cbf3cc48b6ba6084b1c
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: BinarySecurityToken.java,v 1.9 2009/07/24 21:51:06 mallas Exp $
*
*/
/**
* This class <code>BinarySecurityToken</code> represents an X509
* token that can be inserted into web services security header
* for message level security.
*
* <p>This class implements <code>SecurityToken</code> and can be
* created through security token factory.
*/
public class BinarySecurityToken implements SecurityToken {
/**
* Default constructor
*/
private BinarySecurityToken () {}
/**
* Constructor
* @param tokenSpec the <code>X509TokenSpec</code> for generating
* binary security token.
*/
throws SecurityException {
throw new SecurityException(
}
throw new SecurityException(
}
try {
} else {
"value type. " + valueType);
throw new SecurityException(
}
} catch (CertificateEncodingException cee) {
"Encoding Exception", cee);
throw new SecurityException(
} catch (CertificateException ce) {
"Exception", ce);
throw new SecurityException(
}
}
byte data[];
try {
} catch (CertificateEncodingException ce) {
throw new SecurityException(
}
this.encodingType = encodingType;
}
/**
* Constructor to create Kerberos Token
* @param kbSpec The Kerberos Token Specification
* @throws com.sun.identity.wss.security.SecurityException
*/
throws SecurityException {
this.value = kerberosToken;
}
/**
* Constructor
* @param token Binary Security Token Element
* @exception SecurityException if token Element is not a valid binary
* security token
*/
throws SecurityException {
throw new IllegalArgumentException(
}
if (elementName == null) {
}
":" + elementName) ;
}
}
for (int i = 0; i < len; i++) {
continue;
}
// check Id/EncodingType/ValueType attribute
// no namespace match done here
// no namespace match done here
}
}
throw new SecurityException(
}
if (encodingType == null) {
throw new SecurityException(
}
throw new SecurityException(
}
}
try {
continue;
}
}
// Node node = token.getFirstChild();
} catch (Exception e) {
}
}
// save the original string for toString()
}
/**
* Returns Kerberos Token
* @throws com.sun.identity.wss.security.SecurityException
*/
private void getKerberosToken() throws SecurityException {
try {
null,
byte[] token = new byte[0];
return null;
}
});
}
// Obtain the session key to sign using kerberos ticket.
if(privObject instanceof KerberosTicket){
continue;
}
break;
}
}
}
if (config instanceof KerberosConfiguration) {
} else {
}
// perform service authentication using JDK Kerberos module
try {
return lc.getSubject();
} catch (LoginException ex) {
}
}
/**
* trim prefix and get the value, e.g, for wsse:X509v3 will return X509v3
*/
return val;
}
if (pos == -1) {
return val;
return "";
} else {
}
}
/**
* Gets encoding type for the token.
*
* @return encoding type for the token.
*/
public String getEncodingType() {
return encodingType;
}
/**
* Gets value type for the token.
*
* @return value type for the token.
*/
public String getValueType() {
return valueType;
}
/**
* Gets id attribute for the tokens.
*
* @return id attribute for the token.
*/
return id;
}
/**
* Gets value of the token.
*
* @return value of the token.
*/
return value;
}
/**
* Returns the secret key for kerberos token.
* @return the secret key
*/
public Key getSecretKey() {
return secretKey;
}
/**
* Returns a String representation of the token
* @return A string containing the valid XML for this element
*/
}
return xmlString;
}
/**
* Returns the token type.
* @return String the token type.
*/
public String getTokenType() {
return tokenType;
}
/**
* Returns the array of certificate aliases defined in this spec.
*
* @return String[] the array of subject certificate aliases.
*/
public String[] getSubjectCertAlias() {
return this.certAlias;
}
/**
* Returns the signing id for binary security token.
* @return the signing id for the binary security token.
*/
public String getSigningId() {
return id;
}
/**
* Returns the <code>DOM</code> Element of the binary security
* token.
* @return Element the DOM document element of binary security token.
* @exception SecurityException if the document element can not be
* created.
*/
throw new SecurityException(
}
return document.getDocumentElement();
}
/**
* The <code>X509V3</code> value type indicates that
* the value name given corresponds to a X509 Certificate
*/
/**
* The <code>PKCS7</code> value type indicates
* that the value name given corresponds to a
* PKCS7 object
*/
/**
* The <code>PKIPATH</code> value type indicates
* that the value name given corresponds to a
* PKI Path object
*/
/**
* The <code>BASE64BINARY</code> encoding type indicates that
* the encoding name given corresponds to base64 encoding of a binary value
*/
public static final String BASE64BINARY =
/**
* The <code>HEXBINARY</code> encoding type indicates that
* the encoding name given corresponds to Hex encoding of
* a binary value
*/
}