TsgcHTTP_JWT_Server › Events

TsgcHTTP_JWT_Server Events

Events you can handle, grouped by purpose, followed by the full alphabetical list.

Request pipeline

NameDescription
OnJWTBeforeRequestFired for every incoming HTTP/WebSocket request before any JWT processing; set Cancel=True to bypass JWT validation for this connection.
OnJWTUnauthorizedFired when the request has no valid JWT and is about to be rejected; set Disconnect=False to still accept it (for example, CORS pre-flight requests).
OnJWTExceptionFired when an exception is raised while decoding or validating the token so the application can log the error.
OnJWTResponseErrorFired just before the Unauthorized HTTP response is sent, allowing the code (default 401), text (default "Unauthorized") and headers to be customized.

Validation

NameDescription
OnJWTBeforeValidateTokenFired after a Bearer token is extracted and before it is validated; set Cancel=True to skip validation (the request is then treated as authorized).
OnJWTBeforeValidateSignatureFired after the JWT is decoded and before its signature is verified, exposing the decoded Header and Payload and allowing the validation Secret / PublicKey to be overridden per token.
OnJWTAfterValidateTokenFired after the signature and claim validations run; inspect Header, Payload and Error, and flip the Valid flag to accept or reject the token.

All Events (alphabetical)

NameDescription
OnJWTAfterValidateTokenFired after the signature and claim validations run; inspect Header, Payload and Error, and flip the Valid flag to accept or reject the token.
OnJWTBeforeRequestFired for every incoming HTTP/WebSocket request before any JWT processing; set Cancel=True to bypass JWT validation for this connection.
OnJWTBeforeValidateSignatureFired after the JWT is decoded and before its signature is verified, exposing the decoded Header and Payload and allowing the validation Secret / PublicKey to be overridden per token.
OnJWTBeforeValidateTokenFired after a Bearer token is extracted and before it is validated; set Cancel=True to skip validation (the request is then treated as authorized).
OnJWTExceptionFired when an exception is raised while decoding or validating the token so the application can log the error.
OnJWTResponseErrorFired just before the Unauthorized HTTP response is sent, allowing the code (default 401), text (default "Unauthorized") and headers to be customized.
OnJWTUnauthorizedFired when the request has no valid JWT and is about to be rejected; set Disconnect=False to still accept it (for example, CORS pre-flight requests).