Base solution for your next web application
Open Closed

how to get the instance of IAuthenticationManager #64


User avatar
0
lcyhjx created

Hi, I get the Module Zero project, it works fine. Thanks. But I found that the instance of IAuthenticationManager is created in web layer. Since the WEB API may not only used by Web Application, may also use by other clients, such as mobile application. So I would like to move AuthenticationManager from web layer to Web API/Application layer. In normal way, I can get instance of IAuthenticationManager in Web API layer as following: private IAuthenticationManager Authentication { get { return System.Web.Http. ApiController.Request.GetOwinContext().Authentication; } } But in Abp Framework, the Web Api is built dynamic, I do not know how to get the instance of IAuthenticationManager in Applciation layer with Abp framework, could you please give me some advice?


3 Answer(s)
  • User Avatar
    0
    lcyhjx created

    Do you have any suggestion?

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Where do you need it? If for a single method/class for login, I advice you to create a regular Web API controller derived from AbpApiController in web API layer. You can not and should not use web API specific stuff in Application layer since it's web layer independed. ABP provides dynamic web api layer but you can always create regular api controllers as always you do.

  • User Avatar
    0
    lcyhjx created

    Thanks your clarification, I have used another way to avoid required it.