ClaimsPrincipal.IsInRole 方法

This class interprets IsInRole as the reflection of whether this principal possesses a claim specified by a configured list. The claim value has no bearing on the result.

命名空間: Microsoft.IdentityModel.Claims
組件: Microsoft.IdentityModel (在 microsoft.identitymodel.dll 中)

使用方式

    Dim instance As ClaimsPrincipal
Dim role As String
Dim returnValue As Boolean

returnValue = instance.IsInRole(role)

語法

'宣告
Public Function IsInRole ( _
    role As String _
) As Boolean
public bool IsInRole (
    string role
)
public:
virtual bool IsInRole (
    String^ role
) sealed
public final boolean IsInRole (
    String role
)
public final function IsInRole (
    role : String
) : boolean

參數

  • role
    The claim type of the role to check for.

傳回值

Returns Boolean. true if a claim with the specified type exists; otherwise, false.

執行緒安全

任何這個類型的公用靜態 (在 Visual Basic 中為 共用) 成員都具備執行緒安全。不保證任何執行個體成員都具備執行緒安全。

平台

開發平台

Windows Server 2003, Windows Vista

Target Platforms

Windows Server 2008, Windows Vista, Not tested on Windows XP

請參閱

參考

ClaimsPrincipal 類別
ClaimsPrincipal 成員
Microsoft.IdentityModel.Claims 命名空間