/// <summary> /// Imitate the AuthenticationMethodProvider::ProvideModuleConnectionString behavior /// </summary> /// <returns>Connection string of the Security Module</returns> protected string InitAuthenticationMethodProvider() { AuthenticationMethodProviderBase authenticationMethodProvider = null; IDeviceApi deviceApiMocked = new DeviceApiMock(); if (_authData.Identity == AuthenticationMethodProvider.AuthenticationIdentity.Module) { authenticationMethodProvider = new AuthenticationMethodProviderFromModule(_authData); } else if (_authData.Identity == AuthenticationMethodProvider.AuthenticationIdentity.Device) { authenticationMethodProvider = new AuthenticationMethodProviderFromDevice(deviceApiMocked, _authData); } else { throw new MisconfigurationException("Not supported identity"); } authenticationMethodProvider.ValidateConfiguration(_authData); var connectionString = authenticationMethodProvider.GetConnectionString(); return(connectionString); }
/// <summary> /// Imitate the AuthenticationMethodProvider::ProvideModuleConnectionString behavior /// </summary> /// <returns>Connection string of the Security Module</returns> protected string InitAuthenticationMethodProvider() { AuthenticationMethodProviderBase authenticationMethodProvider = null; IDeviceApi deviceApiMocked = new DeviceApiMock(); if (_authData.Identity == AuthenticationMethodProvider.AuthenticationIdentity.Module) { authenticationMethodProvider = new AuthenticationMethodProviderFromModule(_authData); } else if (_authData.Identity == AuthenticationMethodProvider.AuthenticationIdentity.Device) { authenticationMethodProvider = new AuthenticationMethodProviderFromDevice(deviceApiMocked, _authData); } else { throw new ArgumentOutOfRangeException(paramName: "identity", message: "Not supported identity"); } var connectionString = authenticationMethodProvider.GetConnectionString(); return(connectionString); }