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:
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.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.inductiveautomation.perspective.gateway.session.InternalSession
InternalSession.PageVisitor
Nested classes/interfaces inherited from interface com.inductiveautomation.perspective.gateway.api.Session
Session.WebAuthStatusChangeEvent
-
Field Summary
Fields inherited from interface com.inductiveautomation.perspective.gateway.session.InternalSession
SESSION
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Broadcast a message to all pages associated with this sessionvoid
Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).void
Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).createPropertyReference
(String referencePath, Consumer<PropertyTreeChangeEvent> subscriber, Set<Origin> acceptableOrigins) Create aPropertyReference
with thisPerspectiveElement
as the target.createViewModel
(PageModel group, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject params) Find thePage
associated with the given page IDfindViewConfig
(String viewPath) Returns aCompletableFuture
that completes to present anOptional
<ViewConfig
> for the specified path.int
int
The current locale for this session, or a safe defaultLocale.getDefault()
if not available.getOrCreatePage
(String pageId) Fetch thePageModel
associated with the given page ID.int
getPages()
Fetch the project associated with this session.getPropertyTreeOf
(PropertyType propertyType) Fetch thePropertyTree
associated with the givenPropertyType
The current timezone id for this session, or a safe default if not available.int
handleMessage
(com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchEvent event) Logout of this session.void
notifyConnected
(MessageChannel channel) Let the session know that the page has connectedvoid
notifyDisconnected
(MessageChannel channel) Let the session know that the page has disconnectedvoid
onKeepaliveReceived
(String pageId, long timestamp) Called by the client to keep the session alive.void
onLoginResponse
(WebAuthResponseContext webAuthResponseContext) Called when the session receives a login response from the IdPvoid
onLogoutResponse
(WebAuthResponseContext webAuthResponseContext) Called when this session received a logout response from the IdPvoid
onSessionInit
(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse) Called during the session-init lifecycle of the client.void
receive
(MessageChannel channel, String protocol, Reader payload) Called when this session has received a message from the message channel.void
refreshBinding
(PropertyKey property) Refresh the binding for the given propertyvoid
updateSessionProps
(SessionPropsConfig config) Update the props and bindings associated with this sessionvoid
visitPage
(String pageId, InternalSession.PageVisitor visitor) Visit the page associated with the given ID.Methods inherited from class com.inductiveautomation.perspective.gateway.session.SessionKernelWrapper
claimToken, createToken, getAuditSnapshot, getEventBus, getEventManager, getGson, getLastComm, getLastMessageTime, getLogger, getLogoutMessage, getPageClosedMessage, getProjectName, getSessionClosedMessage, getSessionCollection, getSessionId, getSessionInfo, getSessionStats, getStartupTime, getUptime, onHello, onShutdown, onStartup, queue, touch
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startup
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContext
audit
Methods inherited from interface com.inductiveautomation.perspective.gateway.session.InternalSession
close, destroySession, getPerspectiveContext, getTimeZone, isRunning, scope, shutdown, startup
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContext
mdc, mdcSetupTree, mdcTeardownTree, mdcWrap
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElement
getAuditProfile, getQualifiedPath
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.Session
getGatewayContext, getMdcParent, getName, getPage, getPageTimeout, getSession, getView, mdcSetup, mdcTeardown, sendErrorToDesigner
Methods inherited from interface com.inductiveautomation.perspective.gateway.session.SessionKernel
shutdown, startup
-
Method Details
-
handleMessage
public List<String> handleMessage(com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchEvent event) - Specified by:
handleMessage
in interfacecom.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchHandler
-
broadcast
Description copied from class:SessionKernelWrapper
Broadcast a message to all pages associated with this session- Specified by:
broadcast
in classSessionKernelWrapper<com.inductiveautomation.perspective.gateway.session.SecuredPerspectiveProjectSession.SessionKernelImpl>
- Parameters:
protocol
- the protocol of the message to broadcastpayload
- the payload of the message to broadcast
-
getProject
Description copied from interface:InternalSession
Fetch the project associated with this session.- Specified by:
getProject
in interfaceInternalSession
- Returns:
- the
PerspectiveProject
associated with this session
-
notifyConnected
Description copied from interface:InternalSession
Let the session know that the page has connected- Specified by:
notifyConnected
in interfaceInternalSession
- Parameters:
channel
- theMessageChannel
used for communications between the client page and the gateway page
-
notifyDisconnected
Description copied from interface:InternalSession
Let the session know that the page has disconnected- Specified by:
notifyDisconnected
in interfaceInternalSession
- Parameters:
channel
- theMessageChannel
used for communications between the client page and the gateway page
-
receive
Description copied from interface:InternalSession
Called when this session has received a message from the message channel.- Specified by:
receive
in interfaceInternalSession
- Parameters:
channel
- theMessageChannel
from which the message was receivedprotocol
- the protocol of the messagepayload
- the payload of the message
-
getOrCreatePage
Description copied from interface:InternalSession
Fetch thePageModel
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 interfaceInternalSession
- 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
Description copied from interface:Session
Find thePage
associated with the given page ID- Specified by:
findPage
in interfaceInternalSession
- Specified by:
findPage
in interfaceSession
- Parameters:
pageId
- the page ID associated with the target page- Returns:
- the page associated with the given page ID if it exists
-
getPages
- Specified by:
getPages
in interfaceInternalSession
- Specified by:
getPages
in interfaceSession
- Returns:
- A list of all open pages for this session
-
getPageCount
public int getPageCount()- Specified by:
getPageCount
in interfaceInternalSession
-
getViewCount
public int getViewCount()- Specified by:
getViewCount
in interfaceInternalSession
-
getComponentCount
public int getComponentCount()- Specified by:
getComponentCount
in interfaceInternalSession
-
getBindingCount
public int getBindingCount()- Specified by:
getBindingCount
in interfaceInternalSession
-
visitPage
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 interfaceInternalSession
- Parameters:
pageId
- the target page IDvisitor
- the page visitor
-
closePage
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 interfaceInternalSession
- Parameters:
pageId
- the page ID associated with the target page
-
closePage
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 interfaceInternalSession
- Parameters:
pageId
- the page ID associated with the target pagemessage
- 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 interfaceInternalSession
- Parameters:
sessionInitResponse
- the response JSON object to be passed back to the client in response to the session-init call
-
logout
Description copied from interface:InternalSession
Logout of this session. The user will no longer be authenticated.- Specified by:
logout
in interfaceInternalSession
- 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
Description copied from interface:InternalSession
Called when the session receives a login response from the IdP- Specified by:
onLoginResponse
in interfaceInternalSession
- Parameters:
webAuthResponseContext
- the login response object
-
onLogoutResponse
Description copied from interface:InternalSession
Called when this session received a logout response from the IdP- Specified by:
onLogoutResponse
in interfaceInternalSession
- Parameters:
webAuthResponseContext
- the logout response object
-
onKeepaliveReceived
Description copied from interface:InternalSession
Called by the client to keep the session alive.- Specified by:
onKeepaliveReceived
in interfaceInternalSession
- Parameters:
pageId
- the page ID of the page which triggered the keep alive requesttimestamp
- the timestamp associated with the keep alive request
-
updateSessionProps
Description copied from interface:InternalSession
Update the props and bindings associated with this session- Specified by:
updateSessionProps
in interfaceInternalSession
- Parameters:
config
- the session props config to apply
-
findViewConfig
Description copied from interface:Session
Returns aCompletableFuture
that completes to present anOptional
<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 interfaceSession
- 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 interfaceSession
-
getTagManager
- Specified by:
getTagManager
in interfaceSession
-
getTagHistoryManager
- Specified by:
getTagHistoryManager
in interfaceSession
-
getScriptManager
- Specified by:
getScriptManager
in interfaceSession
-
getNamedQueryManager
- Specified by:
getNamedQueryManager
in interfaceSession
-
getWebAuthStatus
- Specified by:
getWebAuthStatus
in interfaceSession
- Returns:
- the
WebAuthStatus
for thisSession
-
getLocale
Description copied from interface:InternalSession
The current locale for this session, or a safe defaultLocale.getDefault()
if not available.- Specified by:
getLocale
in interfaceInternalSession
-
getTimeZoneId
Description copied from interface:InternalSession
The current timezone id for this session, or a safe default if not available.- Specified by:
getTimeZoneId
in interfaceInternalSession
-
refreshBinding
Description copied from interface:Session
Refresh the binding for the given property- Specified by:
refreshBinding
in interfaceSession
- 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 aPropertyReference
with thisPerspectiveElement
as the target.- Specified by:
createPropertyReference
in interfacePerspectiveElement
- Parameters:
referencePath
- the path to the propertysubscriber
- the subscriber - aConsumer
ofPropertyTreeChangeEvent
sacceptableOrigins
- theSet
ofOrigin
s in which the subscriber is interested- Returns:
- the
PropertyReference
-
getPropertyTreeOf
Description copied from interface:PropertyTreeOwner
Fetch thePropertyTree
associated with the givenPropertyType
- Specified by:
getPropertyTreeOf
in interfacePropertyTreeOwner
- Parameters:
propertyType
- ThePropertyType
of thePropertyTree
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
-