SessionSecurityTokenHandler.CreateToken(SecurityTokenDescriptor) 方法

定义

创建基于指定标记描述符的安全令牌。Creates a security token based on the specified token descriptor.

public:
 override System::IdentityModel::Tokens::SecurityToken ^ CreateToken(System::IdentityModel::Tokens::SecurityTokenDescriptor ^ tokenDescriptor);
public override System.IdentityModel.Tokens.SecurityToken CreateToken (System.IdentityModel.Tokens.SecurityTokenDescriptor tokenDescriptor);
override this.CreateToken : System.IdentityModel.Tokens.SecurityTokenDescriptor -> System.IdentityModel.Tokens.SecurityToken
Public Overrides Function CreateToken (tokenDescriptor As SecurityTokenDescriptor) As SecurityToken

参数

tokenDescriptor
SecurityTokenDescriptor

用于创建标记的标记说明符。The token descriptor from which to create the token.

返回

SecurityToken

创建的安全令牌。The security token that was created. 这将是 SessionSecurityToken 的实例。This will be an instance of SessionSecurityToken.

例外

tokenDescriptornulltokenDescriptor is null.

Configuration 属性为 nullThe Configuration property is null.

注解

通过在标记描述符中使用以下属性,创建并返回会话安全令牌: SecurityTokenDescriptor.SubjectSecurityTokenDescriptor.LifetimeCreates and returns a session security token by using the following properties in the token descriptor: SecurityTokenDescriptor.Subject, and SecurityTokenDescriptor.Lifetime. 如果在 SecurityTokenHandlerConfiguration.SaveBootstrapContext true 属性指定的令牌处理程序配置上设置了该属性 Configuration ,则会从该属性创建引导上下文,并将其 SecurityTokenDescriptor.Token 保存在会话令牌中。If the SecurityTokenHandlerConfiguration.SaveBootstrapContext property is set true on the token handler configuration specified by the Configuration property, the bootstrap context is created from the SecurityTokenDescriptor.Token property and is saved in the session token.

适用于