JWT Utils

Official Content
This documentation is valid for:

Note: This is part of the GeneXus JWT Module and provides different utilities...

PrivateClaims

SetClaim

Adds a String private claim.

SetClaim(privateClaimKey, privateClaimValue)
  • Input privateClaimkey: Character(100)
  • Input privateClaimValue: Character(100)
  • Returns: Boolean true if the claim was added correctly.

Example:

&isOK = &PrivateClaims.SetClaim(&key, &value)

SetNestedClaim

(This method is available since GeneXus 16 Upgrade 11)

Adds nested private claims on multiple levels as an arborescent structure

SetNestedClaim(privateClaimKey, privateClaimObject)
  • Input privateClaimKey: Character(100)
  • Input privateClaimObject: PrivateClaim 
  • Returns: Boolean true if the claim was added correctly.

Example:

&isOK = &PrivateClaimsFather.SetNestedClaim(&key, &PrivateClaimsSon)

SetNumericClaim

(This method is available since GeneXus 17 Upgrade 2)

Adds a Numeric private claim.

SetNumericClaim(privateClaimKey, privateClaimValue)
  • Input privateClaimkey: Character(100)
  • Input privateClaimValue: Numeric(8.0)
  • Returns: Boolean true if the claim was added correctly.

Example:

&isOK = &PrivateClaims.SetNumericClaim(&key, &value)

SetBooleanClaim

(This method is available since GeneXus 17 Upgrade 2)

Adds a Boolean private claim.

SetBooleanClaim(privateClaimKey, privateClaimValue)
  • Input privateClaimkey: Character(100)
  • Input privateClaimValue: Boolean
  • Returns: Boolean true if the claim was added correctly.

Example:

&isOK = &PrivateClaims.SetBooleanClaim(&key, &value)

SetDateClaim

(This method is available since GeneXus 17 Upgrade 2)

Adds a Date private claim.

SetDateClaim(privateClaimKey, privateClaimValue)
  • Input privateClaimkey: Character(100)
  • Input privateClaimValue: Numeric(11.0)
  • Returns: Boolean true if the claim was added correctly.

Example:

&isOK = &PrivateClaims.SetDateClaim(&key, &value)
  • JWT uses an integer defined as UNIX time format, which is the number of seconds since the 1st of January of 1970 at 00.00.00. The complexity of this calculation is transparent to the user.

Revocation List

Defines a revocation list to be used on token verification.

DeleteFromRevocationList

Deletes a token ID from the revocation list.

DeleteFromRevocationList(id)
  • Input id: Character(100)
  • Returns: Boolean, true if it was successfully removed.

Example:

&RList.DeleteFromRevocationList(&id)

AddIDToRevocationList

Adds a token ID to the revocation list.

AddIDToRevocationList(id)
  • Input id: Character(100)
  • Returns void

Example:

&RList.AddIDToRevocationList(&id)

IsInRevocationList

Verifies if a given ID is included in the revocation list.

IsInRevocationList(id)
  • Input id: Character(100)
  • Returns true if the ID is present in the revocation list.

GUID

Deprecated since GeneXus 16 Upgrade 11, use GeneXus GUID data type instead.

GUID generator utility for token ID generation.

Generate

Generates a string GUID using platform default implementation.

Generate()
  • Returns Character(100) GUID

Example

 &guid = &GUID.Generate()

Implementation details:

  • Java - uses java.util.UUID implementation
  • .Net - uses System.Guid implementation

DateUtil

Deprecated since GeneXus 16 Upgrade 11, use GeneXus DateTime data type instead.

It retrieves system date and time using seconds to calculate registered time validating claims on the string format yyyy/MM/dd HH:mm:ss specific for the module definition.

This utility is made to bring a tool to manage Dates and Times in a human-readable form.

JWT uses an integer defined as UNIX time format, which is the number of seconds since the 1st of January of 1970 at 00.00.00. The complexity of this calculation is transparent to the user.

GetCurrentDate

Gets the current system date.

GetCurrentDate()
  • Returns Character(100) current date and time using seconds on the yyyy/MM/dd HH:mm:ss specific format.

Example:

&date = &DateUtil.GetCurrentDate()

CurrentPlusSeconds

Gets the system's current date and adds the specified seconds returning a string with the specific format for the module definition.

CurrentPlusSeconds(seconds)
  • Input seconds: Numeric(12.0)
  • Returns Character(100) string date formatted as yyyy/MM/dd HH:mm:ss

Example:

&date = &DateUtil.CurrentPlusSeconds(&seconds)

CurrentMinusSeconds

Gets the system's current date and subtracts the specified seconds returning a string with the specific format for the module definition.

CurrentMinusSeconds(seconds)
  • Input seconds: Numeric(12.0)
  • Returns Character(100)  string date formated yyyy/MM/dd HH:mm:ss

Example:

&date = &DateUtil.CurrentMinusSeconds(&seconds)