com.sun.xml.wss.core
Class UsernameToken

java.lang.Object
  extended by com.sun.xml.wss.impl.misc.SOAPElementExtension
      extended by com.sun.xml.wss.impl.misc.SecurityHeaderBlockImpl
          extended by com.sun.xml.wss.core.UsernameToken
All Implemented Interfaces:
Token, SecurityHeaderBlock, SecurityToken, SOAPElement, Element, Node

public class UsernameToken
extends SecurityHeaderBlockImpl
implements SecurityToken, Token

Support for a WSS:Username Token Profile. Represents a wsse:UsernameToken.

Author:
Manveen Kaur, Edwin Goei

Field Summary
static long MAX_NONCE_AGE
           
 
Fields inherited from class com.sun.xml.wss.impl.misc.SecurityHeaderBlockImpl
delegateElement
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
UsernameToken(Document document, String username)
           
UsernameToken(Document document, String username, String password)
           
UsernameToken(Document document, String username, String password, boolean digestPassword)
           
UsernameToken(Document document, String username, String password, boolean setNonce, boolean digestPassword)
          C'tor that creates the optional element nonce, created is not set.
UsernameToken(Document document, String username, String password, boolean setNonce, boolean setCreatedTimestamp, boolean digestPassword)
          C'tor that creates the optional elements of nonce and created.
UsernameToken(SOAPElement usernameTokenSoapElement)
          Extracts info from SOAPElement representation
UsernameToken(SOAPElement usernameTokenSoapElement, boolean bspFlag)
           
 
Method Summary
static SecurityHeaderBlock fromSoapElement(SOAPElement element)
           
 SOAPElement getAsSoapElement()
           
 String getCreated()
          Returns the created which may be null meaning no time of creation.
 String getNonce()
           
 String getNonceEncodingType()
           
 String getPassword()
           
 String getPasswordDigest()
           
 String getPasswordType()
           
 Object getTokenValue()
          The token Value
 String getType()
          The type of the Token
 String getUsername()
           
 boolean isBSP()
           
 void isBSP(boolean flag)
           
 void setCreationTime(String time)
          set the creation time.
 void setDigestOn()
           
 void setNonce(String nonceValue)
          set the nonce value.If nonce value is null then it will create one.
 void setPassword(String passwd)
          Sets the password.
 void setUsername(String username)
           
 
Methods inherited from class com.sun.xml.wss.impl.misc.SecurityHeaderBlockImpl
addAttribute, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addNamespaceDeclaration, addTextNode, appendChild, cloneNode, compareDocumentPosition, detachNode, equals, fromSoapElement, getAllAttributes, getAllAttributesAsQNames, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getAttributeValue, getBaseURI, getChildElements, getChildElements, getChildNodes, getElementName, getElementsByTagName, getElementsByTagNameNS, getEncodingStyle, getFeature, getFirstChild, getId, getLastChild, getLocalName, getNamespacePrefixes, getNamespaceURI, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPrefix, getPreviousSibling, getSchemaTypeInfo, getSoapFactory, getTagName, getTextContent, getUserData, getValue, getVisibleNamespacePrefixes, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, recycleNode, removeAttribute, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, removeContents, removeNamespaceDeclaration, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setEncodingStyle, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setNodeValue, setParentElement, setPrefix, setSOAPElement, setTextContent, setUserData, setValue, setWsuIdAttr
 
Methods inherited from class com.sun.xml.wss.impl.misc.SOAPElementExtension
addAttribute, addChildElement, createQName, getAttributeValue, getChildElements, getElementQName, removeAttribute, setElementQName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.xml.wss.core.SecurityHeaderBlock
getId
 
Methods inherited from interface javax.xml.soap.SOAPElement
addAttribute, addAttribute, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addNamespaceDeclaration, addTextNode, createQName, getAllAttributes, getAllAttributesAsQNames, getAttributeValue, getAttributeValue, getChildElements, getChildElements, getChildElements, getElementName, getElementQName, getEncodingStyle, getNamespacePrefixes, getNamespaceURI, getVisibleNamespacePrefixes, removeAttribute, removeAttribute, removeContents, removeNamespaceDeclaration, setElementQName, setEncodingStyle
 
