private static IAuthenticator CreateSkipAuthenticator(IDevice device, AuthenticationCredential credential)
        {
            Type deviceType = device.GetType();

            if (deviceType == typeof(JediOmniDevice))
            {
                return(new JediOmniSkipAuthenticator(device, credential));
            }

            throw new ArgumentException($"{deviceType.Name} does not have a SkipAuthenticator implementation.");
        }
        /// <summary>
        /// Creates an <see cref="IAuthenticator" /> for the specified <see cref="IDevice" />.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="credential">The credential.</param>
        /// <param name="provider">The Provider.</param>
        /// <returns><see cref="IAuthenticator" /></returns>
        public static IAuthenticator Create(IDevice device, AuthenticationCredential credential, AuthenticationProvider provider)
        {
            switch (provider)
            {
            case AuthenticationProvider.Skip:
                return(CreateSkipAuthenticator(device, credential));

            default:
                return(_instance.FactoryCreate(device, credential, provider));
            }
        }
        /// <summary>
        /// Creates an <see cref="IAuthenticator" /> for the specified <see cref="IDevice" /> and <see cref="PluginExecutionData" />.
        /// Handles setting of <see cref="BadgeBoxInfo" /> if <see cref="AuthenticationProvider" /> is Card.
        /// </summary>
        /// <param name="deviceId">The device identifier.</param>
        /// <param name="device">The device.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="pluginExecutionData">The Execution data.</param>
        /// <returns><see cref="IAuthenticator" /></returns>
        public static IAuthenticator Create(string deviceId, IDevice device, AuthenticationProvider provider, PluginExecutionData pluginExecutionData)
        {
            AuthenticationCredential authCredential = null;

            switch (provider)
            {
            case AuthenticationProvider.Card:
                authCredential = new AuthenticationCredential(pluginExecutionData, deviceId, device.Address);
                break;

            default:
                authCredential = new AuthenticationCredential(pluginExecutionData.Credential);
                break;
            }

            return(Create(device, authCredential, provider));
        }
        /// <summary>
        /// Creates an <see cref="IAuthenticator" /> for the specified <see cref="IDevice" />.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="credential">The credential.</param>
        /// <param name="provider">The Provider.</param>
        /// <returns><see cref="IAuthenticator" /></returns>
        public static IAuthenticator Create(IDevice device, NetworkCredential credential, AuthenticationProvider provider)
        {
            AuthenticationCredential authCredential = new AuthenticationCredential(credential);

            return(Create(device, authCredential, provider));
        }
 /// <summary>
 /// Creates an <see cref="IAuthenticator" /> for the specified <see cref="IDevice" />
 /// with a default AuthenticationProvider.Auto.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="credential">The credential.</param>
 /// <returns><see cref="IAuthenticator" /></returns>
 public static IAuthenticator Create(IDevice device, AuthenticationCredential credential)
 {
     return(Create(device, credential, AuthenticationProvider.Auto));
 }
Esempio n. 6
0
 /// <summary>
 /// Constructs a new instance of <see cref="AuthenticatorBase" />
 /// </summary>
 /// <param name="credential"></param>
 /// <param name="provider"></param>
 protected AuthenticatorBase(AuthenticationCredential credential, AuthenticationProvider provider)
 {
     Credential = credential;
     Provider   = provider;
 }