Seed users to Episerver’s ASP.NET Identity implementation

casper.rasmussen/ March 2, 2017/ Episerver CMS/ 1 comments

After installing Episerver’s ASP.NET Identity implementation, via EPiServer.Cms.UI.AspNetIdentity and Cookie Authentication, you’ll have to seed at least one user to take advantage of Episerver’s administration or authoring capabilities.

Seeding users, in the Alloy example site, are managed by a FilterAttribute, which ensures requests get’s routed by a registration controller for the initial user setup. Instead of relying on that entire mechanism, you can just as well seed the initial accounts via a MigrationStep.

 

 

Above code is an example of how you can seed an “initialadministrator” account with WebAdmins and WebEditors privileges. Be aware that these groups already has to exist for the example to work – but you can easily add these dynamically, as part of your seed, through the use of IRoleStore.

Happy seeding.

1 Comment

  1. Nice article and alternative, I used to do this via the Initialization module though.

Leave a Comment

Your email address will not be published. Required fields are marked *

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*