示例#1
0
        /// <summary>
        /// Sets the badge box.
        /// </summary>
        /// <param name="availableAssets">The available assets.</param>
        /// <param name="deviceAsset">The device asset.</param>
        /// <returns></returns>
        private BadgeBoxInfo SetBadgeBox(Framework.Assets.AssetInfoCollection availableAssets, IDeviceInfo deviceAsset)
        {
            ExecutionServices.SystemTrace.LogDebug($"Number of assets: {availableAssets.Count.ToString()}");
            BadgeBoxInfo badgeBoxAsset = null;

            if (availableAssets.OfType <BadgeBoxInfo>().Any())
            {
                ExecutionServices.SystemTrace.LogDebug($"Printer ID of badge box:");
                ExecutionServices.SystemTrace.LogDebug(availableAssets.OfType <BadgeBoxInfo>().FirstOrDefault().PrinterId);
                ExecutionServices.SystemTrace.LogDebug($"Device Asset: " + deviceAsset.AssetId);

                badgeBoxAsset = availableAssets.OfType <BadgeBoxInfo>().FirstOrDefault(n => n.PrinterId == deviceAsset.AssetId);
            }
            if (badgeBoxAsset == null)
            {
                throw new Exception($"No Badge Box associated with device {deviceAsset.AssetId}, {deviceAsset.Address}");
            }
            return(badgeBoxAsset);
        }
示例#2
0
        /// <summary>
        /// Do login for using Card(BadgeBox)
        /// </summary>
        /// <param name="asset">The asset info for Card login.</param>
        /// <param name="credential">The credential info for Card login.</param>
        /// <returns>IAuthenticator</returns>
        public void KioskCardAuthenticate(Framework.Assets.AssetInfoCollection asset, System.Net.NetworkCredential credential)
        {
            IAuthenticator auth = null;

            // Gets the authenticator for the given device and requested solution.
            BadgeBoxInfo bbi = SetBadgeBox(asset, DeviceInfo);

            auth = AuthenticatorFactory.Create(Device, credential, bbi, AuthenticationProvider.Card);
            auth.WorkflowLogger = WorkflowLogger;
            try
            {
                RecordEvent(DeviceWorkflowMarker.AuthenticationBegin);
                auth.Authenticate();
            }
            catch (DeviceInvalidOperationException)
            {
                UpdateStatus($"Kiosk needs checking other way to verify login.\n ");
            }

            VerifyLogin(KioskAuthType.Card, null);
        }