|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ws.security.message.WSSecBase
org.apache.ws.security.message.WSSecUsernameToken
Builds a WS UsernameToken. Refer to the WS specification, UsernameToken profile
Field Summary |
Fields inherited from class org.apache.ws.security.message.WSSecBase |
doDebug, keyIdentifierType, parts, password, user, wssConfig |
Constructor Summary | |
WSSecUsernameToken()
Constructor. |
Method Summary | |
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. |
org.w3c.dom.Document |
build(org.w3c.dom.Document doc,
WSSecHeader secHeader)
Adds a new UsernameToken to a soap envelope. |
byte[] |
getDerivedKey()
Get the derived key. |
java.lang.String |
getId()
Get the id generated during prepare() . |
byte[] |
getSecretKey()
Get the derived secret key. |
org.w3c.dom.Element |
getUsernameTokenElement()
Returns the UsernameToken element. |
void |
prepare(org.w3c.dom.Document doc)
Creates a Username token. |
void |
prependToHeader(WSSecHeader secHeader)
Prepends the UsernameToken element to the elements already in the Security header. |
void |
setPasswordType(java.lang.String pwType)
Defines how to construct the password element of the UsernameToken . |
Methods inherited from class org.apache.ws.security.message.WSSecBase |
getKeyIdentifierType, setBodyID, setKeyIdentifierType, setParts, setUserInfo, setWsConfig, setWsuId |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public WSSecUsernameToken()
Method Detail |
public void setPasswordType(java.lang.String pwType)
UsernameToken
.
pwType
- contains the password type. Only allowed values are
WSConstants.PASSWORD_DIGEST
and
WSConstants.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[] getSecretKey() throws WSSecurityException
prepare()
method was called use this method
to compute a derived secret key. If "useDerivedKey" is set, then the returned secret
key is derived as per the UsernameToken 1.1 specification. Otherwise, the generation
of this secret key is according to the WS-Trust specifications.
prepare()
was not called before.
WSSecurityException
public 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.
WSSecurityException
public java.lang.String getId()
prepare()
.
Returns the the value of wsu:Id attribute of this UsernameToken.
prepare()
was not called before.public void prepare(org.w3c.dom.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 org.w3c.dom.Document build(org.w3c.dom.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 envelope
public org.w3c.dom.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.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |