/// <summary> /// Creates a new user without a password /// </summary> /// <param name="username">New username</param> /// <param name="email">Email of the user</param> /// <param name="firstName">First name of the user</param> /// <param name="lastName">Last name of the user</param> /// <returns></returns> public async Task<ApplicationUser> Create(string username, string email, string firstName, string lastName) { var user = new ApplicationUser { Id = Guid.NewGuid().ToString(), UserName = username, Email = email, FirstName = firstName, LastName = lastName }; IdentityResult result = await _userManager().CreateAsync(user); HandleError(result); return user; }
/// <summary> /// Creates properties to add to the token response /// </summary> /// <param name="user"></param> /// <returns></returns> public static AuthenticationProperties CreateProperties(ApplicationUser user) { var getUserInfoResponse = _mapper.Map<ApplicationUser, GetUserInfoResponse>(user); IDictionary<string, string> data = new Dictionary<string, string> { { "payload", getUserInfoResponse.ToJson() } }; return new AuthenticationProperties(data); }