This class allows you to interact with a user's session in the current browser

verifications

global cym.Browser.SessionVerifications verifications;

Return

Returns the SessionVerifications which the user has provided in the current session.

OwnerId

global Id OwnerId;

Return

The Id of the user who can login with this session

Id

global Id id;

Return

The Id of this session

lastLoginHistoryId

global Id lastLoginHistoryId;

Return

The last LoginHistory which was used with this session

isActive

global Boolean isActive();

Return

A boolean indicating if the session has been activated.

getRemoteApex

global cym.Remote.Apex getRemoteApex(Type fn);

Input

fn : A Type which extends the cym.Remote.Apex. The Apex Function will run under the session's OwnerId; even if the user is not currently logged in.

Return

A cym.Remote.Apex object which can be executed
This is a very powerful feature which mimics System.runAs but is not limited to testing. Use it with caution.

activate

global Session activate();
global Session activate(String requestId);
Fetches the required sid to start a session.
This method is mainly used from an guest context for passwordless login.

Input

requestId : A unique identifier of the authentication request. It's stored as part of the verification process and allows you to correlate multiple verifications belonging to the same request.
If you don't provide an identifier, a random value is generated.

Return

The current Session

resume

global PageReference resume(String startURL);
Use this method to establish the user session in the user's browser and redirect her to a specific page

Input

startURL : The relative URL where the user should be redirected after the session has been established

Return

PageReference where the user can be redirected
This is a very powerful feature which allows you to start a user session anytime. Always require a user verification (password, biometrics, ...) before calling it.

sync

global Session sync();
Use this method to synchronize the Salesforce Authenticators (password, TOTP, ...) with the current Session.

Return

The current Session

apply

global Session apply(cym.Community.Authenticator authenticator, Integer maxAge, String[] amrs);
Use this method to add a new nerification to the current session. You must ensure that the verification has been successfully completed by the user before using this method

Input

authenticator : A reference to the authenticator which was used during the user verification
maxAge : An integer which overrides the default authenticator maxAge
amrs : A list of amrs which override the default authenticator amrs

Return

The current Session