JWT 서버

서버 측 JWT 검증이에요. TsgcHTTP_JWT_Server를 TsgcWebSocketHTTPServer에 연결하여 요청을 디스패치하기 전에 Authorization Bearer 토큰을 검증해요.

TsgcHTTP_JWT_Server

수신된 JWT를 서명 키(HMAC, RSA, ECDSA, EdDSA)에 대해 검증하고, exp/nbf/aud/iss 클레임을 확인하며, 일치하지 않는 토큰을 애플리케이션 계층을 위한 타입화된 이벤트로 거부해요.

컴포넌트 클래스

TsgcHTTP_JWT_Server

프로토콜

RFC 7519 (JWT)

플랫폼

Windows, macOS, Linux, iOS, Android

에디션

Enterprise

Drop, attach to server, verify on every request

Drop a TsgcHTTP_JWT_Server, configure the verifying keys (or a JWKS URL) and attach to TsgcWebSocketHTTPServer.JWT — all incoming requests are validated automatically.

uses
  sgcWebSocket, sgcHTTP;

var
  Server: TsgcWebSocketHTTPServer;
  JWT: TsgcHTTP_JWT_Server;
begin
  JWT := TsgcHTTP_JWT_Server.Create(nil);
  JWT.JWTOptions.Algorithms.HS.Secret := 'shared-secret';
  JWT.JWTOptions.Verify.Issuer   := 'auth.example.com';
  JWT.JWTOptions.Verify.Audience := 'api.example.com';

  Server := TsgcWebSocketHTTPServer.Create(nil);
  Server.Port := 8443;
  Server.SSL  := True;
  Server.Authentication.JWT.Enabled := True;
  Server.Authentication.JWT.Server  := JWT;

  Server.Active := True;
end;
// uses: sgcWebSocket, sgcHTTP
TsgcHTTP_JWT_Server *JWT = new TsgcHTTP_JWT_Server(this);
JWT->JWTOptions->Algorithms->HS->Secret = "shared-secret";

TsgcWebSocketHTTPServer *Server = new TsgcWebSocketHTTPServer(this);
Server->Authentication->JWT->Enabled = true;
Server->Authentication->JWT->Server  = JWT;
Server->Active = true;

내부 구성

Server-side JWT verifier that integrates directly with TsgcWebSocketHTTPServer and TsgcWebSocketServer authentication.

Multi-algorithm verify

Supports HS256/384/512, RS256/384/512, ES256/384/512, PS256/384/512 and EdDSA. Multiple keys (kid-indexed) can be loaded for key rotation.

Standard claim checks

Verify.Issuer, Verify.Audience, Verify.Subject, Verify.NotBefore, Verify.ExpirationTime are all enforced against the inbound payload by default.

JWKS endpoint

Point JWTOptions.JWKS.URL at an issuer JWKS endpoint — the component fetches the public keys, caches them and rotates per the JWK kid in each token header.

On-failure event

OnAuthError exposes the rejection reason (signature mismatch, expired, audience mismatch); your app decides whether to 401 or fall back.

WebSocket hooks

Works for TsgcWebSocketServer too — the WebSocket upgrade carries the Authorization header, the JWT server verifies before OnConnect fires.

JWE support

Encrypted JWE tokens are decoded and verified inline using the configured private key (RSA-OAEP, ECDH-ES key wrap; AES-CBC / AES-GCM content encryption).

사양 및 참조

이 컴포넌트가 구현하는 표준의 공식 출처예요.

문서 및 데모

컴포넌트 레퍼런스 링크, 즉시 실행 가능한 데모 프로젝트, 체험판 다운로드를 제공해요.

온라인 도움말 — TsgcHTTP_JWT_Server 이 컴포넌트의 전체 속성, 메서드, 이벤트 레퍼런스예요.
Demo Project — Demos\20.HTTP_Protocol\05.JWT 즉시 실행 가능한 예제 프로젝트예요. sgcWebSockets 패키지에 포함돼 있어요 — 아래에서 체험판을 다운로드하세요.
기술 문서 (PDF) 이 컴포넌트의 기능, 빠른 시작, Delphi 및 C++ Builder 코드 샘플, 기본 출처 참조를 포함해요.
사용자 매뉴얼 (PDF) 라이브러리의 모든 컴포넌트를 다루는 종합 매뉴얼이에요.

Ready to Verify JWTs Server-side?

Download the free trial and add JWT validation to your Delphi servers.