TsgcHTTP_JWT_ClientProperties › JWTOptions

JWTOptions Property

Token configuration: algorithm, signing key material, standard claims and custom header/payload entries.

Syntax

property JWTOptions: TsgcHTTP_JWT_Client_Options read FJWTOptions write SetJWTOptions;

Default Value

Header.alg=jwtHS256; RefreshTokenAfter=0 (token regenerated on every request); all other string/integer claims empty.

Remarks

Publishes everything required to build and sign a JSON Web Token (RFC 7519). The sub-objects map 1:1 to the JWT wire format:

There is no Issuer/Audience/Expiration property at the root of JWTOptions; those RFC 7519 claims are set via Payload.iss, Payload.aud and Payload.exp respectively.

Example


oJWT.JWTOptions.Header.alg := jwtHS256;
oJWT.JWTOptions.Algorithms.HS.Secret := '79F66F1E-E998-436B-8A0A-3E5DEFA4FD9E';
oJWT.JWTOptions.Payload.iss := '2886EC7547B7BA6A9009';
oJWT.JWTOptions.Payload.sub := '1234567890';
oJWT.JWTOptions.Payload.iat := 1630925658;
oJWT.JWTOptions.Payload.exp := 1630933158;
oJWT.JWTOptions.Payload.AddKeyValue('origin', 'www.yourwebsite.com');
oJWT.JWTOptions.RefreshTokenAfter := 60 * 40;

Back to Properties