TsgcWebSocketProxyServer › Eventos › OnNegotiateAuthentication
Dispara quando uma troca Kerberos ou NTLM (Negotiate) é concluída, para que a aplicação possa aceitar ou rejeitar o principal autenticado.
property OnNegotiateAuthentication: TsgcWSNegotiateAuthenticationEvent;
// TsgcWSNegotiateAuthenticationEvent = procedure(Connection: TsgcWSConnection; const aPrincipal: String; var Authenticated: Boolean) of object
—
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.
procedure TForm1.OnNegotiateAuthenticationEvent(Connection: TsgcWSConnection;
const aPrincipal: String; var Authenticated: Boolean);
begin
Authenticated := SameText(aPrincipal, 'EXAMPLE\alice') or
SameText(aPrincipal, 'EXAMPLE\bob');
end;