public class WSSecUsernameToken extends WSSecBase
attachmentCallbackHandler, callbackLookup, doDebug, keyIdentifierType, password, storeBytesInAttachment, user| Constructor and Description |
|---|
WSSecUsernameToken() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCreated()
Add a Created element to the UsernameToken.
|
void |
addDerivedKey(boolean useMac,
byte[] saltValue,
int iteration)
Add a derived key to the UsernameToken
|
void |
addNonce()
Add a Nonce element to the UsernameToken.
|
void |
appendToHeader(WSSecHeader secHeader)
Appends the UsernameToken element to the elements already in the
Security header.
|
Document |
build(Document doc,
WSSecHeader secHeader)
Adds a new
UsernameToken to a soap envelope. |
byte[] |
getDerivedKey()
Get the derived key.
|
String |
getId()
Get the id generated during
prepare(). |
boolean |
getPasswordsAreEncoded() |
Element |
getUsernameTokenElement()
Returns the
UsernameToken element. |
WSTimeSource |
getWsTimeSource() |
boolean |
isPrecisionInMilliSeconds() |
void |
prepare(Document doc)
Creates a Username token.
|
void |
prependToHeader(WSSecHeader secHeader)
Prepends the UsernameToken element to the elements already in the
Security header.
|
void |
setPasswordsAreEncoded(boolean passwordsAreEncoded) |
void |
setPasswordType(String pwType)
Defines how to construct the password element of the
UsernameToken. |
void |
setPrecisionInMilliSeconds(boolean precisionInMilliSeconds) |
void |
setWsTimeSource(WSTimeSource wsTimeSource) |
getIdAllocator, getKeyIdentifierType, getParts, setAttachmentCallbackHandler, setBodyID, setCallbackLookup, setIdAllocator, setKeyIdentifierType, setStoreBytesInAttachment, setUserInfo, setWsuIdpublic void setPasswordType(String pwType)
UsernameToken.pwType - contains the password type. Only allowed values are
WSS4JConstants.PASSWORD_DIGEST and
WSS4JConstants.PASSWORD_TEXT.
or null when no password is needed.public void addNonce()
public void addCreated()
public void addDerivedKey(boolean useMac,
byte[] saltValue,
int iteration)
useMac - whether the derived key is to be used for a MAC or notsaltValue - The salt value to useiteration - The number of iterations to use in deriving a keypublic byte[] getDerivedKey()
throws WSSecurityException
prepare() method was called use this method
to compute a derived key. The generation of this secret key is according
to the UsernameTokenProfile 1.1 specification (section 4 - Key Derivation).prepare()
was not called before.WSSecurityExceptionpublic void setPasswordsAreEncoded(boolean passwordsAreEncoded)
passwordsAreEncoded - whether passwords are encodedpublic boolean getPasswordsAreEncoded()
public String getId()
prepare().
Returns the the value of wsu:Id attribute of this UsernameToken.prepare()
was not called before.public void prepare(Document doc)
prepare() all parameters such as user, password,
passwordType etc. must be set. A complete UsernameToken is
constructed.doc - The SOAP envelope as W3C documentpublic void prependToHeader(WSSecHeader secHeader)
prepare().
This allows to insert the UsernameToken element at any position in the
Security header.secHeader - The security header that holds the Signature element.public void appendToHeader(WSSecHeader secHeader)
prepare().
This allows to insert the UsernameToken element at any position in the
Security header.secHeader - The security header that holds the Signature element.public Document build(Document doc, WSSecHeader secHeader)
UsernameToken to a soap envelope.
Before calling build() all parameters such as user,
password, passwordType etc. must be set. A complete
UsernameToken is constructed and added to the
wsse:Security header.doc - The SOAP envelope as W3C documentsecHeader - The security header inside the SOAP envelopepublic Element getUsernameTokenElement()
UsernameToken element.
The method can be called any time after prepare().
This allows to insert the UsernameToken element at any position in the
Security header.public boolean isPrecisionInMilliSeconds()
public void setPrecisionInMilliSeconds(boolean precisionInMilliSeconds)
public WSTimeSource getWsTimeSource()
public void setWsTimeSource(WSTimeSource wsTimeSource)
Copyright © 2017 JBoss by Red Hat. All rights reserved.