This project is followed the article Dynamic Role-Based Authorization in ASP.NET Core 2.0, and forked from the github project.
In this project, I make some change like
- Use the ASP.NET Core 2.1 to create the new project. So you will find out the identity didn't contains in the project directly. You can get more detail from official website.
- In orginal project, the access property is belong to ApplicationRole. I use the RoleClaims to store the access type instead of role property. It can use the IdentityUser, IdentityRole directly.
- Add SeedData class to initialize the data. We can get the default data like
- Default User: admin@demo.com, Pwd:123qwe!@#QWE
- Default Role: Administrator, and it contains All access function.
- Add missing library like jquery-bonsai, jquery-qubit.
- Download the project.
- Use
Update-database
to create the database. - Run the project.
- Visit Contract page, it contains the initilize data function.
- Now you can login with admin@demo.com, and test the authorization function.