Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Callbacks in CreatePerOwinContext() never called - what's wrong?

$
0
0

In Startup.cs I am using Lambdas to create an instance of my UserManager class:

app.CreatePerOwinContext(() => new IdentityContext("AuthDatabase"));
app.CreatePerOwinContext((IdentityFactoryOptions<UserManager> options, IOwinContext owin) => new UserManager(new UserStore<User, Role, Guid, UserLogin, UserRole, UserClaim>(owin.Get<IdentityContext>()), options.DataProtectionProvider));

In one of my controllers I'm using a Lambda to retrieve the UserManager instance:

private UserManager UserManager => _userMan ?? (_userMan = Request.GetOwinContext().GetUserManager<UserManager>());

But this line doesn't execute above Lambdas. Instead GetUserManager() always returns null.

What's wrong with above code? Why are the callbacks never called?


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>