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 中为 Shared)成员都是线程安全的。但不能保证任何实例成员是线程安全的。

平台

开发平台

Windows Server 2003, Windows Vista

Target Platforms

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

请参见

参考

ClaimsPrincipal 类
ClaimsPrincipal 成员
Microsoft.IdentityModel.Claims 命名空间