Methods inherited from interface javax.xml.soap.Node
detachNode, getParentElement, getValue, recycleNode, setParentElement, setValue
 
Methods inherited from interface org.w3c.dom.Element
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Field Detail

MAX_NONCE_AGE

public static final long MAX_NONCE_AGE
See Also:
Constant Field Values
Constructor Detail

UsernameToken

public UsernameToken(Document document,
                     String username)
              throws SecurityTokenException
Throws:
SecurityTokenException

UsernameToken

public UsernameToken(Document document,
                     String username,
                     String password,
                     boolean digestPassword)
              throws SecurityTokenException
Throws:
SecurityTokenException

UsernameToken

public UsernameToken(Document document,
                     String username,
                     String password)
              throws SecurityTokenException
Throws:
SecurityTokenException

UsernameToken

public UsernameToken(Document document,
                     String username,
                     String password,
                     boolean setNonce,
                     boolean digestPassword)
              throws SecurityTokenException
C'tor that creates the optional element nonce, created is not set.

Throws:
SecurityTokenException

UsernameToken

public UsernameToken(Document document,
                     String username,
                     String password,
                     boolean setNonce,
                     boolean setCreatedTimestamp,
                     boolean digestPassword)
              throws SecurityTokenException
C'tor that creates the optional elements of nonce and created.

Throws:
SecurityTokenException

UsernameToken

public UsernameToken(SOAPElement usernameTokenSoapElement,
                     boolean bspFlag)
              throws XWSSecurityException
Throws:
XWSSecurityException

UsernameToken

public UsernameToken(SOAPElement usernameTokenSoapElement)
              throws XWSSecurityException
Extracts info from SOAPElement representation

Parameters:
usernameTokenSoapElement -
Throws:
XWSSecurityException
Method Detail

fromSoapElement

public static SecurityHeaderBlock fromSoapElement(SOAPElement element)
                                           throws XWSSecurityException
Throws:
XWSSecurityException

getUsername

public String getUsername()
Returns:
Returns the username.

setUsername

public void setUsername(String username)

getPassword

public String getPassword()
Returns:
Returns the password which may be null meaning no password.

getPasswordType

public String getPasswordType()
Returns:
Returns the passwordType.

getNonceEncodingType

public String getNonceEncodingType()
Returns:
Returns the Nonce Encoding type.

getNonce

public String getNonce()
                throws SecurityTokenException
Returns:
Returns the encoded nonce. Null indicates no nonce was set.
Throws:
SecurityTokenException

getCreated

public String getCreated()
Returns the created which may be null meaning no time of creation.


getPasswordDigest

public String getPasswordDigest()

setPassword

public void setPassword(String passwd)
Sets the password.

Parameters:
passwd -

setNonce

public void setNonce(String nonceValue)
set the nonce value.If nonce value is null then it will create one.

Parameters:
nonceValue -

setCreationTime

public void setCreationTime(String time)
                     throws XWSSecurityException
set the creation time.

Parameters:
time - If null or empty then this method would create one.
Throws:
XWSSecurityException

setDigestOn

public void setDigestOn()
                 throws SecurityTokenException
Throws:
SecurityTokenException

getAsSoapElement

public SOAPElement getAsSoapElement()
                             throws SecurityTokenException
Specified by:
getAsSoapElement in interface SecurityHeaderBlock
Overrides:
getAsSoapElement in class SecurityHeaderBlockImpl
Throws:
SecurityTokenException

isBSP

public void isBSP(boolean flag)
Overrides:
isBSP in class SecurityHeaderBlockImpl

isBSP

public boolean isBSP()
Overrides:
isBSP in class SecurityHeaderBlockImpl

getType

public String getType()
Description copied from interface: Token
The type of the Token

Specified by:
getType in interface Token

getTokenValue

public Object getTokenValue()
Description copied from interface: Token
The token Value

Specified by:
getTokenValue in interface Token


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.