Example #1
0
        public async Task <IActionResult> GetAuthInfo(string token)
        {
            try
            {
                if (string.IsNullOrEmpty(token))
                {
                    return(BadRequest("Token cannot be empty."));
                }

                var tokeAuthDataModel = await _userDataProvider.GetUserAuthInfo(token);

                if (tokeAuthDataModel == null)
                {
                    return(null);
                }

                var result = new Shared.Authorization.Models.UserAuthModel
                {
                    Id     = tokeAuthDataModel.Id,
                    Role   = tokeAuthDataModel.Role,
                    RoleId = tokeAuthDataModel.RoleId,
                    UserTokenExpirationDate = tokeAuthDataModel.UserTokenExpirationDate
                };

                return(Ok(result));
            }
            catch
            {
                return(null);
            }
        }