Proveedor OAuth 2.0 (TsgcHTTP_OAuth2_Server_Provider) — sgcWebSockets | eSeGeCe

OAuth 2.0 Provider

Stand up your own OAuth 2.0 authorization server in Delphi. Authorize, token, refresh and revoke endpoints with PKCE, signed JWT access tokens and pluggable storage.

TsgcHTTP_OAuth2_Server_Provider

Full OAuth 2.0 authorization-server implementation: registers clients, issues authorization codes, exchanges them for access + refresh tokens, signs JWTs and supports PKCE, refresh rotation and revocation.

Clase del componente

TsgcHTTP_OAuth2_Server_Provider

Plataformas

Windows, macOS, Linux, iOS, Android

Edición

Enterprise

Drop, configure clients, run

Drop a TsgcHTTP_OAuth2_Server_Provider, register your client_ids and redirect_uris, attach to TsgcWebSocketHTTPServer — the standard endpoints (/authorize, /token, /revoke) become available.

uses
  sgcWebSocket, sgcHTTP;

var
  Server: TsgcWebSocketHTTPServer;
  Provider: TsgcHTTP_OAuth2_Server_Provider;
begin
  Provider := TsgcHTTP_OAuth2_Server_Provider.Create(nil);
  Provider.ProviderOptions.AuthorizationEndpoint := '/oauth/authorize';
  Provider.ProviderOptions.TokenEndpoint         := '/oauth/token';
  Provider.ProviderOptions.RevocationEndpoint    := '/oauth/revoke';
  Provider.ProviderOptions.PKCE.Required := True;

  Provider.OnAuthorizeRequest := procedure(Sender: TObject;
    const aRequest: TsgcOAuth2_AuthorizeRequest;
    var aResponse: TsgcOAuth2_AuthorizeResponse)
  begin
    // validate user session, issue or deny the auth code
    aResponse.Code := GenerateAuthCode(aRequest.ClientId, aRequest.UserId);
  end;

  Server := TsgcWebSocketHTTPServer.Create(nil);
  Server.Port := 8443;
  Server.SSL  := True;
  Server.OAuth2.Provider := Provider;
  Server.Active := True;
end;
// uses: sgcWebSocket, sgcHTTP
TsgcHTTP_OAuth2_Server_Provider *Provider = new TsgcHTTP_OAuth2_Server_Provider(this);
Provider->ProviderOptions->AuthorizationEndpoint = "/oauth/authorize";
Provider->ProviderOptions->TokenEndpoint        = "/oauth/token";

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

Qué incluye

A self-hosted authorization server — everything from /authorize to refresh-token rotation in one Delphi component.

Authorize endpoint

Handles GET /authorize requests, validates response_type, client_id and redirect_uri, then raises OnAuthorizeRequest for your user-session login UI.

Token endpoint

POST /token issues access + refresh tokens for the authorization_code, refresh_token and client_credentials grants. PKCE code_verifier is verified per RFC 7636.

JWT-signed access tokens

Optionally issue self-contained JWT access tokens (HS or RS / ES) so resource servers can validate without an introspection round-trip.

Refresh-token rotation

When ProviderOptions.RefreshToken.Rotation is enabled, every refresh issues a new refresh-token and invalidates the previous one — aligning with OAuth 2.1 best practice.

Revocation endpoint

POST /revoke invalidates an access or refresh token per RFC 7009 — honours both Bearer and client_credentials revocations.

Pluggable storage

OnLookupClient, OnPersistAuthCode, OnPersistRefreshToken and friends let you back the provider with FireDAC, SQLite, Redis or your own DAL.

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_Provider Referencia completa de propiedades, métodos y eventos de este componente.
Demo Project — Demos\20.HTTP_Protocol\08.OAuth2_ServerProvider 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 Run Your Own OAuth 2.0 Provider?

Download the free trial and stand up an OAuth 2.0 authorization server in Delphi.