public async Task <NotificationResult> DeleteUser() { var user = OwinHelper.CreateUser(User.Identity as ClaimsIdentity); await this.UserProvider.DeleteUserWithDependenciesAsync(user); this.EmailProvider.SendDeleteConfirmationAsync(user); return(new NotificationResult(user.Email)); }
/// <summary> /// Extracts user info from identity /// </summary> /// <param name="identity"></param> /// <returns></returns> public User TryGetRegisteredUserFromIdentity(ClaimsIdentity claimsIdentity) { if (claimsIdentity == null || !claimsIdentity.IsAuthenticated) { return(null); } //if issued by external => user is not registered, return null Claim userIdClaim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); if (userIdClaim.Issuer != ClaimsIdentity.DefaultIssuer) { return(null); } return(OwinHelper.CreateUser(claimsIdentity)); }