Interface ISoImpersonationService
Namespace: SuperOffice.Security
Assembly: SoCore.dll
Syntax
public interface ISoImpersonationService
Methods
CanImpersonate(ClaimsPrincipal)
Check if the user represented by the provided principle is permitted to impersonate.
Declaration
bool CanImpersonate(ClaimsPrincipal impersonator)
Parameters
Type | Name | Description |
---|---|---|
ClaimsPrincipal | impersonator | The user to check if it has the permission to impersonate |
Returns
Type | Description |
---|---|
bool | True if the user represented by the provided principle is permitted to impersonate. |
Impersonate(string)
Impersonate as the user with the provided user name. Only users of type System logged in with username and passwords are permitted to impersonate. Call Dispose() or SoImpersonationContext.Revert. Impersonation is not supported with remote mode.
Declaration
SoImpersonationContext Impersonate(string user)
Parameters
Type | Name | Description |
---|---|---|
string | user | Name of the user to impersonate as. |
Returns
Type | Description |
---|---|
SoImpersonationContext | Disposable context for the impersonation. |
Remarks
Impersonation lives in the thread scope. Threads executed with the SoContext.SpawnThread will also be executed inside the scope of the impersonated user. It is not permitted to log out using Close() or in any other way end the current session like calling SoSession.Suspend while in a impersonated state.