single-sign-onowinienumerablehttpcontextroleprovider

C# roleprovider. getallroles() method is overriding Var userdetails= HttpContext.Current.GetOwinContext().Authentication.User.Claims;


I am using SSO in my login page and while authenticated by okta and receiving user claim details, the code is not working correctly, instead the control is taken next to existing role provider class.

Ienumerable userdetails= HttpContext.Current.GetOwinContext().Authentication.User.Claims;

code to get userclaim details,

once the breakpoint hit this line, the next line of control is on ,

Public Class AppRoleprovider: Roleprovider
{
  Public override String [] GetAllRoles()
   {
   return GetAllRolesfromtableAdapter();
   }
}

and proceeds, but this is not expected behaviour.


Solution

  • I have found the solution for the issue. This is an already existing Application I was working as part of enhancement there was a tag <roleManager> in web config. so I made it as enabled=false.

    <roleManager defaultroleprovider="***roleprovider" enabled="false" ....</roleManager>
    

    After making this change, the below line able is executed successfully and able to receive userclaims.

    Ienumerable userdetails= HttpContext.Current.GetOwinContext().Authentication.User.Claims;