public override async Task DeleteUserAsync(string localUserId, System.Security.Claims.ClaimsPrincipal adminUser) { // go through all the auth0 accounts and remove them from the system. var accounts = await _db.Auth0Users.Where(u => u.LocalUserId == localUserId).ToListAsync(); var auth0Service = new Auth0Service(); foreach (var account in accounts) { //remove from auth0 if (Engine.Settings.Account.DeleteRemoteAccounts) { await auth0Service.DeleteUser(account.Id); } _db.Entry(account).State = EntityState.Deleted; } await _db.SaveChangesAsync(); var user = await PrepareUserForDelete(localUserId, adminUser); _db.Auth0Users.Where(l => l.LocalUserId == localUserId).ForEach(f => _db.Entry(f).State = EntityState.Deleted); await _db.SaveChangesAsync(); // now delete the user await base.DeleteUserAsync(localUserId, adminUser); }
public async override Task DeleteRoleAsync(string role) { if (Engine.Settings.Account.DeleteRemoteAccounts) { var authService = new Auth0Service(); await authService.DeleteRole(role); } await base.DeleteRoleAsync(role); }
public override async Task SendVerificationEmail(ApplicationUser localUser, string userId, string returnUrl) { // get the users' current connected account. // send a verification email on the whattheolddowntheold. var authService = new Auth0Service(); var ticket = await authService.GetEmailVerificationTicket(userId, returnUrl); var verifyModel = new VerifyEmailModel(localUser, ticket.Value) { SendToRecipient = true }; await _mailService.ProcessAndSend(verifyModel); }
public async override Task <ApplicationRole> CreateRoleAsync(string role) { var internalRole = await base.CreateRoleAsync(role); var authService = new Auth0Service(); var remoteRole = await authService.CreateRoleAsync(internalRole); internalRole.RemoteId = remoteRole.Id; _db.Roles.Update(internalRole); await _db.SaveChangesAsync(); return(internalRole); }