IIdentityApi Interface

Provide the methods for working with user identity

Definition

Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime (in Casewhere.Runtime.dll) Version: 2.9.8.6
C#
public interface IIdentityApi

Methods

CheckUserSessionValidity Check user session still valid/active

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
identityApi.CheckUserSessionValidity("623977EE-BD06-4256-8D66-9B94A7BE6FCC");
CreateAuthorizationCode To create an authorization code to serve for getting the access token later.

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
var model = new AuthorizationCodeModel 
{
    WorkerSiteDomain = "your-worker.casewhere.com",
    Username = "NemUser",
    Claims = new Dictionary<string, string>{ { "CPR", "12345" } },
    ExpiredSessionMinutes = 180
};
identityApi.CreateAuthorizationCode(model);
GetClaims Get all values of a given claim in the current user claim collection.
GetExpiredTime Get the user session expired time

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
identityApi.GetExpiredTime("623977EE-BD06-4256-8D66-9B94A7BE6FCC");
GetUserClaims Get the claim collection of the current user.
GetUserClaimsBySPIdPSession Get the claim collection of a given SPIDPSessionId
GetUserClaimsByUserSessionId Get the claim collection of a given UserSessionId
Impersonate To pretend to be someone else by changing another username

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
identityApi.Impersonate("dtt");
RemoveClaim Remove a given claim in the current user claim collection.
SetClaim Set the new claim into identity

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
identityApi.SetClaim("CPR", "123456789");
SetClaimForSPIdPSession Update the claim set of the given SPIdPSession and this update will affect to the access token later

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
identityApi.SetClaimForSPIdPSession("00000000-0000-0000-0000-000000000000", "CPR", "123456789");
SetClaimForUserSession Update the claim set of the given UserSession and this update will affect to the access token right after

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
identityApi.SetClaimForUserSession("00000000-0000-0000-0000-000000000000", "CPR", "123456789");
TerminateAccessToken To terminate all user sessions related to given access token.

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
identityApi.TerminateAccessToken("Enter your access token");
TerminateUserSession(Guid) To terminate the user session of given userSessionId.

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
identityApi.TerminateUserSession("623977EE-BD06-4256-8D66-9B94A7BE6FCC");
TerminateUserSession(String) To terminate the user session of given username.

Example

C#
var identityApi = ctx.Use<IIdentityApi>();
identityApi.TerminateUserSession("dtt");
TryToGetUserToken Try to get the user token from the given access token.

See Also