4

I need access to a valid instance of a AuthenticationManager outside of a controller. For example, in a custom AuthroizeAttribute. In the template used to create an MVC 5 application that uses ASP.NET Identity it creates this code in the AccountController to create an instance of a AuthenticationManager.

    private IAuthenticationManager AuthenticationManager
    {
        get
        {
            return HttpContext.GetOwinContext().Authentication;
        }
    }

This HttpContext is a property of the Controller. How do I create an AuthenticationManager that has the correct context if I am not in a controller?

I am having a hard time finding any good documentation on ASP.NET Identity and OWIN.

Kevin Junghans
  • 17,475
  • 4
  • 45
  • 62

1 Answers1

2

Can't you get the current HttpContext with System.Web.HttpContext.Current? –

Alex Dresko
  • 5,179
  • 3
  • 37
  • 57