You are developing an application that will use custom authentication and role-based security. You need to write a code segment to make the runtime assign an unauthenticated principal object to each running thread. Which code segment should you use?

You are developing an application that will use custom authentication and role-based security.
You need to write a code segment to make the runtime assign an unauthenticated principal object to each running thread.
Which code segment should you use?


A. AppDomain^ domain =
    AppDomain::CurrentDomain;domain->SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal);
B. AppDomain^ domain =
    AppDomain::CurrentDomain;domain->SetThreadPrincipal(gcnew WindowsPrincipal(nullptr));
C. AppDomain^ domain =
    AppDomain::CurrentDomain;domain-    
    >SetAppDomainPolicy(PolicyLevel::CreateAppDomainLevel());
D. AppDomain^ domain =
    AppDomain::CurrentDomain;domain-    
    >SetPrincipalPolicy(PrincipalPolicy::UnauthenticatedPrincipal);

Answer: D 










No comments:

Post a Comment