예제 #1
0
        public async Task <ActionResult <PersonDetailsUpdate> > GetUpdate(int id, [FromHeader] string authorization)
        {
            if (string.IsNullOrEmpty(authorization))
            {
                return(Unauthorized());
            }

            try
            {
                var auth          = FirebaseAuth.DefaultInstance;
                var fireBaseToken = await auth.VerifyIdTokenAsync(authorization);

                if (fireBaseToken.Claims.ContainsKey("edit") && (bool)fireBaseToken.Claims["edit"])
                {
                    var returnValues = await _familyRepository.GetDetailsForUpdate(id);

                    return(Ok(returnValues));
                }
            }
            catch
            {
                return(Unauthorized());
            }

            return(Unauthorized());
        }