public override void Launch(IAuthenticator authenticator, AuthenticationInitMethod authenticationInitMethod)
 {
     if (authenticationInitMethod.Equals(AuthenticationInitMethod.SignInButton))
     {
         Launch(authenticator, AuthenticationMode.Eager);
     }
     else
     {
         Launch(authenticator, AuthenticationMode.Lazy);
     }
 }
示例#2
0
        /// <summary>
        /// Launches the application.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="deviceAsset">The device asset.</param>
        /// <returns>PluginExecutionResult</returns>
        private PluginExecutionResult LaunchApp(IDevice device, IDeviceInfo deviceAsset)
        {
            PluginExecutionResult result = new PluginExecutionResult(PluginResult.Passed);
            string buttonText            = _activityData.InitiationButton;

            try
            {
                _workflowLogger.RecordEvent(DeviceWorkflowMarker.ActivityBegin);

                AuthenticationInitMethod aim = GetAuthenticationInitMethod(_activityData.InitiationButton);
                DeviceSignOutMethod      deviceUnauthMethod = SignOutMethod.GetSignOutMethod(_activityData.UnAuthenticateMethod);
                IAuthenticator           auth = GetAuthenticator(device, deviceAsset);

                // retrieve the Authentication solution, plugin.
                IAuthenticationDriver app = GetApp(device);

                UpdateStatus("Launching authentication for " + buttonText + ".");
                if (!aim.Equals(AuthenticationInitMethod.DoNotSignIn))
                {
                    app.Launch(auth, aim);
                }
                else
                {
                    UpdateStatus("Skip Sign In :: Do not Sign In");
                }

                UpdateStatus("Logging out of device " + deviceAsset.AssetId + " - " + deviceAsset.Address + " by " + _activityData.UnAuthenticateMethod);
                if (deviceUnauthMethod.Equals(DeviceSignOutMethod.DoNotSignOut))
                {
                    UpdateStatus("Skip Sign Out :: Do Not Sign Out");
                }
                else
                {
                    app.SignOut(deviceUnauthMethod, device);
                }

                _workflowLogger.RecordEvent(DeviceWorkflowMarker.ActivityEnd);
            }
            catch (DeviceCommunicationException ex)
            {
                result = new PluginExecutionResult(PluginResult.Failed, ex.Message, "Device communication error.");
            }
            catch (DeviceInvalidOperationException ex)
            {
                result = new PluginExecutionResult(PluginResult.Failed, ex.Message, "Device automation error.");
            }
            catch (DeviceWorkflowException ex)
            {
                result = new PluginExecutionResult(PluginResult.Failed, ex, "Device workflow error.");
            }

            return(result);
        }
        /// <summary>
        /// Enters credentials on the device control panel and initiates the authentication process.
        /// Applies the specified parameters before submitting the authentication request.
        /// </summary>
        public void Authenticate(Dictionary <string, object> parameters)
        {
            AuthenticationInitMethod authMode = GetAuthenticationInitMethod();

            RecordEvent(DeviceWorkflowMarker.AuthenticationBegin);
            AuthenticationProvider deviceDefaultProvider = GetDefaultProvider(ControlPanel.GetScreenInfo());

            // Eager Auth allows for the setting of a provider.  Lazy Auth just prompts for credentials,
            // so we only want to allow the provider to be set if auth mode is Eager.
            if (authMode == AuthenticationInitMethod.SignInButton)
            {
                if (Provider == AuthenticationProvider.Auto)
                {
                    // Use the device default
                    Provider = deviceDefaultProvider;
                }

                if (Provider != deviceDefaultProvider)
                {
                    // Set the device provider to the requested provider
                    SetDeviceProvider(Provider);
                }

                ControlPanel.PressByValue("Continue");
            }

            //At this point this.Provider should be correctly set, so we should use it from now on.
            IAppAuthenticator appAuthenticator = GetAppAuthenticator(Provider);

            if (Provider != AuthenticationProvider.Card && parameters?.Count > 0)
            {
                appAuthenticator.ApplyParameters(parameters);
            }

            RecordInfo(DeviceWorkflowMarker.AuthType, Provider.GetDescription());
            RecordEvent(DeviceWorkflowMarker.EnterCredentialsBegin);
            appAuthenticator.EnterCredentials();
            RecordEvent(DeviceWorkflowMarker.EnterCredentialsEnd);

            if (Provider != AuthenticationProvider.Card)
            {
                appAuthenticator.SubmitAuthentication();
            }
            RecordEvent(DeviceWorkflowMarker.AuthenticationEnd);
        }
