Exemplo n.º 1
0
        public IActionResult RefreshToken([FromHeader] string Authorization)
        {
            var baseUser = _authUser.CheckRefreshToken(Authorization);

            if (baseUser != null && baseUser.IsActive)
            {
                var tokens = _jwtTokenProvider.GenerateJwtUserToken(baseUser);

                var payloadData = _authUser.PackPayloadPart(tokens, baseUser);

                return(Ok(new JsonPayloadPattern().JsonPayload(_success, "", Ok().StatusCode, payloadData)));
            }
            return(Unauthorized());
        }
Exemplo n.º 2
0
        public IActionResult Post([FromBody] UserDTO userDTO)
        {
            var baseUser = this._authUser.CheckUser(userDTO);

            if (baseUser != null && baseUser.IsActive)
            {
                if (this._authUser.Authenticate(baseUser, userDTO))
                {
                    var tokens      = _jwtTokenProvider.GenerateJwtUserToken(baseUser);
                    var payloadData = _authUser.PackPayloadPart(tokens, baseUser);

                    return(Ok(
                               new JsonPayloadPattern().JsonPayload(_success, "", Ok().StatusCode, payloadData)));
                }
            }
            return(Unauthorized());
        }