com.sun.xml.ws.security.opt.impl.keyinfo
Class TokenBuilder

java.lang.Object
  extended by com.sun.xml.ws.security.opt.impl.keyinfo.TokenBuilder
All Implemented Interfaces:
TokenBuilder
Direct Known Subclasses:
DerivedKeyTokenBuilder, IssuedTokenBuilder, KerberosTokenBuilder, KeyValueTokenBuilder, SamlTokenBuilder, SCTBuilder, SymmetricTokenBuilder, UsernameTokenBuilder, X509TokenBuilder

public abstract class TokenBuilder
extends Object
implements TokenBuilder

Author:
K.Venugopal@sun.com

Field Summary
protected  JAXBFilterProcessingContext context
           
protected  WSSElementFactory elementFactory
           
protected  KeyInfo keyInfo
           
protected static Logger logger
           
protected  SecurityHeader securityHeader
           
 
Constructor Summary
TokenBuilder(JAXBFilterProcessingContext context)
          Creates a new instance of TokenBuilder
 
Method Summary
protected  DirectReference buildDirectReference(String id, String valueType)
          builds the direct reference and sets the id and valueType in it
protected  KeyInfo buildKeyInfo(PublicKey pubKey)
          builds key value with the public key provided Uses thid key value to construct key info
protected  KeyInfo buildKeyInfo(Reference ref, String strId)
          builds SecurityTokenReference with the reference element provided and with the id.
protected  KeyInfo buildKeyInfo(SecurityTokenReference str)
          creates key info with the SecurityTokenReference provided
protected  KeyIdentifier buildKeyInfoWithEKSHA1(String ekSHA1Ref)
          builds keyInfo with the given encrypted key sha1 reference
protected  KeyIdentifier buildKeyInfoWithKI(AuthenticationTokenPolicy.X509CertificateBinding binding, String refType)
          builds keyInfo with the given X509 certificate binding
protected  KeyIdentifier buildKeyInfoWithKIKerberos(AuthenticationTokenPolicy.KerberosTokenBinding binding, String refType)
          builds keyInfo with the given kerberos token binding
protected  KeyValue buildKeyValue(PublicKey pubKey)
          builds RSA key value with the public key provided
protected  KeyInfo buildKIWithKeyName(String name)
           
protected  SecurityTokenReference buildSTR(Reference ref)
          creates a new SecurityTokenReference with the reference element provided
protected  SecurityTokenReference buildSTR(String strId, Reference ref)
          creates a new SecurityTokenReference with the reference element provided sets the id provided in the SecurityTokenReference if the security policy is a SignaturePolicy
protected  BinarySecurityToken createBinarySecurityToken(AuthenticationTokenPolicy.X509CertificateBinding binding, X509Certificate x509Cert)
          if a BinarySecurityToken already exists in the security header with the id of the binding returns it else creates a BinarySecurityToken with the X509 certificate provided Adds the username token to the security header
protected  BinarySecurityToken createKerberosBST(AuthenticationTokenPolicy.KerberosTokenBinding binding, byte[] kerbToken)
          if an BinarySecurityToken already exists in the security header with the id of the binding returns it else creates a new BinarySecurityToken with the kerboros token provided Adds the BinarySecurityToken to the security header
protected  UsernameToken createUsernameToken(AuthenticationTokenPolicy.UsernameTokenBinding binding, UsernameToken unToken)
          if an UsernameToken already exists in the security header with the id of the binding returns it else sets the id of the binding in the usernametoken provided and returns it Adds the username token to the security header
protected  String getID(WSSPolicy policy)
           
 KeyInfo getKeyInfo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.xml.ws.security.opt.api.keyinfo.TokenBuilder
process
 

Field Detail

logger

protected static final Logger logger

context

protected JAXBFilterProcessingContext context

securityHeader

protected SecurityHeader securityHeader

elementFactory

protected WSSElementFactory elementFactory

keyInfo

protected KeyInfo keyInfo
Constructor Detail

TokenBuilder

public TokenBuilder(JAXBFilterProcessingContext context)
Creates a new instance of TokenBuilder

Method Detail

createBinarySecurityToken

protected BinarySecurityToken createBinarySecurityToken(AuthenticationTokenPolicy.X509CertificateBinding binding,
                                                        X509Certificate x509Cert)
                                                 throws XWSSecurityException
