Edit

Share via


ClaimTypeRequirement Constructors

Definition

Initializes a new instance of the ClaimTypeRequirement class.

Overloads

ClaimTypeRequirement(String)

Initializes a new instance of the ClaimTypeRequirement class for a required claim of the specified type.

ClaimTypeRequirement(String, Boolean)

Initializes a new instance of the ClaimTypeRequirement class for a claim of the specified type.

ClaimTypeRequirement(String)

Source:
ClaimTypeRequirement.cs
Source:
ClaimTypeRequirement.cs
Source:
ClaimTypeRequirement.cs

Initializes a new instance of the ClaimTypeRequirement class for a required claim of the specified type.

public:
 ClaimTypeRequirement(System::String ^ claimType);
public ClaimTypeRequirement (string claimType);
new System.ServiceModel.Security.Tokens.ClaimTypeRequirement : string -> System.ServiceModel.Security.Tokens.ClaimTypeRequirement
Public Sub New (claimType As String)

Parameters

claimType
String

The claim type.

Examples

The following code adds two claim type requirements to a security binding.

WSFederationHttpBinding binding = new WSFederationHttpBinding();
binding.Security.Message.ClaimTypeRequirements.Add
   (new ClaimTypeRequirement
   ("http://schemas.microsoft.com/ws/2005/05/identity/claims/EmailAddress"));
binding.Security.Message.ClaimTypeRequirements.Add
   (new ClaimTypeRequirement
   ("http://schemas.microsoft.com/ws/2005/05/identity/claims/UserName", true));

Remarks

The predefined claim types can be found at ClaimTypes.

Applies to

ClaimTypeRequirement(String, Boolean)

Source:
ClaimTypeRequirement.cs
Source:
ClaimTypeRequirement.cs
Source:
ClaimTypeRequirement.cs

Initializes a new instance of the ClaimTypeRequirement class for a claim of the specified type.

public:
 ClaimTypeRequirement(System::String ^ claimType, bool isOptional);
public ClaimTypeRequirement (string claimType, bool isOptional);
new System.ServiceModel.Security.Tokens.ClaimTypeRequirement : string * bool -> System.ServiceModel.Security.Tokens.ClaimTypeRequirement
Public Sub New (claimType As String, isOptional As Boolean)

Parameters

claimType
String

The claim type.

isOptional
Boolean

If false, the claim is required; otherwise, it is optional.

Examples

The following code adds two claim type requirements to a security binding.

WSFederationHttpBinding binding = new WSFederationHttpBinding();
binding.Security.Message.ClaimTypeRequirements.Add
   (new ClaimTypeRequirement
   ("http://schemas.microsoft.com/ws/2005/05/identity/claims/EmailAddress"));
binding.Security.Message.ClaimTypeRequirements.Add
   (new ClaimTypeRequirement
   ("http://schemas.microsoft.com/ws/2005/05/identity/claims/UserName", true));

Applies to