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. Dim objUser As WindowsIdentity = WindowsIdentity.GetCurrentFor Each objGroup
As IdentityReference In objUser.Groups
Dim objNT As NTAccount = _
DirectCast(objGroup.Translate( _
Type.GetType("NTAccount")), NTAccount)
Dim blnAuth As Boolean = objNT.Value.Equals( _
Environment.MachineName & "\Clerk")
If blnAuth Then Exit ForNext
B. Dim objUser As WindowsPrincipal = _
DirectCast(Thread.CurrentPrincipal, WindowsPrincipal)Dim blnAuth As Boolean =
objUser.IsInRole("Clerk")
C. Dim objUser As GenericPrincipal = _
DirectCast(Thread.CurrentPrincipal, GenericPrincipal)Dim blnAuth As Boolean =
objUser.IsInRole("Clerk")
D. Dim objUser As WindowsPrincipal = _
DirectCast(Thread.CurrentPrincipal, WindowsPrincipal)Dim blnAuth As Boolean = _
objUser.IsInRole(Environment.MachineName)
Answer: B
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. Dim objUser As WindowsIdentity = WindowsIdentity.GetCurrentFor Each objGroup
As IdentityReference In objUser.Groups
Dim objNT As NTAccount = _
DirectCast(objGroup.Translate( _
Type.GetType("NTAccount")), NTAccount)
Dim blnAuth As Boolean = objNT.Value.Equals( _
Environment.MachineName & "\Clerk")
If blnAuth Then Exit ForNext
B. Dim objUser As WindowsPrincipal = _
DirectCast(Thread.CurrentPrincipal, WindowsPrincipal)Dim blnAuth As Boolean =
objUser.IsInRole("Clerk")
C. Dim objUser As GenericPrincipal = _
DirectCast(Thread.CurrentPrincipal, GenericPrincipal)Dim blnAuth As Boolean =
objUser.IsInRole("Clerk")
D. Dim objUser As WindowsPrincipal = _
DirectCast(Thread.CurrentPrincipal, WindowsPrincipal)Dim blnAuth As Boolean = _
objUser.IsInRole(Environment.MachineName)
Answer: B
No comments:
Post a Comment