RoleManagerModule and RolePrincipal Object

According to my book, if role management is enabled, it RoleManagerModulecreates a user security context by assigning RolePrincipalan object HttpRequest.User. But a security context has already been created (thus the main object is assigned HttpContext.User) on FormsAuthenticationModulewhich is called before RoleManagerModule, which is called?

I ask this because in the following code the main object assigned HttpRequest.Useralready exists, although it RoleManagerModulehas not yet been called:

protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
    if (User.Identity.IsAuthenticated && Roles.Enabled)
    {
        //here we subscribe user to a role via Roles.AddUserToRole()
    }       
}

So, the main object created FormsAuthenticationModuleand assigned HttpRequest.User, later replaced by the object RolePrincipal(created RoleManagerModule)?

+3
1

:

Roles , HTTP- RoleManagerModule FormsAuthenticationModule PostAuthenticateRequest, AuthenticateRequest. , RoleManagerModule GenericPrincipal, FormsAuthenticationModule, RolePrincipal. RolePrincipal API , .

, .

+6

Source: https://habr.com/ru/post/1708456/


All Articles