Class SessionContext


  • public class SessionContext
    extends Object
    The SessionContext class represents session status of an entity to another system entity. It is supplied to a relying party to support policy enforcement.
    • Field Detail

      • _providerID

        protected String _providerID
      • _issueInstant

        protected Date _issueInstant
      • _authenticationInstant

        protected Date _authenticationInstant
    • Constructor Detail

      • SessionContext

        protected SessionContext()
        Default constructor
      • SessionContext

        public SessionContext​(SessionSubject sessionSubject,
                              AuthnContext authnContext,
                              String providerID)
                       throws SAMLException
        Constructs a SessionContext object from a SessionSubject object, a AuthnContext object and a String.
        Parameters:
        sessionSubject - SessionSubject object.
        authnContext - authentication context object.
        providerID - provider ID.
        Throws:
        SAMLException - if sessionSubject is null or providerID is null.
      • SessionContext

        public SessionContext​(Element element)
                       throws SAMLException
        Constructs an SessionContext object from a DOM Element.
        Parameters:
        element - representing a DOM tree element.
        Throws:
        SAMLException - if there is an error in the sender or in the element definition.
    • Method Detail

      • getSessionSubject

        public SessionSubject getSessionSubject()
        Returns the SessionSubject within the SessionContext object.
        Returns:
        SessionSubject object.
      • setSessionSubject

        public void setSessionSubject​(SessionSubject sub)
        Sets the SessionSubject object.
        Parameters:
        sub - SessionSubject object.
      • getAuthnContext

        public AuthnContext getAuthnContext()
        Returns the AuthnContext within the SessionContext object.
        Returns:
        AuthnContext object.
      • getProviderID

        public String getProviderID()
        Returns the ProviderID in the SessionContext object.
        Returns:
        ProviderID object
      • setAuthnContext

        public boolean setAuthnContext​(AuthnContext authnContext)
        Sets the AuthnContext in the SessionContext.
        Parameters:
        authnContext - AuthnContext to be set.
        Returns:
        true if AuthnContext was set.
      • toXMLString

        public String toXMLString()
                           throws ParseException,
                                  FSMsgException
        Returns a String representation of the SessionContext element.
        Returns:
        A string containing the valid XML for this element. By default name space name is prepended to the element name example <saml:Subject>.
        Throws:
        ParseException - if could not convert String Date expression to Date object.
        FSMsgException - if could not get AuthnContext XML String representation.
      • toXMLString

        public String toXMLString​(boolean includeNS,
                                  boolean declareNS)
                           throws ParseException,
                                  FSMsgException
        Returns a String representation of the <SessionContext> element.
        Parameters:
        includeNS - if true prepends all elements by their Namespace name <saml:Subject>.
        declareNS - if true includes the namespace within the generated XML.
        Returns:
        A string containing the valid XML for this element. Return null if error happened.
        Throws:
        ParseException - if could not convert String Date expression to Date object.
        FSMsgException - if could not get AuthnContext XML String representation.