No items found.

Custom External Token Validator Provider

The Custom External Token Validator Provider enables the validation and interpretation within Kuika of tokens generated by external identity providers (SSO, external authentication services, mobile token services, etc.). Thanks to this provider, access tokens coming from outside Kuika are verified, and user information is securely transferred to the system.

It can be used in the following situations:

  • If the application uses an external authentication system (SSO, OAuth-based services, custom authentication services),
  • If users log in to Kuika using an external token instead of a username and password,
  • If you want to verify the validity of tokens coming from mobile apps, gateways, or third-party systems.

Creation steps:

  1. Select C# Functions and enter a name.
  2. From the Template field, select the Custom External Token Validator Provider template.
  3. Click the CREATE button.

Custom External Token Validator Class

The class in the template implements the IExternalTokenValidator interface and manages the validation process for external tokens received by Kuika.

TokenProviderType Property

public EExternalTokenProviderTypes TokenProviderType =>EExternalTokenProviderTypes.External1;

This property specifies which “slot” the validator is associated with. It can take values between External1 and External5; the default value is External1.

An incoming request reaches this validator only when it specifies the same slot. The slot is specified in two ways:

  • via the providerType field in the body of the /auth/loginwithtoken request,
  • or via the external_provider_type=“External1” attribute when the application is embedded as an MFE.
If you add a second external token validator, assign it both a different slot (e.g., External2) and a different class name. Since all validators are created within the same Kuika.ThirdPartyApisCollection namespace, two classes with the same name cannot be compiled.

Validate Method

public ExternalTokenResult Validate(ExternalTokenRequest request)

Used to check the validity of an external token received by Kuika and return user information as a result of the validation.

Tasks:

  • Verify the validity of the incoming TokenString value
  • Identify the user associated with the token
  • Return the credentials that Kuika will use

Example return:

return new ExternalTokenResult()
{
RefreshToken = request.RefreshToken,
Token = request.TokenString,
UserName = request.Username,
Name = null,
Surname = null,
PhoneNumber = null
};
Fields that return null are considered invalid by Kuika; non-null fields are actively used by Kuika.

RefreshToken Method

public ExternalTokenResult RefreshToken(ExternalRefreshTokenRequest request)

Enables the updating of expired or tokens requiring renewal via the refresh token.

Tasks:

  • Validate the refresh token
  • Return new or updated token information to Kuika

Example return:

return new ExternalTokenResult()
{
RefreshToken = request.RefreshToken,
Token = request.TokenString
};