Servidor OAuth 2.0 (TsgcHTTP_OAuth2_Server) — sgcWebSockets | eSeGeCe

OAuth 2.0 Server

Server-side OAuth 2.0 protector for sgcWebSockets HTTP and WebSocket servers. Verify access tokens via JWT validation or RFC 7662 introspection.

TsgcHTTP_OAuth2_Server

Lightweight resource-server component — verifies inbound Bearer tokens via JWT signature checks or RFC 7662 token introspection, then exposes the parsed claims to your application.

Clase del componente

TsgcHTTP_OAuth2_Server

Plataformas

Windows, macOS, Linux, iOS, Android

Edición

Enterprise

Drop, attach to your server, accept tokens

Configure JWT key (or introspection URL), then attach to TsgcWebSocketHTTPServer.OAuth2 — incoming requests get token-verified before your handler fires.

uses
  sgcWebSocket, sgcHTTP;

var
  Server: TsgcWebSocketHTTPServer;
  OAuth2: TsgcHTTP_OAuth2_Server;
begin
  OAuth2 := TsgcHTTP_OAuth2_Server.Create(nil);
  OAuth2.OAuth2Options.JWT.Algorithms.HS.Secret := 'shared-secret';

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

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

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

Qué incluye

Resource-server component that protects HTTP and WebSocket endpoints with JWT-validated or introspection-validated access tokens.

JWT validation

Built-in JWT verifier (HS / RS / ES / EdDSA) against either a static key or a JWKS endpoint — no round trip to the issuer for self-contained tokens.

Token introspection

Set OAuth2Options.IntrospectionURL per RFC 7662 — the component POSTs the inbound token to the issuer and caches the active/inactive result with a TTL.

Scope enforcement

Attach OAuth2Options.RequiredScope to limit access to tokens carrying the chosen scope. OnAuthError reports the rejection reason.

WebSocket-aware

Works with both HTTP requests and WebSocket upgrades — the upgrade Authorization header (or query token) is verified before OnConnect.

OnVerify hook

Implement OnVerify for custom claim checks (multi-tenant aud, dynamic scope mapping, account-status). Return Accept = False to short-circuit with 401.

Provider sibling

TsgcHTTP_OAuth2_Server_Provider turns this component into a full authorization server (issuer): authorize, token and revoke endpoints with persistent client/refresh-token storage.

Especificaciones y referencias

Fuentes autorizadas de los estándares que implementa este componente.

Documentación y Demos

Enlace directo a la referencia del componente, descarga el proyecto demo listo para ejecutar y la prueba gratuita.

Online Help — TsgcHTTP_OAuth2_Server Referencia completa de propiedades, métodos y eventos de este componente.
Demo Project — Demos\20.HTTP_Protocol\02.OAuth2_Authentication Proyecto de ejemplo listo para ejecutar. Se incluye en el paquete sgcWebSockets — descarga la prueba gratuita más abajo.
Documento técnico (PDF) Características, inicio rápido, ejemplos de código para Delphi y C++ Builder y referencias de fuentes primarias — solo este componente.
Manual de usuario (PDF) Manual completo que cubre todos los componentes de la biblioteca.
La mejor opción: All-AccessTodos los productos de eSeGeCe, con Premium Support incluido, desde €1,059 al año.
Ver precios de All-Access

Ready to Protect APIs with OAuth 2.0?

Download the free trial and add OAuth 2.0 token validation to your Delphi servers.