public AuthenticationController(
     SignInManager<ApplicationUser> signInManager,
     UserManager<ApplicationUser> userManager,
     RolesSettings rolesSettings,
     TwitterSettings twitterSettings)
 {
     _signInManager = signInManager;
     _userManager = userManager;
     _rolesSettings = rolesSettings;
     _twitterSettings = twitterSettings;
 }    
Exemple #2
0
        private static async Task CreateRolesAsync(
            RoleManager <IdentityRole> roleManager, RolesSettings rolesSettings)
        {
            var roles = rolesSettings.ListOfRoles;

            foreach (var role in roles)
            {
                if (await roleManager.RoleExistsAsync(role))
                {
                    continue;
                }
                await roleManager.CreateAsync(
                    new IdentityRole(role));
            }
        }