public class WSSecUsernameToken extends WSSecBase
callbackLookup, doDebug, keyIdentifierType, parts, password, user
Constructor and Description |
---|
WSSecUsernameToken() |
WSSecUsernameToken(WSSConfig config) |
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() |
byte[] |
getSecretKey()
Get the derived secret key.
|
int |
getSecretKeyLength()
Get the secret key length
|
Element |
getUsernameTokenElement()
Returns the
UsernameToken element. |
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 |
setSecretKeyLength(int length)
Set the secret key length
|
getKeyIdentifierType, getWsConfig, setBodyID, setCallbackLookup, setKeyIdentifierType, setParts, setUserInfo, setWsConfig, setWsuId
public WSSecUsernameToken()
public WSSecUsernameToken(WSSConfig config)
public void setPasswordType(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 setSecretKeyLength(int length)
public int getSecretKeyLength()
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 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.Copyright © 2018 JBoss by Red Hat. All rights reserved.