ClaimsIdentity.AddClaim(Claim) 方法

定义

添加单个声明到此声明标识。Adds a single claim to this claims identity.

public:
 virtual void AddClaim(System::Security::Claims::Claim ^ claim);
[System.Security.SecurityCritical]
public virtual void AddClaim (System.Security.Claims.Claim claim);
public virtual void AddClaim (System.Security.Claims.Claim claim);
[<System.Security.SecurityCritical>]
abstract member AddClaim : System.Security.Claims.Claim -> unit
override this.AddClaim : System.Security.Claims.Claim -> unit
abstract member AddClaim : System.Security.Claims.Claim -> unit
override this.AddClaim : System.Security.Claims.Claim -> unit
Public Overridable Sub AddClaim (claim As Claim)

参数

claim
Claim

要添加的声明。The claim to add.

属性

例外

claimnullclaim is null.

注解

检查声明,如果使用者与此声明标识不同,则 Claim.Clone(ClaimsIdentity) 使用此声明标识作为参数来调用方法,以使用正确的主题创建新声明。The claim is examined and if the subject is different than this claims identity, the Claim.Clone(ClaimsIdentity) method is invoked with this claims identity as the parameter to create a new claim with the correct subject.

此方法已 SecurityCritical 应用特性来控制哪些实体可以将声明添加到标识。This method has the SecurityCritical attribute applied to control which entities can add claims to the identity. 在管道中,根据集合中存在的声明做出授权决定 ClaimsFurther down the pipe, authorization decisions are made based on the claims that are present in the Claims collection.

适用于