PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use to retrieve the claim for validation?

You are creating a Windows Communication Foundation (WCF) service that uses claims-based authorization.
The following code retrieves the correct claim set.

var claims = ServiceSecurityContext.Current.AuthorizationContext.ClaimSets[0];

You need to validate that the requesting client application has included a valid DNS value in the claim.
Which code segment should you use to retrieve the claim for validation?

PrepAway - Latest Free Exam Questions & Answers

A.
claims.FindClaims(ClaimTypes.Dns, Rights.PossessProperty).FirstOrDefault();

B.
claims.FindClaims(ClaimTypes.Dns, Rights.Identity).FirstOrDefault();

C.
claims.ContainsClaim(Claim.CreateDnsClaim(ClaimTypes.Dns));

D.
claims.Equals(ClaimTypes.Dns);

Explanation:
ClaimSet.FindClaims Method
When overridden in a derived class, searches for a Claim object that matches the specified claim type and rights in the ClaimSet.

Identity Gets a string that specifies that the right represents an identity.
PossessProperty Gets a string that specifies that the right represents a property that the entity associated with a claim possesses.

ClaimTypes class
(http://msdn.microsoft.com/en-us/library/system.identitymodel.claims.claimtypes.aspx)

Authorization In WCF-Based Services
(http://msdn.microsoft.com/en-us/magazine/cc948343.aspx)

Rights Class
(http://msdn.microsoft.com/en-us/library/system.identitymodel.claims.rights.aspx)

One Comment on “Which code segment should you use to retrieve the claim for validation?


Leave a Reply