Interface ClientSessionFactory

  • All Superinterfaces:
    Serializable
    All Known Implementing Classes:
    AddAttrSessionFactory

    public interface ClientSessionFactory
    extends Serializable
    A client session factory provides the user with a token needed for calling the ADEPT2-API. The session contains a security token identifying the user as well as an identification (URI) of the component using the session token. They may have additional, session-specific attributes, for instance to use in a web context. Session tokens must only be used for one method call.
    This factory encapsulates the security (and user) information. A special URI of the calling component may be provided when creating a new session token. Otherwise the URIs have to be set before retrieving a session token.

    While a session token is used like a transaction in a database management system, a session factory corresponds to a user session, for instance in a web browser. A session factory is retrieved when logging on and may be used until logging off. Every request or a combination or requests belonging together in one transaction are performed with the same session token of the provided session factory (user session).

    Author:
    Ulrich Kreher
    • Field Detail

      • serialVersionUID

        static final long serialVersionUID
        Generated ID for serialisation.
        See Also:
        Constant Field Values
    • Method Detail

      • getAuthenticatedAgent

        RichAgent getAuthenticatedAgent()
        Gets the RichAgent which is authenticated for this client session factory.
        Returns:
        The RichAgent authenticated for this client session factory.
      • setClientURIs

        void setClientURIs​(URI[] clientURIs)
        Sets the URIs to be used when creating a session token without explicit URIs. This method has to be called before calling getSessionToken() and it must not be called more than once! Further calls are ignored.
        The array should be a copy of the original one.
        Parameters:
        clientURIs - The URIs of the client used if a component does not have its own URIs. This must not be null.
      • getSessionToken

        SessionToken getSessionToken​(URI[] callingComponent)
        Creates a new (top-level) session token which is needed for calling the ADEPT2-API. This method provides a session token containing the appropriate security token, the agent and organisational position ID. The calling component just has to submit a URI of itself.
        This method has to be used by components having a own external communication interface.
        Parameters:
        callingComponent - The component initiating the requested session on the client side, identified by its communication protocol depended URIs.
        Returns:
        A session token (signed) for the logged on user, the corresponding organisational position, security token and the designated component initiating the session.
      • getSessionToken

        SessionToken getSessionToken​(URI[] callingComponent,
                                     Map<String,​String> additionalAttributes)
        Creates a new (top-level) session token which is needed for calling the ADEPT2-API. This method provides a session token containing the appropriate security token, the agent and organisational position ID as well as the additional attributes. The calling component just has to submit a URI of itself.
        This method has to be used by components having a own external communication interface.
        Parameters:
        callingComponent - The component initiating the requested session on the client side, identified by its communication protocol depended URIs.
        additionalAttributes - Additional attributes which are provided by the created session token. This may be null.
        Returns:
        A session token for the logged on user, the corresponding organisational position, security token and the designated component initiating the session.
      • getSessionToken

        SessionToken getSessionToken()
        Creates a new (top-level) session token which is needed for calling the ADEPT2-API. This method provides a session token containing the appropriate security token, the agent and organisational position ID and the URIs of the client.

        Before calling this method, setClientURIs(URI[]) has to be called. Otherwise an IllegalStateException will be thrown.

        Returns:
        A session token for the logged on user, the corresponding organisational position, security token and URIs of the corresponding client.
        Throws:
        IllegalStateException - If the URIs are not set yet an IllegalStateException will be thrown.
      • getSessionToken

        SessionToken getSessionToken​(Map<String,​String> additionalAttributes)
        Creates a new (top-level) session token which is needed for calling the ADEPT2-API. This method provides a session token containing the appropriate security token, the agent and organisational position ID and the URIs of the client as well as the additional attributes.

        Before calling this method, setClientURIs(URI[]) has to be called. Otherwise an IllegalStateException will be thrown.

        Parameters:
        additionalAttributes - Additional attributes which are provided by the created session token. This may be null.
        Returns:
        A session token for the logged on user, the corresponding organisational position, security token and URIs of the corresponding client.
        Throws:
        IllegalStateException - If the URIs are not set yet an IllegalStateException will be thrown.