SecurityTokenHandler.CreateSecurityTokenReference(SecurityToken, Boolean) Método

Definição

Quando substituído em uma classe derivada, cria a referência de token de segurança para tokens processados por essa classe.When overridden in a derived class, creates the security token reference for tokens processed by that class. Este método é geralmente chamado por um STS (serviço de token de segurança).This method is typically called by a security token service (STS).

public:
 virtual System::IdentityModel::Tokens::SecurityKeyIdentifierClause ^ CreateSecurityTokenReference(System::IdentityModel::Tokens::SecurityToken ^ token, bool attached);
public virtual System.IdentityModel.Tokens.SecurityKeyIdentifierClause CreateSecurityTokenReference (System.IdentityModel.Tokens.SecurityToken token, bool attached);
abstract member CreateSecurityTokenReference : System.IdentityModel.Tokens.SecurityToken * bool -> System.IdentityModel.Tokens.SecurityKeyIdentifierClause
override this.CreateSecurityTokenReference : System.IdentityModel.Tokens.SecurityToken * bool -> System.IdentityModel.Tokens.SecurityKeyIdentifierClause
Public Overridable Function CreateSecurityTokenReference (token As SecurityToken, attached As Boolean) As SecurityKeyIdentifierClause

Parâmetros

token
SecurityToken

O token para o qual a referência deve ser criada.The token for which the reference is to be created.

attached
Boolean

true se uma referência anexada deve ser criada; false se uma referência desanexada deve ser criada.true if an attached reference should be created; false if an unattached reference should be created.

Retornos

SecurityKeyIdentifierClause

Uma cláusula de identificador de chave que referencia o token especificado.A key identifier clause that references the specified token.

Exemplos

O código a seguir mostra como substituir o CreateSecurityTokenReference método para criar uma cláusula de identificador de chave do token especificado.The following code shows how to override the CreateSecurityTokenReference method to create a key identifier clause from the specified token. O código é extraído do Custom Token exemplo.The code is taken from the Custom Token sample. Este exemplo fornece classes personalizadas que permitem o processamento de tokens da Web simples (SWT).This sample provides custom classes that enable processing of Simple Web Tokens (SWT). Para obter informações sobre esse exemplo e outros exemplos disponíveis para o WIF e onde baixá-los, consulte o índice de exemplo de código do WIF.For information about this sample and other samples available for WIF and where to download them, see WIF Code Sample Index.

public override SecurityKeyIdentifierClause CreateSecurityTokenReference(SecurityToken token, bool attached)
{
    return token.CreateKeyIdentifierClause<LocalIdKeyIdentifierClause>();           
}

Comentários

Por padrão, esse método gera uma NotImplementedException exceção.By default this method throws a NotImplementedException exception.

As classes derivadas substituem esse método para retornar uma cláusula de identificador de chave ( SecurityKeyIdentifierClause ) que pode ser usada para criar um <wsse:SecurityTokenReference> elemento para o token especificado.Derived classes override this method to return a key identifier clause (SecurityKeyIdentifierClause) that can be used to create a <wsse:SecurityTokenReference> element for the specified token.

Chamado a partir de implementações da SecurityTokenService classe.Called from implementations of the SecurityTokenService class.

Normalmente, um não SecurityKeyIdentifierClause precisa ser usado, além de quando um serviço de token de segurança personalizado é criado.Typically, a SecurityKeyIdentifierClause does not need to be used, other than when a custom security token service is created. Quando um serviço de token de segurança retorna um token de segurança, o token de segurança emitido contém referências a tokens de segurança anexados e desanexados.When a security token service returns a security token, the issued security token contains references to attached and unattached security tokens. Referências anexadas se referem a tokens de segurança que estão contidos no cabeçalho de segurança de uma mensagem SOAP e as referências desanexadas referenciam tokens de segurança que não estão incluídos no cabeçalho de segurança de uma mensagem SOAP.Attached references refer to security tokens that are contained within the security header of a SOAP message and unattached references reference security tokens that are not included within the security header of a SOAP message. Essas referências normalmente afirmam a autenticidade do token de segurança emitido.These references typically affirm the authenticity of the issued security token.

Aplica-se a