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 aPerspectiveProjectSession
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
broadcast(java.lang.String protocol, java.lang.String payload)
Broadcast a message to all pages associated with this sessionvoid
closePage(java.lang.String pageId)
Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).void
closePage(java.lang.String pageId, java.lang.String message)
Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).PropertyReference
createPropertyReference(java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins)
Create aPropertyReference
with thisPerspectiveElement
as the target.ViewModel
createViewModel(PageModel group, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject params)
java.util.Optional<PageModel>
findPage(java.lang.String pageId)
Find thePage
associated with the given page IDjava.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>>
findViewConfig(java.lang.String viewPath)
Returns aCompletableFuture
that completes to present anOptional
<ViewConfig
> for the specified path.int
getBindingCount()
int
getComponentCount()
java.util.Locale
getLocale()
The current locale for this session, or a safe defaultLocale.getDefault()
if not available.NamedQueryManager
getNamedQueryManager()
PageModel
getOrCreatePage(java.lang.String pageId)
Fetch thePageModel
associated with the given page ID.int
getPageCount()
java.util.List<PageModel>
getPages()
PerspectiveProject
getProject()
Fetch the project associated with this session.PropertyTree
getPropertyTreeOf(PropertyType propertyType)
Fetch thePropertyTree
associated with the givenPropertyType
ScriptManager
getScriptManager()
TagHistoryManager
getTagHistoryManager()
TagManager
getTagManager()
java.lang.String
getTimeZoneId()
The current timezone id for this session, or a safe default if not available.int
getViewCount()
WebAuthStatus
getWebAuthStatus()
java.util.List<java.lang.String>
handleMessage(com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchEvent event)
java.util.Optional<java.lang.String>
logout(java.lang.String message)
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(java.lang.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, java.lang.String protocol, java.io.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(java.lang.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 Detail
-
handleMessage
public java.util.List<java.lang.String> handleMessage(com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchEvent event)
- Specified by:
handleMessage
in interfacecom.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 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
@Nonnull public PerspectiveProject 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
public void notifyConnected(MessageChannel channel)
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
public void notifyDisconnected(MessageChannel channel)
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
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 interfaceInternalSession
- Parameters:
channel
- theMessageChannel
from which the message was receivedprotocol
- the protocol of the messagepayload
- the payload of the message
-
getOrCreatePage
public PageModel getOrCreatePage(java.lang.String pageId)
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
public java.util.Optional<PageModel> findPage(java.lang.String pageId)
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
public java.util.List<PageModel> 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
public void visitPage(java.lang.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 interfaceInternalSession
- Parameters:
pageId
- the target page IDvisitor
- the page visitor
-
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 interfaceInternalSession
- 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 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
@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 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
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 interfaceInternalSession
- 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 interfaceInternalSession
- 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 interfaceInternalSession
- Parameters:
pageId
- the page ID of the page which triggered the keep alive requesttimestamp
- 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 interfaceInternalSession
- Parameters:
config
- the session props config to apply
-
findViewConfig
public java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>> findViewConfig(java.lang.String viewPath)
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
public TagManager getTagManager()
- Specified by:
getTagManager
in interfaceSession
-
getTagHistoryManager
public TagHistoryManager getTagHistoryManager()
- Specified by:
getTagHistoryManager
in interfaceSession
-
getScriptManager
public ScriptManager getScriptManager()
- Specified by:
getScriptManager
in interfaceSession
-
getNamedQueryManager
public NamedQueryManager getNamedQueryManager()
- Specified by:
getNamedQueryManager
in interfaceSession
-
getWebAuthStatus
@Nonnull public WebAuthStatus getWebAuthStatus()
- Specified by:
getWebAuthStatus
in interfaceSession
- Returns:
- the
WebAuthStatus
for thisSession
-
getLocale
public java.util.Locale 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
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 interfaceInternalSession
-
refreshBinding
public void refreshBinding(PropertyKey property)
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(java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.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
@Nullable public PropertyTree getPropertyTreeOf(@Nullable PropertyType propertyType)
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
-
-