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 aPerspectiveProjectSessionwhich 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 voidbroadcast(java.lang.String protocol, java.lang.String payload)Broadcast a message to all pages associated with this sessionvoidclosePage(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).voidclosePage(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).PropertyReferencecreatePropertyReference(java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins)Create aPropertyReferencewith thisPerspectiveElementas the target.ViewModelcreateViewModel(PageModel group, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject params)java.util.Optional<PageModel>findPage(java.lang.String pageId)Find thePageassociated with the given page IDjava.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>>findViewConfig(java.lang.String viewPath)Returns aCompletableFuturethat completes to present anOptional<ViewConfig> for the specified path.java.util.LocalegetLocale()The current locale for this session, or a safe defaultLocale.getDefault()if not available.NamedQueryManagergetNamedQueryManager()PageModelgetOrCreatePage(java.lang.String pageId)Fetch thePageModelassociated with the given page ID.java.util.List<PageModel>getPages()PerspectiveProjectgetProject()Fetch the project associated with this session.PropertyTreegetPropertyTreeOf(PropertyType propertyType)Fetch thePropertyTreeassociated with the givenPropertyTypeScriptManagergetScriptManager()TagHistoryManagergetTagHistoryManager()TagManagergetTagManager()java.lang.StringgetTimeZoneId()The current timezone id for this session, or a safe default if not available.WebAuthStatusgetWebAuthStatus()java.util.List<java.lang.String>handleMessage(com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchEvent event)java.util.Optional<java.lang.String>logout()Logout of this session.voidnotifyConnected(MessageChannel channel)Let the session know that the page has connectedvoidnotifyDisconnected(MessageChannel channel)Let the session know that the page has disconnectedvoidonKeepaliveReceived(java.lang.String pageId, long timestamp)Called by the client to keep the session alive.voidonLoginResponse(WebAuthResponseContext webAuthResponseContext)Called when the session receives a login response from the IdPvoidonLogoutResponse(WebAuthResponseContext webAuthResponseContext)Called when this session received a logout response from the IdPvoidonSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse)Called during the session-init lifecycle of the client.voidreceive(MessageChannel channel, java.lang.String protocol, java.io.Reader payload)Called when this session has received a message from the message channel.voidrefreshBinding(PropertyKey property)Refresh the binding for the given propertyvoidupdateSessionProps(SessionPropsConfig config)Update the props and bindings associated with this sessionvoidvisitPage(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
-
handleMessage
public java.util.List<java.lang.String> handleMessage(com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchEvent event)
- Specified by:
handleMessagein interfacecom.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchHandler
-
broadcast
protected void broadcast(java.lang.String protocol, java.lang.String payload)Description copied from class:SessionKernelWrapperBroadcast a message to all pages associated with this session- Specified by:
broadcastin 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:InternalSessionFetch the project associated with this session.- Specified by:
getProjectin interfaceInternalSession- Returns:
- the
PerspectiveProjectassociated with this session
-
notifyConnected
public void notifyConnected(MessageChannel channel)
Description copied from interface:InternalSessionLet the session know that the page has connected- Specified by:
notifyConnectedin interfaceInternalSession- Parameters:
channel- theMessageChannelused for communications between the client page and the gateway page
-
notifyDisconnected
public void notifyDisconnected(MessageChannel channel)
Description copied from interface:InternalSessionLet the session know that the page has disconnected- Specified by:
notifyDisconnectedin interfaceInternalSession- Parameters:
channel- theMessageChannelused 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:InternalSessionCalled when this session has received a message from the message channel.- Specified by:
receivein interfaceInternalSession- Parameters:
channel- theMessageChannelfrom 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:InternalSessionFetch thePageModelassociated with the given page ID. If the page does not exist, it is created, associated with the given page ID, and returned.- Specified by:
getOrCreatePagein 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:SessionFind thePageassociated with the given page ID- Specified by:
findPagein interfaceInternalSession- Specified by:
findPagein 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:
getPagesin interfaceInternalSession- Specified by:
getPagesin interfaceSession- 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:InternalSessionVisit 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:
visitPagein interfaceInternalSession- Parameters:
pageId- the target page IDvisitor- the page visitor
-
closePage
public void closePage(java.lang.String pageId)
Description copied from interface:InternalSessionShuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).- Specified by:
closePagein 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:InternalSessionShuts 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:
closePagein 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:InternalSessionCalled during the session-init lifecycle of the client. Implementations may modify the given response JSON object to pass back to the client.- Specified by:
onSessionInitin 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()
Description copied from interface:InternalSessionLogout of this session. The user will no longer be authenticated.- Specified by:
logoutin interfaceInternalSession- Returns:
- a logout token or hint for the IdP if one is available
-
onLoginResponse
public void onLoginResponse(@Nonnull WebAuthResponseContext webAuthResponseContext)Description copied from interface:InternalSessionCalled when the session receives a login response from the IdP- Specified by:
onLoginResponsein interfaceInternalSession- Parameters:
webAuthResponseContext- the login response object
-
onLogoutResponse
public void onLogoutResponse(@Nonnull WebAuthResponseContext webAuthResponseContext)Description copied from interface:InternalSessionCalled when this session received a logout response from the IdP- Specified by:
onLogoutResponsein interfaceInternalSession- Parameters:
webAuthResponseContext- the logout response object
-
onKeepaliveReceived
public void onKeepaliveReceived(java.lang.String pageId, long timestamp)Description copied from interface:InternalSessionCalled by the client to keep the session alive.- Specified by:
onKeepaliveReceivedin 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:InternalSessionUpdate the props and bindings associated with this session- Specified by:
updateSessionPropsin 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:SessionReturns aCompletableFuturethat 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:
findViewConfigin 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:
createViewModelin interfaceSession
-
getTagManager
public TagManager getTagManager()
- Specified by:
getTagManagerin interfaceSession
-
getTagHistoryManager
public TagHistoryManager getTagHistoryManager()
- Specified by:
getTagHistoryManagerin interfaceSession
-
getScriptManager
public ScriptManager getScriptManager()
- Specified by:
getScriptManagerin interfaceSession
-
getNamedQueryManager
public NamedQueryManager getNamedQueryManager()
- Specified by:
getNamedQueryManagerin interfaceSession
-
getWebAuthStatus
@Nonnull public WebAuthStatus getWebAuthStatus()
- Specified by:
getWebAuthStatusin interfaceSession- Returns:
- the
WebAuthStatusfor thisSession
-
getLocale
public java.util.Locale getLocale()
Description copied from interface:InternalSessionThe current locale for this session, or a safe defaultLocale.getDefault()if not available.- Specified by:
getLocalein interfaceInternalSession
-
getTimeZoneId
public java.lang.String getTimeZoneId()
Description copied from interface:InternalSessionThe current timezone id for this session, or a safe default if not available.- Specified by:
getTimeZoneIdin interfaceInternalSession
-
refreshBinding
public void refreshBinding(PropertyKey property)
Description copied from interface:SessionRefresh the binding for the given property- Specified by:
refreshBindingin 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:PerspectiveElementCreate aPropertyReferencewith thisPerspectiveElementas the target.- Specified by:
createPropertyReferencein interfacePerspectiveElement- Parameters:
referencePath- the path to the propertysubscriber- the subscriber - aConsumerofPropertyTreeChangeEventsacceptableOrigins- theSetofOrigins in which the subscriber is interested- Returns:
- the
PropertyReference
-
getPropertyTreeOf
@Nullable public PropertyTree getPropertyTreeOf(@Nullable PropertyType propertyType)
Description copied from interface:PropertyTreeOwnerFetch thePropertyTreeassociated with the givenPropertyType- Specified by:
getPropertyTreeOfin interfacePropertyTreeOwner- Parameters:
propertyType- ThePropertyTypeof thePropertyTreewe 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
-
-