Class SoContext
Class holding context information about the currently logged on user.
Inherited Members
Namespace: SuperOffice
Assembly: SoCore.dll
Syntax
public sealed class SoContext
Examples
Log in and get the users home country:
SoSession session = SoSession.Authenticate("user", "password");
int countryId = SoContext.CurrentPrincipal.GetHomeCountryId();
session.Close();
Constructors
SoContext()
Class holding context information about the currently logged on user.
Declaration
public SoContext()
Examples
Log in and get the users home country:
SoSession session = SoSession.Authenticate("user", "password");
int countryId = SoContext.CurrentPrincipal.GetHomeCountryId();
session.Close();
Properties
CurrentIdentity
Obtain the current identity
Declaration
[Obsolete("Get ClaimsIdentity through SuperOffice.SoContext.CurrentPrincipal.GetClaimsIdentity() instead.")]
public static ClaimsIdentity CurrentIdentity { get; }
Property Value
Type | Description |
---|---|
ClaimsIdentity |
CurrentPrincipal
Obtain the current principal
Declaration
public static ClaimsPrincipal CurrentPrincipal { get; }
Property Value
Type | Description |
---|---|
ClaimsPrincipal |
IsAuthenticated
True if authenticated
Declaration
public static bool IsAuthenticated { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
CloseCurrentSession()
Close any open session. Does nothing if the current session is already closed.
Declaration
public static void CloseCurrentSession()
Remarks
Will no longer throw an exception if called twice.
ToString()
If there is a valid principal, return his ToString() - generally for debug purposes. An empty string is returned if there is no valid principal (_currentPrincipal returned null).
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | Current principal's ToString, or string.Empty if the current SoPrincipal is null |