问题:
您正在编写代码的用户身份验证和授权。
在您的应用程序数据存储区中存储的用户名、 密码和角色。
您需要建立用户的安全上下文将用于授权检查,如 IsInRole。
您编写下面的代码段,授权用户。()
if (!TestPassword(userName, password))
throw new Exception("could not authenticate user");
String[] userRolesArray = LookupUserRoles(userName);
A .
B .
C .
D .
您正在编写代码的用户身份验证和授权。
在您的应用程序数据存储区中存储的用户名、 密码和角色。
您需要建立用户的安全上下文将用于授权检查,如 IsInRole。
您编写下面的代码段,授权用户。()
if (!TestPassword(userName, password))
throw new Exception("could not authenticate user");
String[] userRolesArray = LookupUserRoles(userName);
● 参考解析
因为应用程序存储凭据,GenericIdentity和GenericPrincipal的类应使用WindowsIdentity\Pricipal类而不是。