Esempio n. 1
0
        public async Task <IdentityResult> ChangePassword([FromBody] LoginPoco loginPoco)
        {
            var findByNameAsync = await _context.FestiUsers.Include(el => el.UserAccount).FirstOrDefaultAsync(elem => elem.Id == loginPoco.UserId);

            _authManager.RemovePassword(findByNameAsync.UserAccount.Id);
            return(await _authManager.AddPasswordAsync(findByNameAsync.UserAccount.Id, loginPoco.Password));
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> Post([FromBody] LoginPoco assertion)
        {
            UserAccount user;

            if ((user = await _authManager.IsValidAssertion(assertion)) == null)
            {
                return(Unauthorized());
            }
            var token = await _tokenManager.CreateTokenMSCLient(user);

            return(Ok(new LoginResult
            {
                AuthenticationToken = token,
                User = new LoginResultUser {
                    UserId = user.UserName
                }
            }));
        }