private SimDeviceAuthenticationResponse CreateSimDeviceAuthenticationResponse(SimAndDeviceAuthenticated simAndDeviceAuthenticated, SimAndDevice simAndDevice, HashSet <string> canLogonUsers)
        {
            var simDeviceAuthenticationResponse = new SimDeviceAuthenticationResponse
            {
                AuthId                     = simAndDeviceAuthenticated.Id,
                CanLogonUsers              = canLogonUsers,
                AssignDeviceIpAddress      = simAndDevice.IsolatedNw2Ip,
                WindowsSignInListCacheDays = simAndDevice.Device.WindowsSignInListCacheDays,
                IsSoftwareRadioState       = simAndDevice.Device.LteModule?.UseSoftwareRadioState,
                AuthenticationDuration     = simAndDevice.AuthenticationDuration
            };

            if (simAndDevice.Device.OrganizationClientApp != null)
            {
                var clientInformation = new SimDeviceAuthenticationResponse.ClientInformation();
                clientInformation.Os = simAndDevice.Device.OrganizationClientApp?.ClientApp.ClientOs.Name;

                try
                {
                    clientInformation.Version = new Version(simAndDevice.Device.OrganizationClientApp?.ClientApp.Version);
                }
                catch (ArgumentException)
                {
                    _logger.LogWarning($"Invalid Version {simAndDevice.Device.OrganizationClientApp?.ClientApp.Version}");
                }

                simDeviceAuthenticationResponse.Client = clientInformation;
            }
            return(simDeviceAuthenticationResponse);
        }
        private SimDeviceAuthenticationResponse CreateSimDeviceAuthenticationResponse(SimDeviceAuthenticationStateDone simDeviceAuthenticationStateDone, SimDevice simDevice, List <string> canLogonUsers)
        {
            var simDeviceAuthenticationResponse = new SimDeviceAuthenticationResponse
            {
                AuthId                = simDeviceAuthenticationStateDone.Id.ToString(),
                CanLogonUsers         = canLogonUsers,
                AssignDeviceIpAddress = simDevice.Nw2IpAddressPool
            };
            // AdDevice がある場合 AdDeviceSettingOfflineWindowsSignIn を設置します 逆にない場合 設置しない
            AdDevice adDevice = _authenticationRepository.GetAdDevice(simDevice.Device.Id);

            if (adDevice != null && adDevice.AdDeviceSettingOfflineWindowsSignIn != null)
            {
                simDeviceAuthenticationResponse.SimDeviceConfigureDictionary
                    = new Dictionary <string, string>
                    {
                    {
                        "windows_signIn_cache_days",
                        adDevice.AdDeviceSettingOfflineWindowsSignIn.WindowsSignInListCacheDays.ToString()
                    }
                    };
            }
            return(simDeviceAuthenticationResponse);
        }