Using Asp.NET Identity with custom user manager/database -


i use parts of identity system of asp.net access custom database, not of parts. database portion wasn't difficult, trying find out how write code put work of identity methods custom implementation. example 1 of differing items not use usermanager password hash, instead use other 3rd party password hash function. of things i'd take advantage of cookie authentication, password validator fields, etc. so, first thing tried @ standard createasync method does, , takes me blank line looking this:

[asyncstatemachine(typeof(usermanager<>.<createasync>d__73))] public virtual task<identityresult> createasync(tuser user, string password); 

how can make custom create-async , password-verification functions? oh, 'custom database' mean, not want use tables come identity, no roles, claims, own users table all.

i did there's code post here answer unfortunately.

for createasync need make custom userstore class implements `iuserstore<your custom user>, iuserpasswordstore<your custom user>`  need implement createasync method:  async task<identityresult> iuserstore<your custom user>.createasync(your custom user user, cancellationtoken cancellationtoken)         {              identityresult result;             var tsk = task.factory.startnew(() => result = somedataaccessclass.somesaveusertodatabasefunction(user));              return await tsk;         } 

you can implement data class , save user function want @ point.

the password verification little more complex depending on do.

you'll have create custom signinmanager inherits the regular signinmanager. override passwordsigninasync method whatever you're doing security-wise. note you'll need implement of other functions on usermanager find user async , stuff that.

also note identity pipeline fill in missing pieces need services.addidentity().adduserstore().addsigninmanger (and other classes customize) in startup.cs configureservices() method , throw app.useidentity() configure method too.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -