I have an custom role provider that gets the roles a user belongs to from a database. I also have a custom authentication module registered in my web.config s httpModules which sniffs incoming HTTP requests and (if it s an OAuth signed request) sets the HttpContext.Current.User property to impersonate the user, and the IPrincipal that it sets includes all the user s roles, plus an extra one called "delegated".
The trouble is, after I set my custom IPrincipal, apparently ASP.NET still calls my custom role provider, and then resets the IPrincipal with one that has only the standard roles for that user.
If I set <roleManager enabled="false" ...>
in my web.config file, the authentication module s assigned roles stick. Obviously though, I want the best of both worlds. How can I use the role provider, but "cancel" the role provider s effect when my authentication module decides to?