locked
Injecting IIdentity using Ninject RRS feed

  • Question

  • User-638259267 posted

    I have a custom class derived from ClaimsIdentity as follows:

    public class AuthenticatedUser : ClaimsIdentity, IAuthenticatedUser
        {
            public AuthenticatedUser(IIdentity identity): base(identity)
            {
                this.Identity = identity;
            }
    }

    However, the problem that I am encountering is that I am using Ninject as my IoC container and when I attempt to load my class, I have no idea how to inject IIdentity using Ninject to accomplish this!

    Normally in Ninject, I inject an interface and cast it to a concrete instance of a class, but how do I do this when there is no concrete instance I am using since IIdentity IS the base interface/class defined in the .NET Framework?

    Please advise.

    Thanks.

    Friday, April 15, 2016 9:21 AM

All replies