Package com.sun.xml.wss.impl.policy.mls
Class AuthenticationTokenPolicy.UsernameTokenBinding
java.lang.Object
com.sun.xml.wss.impl.policy.MLSPolicy
com.sun.xml.wss.impl.policy.mls.WSSPolicy
com.sun.xml.wss.impl.policy.mls.KeyBindingBase
com.sun.xml.wss.impl.policy.mls.AuthenticationTokenPolicy.UsernameTokenBinding
- All Implemented Interfaces:
SecurityPolicy,Cloneable
- Enclosing class:
- AuthenticationTokenPolicy
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.
-
Field Summary
Fields inherited from class com.sun.xml.wss.impl.policy.mls.KeyBindingBase
claims, claimsDialect, INCLUDE_ALWAYS, INCLUDE_ALWAYS_TO_RECIPIENT, INCLUDE_ALWAYS_TO_RECIPIENT_VER2, INCLUDE_ALWAYS_VER2, INCLUDE_NEVER, INCLUDE_NEVER_VER2, INCLUDE_ONCE, INCLUDE_ONCE_VER2, includeToken, issuer, policyTokenFields inherited from class com.sun.xml.wss.impl.policy.mls.WSSPolicy
_featureBinding, _isOptional, _keyBinding, _policyIdentifier, bsp, UUID -
Constructor Summary
ConstructorsConstructorDescriptionDefault ConstructorUsernameTokenBinding(String username, String password, String nonce, boolean doDigest, String creationTime) Constructor -
Method Summary
Modifier and TypeMethodDescriptionclone()clone operatrorbooleanEquals operatorbooleanequalsIgnoreTargets(WSSPolicy policy) booleanlonggetNonce()get the nonceget the passwordgetSecretKey(String algorithm) getSTRID()getType()Get the type of the policy.booleanbooleanget the useNonce flagget the usernamebooleanbooleanvoidisEndorsing(boolean flag) Create and set the FeatureBinding for this WSSPolicy to a TimestampPolicy * @return a new TimestampPolicy as a FeatureBinding for this WSSPolicyvoidsetDigestOn(boolean doDigest) setter for a boolean flag indicating whether the password should be digested while constructing a wss:UsernameToken from this PolicyvoidsetKeyAlgorithm(String keyAlgorithm) voidsetMaxNonceAge(long nonceAge) set the maximum age in Milliseconds for which a receiving entity should cache the nonce associated with this policy.voidset the noncevoidsetNoPassword(boolean value) voidsetPassword(String password) set the passwordvoidsetReferenceType(String referenceType) voidsetSecretKey(byte[] secretKey) voidsetSecretKey(SecretKey secretKey) voidvoidsetUseCreated(boolean useCreated) voidsetUseNonce(boolean useNonce) setter for a boolean flag indicating whether a nonce should be while constructing a wss:UsernameToken from this PolicyvoidsetUsername(String username) set the usernamevoidsetUsernameToken(UsernameToken token) voidsetValueType(String valueType) toString()Methods inherited from class com.sun.xml.wss.impl.policy.mls.KeyBindingBase
getClaims, getIncludeToken, getIssuer, policyTokenWasSet, setClaims, setIncludeToken, setIssuer, setPolicyTokenFlagMethods inherited from class com.sun.xml.wss.impl.policy.mls.WSSPolicy
getFeatureBinding, getKeyBinding, getPolicyIdentifier, getUUID, isBSP, isBSP, isOptional, isOptional, setFeatureBinding, setKeyBinding, setPolicyIdentifier, setUUIDMethods inherited from class com.sun.xml.wss.impl.policy.MLSPolicy
isReadOnly, isReadOnly
-
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 sentpassword- password to be sentnonce- noncedoDigest- if password should be digestedcreationTime- timestamp
-
-
Method Details
-
getReferenceType
-
getUsernameToken
-
isEndorsing
public void isEndorsing(boolean flag) -
isEndorsing
public boolean isEndorsing() -
setUsernameToken
-
setReferenceType
-
newTimestampFeatureBinding
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
set the username -
setPassword
set the password -
setNonce
set the 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 -
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 -
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. -
getUsername
get the username- Returns:
- username
-
getPassword
get the password- Returns:
- password
-
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
-
getSTRID
-
setValueType
-
setKeyAlgorithm
-
getKeyAlgorithm
- Returns:
- the keyAlgorithm
-
setSecretKey
-
setSecretKey
public void setSecretKey(byte[] secretKey) -
getSecretKey
-
getSecretKey
-
equals
Equals operator -
equalsIgnoreTargets
- Specified by:
equalsIgnoreTargetsin classWSSPolicy
-
clone
Description copied from class:WSSPolicyclone operatror -
getType
Description copied from interface:SecurityPolicyGet the type of the policy.Implementation Note: Useful to avoid instanceof checks and String.equals checks
- Returns:
- the type of the policy
-
toString
-