exampleDelegateMethod

exampleDelegateMethod(token: String): Boolean typeMethod;

The exampleDelegateMethod method of the JadeRequiredDelegateClaimAnnotation class provides an example of the required format for the delegate method, passing the token parameter to that method, and returns true if the delegate method is successfully called.

If the method value of the delegateMethod property does not match the signature of the exampleDelegateMethod method, the validateToken method returns false.

The following is an example of a delegate method that matches the exampleDelegateMethod signature.

verifyFooIsBar(token: String): Boolean typeMethod;
constants
    Body = JadeRequiredClaimAnnotation.Location_Body;
    HS256 = JadeRestService.EncryptionAlg_HS256;
    HS384 = JadeRestService.EncryptionAlg_HS384;
    HS512 = JadeRestService.EncryptionAlg_HS512;
vars
    isFooBar : Boolean;
    isForMe  : Boolean;
    algOK    : Boolean;
begin
    isFooBar := JadeJWTValidator@verifySingleValueClaim(Body, token, "Foo", "Bar");
    isForMe := JadeJWTValidator@verifyAudienceClaim(token, "JADE");
    algOK := JadeJWTValidator@verifyAlgorithmClaim(token, HS256) 
               or JadeJWTValidator@verifyAlgorithmClaim(token, HS384) 
               or JadeJWTValidator@verifyAlgorithmClaim(token, HS512);
    return algOK and isForMe and isFooBar;
end;

2020.0.01 and higher