|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ws.security.message.token.UsernameToken
UsernameToken according to WS Security specifications, UsernameToken profile.
Field Summary | |
protected org.w3c.dom.Element |
element
|
protected org.w3c.dom.Element |
elementCreated
|
protected org.w3c.dom.Element |
elementIteration
|
protected org.w3c.dom.Element |
elementNonce
|
protected org.w3c.dom.Element |
elementPassword
|
protected org.w3c.dom.Element |
elementSalt
|
protected org.w3c.dom.Element |
elementUsername
|
protected boolean |
hashed
|
static java.lang.String |
PASSWORD_TYPE
|
protected java.lang.String |
passwordType
|
static javax.xml.namespace.QName |
TOKEN
|
Constructor Summary | |
UsernameToken(boolean milliseconds,
org.w3c.dom.Document doc)
Constructs a UsernameToken object according to the defined
parameters. |
|
UsernameToken(boolean milliseconds,
org.w3c.dom.Document doc,
java.lang.String pwType)
Constructs a UsernameToken object according to the defined
parameters. |
|
UsernameToken(org.w3c.dom.Element elem)
Constructs a UsernameToken object and parses the
wsse:UsernameToken element to initialize it. |
Method Summary | |
void |
addCreated(boolean milliseconds,
org.w3c.dom.Document doc)
Creates and adds a Created element to this UsernameToken |
void |
addIteration(org.w3c.dom.Document doc,
int iteration)
Creates and adds a Iteration element to this UsernameToken |
void |
addNonce(org.w3c.dom.Document doc)
Creates and adds a Nonce element to this UsernameToken |
byte[] |
addSalt(org.w3c.dom.Document doc,
byte[] saltValue,
boolean mac)
Adds and otionally creates a Salt element to this UsernameToken. |
static java.lang.String |
doPasswordDigest(java.lang.String nonce,
java.lang.String created,
java.lang.String password)
|
static byte[] |
generateDerivedKey(java.lang.String password,
byte[] salt,
int iteration)
This static method generates a derived key as defined in WSS Username Token Profile. |
static byte[] |
generateSalt(boolean useForMac)
This static method generates a 128 bit salt value as defined in WSS Username Token Profile. |
java.lang.String |
getCreated()
Get the created timestamp. |
org.w3c.dom.Element |
getElement()
Returns the dom element of this UsernameToken object. |
java.lang.String |
getID()
Gets the id. |
int |
getIteration()
Get the Iteration value of this UsernameToken. |
java.lang.String |
getName()
Get the user name. |
java.lang.String |
getNonce()
Get the nonce. |
java.lang.String |
getPassword()
Gets the password string. |
java.lang.String |
getPasswordType()
|
byte[] |
getSalt()
Get the Salt value of this UsernameToken. |
byte[] |
getSecretKey()
Gets the secret key as per WS-Trust spec. |
byte[] |
getSecretKey(int keylen,
java.lang.String labelString)
Gets the secret key as per WS-Trust spec. |
boolean |
isHashed()
Get the hashed inidicator. |
void |
setID(java.lang.String id)
Set the id of this username token. |
void |
setName(java.lang.String name)
Set the user name. |
void |
setPassword(java.lang.String pwd)
Sets the password string. |
java.lang.String |
toString()
Returns the string representation of the token. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String PASSWORD_TYPE
protected org.w3c.dom.Element element
protected org.w3c.dom.Element elementUsername
protected org.w3c.dom.Element elementPassword
protected org.w3c.dom.Element elementNonce
protected org.w3c.dom.Element elementCreated
protected org.w3c.dom.Element elementSalt
protected org.w3c.dom.Element elementIteration
protected java.lang.String passwordType
protected boolean hashed
public static final javax.xml.namespace.QName TOKEN
Constructor Detail |
public UsernameToken(org.w3c.dom.Element elem) throws WSSecurityException
UsernameToken
object and parses the
wsse:UsernameToken
element to initialize it.
elem
- the wsse:UsernameToken
element that contains
the UsernameToken data
WSSecurityException
public UsernameToken(boolean milliseconds, org.w3c.dom.Document doc)
UsernameToken
object according to the defined
parameters. This constructes set the password encoding to
WSConstants.PASSWORD_DIGEST
doc
- the SOAP envelope as Document
public UsernameToken(boolean milliseconds, org.w3c.dom.Document doc, java.lang.String pwType)
UsernameToken
object according to the defined
parameters.
doc
- the SOAP envelope as Document
pwType
- the required password encoding, either
WSConstants.PASSWORD_DIGEST
or
WSConstants.PASSWORD_TEXT
or null
if no
password requiredMethod Detail |
public void addNonce(org.w3c.dom.Document doc)
public void addCreated(boolean milliseconds, org.w3c.dom.Document doc)
public byte[] addSalt(org.w3c.dom.Document doc, byte[] saltValue, boolean mac)
saltCalue
is null
the the method
generates a new salt. Otherwise it uses the the given value.
doc
- The Document for the UsernameTokensaltValue
- The salt to add, if null generate a new salt valuemac
- If true
then an optionally generated value is
usable for a MAC
public void addIteration(org.w3c.dom.Document doc, int iteration)
public java.lang.String getName()
public void setName(java.lang.String name)
name
- sets a text node containing the use name into the user name
element.public java.lang.String getNonce()
public java.lang.String getCreated()
public java.lang.String getPassword()
null
if no such node
exists.public byte[] getSalt() throws WSSecurityException
null
if no Salt
value is available in the username token.
WSSecurityException
public int getIteration()
public boolean isHashed()
true> the password of the
UsernameToken
was encoded using
WSConstants.PASSWORD_DIGEST
- Returns:
- the hashed indicator.
public java.lang.String getPasswordType()
public void setPassword(java.lang.String pwd)
UsernameToken
either as plain text or encodes the password
according to the WS Security specifications, UsernameToken profile, into
a password digest.
pwd
- the password to usepublic static java.lang.String doPasswordDigest(java.lang.String nonce, java.lang.String created, java.lang.String password)
public org.w3c.dom.Element getElement()
UsernameToken
object.
wsse:UsernameToken
elementpublic java.lang.String toString()
public java.lang.String getID()
wsu:Id
attribute of this username
tokenpublic void setID(java.lang.String id)
id
- the value for the wsu:Id
attribute of this
username tokenpublic byte[] getSecretKey()
public byte[] getSecretKey(int keylen, java.lang.String labelString)
keylen
- How many bytes to generate for the keylabelString
- the label used to generate the seed
public static byte[] generateDerivedKey(java.lang.String password, byte[] salt, int iteration) throws WSSecurityException
password
- The password to include in the key generationsalt
- The Salt valueiteration
- The Iteration value. If zero (0) is given the mehtod uses the
default value
WSSecurityException
public static byte[] generateSalt(boolean useForMac)
useForMac
- If true
define the Salt for use in a MAC
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |