You are creating a new security policy for an application domain. You write the following lines of
code.
PolicyLevel policy = PolicyLevel.CreateAppDomainLevel();
PolicyStatement noTrustStatement =
new PolicyStatement(
policy.GetNamedPermissionSet(“Nothing”));
PolicyStatement fullTrustStatement =
new PolicyStatement(
policy.GetNamedPermissionSet(“FullTrust”));
You need to arrange code groups for the policy so that loaded assemblies default to the Nothing
permission set. If the assembly originates from a trusted zone, the security policy must grant the
assembly the FullTrust permission set. Which code segment should you use?
A. CodeGroup group1 = new FirstMatchCodeGroup(
new ZoneMembershipCondition(SecurityZone.Trusted),
fullTrustStatement); CodeGroup group2 = new UnionCodegroup(
new AllMembershipCondition(),
noTrustStatement); group1.AddChild(group2);
B. CodeGroup group1 = new FirstMatchCodeGroup(
new AllMembershipCondition(),
noTrustStatement); CodeGroup group2 = new UnionCodeGroup(
new ZoneMembershipCondition(SecurityZone.Trusted),
fullTrustStatement); group1.AddChild(group2);
C. CodeGroup group = new UnionCodeGroup(
new ZoneMembershipCondition(SecurityZone.Trusted),
fullTrustStatement);
D. CodeGroup group = new FirstMatchCodeGroup(
new AllMembershipCondition(),
noTrustStatement);
Answer: B
code.
PolicyLevel policy = PolicyLevel.CreateAppDomainLevel();
PolicyStatement noTrustStatement =
new PolicyStatement(
policy.GetNamedPermissionSet(“Nothing”));
PolicyStatement fullTrustStatement =
new PolicyStatement(
policy.GetNamedPermissionSet(“FullTrust”));
You need to arrange code groups for the policy so that loaded assemblies default to the Nothing
permission set. If the assembly originates from a trusted zone, the security policy must grant the
assembly the FullTrust permission set. Which code segment should you use?
A. CodeGroup group1 = new FirstMatchCodeGroup(
new ZoneMembershipCondition(SecurityZone.Trusted),
fullTrustStatement); CodeGroup group2 = new UnionCodegroup(
new AllMembershipCondition(),
noTrustStatement); group1.AddChild(group2);
B. CodeGroup group1 = new FirstMatchCodeGroup(
new AllMembershipCondition(),
noTrustStatement); CodeGroup group2 = new UnionCodeGroup(
new ZoneMembershipCondition(SecurityZone.Trusted),
fullTrustStatement); group1.AddChild(group2);
C. CodeGroup group = new UnionCodeGroup(
new ZoneMembershipCondition(SecurityZone.Trusted),
fullTrustStatement);
D. CodeGroup group = new FirstMatchCodeGroup(
new AllMembershipCondition(),
noTrustStatement);
Answer: B
No comments:
Post a Comment