Class SecuredPerspectiveProjectSession

  • All Implemented Interfaces:
    com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchHandler, AuditingContext, LoggingContext, PerspectiveElement, PropertyTreeOwner, Session, InternalSession, SessionKernel

    public class SecuredPerspectiveProjectSession
    extends SessionKernelWrapper<com.inductiveautomation.perspective.gateway.session.SecuredPerspectiveProjectSession.SessionKernelImpl>
    implements com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchHandler
    A client session secured by the security levels set in the project's permissions. This class is a proxy to a PerspectiveProjectSession which is only created and run when the user is authorized to do so.
    • Method Detail

      • handleMessage

        public java.util.List<java.lang.String> handleMessage​(com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchEvent event)
        Specified by:
        handleMessage in interface com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchHandler
      • broadcast

        protected void broadcast​(java.lang.String protocol,
                                 java.lang.String payload)
        Description copied from class: SessionKernelWrapper
        Broadcast a message to all pages associated with this session
        Specified by:
        broadcast in class SessionKernelWrapper<com.inductiveautomation.perspective.gateway.session.SecuredPerspectiveProjectSession.SessionKernelImpl>
        Parameters:
        protocol - the protocol of the message to broadcast
        payload - the payload of the message to broadcast
      • receive

        public void receive​(MessageChannel channel,
                            java.lang.String protocol,
                            java.io.Reader payload)
        Description copied from interface: InternalSession
        Called when this session has received a message from the message channel.
        Specified by:
        receive in interface InternalSession
        Parameters:
        channel - the MessageChannel from which the message was received
        protocol - the protocol of the message
        payload - the payload of the message
      • getOrCreatePage

        public PageModel getOrCreatePage​(java.lang.String pageId)
        Description copied from interface: InternalSession
        Fetch the PageModel associated with the given page ID. If the page does not exist, it is created, associated with the given page ID, and returned.
        Specified by:
        getOrCreatePage in interface InternalSession
        Parameters:
        pageId - the page ID associated with the target page
        Returns:
        the page associated with the given page ID or a new page if it does not exist
      • findPage

        public java.util.Optional<PageModel> findPage​(java.lang.String pageId)
        Description copied from interface: Session
        Find the Page associated with the given page ID
        Specified by:
        findPage in interface InternalSession
        Specified by:
        findPage in interface Session
        Parameters:
        pageId - the page ID associated with the target page
        Returns:
        the page associated with the given page ID if it exists
      • closePage

        public void closePage​(java.lang.String pageId)
        Description copied from interface: InternalSession
        Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).
        Specified by:
        closePage in interface InternalSession
        Parameters:
        pageId - the page ID associated with the target page
      • closePage

        public void closePage​(java.lang.String pageId,
                              @Nullable
                              java.lang.String message)
        Description copied from interface: InternalSession
        Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected). Moves the client to a terminal state page of closed with the given message.
        Specified by:
        closePage in interface InternalSession
        Parameters:
        pageId - the page ID associated with the target page
        message - the message displayed to the client on the terminal state page
      • onSessionInit

        public void onSessionInit​(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse)
        Description copied from interface: InternalSession
        Called during the session-init lifecycle of the client. Implementations may modify the given response JSON object to pass back to the client.
        Specified by:
        onSessionInit in interface InternalSession
        Parameters:
        sessionInitResponse - the response JSON object to be passed back to the client in response to the session-init call
      • logout

        @Nonnull
        public java.util.Optional<java.lang.String> logout​(@Nullable
                                                           java.lang.String message)
        Description copied from interface: InternalSession
        Logout of this session. The user will no longer be authenticated.
        Specified by:
        logout in interface InternalSession
        Parameters:
        message - the message to display to the user after they are logged out of this session
        Returns:
        a logout token or hint for the IdP if one is available
      • onLoginResponse

        public void onLoginResponse​(@Nonnull
                                    WebAuthResponseContext webAuthResponseContext)
        Description copied from interface: InternalSession
        Called when the session receives a login response from the IdP
        Specified by:
        onLoginResponse in interface InternalSession
        Parameters:
        webAuthResponseContext - the login response object
      • onLogoutResponse

        public void onLogoutResponse​(@Nonnull
                                     WebAuthResponseContext webAuthResponseContext)
        Description copied from interface: InternalSession
        Called when this session received a logout response from the IdP
        Specified by:
        onLogoutResponse in interface InternalSession
        Parameters:
        webAuthResponseContext - the logout response object
      • onKeepaliveReceived

        public void onKeepaliveReceived​(java.lang.String pageId,
                                        long timestamp)
        Description copied from interface: InternalSession
        Called by the client to keep the session alive.
        Specified by:
        onKeepaliveReceived in interface InternalSession
        Parameters:
        pageId - the page ID of the page which triggered the keep alive request
        timestamp - the timestamp associated with the keep alive request
      • findViewConfig

        public java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>> findViewConfig​(java.lang.String viewPath)
        Description copied from interface: Session
        Returns a CompletableFuture that completes to present an Optional<ViewConfig> for the specified path. The use of the future is to allow for the asynch collection of configs for views which are retrieved via asynchronous processes, as is the case when a view is being edited/altered in the designer.
        Specified by:
        findViewConfig in interface Session
        Parameters:
        viewPath - path to the view's project resource within the project being run.
      • getLocale

        public java.util.Locale getLocale()
        Description copied from interface: InternalSession
        The current locale for this session, or a safe default Locale.getDefault() if not available.
        Specified by:
        getLocale in interface InternalSession
      • getTimeZoneId

        public java.lang.String getTimeZoneId()
        Description copied from interface: InternalSession
        The current timezone id for this session, or a safe default if not available.
        Specified by:
        getTimeZoneId in interface InternalSession
      • refreshBinding

        public void refreshBinding​(PropertyKey property)
        Description copied from interface: Session
        Refresh the binding for the given property
        Specified by:
        refreshBinding in interface Session
        Parameters:
        property - the property which has the binding to refresh