NegotiateStream.ImpersonationLevel Propriedade
Definição
Obtém um valor que indica como o servidor pode usar as credenciais do cliente.Gets a value that indicates how the server can use the client's credentials.
public:
virtual property System::Security::Principal::TokenImpersonationLevel ImpersonationLevel { System::Security::Principal::TokenImpersonationLevel get(); };
public virtual System.Security.Principal.TokenImpersonationLevel ImpersonationLevel { get; }
member this.ImpersonationLevel : System.Security.Principal.TokenImpersonationLevel
Public Overridable ReadOnly Property ImpersonationLevel As TokenImpersonationLevel
Valor da propriedade
Um dos valores de TokenImpersonationLevel.One of the TokenImpersonationLevel values.
Exceções
A autenticação falhou ou não ocorreu.Authentication failed or has not occurred.
Exemplos
O exemplo de código a seguir demonstra como exibir o valor dessa propriedade.The following code example demonstrates displaying the value of this property.
static void DisplayAuthenticationProperties( NegotiateStream^ stream )
{
Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated );
Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated );
Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted );
Console::WriteLine( L"IsSigned: {0}", stream->IsSigned );
Console::WriteLine( L"ImpersonationLevel: {0}", stream->ImpersonationLevel );
Console::WriteLine( L"IsServer: {0}", stream->IsServer );
}
static void DisplayAuthenticationProperties(NegotiateStream stream)
{
Console.WriteLine("IsAuthenticated: {0}", stream.IsAuthenticated);
Console.WriteLine("IsMutuallyAuthenticated: {0}", stream.IsMutuallyAuthenticated);
Console.WriteLine("IsEncrypted: {0}", stream.IsEncrypted);
Console.WriteLine("IsSigned: {0}", stream.IsSigned);
Console.WriteLine("ImpersonationLevel: {0}", stream.ImpersonationLevel);
Console.WriteLine("IsServer: {0}", stream.IsServer);
}
Comentários
Você deve autenticar com êxito antes de chamar esse método.You must successfully authenticate before calling this method. Os clientes especificam o nível de representação quando solicitam autenticação chamando um AuthenticateAsClient dos BeginAuthenticateAsClient métodos ou.Clients specify the impersonation level when they request authentication by calling one of the AuthenticateAsClient or BeginAuthenticateAsClient methods. Se você autenticar sem especificar um TokenImpersonationLevel , Identification será usado.If you authenticate without specifying a TokenImpersonationLevel , Identification is used.