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:
AuditingContext
,LoggingContext
,PerspectiveElement
,PropertyTreeOwner
,Session
,InternalSession
,SessionKernel
public class SecuredPerspectiveProjectSession extends SessionKernelWrapper<com.inductiveautomation.perspective.gateway.session.SecuredPerspectiveProjectSession.SessionKernelImpl>
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.SecurityLevelsChangeEvent
-
-
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.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.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.WebAuthStatus
getWebAuthStatus()
java.util.Optional<java.lang.String>
logout()
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
claimAccessToken, createAccessToken, getAuditSnapshot, getEventBus, getGson, getLastComm, getLastMessageTime, getLogger, getPageClosedMessage, getProjectName, getSessionClosedMessage, getSessionCollection, getSessionId, getSessionInfo, 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
-
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.- 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- 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- 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.- 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.- 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- 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()
- Returns:
- A list of all open pages for this session
-
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.- 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).- 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.- 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.- 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()
Description copied from interface:InternalSession
Logout of this session. The user will no longer be authenticated.- 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- 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- 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.- 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- 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.- 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)
-
getTagManager
public TagManager getTagManager()
-
getTagHistoryManager
public TagHistoryManager getTagHistoryManager()
-
getScriptManager
public ScriptManager getScriptManager()
-
getNamedQueryManager
public NamedQueryManager getNamedQueryManager()
-
getWebAuthStatus
@Nonnull public WebAuthStatus getWebAuthStatus()
- 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.
-
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.
-
refreshBinding
public void refreshBinding(PropertyKey property)
Description copied from interface:Session
Refresh the binding for the given property- 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.- 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
- 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
-
-