Autenticazione Kerberos e Negotiate

Supportato da

TsgcWebSocketServer

TsgcWebSocketHTTPServer

TsgcWebSocketProxyServer

TsgcWebSocketServer_HTTPAPI

*Richiede l'edizione Enterprise di sgcWebSockets. Nelle altre edizioni, l'avvio di un server con Negotiate abilitato solleva l'eccezione "Negotiate authentication requires sgcWebSockets Enterprise".

Panoramica

Negotiate è lo schema di autenticazione HTTP alla base dell'autenticazione integrata di Windows. Il client dimostra la propria identità con Kerberos (SPNEGO) oppure, su Windows, ricorre a NTLM, in modo che gli utenti che hanno già effettuato l'accesso a un dominio si connettano senza digitare una password. I browser in una zona intranet, curl --negotiate e i client .NET che usano le credenziali predefinite possono tutti rispondere alla richiesta.

Piattaforme

Proprietà ed evento

Esempio

Il server seguente accetta solo due principal. L'evento limita l'accesso in base al nome del principal.


uses
  sgcWebSocket, sgcWebSocket_Classes;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    oServer: TsgcWebSocketHTTPServer;
    procedure OnNegotiateAuthenticationEvent(Connection: TsgcWSConnection;
      const aPrincipal: String; var Authenticated: Boolean);
  end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  oServer := TsgcWebSocketHTTPServer.Create(Self);
  oServer.Port := 8080;
  oServer.Authentication.Enabled := True;
  oServer.Authentication.Negotiate.Enabled := True;
  oServer.Authentication.Negotiate.ServicePrincipal :=
    'HTTP/host.example.com@EXAMPLE.COM';
  oServer.OnNegotiateAuthentication := OnNegotiateAuthenticationEvent;
  oServer.Active := True;
end;

procedure TForm1.OnNegotiateAuthenticationEvent(Connection: TsgcWSConnection;
  const aPrincipal: String; var Authenticated: Boolean);
begin
  Authenticated := SameText(aPrincipal, 'EXAMPLE\alice') or
    SameText(aPrincipal, 'EXAMPLE\bob');
end;

Su Linux, imposti Authentication.Negotiate.Keytab sul percorso del keytab, ad esempio /etc/sgc/http.keytab, e usi nell'evento un principal Kerberos come alice@EXAMPLE.COM.

Come funziona lo scambio

Test con curl

curl --negotiate -u : http://host.example.com:8080/

Note di configurazione