コード例 #1
0
        public async Task <JwtResponse> AuthenticateApiUser(Guid ApiId, string AuthToken)
        {
            if (GetByApiId(ApiId) == null)
            {
                var greenlitUser = await _greenlitApiClient.GetRestApiEntity(ApiId, AuthToken);

                var appUser = new User
                {
                    FirstName     = greenlitUser.FirstName,
                    LastName      = greenlitUser.LastName,
                    EmailAddress  = greenlitUser.EmailAddress,
                    GreenlitApiId = greenlitUser.Id
                };

                var result = Create(appUser);
            }

            var localUser = GetByApiId(ApiId);

            if (localUser == null)
            {
                throw new AppException("Failed to create local user account");
            }

            return(await AuthenticateApiUser(localUser));
        }