TsgcWebSocketHTTPServer › Eventos › OnNegotiateAuthentication

OnNegotiateAuthentication Event

Dispara quando uma troca Kerberos ou NTLM (Negotiate) é concluída, para que a aplicação possa aceitar ou rejeitar o principal autenticado.

Sintaxe

property OnNegotiateAuthentication: TsgcWSNegotiateAuthenticationEvent;
// TsgcWSNegotiateAuthenticationEvent = procedure(Connection: TsgcWSConnection; const aPrincipal: String; var Authenticated: Boolean) of object

Valor Padrão

—

Observações

Requer a Edição Enterprise do sgcWebSockets. OnNegotiateAuthentication é gerado quando a troca Kerberos ou NTLM iniciada por Authentication.Negotiate.Enabled é concluída. aPrincipal é a identidade autenticada: DOMAIN\user no Windows e user@REALM no Linux. Authenticated chega como True, portanto, sem um handler, todo principal autenticado pelo Windows ou pelo Kerberos é aceito. Defina-o como False para rejeitar o principal; o cliente então recebe uma resposta 401. Nos servidores Indy, o principal pode ser lido depois como TsgcWSConnectionServer(Connection).Authentication.User (AuthType é authNegotiate). Consulte Autenticação Kerberos e Negotiate.

Exemplo


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

Voltar para Eventos