示例#4
0
        private AuthenticationInitMethod GetAuthenticationInitMethod(string initMethod)
        {
            AuthenticationInitMethod aim = AuthenticationInitMethod.ApplicationButton;

            if (initMethod.Equals(AuthenticationInitMethod.SignInButton.GetDescription()))
            {
                aim = AuthenticationInitMethod.SignInButton;
            }
            else if (initMethod.Equals(AuthenticationInitMethod.Badge.GetDescription()))
            {
                aim = AuthenticationInitMethod.Badge;
            }
            else if (initMethod.Equals(AuthenticationInitMethod.DoNotSignIn.GetDescription()))
            {
                aim = AuthenticationInitMethod.DoNotSignIn;
            }
            return(aim);
        }
示例#5
0
        /// <summary>
        /// Launches the Windjammer specified authenticator utilizing the given authentication initialization method.
        /// </summary>
        /// <param name="authenticator">The authenticator.</param>
        /// <param name="authenticationInitMethod">The authentication initialize method.</param>
        /// <exception cref="DeviceWorkflowException">Device Initialization method " + authenticationInitMethod.GetDescription() + " is not supported at this time.</exception>
        public override void Launch(IAuthenticator authenticator, AuthenticationInitMethod authenticationInitMethod)
        {
            authenticator.InitializationMethod = authenticationInitMethod;

            if (authenticationInitMethod.Equals(AuthenticationInitMethod.SignInButton))
            {
                ActivateViaSignIn(authenticator);
            }
            else if (authenticationInitMethod.Equals(AuthenticationInitMethod.ApplicationButton))
            {
                ActivateViaAppButton(authenticator);
            }
            else if (authenticationInitMethod.Equals(AuthenticationInitMethod.Badge))
            {
                Authenticate(authenticator, JediWindjammerLaunchHelper.HOMESCREEN_FORM);
            }
            else
            {
                throw new DeviceWorkflowException("Device Initialization method " + authenticationInitMethod.GetDescription() + " is not supported at this time.");
            }
        }
 /// <summary>
 /// Launches the specified authenticator with the specified authentication initialization method.
 /// </summary>
 /// <param name="authenticator">The authenticator.</param>
 /// <param name="IAuthenticator">The i authenticator.</param>
 public abstract void Launch(IAuthenticator authenticator, AuthenticationInitMethod IAuthenticator);
        public override void Launch(IAuthenticator authenticator, AuthenticationInitMethod authenticationInitMethod)
        {
            authenticator.InitializationMethod = authenticationInitMethod;


            if (authenticationInitMethod.Equals(AuthenticationInitMethod.SignInButton))
            {
                _launchHelper.PressSignInButton();
                Authenticate(authenticator, JediOmniLaunchHelper.SignInOrSignoutButton);
                OnHomeScreen = IsAuthenticated;
            }
            else if (authenticationInitMethod.Equals(AuthenticationInitMethod.ApplicationButton))
            {
                switch (_initMethod)
                {
                case InitiationMethod.Badge:
                    Authenticate(authenticator, JediOmniLaunchHelper.SignInOrSignoutButton);
                    break;

                case InitiationMethod.Copy:
                    CopyLazyAuth(authenticator, _omniDevice);
                    break;

                case InitiationMethod.Email:
                    EmailLazyAuth(authenticator, _omniDevice);
                    break;

                case InitiationMethod.Fax:
                    FaxLazyAuth(authenticator, _omniDevice);
                    break;

                case InitiationMethod.NetworkFolder:
                    NetworkFolderLazyAuth(authenticator, _omniDevice);
                    break;

                case InitiationMethod.WorkFlow:
                    DssWorkflowLazyAuth(authenticator, _omniDevice);
                    break;

                case InitiationMethod.Equitrac:
                case InitiationMethod.HPAC:
                case InitiationMethod.HPCR_PersonalDistributions:
                case InitiationMethod.HPCR_PuplicDistributions:
                case InitiationMethod.HPCR_RoutingSheet:
                case InitiationMethod.HPCR_ScanToMe:
                case InitiationMethod.HPCR_ScanToMyFiles:
                case InitiationMethod.HPEC:
                case InitiationMethod.HPRoam:
                case InitiationMethod.SafeCom:
                    PressSolutionButton();
                    Authenticate(authenticator, JediOmniLaunchHelper.LazySuccessScreen);
                    OnHomeScreen      = false;
                    IsAuthenticated   = true;
                    IsUnAuthenticated = false;
                    break;

                case InitiationMethod.DoNotSignIn:
                    break;

                default:
                    throw new ControlNotFoundException("The '" + _solutionButton + "' is not defined for use by the Authentication plugin at this time..");
                }
            }
            else if (authenticationInitMethod.Equals(AuthenticationInitMethod.Badge))
            {
                Authenticate(authenticator, JediOmniLaunchHelper.SignInOrSignoutButton);
            }
        }