You need to establish a user security context that will be used for authorization checks such as IsInRole.
You are writing code for user authentication and authorization.
The username, password, and roles are stored in your application data store.
You need to establish a user security context that will be used for authorization checks such as IsInRole.
You write the following code segment to authorize the user.
if (!TestPassword(userName, password))
throw new Exception(“could not authenticate user”);
String[] userRolesArray = LookupUserRoles(userName);