Kerberos 및 Negotiate 인증

지원 대상

TsgcWebSocketServer

TsgcWebSocketHTTPServer

TsgcWebSocketProxyServer

TsgcWebSocketServer_HTTPAPI

*sgcWebSockets Enterprise Edition이 필요합니다. 다른 에디션에서 Negotiate를 활성화한 서버를 시작하면 "Negotiate authentication requires sgcWebSockets Enterprise" 예외가 발생합니다.

개요

Negotiate는 Windows 통합 인증의 기반이 되는 HTTP 인증 스킴입니다. 클라이언트는 Kerberos(SPNEGO)로 자신의 ID를 증명하며, Windows에서는 NTLM으로 폴백하므로 이미 도메인에 로그인한 사용자는 비밀번호를 입력하지 않고 연결할 수 있습니다. 인트라넷 영역의 브라우저, curl --negotiate, 기본 자격 증명을 사용하는 .NET 클라이언트 모두 이 챌린지에 응답할 수 있습니다.

플랫폼

속성과 이벤트

예제

다음 서버는 두 개의 주체만 수락합니다. 이벤트는 주체 이름으로 접근을 제한합니다.


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;

Linux에서는 Authentication.Negotiate.Keytab을 keytab 경로(예: /etc/sgc/http.keytab)로 설정하고, 이벤트에서 alice@EXAMPLE.COM과 같은 Kerberos 주체를 사용하십시오.

교환 방식

curl로 테스트

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

설정 참고 사항