Class SecuredPerspectiveProjectSession

java.lang.Object
com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
com.inductiveautomation.perspective.gateway.session.SessionKernelWrapper<com.inductiveautomation.perspective.gateway.session.SecuredPerspectiveProjectSession.SessionKernelImpl>
com.inductiveautomation.perspective.gateway.session.SecuredPerspectiveProjectSession
All Implemented Interfaces:
Lifecycle, 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 Details

    • handleMessage

      public List<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(String protocol, 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
    • getProject

      @Nonnull public PerspectiveProject getProject()
      Description copied from interface: InternalSession
      Fetch the project associated with this session.
      Specified by:
      getProject in interface InternalSession
      Returns:
      the PerspectiveProject associated with this session
    • notifyConnected

      public void notifyConnected(MessageChannel channel)
      Description copied from interface: InternalSession
      Let the session know that the page has connected
      Specified by:
      notifyConnected in interface InternalSession
      Parameters:
      channel - the MessageChannel used for communications between the client page and the gateway page
    • notifyDisconnected

      public void notifyDisconnected(MessageChannel channel)
      Description copied from interface: InternalSession
      Let the session know that the page has disconnected
      Specified by:
      notifyDisconnected in interface InternalSession
      Parameters:
      channel - the MessageChannel used for communications between the client page and the gateway page
    • receive

      public void receive(MessageChannel channel, String protocol, 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(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 Optional<PageModel> findPage(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
    • getPages

      public List<PageModel> getPages()
      Specified by:
      getPages in interface InternalSession
      Specified by:
      getPages in interface Session
      Returns:
      A list of all open pages for this session
    • getPageCount

      public int getPageCount()
      Specified by:
      getPageCount in interface InternalSession
    • getViewCount

      public int getViewCount()
      Specified by:
      getViewCount in interface InternalSession
    • getComponentCount

      public int getComponentCount()
      Specified by:
      getComponentCount in interface InternalSession
    • getBindingCount

      public int getBindingCount()
      Specified by:
      getBindingCount in interface InternalSession
    • visitPage

      public void visitPage(String pageId, InternalSession.PageVisitor visitor)
      Description copied from interface: InternalSession
      Visit the page associated with the given ID. If the page is found, InternalSession.PageVisitor.onPageFound(PageModel) is invoked with the target page. If the page is not found, InternalSession.PageVisitor.onPageMissing() is invoked. If the page is closed, InternalSession.PageVisitor.onPageClosed(String) is invoked with the closed message.
      Specified by:
      visitPage in interface InternalSession
      Parameters:
      pageId - the target page ID
      visitor - the page visitor
    • closePage

      public void closePage(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(String pageId, @Nullable 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 Optional<String> logout(@Nullable 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 com.inductiveautomation.ignition.gateway.auth.web.response.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 com.inductiveautomation.ignition.gateway.auth.web.response.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(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
    • updateSessionProps

      public void updateSessionProps(SessionPropsConfig config)
      Description copied from interface: InternalSession
      Update the props and bindings associated with this session
      Specified by:
      updateSessionProps in interface InternalSession
      Parameters:
      config - the session props config to apply
    • findViewConfig

      public CompletableFuture<Optional<ViewConfig>> findViewConfig(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.
    • createViewModel

      public ViewModel createViewModel(PageModel group, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject params)
      Specified by:
      createViewModel in interface Session
    • getTagManager

      public TagManager getTagManager()
      Specified by:
      getTagManager in interface Session
    • getTagHistoryManager

      public TagHistoryManager getTagHistoryManager()
      Specified by:
      getTagHistoryManager in interface Session
    • getScriptManager

      public ScriptManager getScriptManager()
      Specified by:
      getScriptManager in interface Session
    • getNamedQueryManager

      public NamedQueryManager getNamedQueryManager()
      Specified by:
      getNamedQueryManager in interface Session
    • getWebAuthStatus

      @Nonnull public WebAuthStatus getWebAuthStatus()
      Specified by:
      getWebAuthStatus in interface Session
      Returns:
      the WebAuthStatus for this Session
    • getLocale

      public 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 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
    • createPropertyReference

      @Nonnull public PropertyReference createPropertyReference(String referencePath, Consumer<PropertyTreeChangeEvent> subscriber, Set<Origin> acceptableOrigins)
      Description copied from interface: PerspectiveElement
      Create a PropertyReference with this PerspectiveElement as the target.
      Specified by:
      createPropertyReference in interface PerspectiveElement
      Parameters:
      referencePath - the path to the property
      subscriber - the subscriber - a Consumer of PropertyTreeChangeEvents
      acceptableOrigins - the Set of Origins in which the subscriber is interested
      Returns:
      the PropertyReference
    • getPropertyTreeOf

      @Nullable public PropertyTree getPropertyTreeOf(@Nullable PropertyType propertyType)
      Description copied from interface: PropertyTreeOwner
      Fetch the PropertyTree associated with the given PropertyType
      Specified by:
      getPropertyTreeOf in interface PropertyTreeOwner
      Parameters:
      propertyType - The PropertyType of the PropertyTree we want to fetch
      Returns:
      The PropertyTree or null if this PropertyTreeOwner does not manage a PropertyTree for the given PropertyType or if a null PropertyType is given