asp.net - Token auth in asp mvc 6 -


it seems there not lot of information how authorization new mvc version. since asp 5 in rc 1 one guess can start trying understand how going work...

what want simple example of auth token contains user's name , roles. link http://bitoftech.net/2015/03/11/asp-net-identity-2-1-roles-based-authorization-authentication-asp-net-web-api/ seems hard find

you can try openiddict that. need rc2 use it, it's quite easy set up:

public void configureservices(iservicecollection services) {     services.addmvc();      services.addentityframework()         .addsqlserver()         .adddbcontext<applicationdbcontext>(options =>             options.usesqlserver(configuration["data:defaultconnection:connectionstring"]));      services.addidentity<applicationuser, identityrole>()         .addentityframeworkstores<applicationdbcontext>()         .adddefaulttokenproviders()         .addopeniddict(); // add openiddict services after registering identity services. }  public void configure(iapplicationbuilder app) {     app.useopeniddict(); } 

sean walsh posted detailed walkthrough on blog: http://capesean.co.za/blog/asp-net-5-jwt-tokens/.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -