Class AuthenticationTokenPolicy.UsernameTokenBinding

All Implemented Interfaces:
SecurityPolicy, Cloneable
Enclosing class:
AuthenticationTokenPolicy

public static class AuthenticationTokenPolicy.UsernameTokenBinding extends KeyBindingBase
A policy representing a WSS UsernameToken. An instance of this class can be used as concrete feature binding for an AuthenticationTokenPolicy. Different parameters in this policy are applicable depending upon whether this policy is used to construct a wss:UsernameToken (sender side policy) or it is used to verify an incoming UsernameToken (receiver side policy). Information on applicability will be indicated where appropriate.
  • Constructor Details

    • UsernameTokenBinding

      public UsernameTokenBinding()
      Default Constructor
    • UsernameTokenBinding

      public UsernameTokenBinding(String username, String password, String nonce, boolean doDigest, String creationTime)
      Constructor
      Parameters:
      username - username to be sent
      password - password to be sent
      nonce - nonce
      doDigest - if password should be digested
      creationTime - timestamp
  • Method Details

    • getReferenceType

      public String getReferenceType()
    • getUsernameToken

      public UsernameToken getUsernameToken()
    • isEndorsing

      public void isEndorsing(boolean flag)
    • isEndorsing

      public boolean isEndorsing()
    • setUsernameToken

      public void setUsernameToken(UsernameToken token)
    • setReferenceType

      public void setReferenceType(String referenceType)
    • newTimestampFeatureBinding

      public MLSPolicy newTimestampFeatureBinding() throws PolicyGenerationException
      Create and set the FeatureBinding for this WSSPolicy to a TimestampPolicy * @return a new TimestampPolicy as a FeatureBinding for this WSSPolicy
      Throws:
      PolicyGenerationException - if TimestampPolicy is not a valid FeatureBinding for this WSSPolicy
      See Also:
    • setUsername

      public void setUsername(String username)
      set the username
      Parameters:
      username -
    • setPassword

      public void setPassword(String password)
      set the password
      Parameters:
      password -
    • setNonce

      public void setNonce(String nonce)
      set the nonce
      Parameters:
      nonce -
    • setUseNonce

      public void setUseNonce(boolean useNonce)
      setter for a boolean flag indicating whether a nonce should be while constructing a wss:UsernameToken from this Policy
      Parameters:
      useNonce -
    • setUseCreated

      public void setUseCreated(boolean useCreated)
    • setDigestOn

      public void setDigestOn(boolean doDigest)
      setter for a boolean flag indicating whether the password should be digested while constructing a wss:UsernameToken from this Policy
      Parameters:
      doDigest -
    • setMaxNonceAge

      public void setMaxNonceAge(long nonceAge)
      set the maximum age in Milliseconds for which a receiving entity should cache the nonce associated with this policy. A receiver may cache received nonces for this period (or more) to minimize nonce-replay attacks This parameter is applicable when this UsernameToken is used as a Receiver requirement.
      Parameters:
      nonceAge -
    • getUsername

      public String getUsername()
      get the username
      Returns:
      username
    • getPassword

      public String getPassword()
      get the password
      Returns:
      password
    • getNonce

      public String getNonce()
      get the nonce
      Returns:
      nonce
    • getUseNonce

      public boolean getUseNonce()
      get the useNonce flag
      Returns:
      true if the useNonce flag is set to true
    • getUseCreated

      public boolean getUseCreated()
    • getDigestOn

      public boolean getDigestOn()
      Returns:
      if password is digested
    • getMaxNonceAge

      public long getMaxNonceAge()
      Returns:
      the maxNonceAge
    • hasNoPassword

      public boolean hasNoPassword()
    • setNoPassword

      public void setNoPassword(boolean value)
    • setSTRID

      public void setSTRID(String id)
    • getSTRID

      public String getSTRID()
    • setValueType

      public void setValueType(String valueType)
    • setKeyAlgorithm

      public void setKeyAlgorithm(String keyAlgorithm)
    • getKeyAlgorithm

      public String getKeyAlgorithm()
      Returns:
      the keyAlgorithm
    • setSecretKey

      public void setSecretKey(SecretKey secretKey)
    • setSecretKey

      public void setSecretKey(byte[] secretKey)
    • getSecretKey

      public SecretKey getSecretKey(String algorithm)
    • getSecretKey

      public SecretKey getSecretKey()
    • equals

      public boolean equals(WSSPolicy policy)
      Equals operator
      Specified by:
      equals in class WSSPolicy
      Returns:
      true if the binding is equal to this UsernameToken Policy
      See Also:
    • equalsIgnoreTargets

      public boolean equalsIgnoreTargets(WSSPolicy policy)
      Specified by:
      equalsIgnoreTargets in class WSSPolicy
    • clone

      public Object clone()
      Description copied from class: WSSPolicy
      clone operatror
      Specified by:
      clone in class WSSPolicy
      Returns:
      a clone of this policy
      See Also:
    • getType

      public String getType()
      Description copied from interface: SecurityPolicy
      Get the type of the policy.

      Implementation Note: Useful to avoid instanceof checks and String.equals checks

      Returns:
      the type of the policy
    • toString

      public String toString()
      Overrides:
      toString in class Object