Class TokenBuilder
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description protected JAXBFilterProcessingContextcontextprotected WSSElementFactoryelementFactoryprotected KeyInfokeyInfoprotected static Loggerloggerprotected SecurityHeadersecurityHeader
-
Constructor Summary
Constructors Constructor Description TokenBuilder(JAXBFilterProcessingContext context)Creates a new instance of TokenBuilder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DirectReferencebuildDirectReference(String id, String valueType)builds the direct reference and sets the id and valueType in itprotected KeyInfobuildKeyInfo(Reference ref, String strId)builds SecurityTokenReference with the reference element provided and with the id.protected KeyInfobuildKeyInfo(SecurityTokenReference str)creates key info with the SecurityTokenReference providedprotected KeyInfobuildKeyInfo(PublicKey pubKey)builds key value with the public key provided Uses thid key value to construct key infoprotected KeyIdentifierbuildKeyInfoWithEKSHA1(String ekSHA1Ref)builds keyInfo with the given encrypted key sha1 referenceprotected KeyIdentifierbuildKeyInfoWithKI(AuthenticationTokenPolicy.X509CertificateBinding binding, String refType)builds keyInfo with the given X509 certificate bindingprotected KeyIdentifierbuildKeyInfoWithKIKerberos(AuthenticationTokenPolicy.KerberosTokenBinding binding, String refType)builds keyInfo with the given kerberos token bindingprotected KeyValuebuildKeyValue(PublicKey pubKey)builds RSA key value with the public key providedprotected KeyInfobuildKIWithKeyName(String name)protected SecurityTokenReferencebuildSTR(Reference ref)creates a new SecurityTokenReference with the reference element providedprotected SecurityTokenReferencebuildSTR(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 SignaturePolicyprotected BinarySecurityTokencreateBinarySecurityToken(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 headerprotected BinarySecurityTokencreateKerberosBST(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 headerprotected UsernameTokencreateUsernameToken(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 headerprotected StringgetID(WSSPolicy policy)KeyInfogetKeyInfo()-
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- X509CertificateBindingx509Cert- 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- UsernameTokenBindingunToken- 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- KerberosTokenBindingkerbToken- 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- Stringref- 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- ReferencstrId- 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
-
buildDirectReference
protected DirectReference buildDirectReference(String id, String valueType)
builds the direct reference and sets the id and valueType in it- Parameters:
id- StringvalueType- String- Returns:
- DirectReference
-
buildKeyInfoWithKI
protected KeyIdentifier buildKeyInfoWithKI(AuthenticationTokenPolicy.X509CertificateBinding binding, String refType) throws XWSSecurityException
builds keyInfo with the given X509 certificate binding- Parameters:
binding- X509CertificateBindingrefType- 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- KerberosTokenBindingrefType- 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
-
getKeyInfo
public KeyInfo getKeyInfo()
- Returns:
- javax.xml.crypto.dsig.keyinfo.KeyInfo
-
-