You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. The service will authenticate the client applications by using Personal Information Cards. You write the following code segment. (Line numbers are included for reference only.)
01 public class CustomServiceAuthorizationManager :
02 ServiceAuthorizationManager {
03 protected override bool CheckAccessCore(OperationContext 04 operationContext)
05 {
06 string action=
07 operationContext.RequestContext.RequestMessage.
08 Headers.Action;
09 if (action == “http://tempuri.org/IEngine/Update”) 10 {
11 foreach (ClaimSet cs in
12 operationContext.ServiceSecurityContext.AuthorizationContext.
13 ClaimSets)
14 {
16 }
17 return false;
18 }
19 return true;
20 }
21 bool IsEmailValid(string email)
22 {
23 //e-mail validation is performed here;
24 return true;
25 }
You need to ensure that only those client applications that provide a valid e-mail address can execute the Update method. Which code segment should you insert at line 15?
A.
foreach (Claim c in cs.FindClaims(“http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress”, “PossessProperty”))
return IsEmailValid(c.Resource.ToString());
B.
foreach (Claim c in cs.FindClaims(“http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress”, string.Empty))
return IsEmailValid(c.Resource.ToString());
C.
foreach (Claim c in cs.FindClaims(“http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress”, Rights.PossessProperty))
return IsEmailValid(c.Resource.ToString());
D.
foreach (Claim c in cs.FindClaims(“http: //schemas.xmlsoap.org/ws/2005/05 identity/claims/emailaddress”, Rights.Identity))
return IsEmailValid(c.Resource.ToString());