Can anyone point me in the direction of some samples or instructions on how to achieve this please?
I have not used StructureMap, but I have done this with Autofac and SimpleInjector.
Autofac registration would look like this:
builder.Register(c => HttpContext.Current.GetOwinContext().Authentication).As<IAuthenticationManager>();
Registration in SimpleInjector looks like this:
container.RegisterPerWebRequest(() => HttpContext.Current.GetOwinContext().Authentication);
And from looking on StructureMap tutorial I can guess that registration there would be something like this:
ForRequestedType<IAuthenticationManager>()
.TheDefaultIs(() => HttpContext.Current.GetOwinContext().Authentication)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With