Interface InternalSession
- All Superinterfaces:
AuditingContext, LoggingContext, PerspectiveElement, PropertyTreeOwner, Session
- All Known Implementing Classes:
AbstractSession, PerspectiveDesignSession, PerspectiveProjectSession, SecuredPerspectiveProjectSession, SessionKernelWrapper
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA page visitor interface.Nested classes/interfaces inherited from interface Session
Session.WebAuthStatusChangeEvent -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionOptional<com.inductiveautomation.ignition.common.gson.JsonElement> claimToken(String type, String token) Claim the given token associated with the given data type previously created by this session.default voidDestroys this session and moves clients to a terminal state of closedvoidShuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).voidShuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).createToken(String type, com.inductiveautomation.ignition.common.gson.JsonElement data) Create a new token associated with the given type and data for the this session.default voidDestroys the session by removing it from its containing session collection and shutting it down (which should close any connected message channels).Find thePageassociated with the given page IDintintlonggetLastComm(TimeUnit timeUnit) Return the time in the given time unit when the last communication was received from the clientdefault longThe current locale for this session, or a safe defaultLocale.getDefault()if not available.getOrCreatePage(String pageId) Fetch thePageModelassociated with the given page ID.intgetPages()default PerspectiveContextdefault @NonNull PerspectiveProjectFetch the project associated with this session.default TimeZoneThe current timezone for this session, or a safe default if not available.The current timezone id for this session, or a safe default if not available.longReturn the amount of time elapsed in the given time unit since the session started up.intbooleancom.inductiveautomation.ignition.gateway.auth.idp.WebAuthSessionContextLogout this session.voidnotifyConnected(MessageChannel channel) Let the session know that the page has connectedvoidnotifyDisconnected(MessageChannel channel) Let the session know that the page has disconnectedvoidonHello()Called every time the hello API is invoked on this session.voidonKeepaliveReceived(String pageId, long timestamp) Called by the client to keep the session alive.voidonLoginResponse(com.inductiveautomation.ignition.gateway.auth.web.response.WebAuthResponseContext webAuthResponseContext) Called when the session receives a login response from the IdP.voidonLogoutResponse(com.inductiveautomation.ignition.gateway.auth.web.response.WebAuthResponseContext webAuthResponseContext) Called when this session received a logout response from the IdP.voidonSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse) Called during the session-init lifecycle of the client.voidreceive(MessageChannel channel, String protocol, Reader payload) Called when this session has received a message from the message channel.default SessionScopescope()The scope in which this context represents -- Client or Designervoidshutdown()Shut down the session.voidstartup()Start up the session.voidupdateSessionProps(SessionPropsConfig config) Update the props and bindings associated with this sessionvoidvisitPage(String pageId, InternalSession.PageVisitor visitor) Visit the page associated with the given ID.Methods inherited from interface AuditingContext
audit, getAuditSnapshotMethods inherited from interface LoggingContext
getLogger, mdc, mdcSetupTree, mdcTeardownTree, mdcWrapMethods inherited from interface PerspectiveElement
createPropertyReference, getAuditProfile, getQualifiedPathMethods inherited from interface PropertyTreeOwner
getPropertyTreeOfMethods inherited from interface Session
createViewModel, findViewConfig, getEventManager, getGatewayContext, getMdcParent, getName, getNamedQueryManager, getPage, getPageTimeout, getProjectName, getScriptManager, getSession, getSessionId, getSessionStats, getTagHistoryManager, getTagManager, getView, getWebAuthStatus, mdcSetup, mdcTeardown, queue, refreshBinding, sendErrorToDesigner
-
Field Details
-
SESSION
-
-
Method Details
-
startup
void startup()Start up the session.- Throws:
IllegalStateException- if the session has already been started or shutdown
-
shutdown
void shutdown()Shut down the session.- Throws:
IllegalStateException- if the session has not been started or if it has already been shut down
-
isRunning
boolean isRunning()- Specified by:
isRunningin interfacePerspectiveElement- Returns:
- true if the session has started and has not yet been shut down
- See Also:
-
notifyConnected
Let the session know that the page has connected- Parameters:
channel- theMessageChannelused for communications between the client page and the gateway page
-
notifyDisconnected
Let the session know that the page has disconnected- Parameters:
channel- theMessageChannelused for communications between the client page and the gateway page
-
destroySession
default void destroySession()Destroys the session by removing it from its containing session collection and shutting it down (which should close any connected message channels). -
receive
Called when this session has received a message from the message channel.- Parameters:
channel- theMessageChannelfrom which the message was receivedprotocol- the protocol of the messagepayload- the payload of the message
-
getOrCreatePage
Fetch thePageModelassociated 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
-
getPages
-
getPageCount
int getPageCount() -
getViewCount
int getViewCount() -
getComponentCount
int getComponentCount() -
getBindingCount
int getBindingCount() -
getLatencyMs
default long getLatencyMs()- Returns:
- the session's most recent network-latency measurement, in milliseconds, or
0if no measurement has been recorded yet. Exposed as a direct field read so callers iterating every session (e.g. the diagnostic-digest summary path) can avoid the per-session walk ofSessionStats#getAllMetrics().
-
visitPage
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
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
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
void onSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse) 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
com.inductiveautomation.ignition.gateway.auth.idp.WebAuthSessionContext logout(@Nullable String message) Logout this session. The user will no longer be authenticated against the session's IdP.Read the IdP to send the logout to from the returned context, not from
Session.getWebAuthStatus()before calling this: a logout waits for any sign-in in progress, so the user it signs out may have just signed in through a different IdP.- Parameters:
message- the message to display to the user after they are logged out of this session- Returns:
- the context this logout replaced, naming the IdP the user was signed in through and carrying that IdP's logout hint, if any. never null.
-
onLoginResponse
void onLoginResponse(com.inductiveautomation.ignition.gateway.auth.web.response.WebAuthResponseContext webAuthResponseContext) throws com.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderException Called when the session receives a login response from the IdP.The response is not always applied - the responding IdP may not be one this session permits, the user may have cancelled, or the IdP may no longer exist or its response may not parse. The reason is thrown rather than logged and dropped so the caller can audit the outcome it actually got instead of assuming success.
- Parameters:
webAuthResponseContext- the login response object- Throws:
com.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderCancellationException- if the user cancelled the login at the IdPcom.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderNotAllowedException- if the responding IdP is not one this session permitscom.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderException- if the response was not applied for any other reason
-
onLogoutResponse
void onLogoutResponse(com.inductiveautomation.ignition.gateway.auth.web.response.WebAuthResponseContext webAuthResponseContext) throws com.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderException Called when this session received a logout response from the IdP.The session was already signed out when the logout request leg ran, before the redirect to the IdP, so a throw from here means only that the IdP's confirmation could not be validated. The sign-out itself stands either way; the reason is thrown so the caller can audit what actually happened instead of assuming the round trip completed cleanly.
- Parameters:
webAuthResponseContext- the logout response object- Throws:
com.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderCancellationException- if the user cancelled the logout at the IdPcom.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderException- if the response could not be validated for any other reason
-
getSessionCollection
PerspectiveSessionCollection getSessionCollection()- Returns:
- the
PerspectiveSessionCollectionwhich contains this session
-
getPerspectiveContext
- Specified by:
getPerspectiveContextin interfaceSession
-
scope
Description copied from interface:SessionThe scope in which this context represents -- Client or Designer -
getLocale
Locale getLocale()The current locale for this session, or a safe defaultLocale.getDefault()if not available. -
getTimeZoneId
String getTimeZoneId()The current timezone id for this session, or a safe default if not available. -
getTimeZone
The current timezone for this session, or a safe default if not available. -
onKeepaliveReceived
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
Update the props and bindings associated with this session- Parameters:
config- the session props config to apply
-
getProject
Fetch the project associated with this session.- Returns:
- the
PerspectiveProjectassociated with this session - Throws:
IllegalStateException- if the project associated with this session does not exist
-
onHello
void onHello()Called every time the hello API is invoked on this session. -
getSessionInfo
PerspectiveSessionInfo getSessionInfo()- Returns:
- a report about this session
-
getUptime
-
getLastComm
-
getSessionClosedMessage
String getSessionClosedMessage()- Returns:
- the default message sent to the client when the session is closed
-
getPageClosedMessage
String getPageClosedMessage()- Returns:
- the default message sent to the client then a page is closed
-
getLogoutMessage
String getLogoutMessage()- Returns:
- the default message sent to the client when the user logs out
-
close
-
createToken
-
claimToken
Optional<com.inductiveautomation.ignition.common.gson.JsonElement> claimToken(String type, String token) Claim the given token associated with the given data type previously created by this session.- Parameters:
token- the token to claim- Returns:
- an
Optionalcontaining theJsonElementdata associated with the given data type and token, or an empty Optional if no data exists for the given data type and token pair
-