Class JWTMessageAuthentication

java.lang.Object
com.highdeal.hci.JWTMessageAuthentication
All Implemented Interfaces:
MessageAuthentication, XMLMarshallable

public class JWTMessageAuthentication extends Object implements MessageAuthentication
This class represents the authentication data used for the "jwt" schema, that is a token.

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="authToken">
   <xs:complexType>
     <xs:simpleContent>
       <xs:extension base="xs:string">
         <xs:attribute name="scheme" type="xs:string" default="jwt"/>
       </xs:extension>
     </xs:simpleContent>
   </xs:complexType>
 </xs:element>

  • Constructor Details

    • JWTMessageAuthentication

      public JWTMessageAuthentication()
      Initializes an empty JWTMessageAuthentication.
      The method setJwtToken(String) must be invoked to be valid.
    • JWTMessageAuthentication

      public JWTMessageAuthentication(String jwtToken)
      Initializes a JWT Message Authentication with a JWT token.
      Parameters:
      jwtToken - The jwt token used to be authenticated
  • Method Details

    • getScheme

      Returns the authentication scheme defined in this class: MessageAuthScheme.JWT.
      Specified by:
      getScheme in interface MessageAuthentication
      Returns:
      MessageAuthScheme.JWT
    • getJwtToken

      public String getJwtToken()
      Returns a jwt token as authentication data.
      Returns:
      A jwt token for authentication
    • setJwtToken

      public void setJwtToken(String jwtToken)
      Sets the JWT token for this message authentication.
      Parameters:
      jwtToken - The JWT token for this message authentication
    • setAttributes

      public void setAttributes(XMLAttributes atts)
      Sets the attributes of the XML representation of the tag being processed.
      Specified by:
      setAttributes in interface XMLMarshallable
      Parameters:
      atts - The XML attributes of the current tag
    • addChild

      public void addChild(String tagName, XMLMarshallable child)
      Adds a child to the objects, the child represents the marshallable object to be added into the content tree.
      Specified by:
      addChild in interface XMLMarshallable
      Parameters:
      tagName - The name of tag for the child
      child - The child to be added
    • addCharacterData

      public void addCharacterData(String cData)
      Adds character data to the content element.
      Specified by:
      addCharacterData in interface XMLMarshallable
      Parameters:
      cData - The character data to be added
    • marshal

      public void marshal(XMLOutputter output)
      Gives an XML representation of this object, and of its children.
      Specified by:
      marshal in interface XMLMarshallable
      Parameters:
      output - The XML output to marshall the object into