if a BinarySecurityToken already exists in the security header with the id of the binding returns it else creates a BinarySecurityToken with the X509 certificate provided Adds the username token to the security header

Parameters:
binding - X509CertificateBinding
x509Cert - X509Certificate
Returns:
BinarySecurityToken
Throws:
XWSSecurityException

createUsernameToken

protected UsernameToken createUsernameToken(AuthenticationTokenPolicy.UsernameTokenBinding binding,
                                            UsernameToken unToken)
                                     throws XWSSecurityException
if an UsernameToken already exists in the security header with the id of the binding returns it else sets the id of the binding in the usernametoken provided and returns it Adds the username token to the security header

Parameters:
binding - UsernameTokenBinding
unToken - UsernameToken
Returns:
UsernameToken
Throws:
XWSSecurityException

createKerberosBST

protected BinarySecurityToken createKerberosBST(AuthenticationTokenPolicy.KerberosTokenBinding binding,
                                                byte[] kerbToken)
                                         throws XWSSecurityException
if an BinarySecurityToken already exists in the security header with the id of the binding returns it else creates a new BinarySecurityToken with the kerboros token provided Adds the BinarySecurityToken to the security header

Parameters:
binding - KerberosTokenBinding
kerbToken - byte[]
Returns:
BinarySecurityToken
Throws:
XWSSecurityException

buildSTR

protected SecurityTokenReference buildSTR(String strId,
                                          Reference ref)
creates a new SecurityTokenReference with the reference element provided sets the id provided in the SecurityTokenReference if the security policy is a SignaturePolicy

Parameters:
strId - String
ref - Reference
Returns:
SecurityTokenReference

buildSTR

protected SecurityTokenReference buildSTR(Reference ref)
creates a new SecurityTokenReference with the reference element provided

Parameters:
ref - Reference
Returns:
SecurityTokenReference

buildKeyInfo

protected KeyInfo buildKeyInfo(Reference ref,
                               String strId)
builds SecurityTokenReference with the reference element provided and with the id. creates key info with this SecurityTokenReference

Parameters:
ref - Referenc
strId - String
Returns:
KeyInfo

buildKeyInfo

protected KeyInfo buildKeyInfo(SecurityTokenReference str)
creates key info with the SecurityTokenReference provided

Parameters:
str - SecurityTokenReference
Returns:
KeyInfo

buildKeyInfo

protected KeyInfo buildKeyInfo(PublicKey pubKey)
builds key value with the public key provided Uses thid key value to construct key info

Parameters:
pubKey - PublicKey
Returns:
KeyInfo

buildKeyValue

protected KeyValue buildKeyValue(PublicKey pubKey)
builds RSA key value with the public key provided

Parameters:
pubKey - PublicKey
Returns:
KeyValue

buildKIWithKeyName

protected KeyInfo buildKIWithKeyName(String name)

buildDirectReference

protected DirectReference buildDirectReference(String id,
                                               String valueType)
builds the direct reference and sets the id and valueType in it

Parameters:
id - String
valueType - String
Returns:
DirectReference

buildKeyInfoWithKI

protected KeyIdentifier buildKeyInfoWithKI(AuthenticationTokenPolicy.X509CertificateBinding binding,
                                           String refType)
                                    throws XWSSecurityException
builds keyInfo with the given X509 certificate binding

Parameters:
binding - X509CertificateBinding
refType - String
Returns:
KeyIdentifier
Throws:
XWSSecurityException

buildKeyInfoWithKIKerberos

protected KeyIdentifier buildKeyInfoWithKIKerberos(AuthenticationTokenPolicy.KerberosTokenBinding binding,
                                                   String refType)
                                            throws XWSSecurityException
builds keyInfo with the given kerberos token binding

Parameters:
binding - KerberosTokenBinding
refType - String
Returns:
KeyIdentifier
Throws:
XWSSecurityException

buildKeyInfoWithEKSHA1

protected KeyIdentifier buildKeyInfoWithEKSHA1(String ekSHA1Ref)
builds keyInfo with the given encrypted key sha1 reference

Parameters:
ekSHA1Ref - String
Returns:
KeyIdentifier

getID

protected String getID(WSSPolicy policy)

getKeyInfo

public KeyInfo getKeyInfo()
Returns:
javax.xml.crypto.dsig.keyinfo.KeyInfo


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.