Has anyone worked with a high assurance session requirement and async apex?
I need to query the Security Health Check objects during an async process (the query happens in a queueable). If "View Health Check" is set to "Raise session to high assurance" on the Identity Verification page in the Setup menu, I get an error when trying to query the Security Health Check object: Requires Extra Verification
Using the SessionManagement class, I tried to:
- Use the
generateVerificationUrl
method to generate a verification url which raises session assurance level, and then start the queueable. The same issue occurred in the queueable making it seem like the high assurance session does not persist into an async action that the running user initiates. - Use the
setSessionLevel
method to try and raise the session assurance level from Apex without user input. I tried this in both the controller which launches the queueable (outside of async apex) as well as in the queueable itself. When I use thesetSessionLevel
method inside a queueable, i get a gack every time. What is the correct way to perform an action which requires a high assurance session inside an async apex context?
setSessionLevel
is the right incantation but what is a session in async context? Almost a philosophical question. Try calling out from your Queueable to your own code wrapped in an Apex REST service.