You create a method that runs by using the credentials of the end user.

You create a method that runs by using the credentials of the end user. You need to use
Microsoft Windows groups to authorize the user. You must add a code segment that identifies
whether a user is in the local group named Clerk.
Which code segment should you use?


A. WindowsIdentity^ currentUser = WindowsIdentity::GetCurrent();For each
    (IdentityReference^ grp in currentUser->Groups) {
    NTAccount^ grpAccount =
    safe_cast<NTAccount^>(grp->Translate(NTAccount::typeid));
    isAuthorized = grpAccount->Value->Equals(
    Environment::MachineName + “\\Clerk”);
    if(isAuthorized) break;}
B. WindowsPrincipal^ currentUser =
    safe_cast<WindowsPrincipal^>(Thread::CurrentPrincipal);isAuthorized = currentUser-    
    >IsInRole(“Clerk”);
    C. GenericPrincipal^ currentUser =
    safe_cast<GenericPrincipal^>(Thread::CurrentPrincipal);isAuthorized = currentUser-    
    >IsInRole(“Clerk”);
D. WindowsPrincipal^ currentUser =
    safe_cast<WindowsPrincipal^>(Thread::CurrentPrincipal);isAuthorized =
    currentUser->IsInRole(
    Environment::MachineName);
    
 
Answer: B

No comments:

Post a Comment