Uwierzytelnianie Kerberos i Negotiate

Obsługiwane przez

TsgcWebSocketServer

TsgcWebSocketHTTPServer

TsgcWebSocketProxyServer

TsgcWebSocketServer_HTTPAPI

*Wymaga sgcWebSockets Enterprise Edition. W innych edycjach uruchomienie serwera z włączonym Negotiate zgłasza wyjątek "Negotiate authentication requires sgcWebSockets Enterprise".

Przegląd

Negotiate to schemat uwierzytelniania HTTP stojący za zintegrowanym uwierzytelnianiem systemu Windows. Klient potwierdza swoją tożsamość za pomocą Kerberos (SPNEGO) lub, w systemie Windows, przechodzi awaryjnie na NTLM, dzięki czemu użytkownicy już zalogowani do domeny łączą się bez wpisywania hasła. Na wyzwanie mogą odpowiedzieć przeglądarki w strefie intranetu, curl --negotiate oraz klienty .NET używające domyślnych poświadczeń.

Platformy

Właściwości i zdarzenie

Przykład

Poniższy serwer akceptuje tylko dwa podmioty. Zdarzenie ogranicza dostęp według nazwy podmiotu.


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;

W systemie Linux ustaw Authentication.Negotiate.Keytab na ścieżkę do pliku keytab, na przykład /etc/sgc/http.keytab, a w zdarzeniu użyj podmiotu Kerberos, takiego jak alice@EXAMPLE.COM.

Jak przebiega wymiana

Test za pomocą curl

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

Uwagi dotyczące konfiguracji