I’m working on a module that has a lot of data exposed as a REST API and I’m currently using HTTP Basic Auth against an Ignition user source for authentication. I’d like to add the ability to use these API endpoints from Perspective, and would like to use the Session ID (as the user would already be authenticated).
I’ve played with the following line of code and browsing around using breakpoints:
List<ClientReqSession> sessions = gatewayContext.getGatewaySessionManager().findSessions();
but I’m struggling to find a property that matches the Perspective SessionID session property that I see in my designer.
You can get the current sessionId with
This requires you depend on the Perspective module, first of all, and second that ThreadLocal is only populated if you make this call within the context of a Perspective request.
I think you’ll have to depend on Perspective regardless, though. Try this:
Get the Perspective
GatewayHook by calling
PerspectiveContext by calling
PerspectiveSessionMonitor by calling
Try looking up a session id using
Got it working - thanks for your help @Kevin.Herron!