Class TokenBuilder

    • Method Detail

      • createBinarySecurityToken

        protected BinarySecurityToken createBinarySecurityToken​(AuthenticationTokenPolicy.X509CertificateBinding binding,
                                                                X509Certificate x509Cert)
                                                         throws com.sun.xml.wss.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:
        com.sun.xml.wss.XWSSecurityException
      • createUsernameToken

        protected UsernameToken createUsernameToken​(AuthenticationTokenPolicy.UsernameTokenBinding binding,
                                                    UsernameToken unToken)
                                             throws com.sun.xml.wss.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:
        com.sun.xml.wss.XWSSecurityException
      • createKerberosBST

        protected BinarySecurityToken createKerberosBST​(AuthenticationTokenPolicy.KerberosTokenBinding binding,
                                                        byte[] kerbToken)
                                                 throws com.sun.xml.wss.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:
        com.sun.xml.wss.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 com.sun.xml.wss.XWSSecurityException
        builds keyInfo with the given X509 certificate binding
        Parameters:
        binding - X509CertificateBinding
        refType - String
        Returns:
        KeyIdentifier
        Throws:
        com.sun.xml.wss.XWSSecurityException
      • buildKeyInfoWithKIKerberos

        protected KeyIdentifier buildKeyInfoWithKIKerberos​(AuthenticationTokenPolicy.KerberosTokenBinding binding,
                                                           String refType)
                                                    throws com.sun.xml.wss.XWSSecurityException
        builds keyInfo with the given kerberos token binding
        Parameters:
        binding - KerberosTokenBinding
        refType - String
        Returns:
        KeyIdentifier
        Throws:
        com.sun.xml.wss.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