public static IHotelTravelServiceProvider GetHotelTravelServiceProvider(ProviderTypes provider) { //if (provider == ProviderTypes.Tourico) //{ // return new TouricoHotelTravelServiceProvider(); //} throw new NotImplementedException(provider.ToString()); }
/// <summary> /// Register extenders of the specified type from the specified assembly as shell providers ensuring that their required arguments /// are also properly registered. /// </summary> /// <param name="args"></param> /// <param name="assembly"></param> /// <typeparam name="T"></typeparam> public static void RegisterArgZeroProviderTypeArguments <T>(string[] args, Assembly assembly) where T : IRegisterArguments { foreach (Type type in assembly.GetTypes().Where(type => type.ExtendsType <T>())) { type.Construct <T>().RegisterArguments(args); string name = type.Name; if (!type.Name.EndsWith("Provider")) { Message.PrintLine("For clarity and convention, the name of type {0} should end with 'Provider'", ConsoleColor.Yellow); } else { name = name.Truncate("Provider".Length); } ProviderTypes.AddMissing(name, type); } }
public void Load(DataRow providerRow) { try { m_id = (providerRow.Table.Columns.Contains("id") && providerRow["id"] != DBNull.Value && providerRow["id"] != null) ? new Guid(providerRow["id"] as string) : Guid.NewGuid(); m_providerType = (ProviderTypes)Enum.Parse(typeof(ProviderTypes), providerRow["providertype"] as string, true); m_owner = providerRow["owner"] as string; AdminMemberId = (providerRow.Table.Columns.Contains("adminmemberid") && providerRow["adminmemberid"] != null) ? providerRow["adminmemberid"] as string : null; m_providerName = providerRow["providername"] as string; m_providerUsername = providerRow["providerusername"] as string; m_providerPassword = providerRow["providerpassword"] as string; m_providerServer = SIPURI.ParseSIPURIRelaxed(providerRow["providerserver"] as string); m_providerAuthUsername = (providerRow.Table.Columns.Contains("providerauthusername") && providerRow["providerauthusername"] != null) ? providerRow["providerauthusername"] as string : null; m_providerOutboundProxy = (providerRow.Table.Columns.Contains("provideroutboundproxy") && providerRow["provideroutboundproxy"] != null) ? providerRow["provideroutboundproxy"] as string : null; m_providerFrom = (providerRow.Table.Columns.Contains("providerfrom") && providerRow["providerfrom"] != null) ? providerRow["providerfrom"] as string : null; m_customHeaders = (providerRow.Table.Columns.Contains("customheaders") && providerRow["customheaders"] != null) ? providerRow["customheaders"] as string : null; m_registerContact = (providerRow.Table.Columns.Contains("registercontact") && providerRow["registercontact"] != DBNull.Value && providerRow["registercontact"] != null && providerRow["registercontact"].ToString().Length > 0) ? SIPURI.ParseSIPURIRelaxed(providerRow["registercontact"] as string) : null; m_registerExpiry = (providerRow.Table.Columns.Contains("registerexpiry") && providerRow["registerexpiry"] != DBNull.Value && providerRow["registerexpiry"] != null) ? Convert.ToInt32(providerRow["registerexpiry"]) : REGISTER_DEFAULT_EXPIRY; m_registerServer = (providerRow.Table.Columns.Contains("registerserver") && providerRow["registerserver"] != null) ? SIPURI.ParseSIPURIRelaxed(providerRow["registerserver"] as string) : null; m_registerRealm = (providerRow.Table.Columns.Contains("registerrealm") && providerRow["registerrealm"] != null) ? providerRow["registerrealm"] as string : null; m_registerEnabled = (providerRow.Table.Columns.Contains("registerenabled") && providerRow["registerenabled"] != DBNull.Value && providerRow["registerenabled"] != null) ? Convert.ToBoolean(providerRow["registerenabled"]) : false; m_registerAdminEnabled = (providerRow.Table.Columns.Contains("registeradminenabled") && providerRow["registeradminenabled"] != DBNull.Value && providerRow["registeradminenabled"] != null) ? Convert.ToBoolean(providerRow["registeradminenabled"]) : true; m_registerDisabledReason = (providerRow.Table.Columns.Contains("registerdisabledreason") && providerRow["registerdisabledreason"] != DBNull.Value && providerRow["registerdisabledreason"] != null) ? providerRow["registerdisabledreason"] as string : null; m_gvCallbackNumber = (providerRow.Table.Columns.Contains("gvcallbacknumber") && providerRow["gvcallbacknumber"] != null) ? providerRow["gvcallbacknumber"] as string : null; m_gvCallbackPattern = (providerRow.Table.Columns.Contains("gvcallbackpattern") && providerRow["gvcallbackpattern"] != null) ? providerRow["gvcallbackpattern"] as string : null; m_gvCallbackType = (providerRow.Table.Columns.Contains("gvcallbacktype") && providerRow["gvcallbacktype"] != DBNull.Value && providerRow["gvcallbacktype"] != null && (providerRow["gvcallbacktype"] as string).NotNullOrBlank()) ? (GoogleVoiceCallbackTypes)Enum.Parse(typeof(GoogleVoiceCallbackTypes), providerRow["gvcallbacktype"] as string, true) : (GoogleVoiceCallbackTypes?)null; LastUpdate = (providerRow.Table.Columns.Contains("lastupdate") && providerRow["lastupdate"] != DBNull.Value && providerRow["lastupdate"] != null) ? DateTimeOffset.Parse(providerRow["lastupdate"] as string) : DateTimeOffset.UtcNow; Inserted = (providerRow.Table.Columns.Contains("inserted") && providerRow["inserted"] != DBNull.Value && providerRow["inserted"] != null) ? DateTimeOffset.Parse(providerRow["inserted"] as string) : DateTimeOffset.UtcNow; m_isReadOnly = (providerRow.Table.Columns.Contains("isreadonly") && providerRow["isreadonly"] != DBNull.Value && providerRow["isreadonly"] != null) ? Convert.ToBoolean(providerRow["isreadonly"]) : false; m_sendMWISubscribe = (providerRow.Table.Columns.Contains("sendmwisubscribe") && providerRow["sendmwisubscribe"] != DBNull.Value && providerRow["sendmwisubscribe"] != null) ? Convert.ToBoolean(providerRow["sendmwisubscribe"]) : false; if (m_registerContact == null && m_registerEnabled) { m_registerEnabled = false; m_registerDisabledReason = "No Contact URI was specified for the registration."; logger.Warn("Registrations for provider " + m_providerName + " owned by " + m_owner + " have been disabled due to an empty or invalid Contact URI."); } } catch (Exception excp) { logger.Error("Exception SIPProvider Load. " + excp.Message); throw; } }
public DataSource(string key, ProviderTypes providerType, string connectionString, int version = 0) { Key = key; ProviderType = providerType; ProviderTypeString = providerType.ToString(); ConnectionString = connectionString; if (ProviderType == ProviderTypes.SqlServer) { DbConnectionType = typeof(SqlConnection); } else if (ProviderType == ProviderTypes.DB2iSeries) { DbConnectionType = AppDomain.CurrentDomain.GetAssemblies() .Where(x => x.GetName().Name == "IBM.Data.DB2.iSeries") .SelectMany(x => x.GetTypes().Where(t => t.Name == "iDB2Connection")) .FirstOrDefault(); } Version = version; }
private static AuthData GetEncodedAccesToken(AuthData authData, ProviderTypes provider) { switch (provider) { case ProviderTypes.Google: case ProviderTypes.GoogleDrive: var tokenSecret = ImportConfiguration.GoogleTokenManager.GetTokenSecret(authData.Token); var consumerKey = ImportConfiguration.GoogleTokenManager.ConsumerKey; var consumerSecret = ImportConfiguration.GoogleTokenManager.ConsumerSecret; var accessToken = GoogleDocsAuthorizationHelper.BuildToken(authData.Token, tokenSecret, consumerKey, consumerSecret); var storage = new CloudStorage(); authData.Token = storage.SerializeSecurityTokenToBase64Ex(accessToken, typeof(GoogleDocsConfiguration), null); break; } return(authData); }
public static SageProviderConfiguration GetSection(ProviderTypes providerType) { var section = ConfigurationManager.GetSection(sectionName) as SageConfiguration; return section.Providers[providerType]; }
private static void SwitchTypes(short set, IDataReader reader, ProviderTypes provider) { switch (set) { case 0: TwoColumn languages = MapTwoColumns(reader); if (provider.Languages == null) { provider.Languages = new List <TwoColumn>(); } provider.Languages.Add(languages); break; case 1: TwoColumn daysOfWeek = MapTwoColumns(reader); if (provider.DaysOfWeek == null) { provider.DaysOfWeek = new List <TwoColumn>(); } provider.DaysOfWeek.Add(daysOfWeek); break; case 2: TwoColumn concernTypes = MapTwoColumns(reader); if (provider.ConcernTypes == null) { provider.ConcernTypes = new List <TwoColumn>(); } provider.ConcernTypes.Add(concernTypes); break; case 3: TwoColumn expertiseTypes = MapTwoColumns(reader); if (provider.ExpertiseTypes == null) { provider.ExpertiseTypes = new List <TwoColumn>(); } provider.ExpertiseTypes.Add(expertiseTypes); break; case 4: TwoColumn licenseTypes = MapTwoColumns(reader); if (provider.LicenseTypes == null) { provider.LicenseTypes = new List <TwoColumn>(); } provider.LicenseTypes.Add(licenseTypes); break; case 5: TwoColumn careNeedsTypes = MapTwoColumns(reader); if (provider.CareNeedsTypes == null) { provider.CareNeedsTypes = new List <TwoColumn>(); } provider.CareNeedsTypes.Add(careNeedsTypes); break; case 6: TwoColumn certificateTypes = MapTwoColumns(reader); if (provider.CertificateTypes == null) { provider.CertificateTypes = new List <TwoColumn>(); } provider.CertificateTypes.Add(certificateTypes); break; case 7: TwoColumn helpNeedTypes = MapTwoColumns(reader); if (provider.HelpNeedTypes == null) { provider.HelpNeedTypes = new List <TwoColumn>(); } provider.HelpNeedTypes.Add(helpNeedTypes); break; case 8: TwoColumn states = MapTwoColumns(reader); if (provider.States == null) { provider.States = new List <TwoColumn>(); } provider.States.Add(states); break; case 9: TwoColumn providerTypes = MapTwoColumns(reader); if (provider.LocationTypes == null) { provider.LocationTypes = new List <TwoColumn>(); } provider.LocationTypes.Add(providerTypes); break; } }
private void Add() { try { SIPProvider sipProvider = null; ProviderTypes providerType = (m_providerTypeSIPRadio.IsChecked != null && m_providerTypeSIPRadio.IsChecked.Value) ? ProviderTypes.SIP : ProviderTypes.GoogleVoice; string providerName = m_providerName.Text.Trim(); string providerUsername = m_providerUsername.Text.Trim(); string providerPassword = m_providerPassword.Text.Trim(); if (providerType == ProviderTypes.SIP) { SIPURI providerServer = (!m_providerServer.Text.IsNullOrBlank()) ? SIPURI.ParseSIPURIRelaxed(m_providerServer.Text.Trim()) : null; bool registerEnabled = m_providerRegister.IsChecked.Value; bool sendMWISubscribe = m_providerSendMWISubscribe.IsChecked.Value; SIPURI registerContact = (!m_providerRegisterContact.Text.IsNullOrBlank()) ? SIPURI.ParseSIPURIRelaxed(m_providerRegisterContact.Text.Trim()) : null; string authUsername = m_providerAuthUsername.Text.Trim(); string providerFrom = m_providerFromHeader.Text.Trim(); string registerRealm = m_providerRegisterRealm.Text.Trim(); SIPURI registerServer = (!m_providerRegisterServer.Text.IsNullOrBlank()) ? SIPURI.ParseSIPURIRelaxed(m_providerRegisterServer.Text.Trim()) : null; int registerExpiry = m_defaultRegisterExpiry; Int32.TryParse(m_providerRegisterExpiry.Text, out registerExpiry); string customHeaders = null; if (m_providerCustomHeaders.Items.Count > 0) { foreach (string customHeader in m_providerCustomHeaders.Items) { customHeaders += (m_sipProvider.CustomHeaders != null && m_sipProvider.CustomHeaders.Trim().Length > 0) ? m_customHeadersSeparator.ToString() : null; customHeaders += customHeader; } } sipProvider = new SIPProvider() { ID = Guid.NewGuid().ToString(), ProviderType = ProviderTypes.SIP.ToString(), Owner = m_owner, ProviderName = providerName, ProviderUsername = providerUsername, ProviderPassword = providerPassword, ProviderServer = (providerServer != null) ? providerServer.ToString() : null, ProviderFrom = providerFrom, CustomHeaders = customHeaders, RegisterContact = (registerContact != null) ? registerContact.ToString() : null, RegisterExpiry = registerExpiry, RegisterServer = (registerServer != null) ? registerServer.ToString() : null, ProviderAuthUsername = authUsername, RegisterRealm = registerRealm, RegisterEnabled = registerEnabled, SendMWISubscribe = sendMWISubscribe, RegisterAdminEnabled = true, Inserted = DateTime.Now.ToString("o"), LastUpdate = DateTime.Now.ToString("o") }; } else { //string gvCallbackNumber = m_gvCallbackNumber.Text; //string gvCallbackPattern = m_gvCallbackNumber.Text; //GoogleVoiceCallbackTypes callbackType = (GoogleVoiceCallbackTypes)Enum.Parse(typeof(GoogleVoiceCallbackTypes), ((TextBlock)m_gvCallbackType.SelectedValue).Text, true); //sipProvider = new SIPProvider(ProviderTypes.GoogleVoice, m_owner, providerName, providerUsername, providerPassword, null, null, null, null, // null, 0, null, null, null, false, true, gvCallbackNumber, gvCallbackPattern, callbackType); sipProvider = new SIPProvider() { ID = Guid.NewGuid().ToString(), ProviderType = ProviderTypes.GoogleVoice.ToString(), Owner = m_owner, ProviderName = providerName, ProviderUsername = providerUsername, ProviderPassword = providerPassword, GVCallbackNumber = m_gvCallbackNumber.Text, GVCallbackPattern = m_gvCallbackPattern.Text, GVCallbackType = ((TextBlock)m_gvCallbackType.SelectedValue).Text, Inserted = DateTime.Now.ToString("o"), LastUpdate = DateTime.Now.ToString("o") }; } if (sipProvider.HasValidationErrors) { WriteStatusMessage(MessageLevelsEnum.Warn, sipProvider.ValidationErrors.First().ErrorMessage); } else { WriteStatusMessage(MessageLevelsEnum.Info, "Adding SIP Provider please wait..."); SIPProviderAdd_External(sipProvider); } } catch (Exception excp) { WriteStatusMessage(MessageLevelsEnum.Error, "Add SIPProvider Exception. " + excp.Message); } }
public static ITransformationProvider Create(ProviderTypes providerType, IDbConnection connection, string defaultSchema, string scope = "default", string providerName = "") { Dialect dialectInstance = DialectForProvider(providerType); return(dialectInstance.NewProviderForDialect(connection, defaultSchema, scope, providerName)); }
private static SagePayment FetchForConfiguration(ProviderTypes? type, SageConfiguration section) { var provider = section.Providers[type ?? section.Default]; return Fetch(provider.Type, provider.VendorName); }
public static SagePayment Fetch(ProviderTypes? type, string filename) { return FetchForConfiguration(type, GetSection(filename)); }
public TypeMap(ProviderTypes type, Type paymentType, Type refundType) { ProviderType = type; PaymentType = paymentType; RefundType = refundType; }
/// <summary> /// Checks if a provider with the given type exists at the ServiceManager /// </summary> /// <typeparam name="T">The type of service</typeparam> /// <param name="type">The provider type</param> /// <returns>Returns true if a provider of the given type was registered</returns> public static bool ProviderExists <T>(ProviderTypes type) where T : IService { EnsureInstance(); return(instance.InstProviderExists <T>(type)); }
public void Load(DataRow providerRow) { try { m_id = (providerRow.Table.Columns.Contains("id") && providerRow["id"] != DBNull.Value && providerRow["id"] != null) ? new Guid(providerRow["id"] as string) : Guid.NewGuid(); m_providerType = (ProviderTypes)Enum.Parse(typeof(ProviderTypes), providerRow["providertype"] as string, true); m_owner = providerRow["owner"] as string; AdminMemberId = (providerRow.Table.Columns.Contains("adminmemberid") && providerRow["adminmemberid"] != null) ? providerRow["adminmemberid"] as string : null; m_providerName = providerRow["providername"] as string; m_providerUsername = providerRow["providerusername"] as string; m_providerPassword = providerRow["providerpassword"] as string; m_providerServer = SIPURI.ParseSIPURIRelaxed(providerRow["providerserver"] as string); m_providerAuthUsername = (providerRow.Table.Columns.Contains("providerauthusername") && providerRow["providerauthusername"] != null) ? providerRow["providerauthusername"] as string : null; m_providerOutboundProxy = (providerRow.Table.Columns.Contains("provideroutboundproxy") && providerRow["provideroutboundproxy"] != null) ? providerRow["provideroutboundproxy"] as string : null; m_providerFrom = (providerRow.Table.Columns.Contains("providerfrom") && providerRow["providerfrom"] != null) ? providerRow["providerfrom"] as string : null; m_customHeaders = (providerRow.Table.Columns.Contains("customheaders") && providerRow["customheaders"] != null) ? providerRow["customheaders"] as string : null; m_registerContact = (providerRow.Table.Columns.Contains("registercontact") && providerRow["registercontact"] != DBNull.Value && providerRow["registercontact"] != null && providerRow["registercontact"].ToString().Length > 0) ? SIPURI.ParseSIPURIRelaxed(providerRow["registercontact"] as string) : null; m_registerExpiry = (providerRow.Table.Columns.Contains("registerexpiry") && providerRow["registerexpiry"] != DBNull.Value && providerRow["registerexpiry"] != null) ? Convert.ToInt32(providerRow["registerexpiry"]) : REGISTER_DEFAULT_EXPIRY; m_registerServer = (providerRow.Table.Columns.Contains("registerserver") && providerRow["registerserver"] != null) ? SIPURI.ParseSIPURIRelaxed(providerRow["registerserver"] as string) : null; m_registerRealm = (providerRow.Table.Columns.Contains("registerrealm") && providerRow["registerrealm"] != null) ? providerRow["registerrealm"] as string : null; m_registerEnabled = (providerRow.Table.Columns.Contains("registerenabled") && providerRow["registerenabled"] != DBNull.Value && providerRow["registerenabled"] != null) ? Convert.ToBoolean(providerRow["registerenabled"]) : false; m_registerAdminEnabled = (providerRow.Table.Columns.Contains("registeradminenabled") && providerRow["registeradminenabled"] != DBNull.Value && providerRow["registeradminenabled"] != null) ? Convert.ToBoolean(providerRow["registeradminenabled"]) : true; m_registerDisabledReason = (providerRow.Table.Columns.Contains("registerdisabledreason") && providerRow["registerdisabledreason"] != DBNull.Value && providerRow["registerdisabledreason"] != null) ? providerRow["registerdisabledreason"] as string : null; m_gvCallbackNumber = (providerRow.Table.Columns.Contains("gvcallbacknumber") && providerRow["gvcallbacknumber"] != null) ? providerRow["gvcallbacknumber"] as string : null; m_gvCallbackPattern = (providerRow.Table.Columns.Contains("gvcallbackpattern") && providerRow["gvcallbackpattern"] != null) ? providerRow["gvcallbackpattern"] as string : null; m_gvCallbackType = (providerRow.Table.Columns.Contains("gvcallbacktype") && providerRow["gvcallbacktype"] != DBNull.Value && providerRow["gvcallbacktype"] != null && (providerRow["gvcallbacktype"] as string).NotNullOrBlank()) ? (GoogleVoiceCallbackTypes)Enum.Parse(typeof(GoogleVoiceCallbackTypes), providerRow["gvcallbacktype"] as string, true) : (GoogleVoiceCallbackTypes?)null; LastUpdate = (providerRow.Table.Columns.Contains("lastupdate") && providerRow["lastupdate"] != DBNull.Value && providerRow["lastupdate"] != null) ? DateTimeOffset.Parse(providerRow["lastupdate"] as string) : DateTimeOffset.UtcNow; Inserted = (providerRow.Table.Columns.Contains("inserted") && providerRow["inserted"] != DBNull.Value && providerRow["inserted"] != null) ? DateTimeOffset.Parse(providerRow["inserted"] as string) : DateTimeOffset.UtcNow; m_isReadOnly = (providerRow.Table.Columns.Contains("isreadonly") && providerRow["isreadonly"] != DBNull.Value && providerRow["isreadonly"] != null) ? Convert.ToBoolean(providerRow["isreadonly"]) : false; m_sendMWISubscribe = (providerRow.Table.Columns.Contains("sendmwisubscribe") && providerRow["sendmwisubscribe"] != DBNull.Value && providerRow["sendmwisubscribe"] != null) ? Convert.ToBoolean(providerRow["sendmwisubscribe"]) : false; if (m_registerContact == null && m_registerEnabled) { m_registerEnabled = false; m_registerDisabledReason = "No Contact URI was specified for the registration."; logger.Warn("Registrations for provider " + m_providerName + " owned by " + m_owner + " have been disabled due to an empty or invalid Contact URI."); } } catch (Exception excp) { logger.Error("Exception SIPProvider Load. " + excp.Message); throw; } }
public WebSageRefund(ProviderTypes type, string url) : base(type) { Url = url; }
public bool ApiKeyDialog(Activity activity, ProviderTypes providerType, int providerId, bool alwaysShowDialog, Action okAction, Action cancelAction, ToastLength toastLength, ILog log) { if (activity == null) { throw new ArgumentNullException(nameof(activity)); } var isValidServiceProvider = true; var isValidApiKey = true; switch (providerType) { case ProviderTypes.WeatherProvider: isValidServiceProvider = AppSettings.Default.ValidateWeatherProvider(providerId); break; } if (isValidServiceProvider) { isValidApiKey = AppSettings.Default.ValidateApiKey(providerId); } var result = isValidServiceProvider && isValidApiKey; if (alwaysShowDialog || !result) { int providerNameId; switch (providerType) { case ProviderTypes.WeatherProvider: providerNameId = AppSettings.Default.GetWeatherProviderNameById(providerId); break; default: providerNameId = AppSettings.Default.GetProviderNameById(providerId); break; } string message = null; activity.RunOnUiThread(() => { if (!isValidServiceProvider) { message = string.Format(activity.GetString(Resource.String.WeatherProviderIsNotImplemented), providerNameId); } else if (alwaysShowDialog || !isValidApiKey) { string GetErrorHandler() { switch (providerType) { case ProviderTypes.WeatherProvider: return(Properties.Resources.UndefinedWeatherProviderApiKey); default: return(Http.Properties.Resources.UndefinedServerApiKey); } } Exception GetExceptionHandler() { switch (providerType) { case ProviderTypes.WeatherProvider: return(new WeatherApiKeyException()); default: return(new ApiKeyException()); } } var dlg = new WidgetUtil(); dlg.InputDialog(context: activity, titleId: providerNameId, layoutId: Resource.Layout.text_input, editTextId: Resource.Id.txtInput, createAction: (view, input) => { if (input == null) { return; } // android:inputType="textPassword" input.InputType = InputTypes.ClassText | InputTypes.TextVariationPassword; }, okAction: (view, value) => { if (string.IsNullOrEmpty(value)) { return(false); } try { AppSettings.Default.SaveApiKey(providerId, value); if (!AppSettings.Default.ValidateApiKey(providerId)) { throw GetExceptionHandler(); } okAction?.Invoke(); } catch (Exception ex) { log?.ErrorFormat("{0} {1}", "OkAction", ex); Toast.MakeText(activity, activity.GetString(Resource.String.InternalError), toastLength).Show(); } return(true); }, cancelAction: () => { cancelAction?.Invoke(); if (!AppSettings.Default.ValidateApiKey(providerId)) { message = GetErrorHandler(); if (!string.IsNullOrEmpty(message)) { Toast.MakeText(activity, message, toastLength).Show(); } } }); return; } if (!string.IsNullOrEmpty(message)) { Toast.MakeText(activity, message, toastLength).Show(); } }); } return(result); }
public BaseSageRequest(ProviderTypes type) { var config = SageConfiguration.GetSection(type); Vendor = new VendorRequest(config.VendorName); }
private static AuthData GetEncodedAccesToken(AuthData authData, ProviderTypes provider) { switch (provider) { case ProviderTypes.Google: case ProviderTypes.GoogleDrive: var tokenSecret = ImportConfiguration.GoogleTokenManager.GetTokenSecret(authData.Token); var consumerKey = ImportConfiguration.GoogleTokenManager.ConsumerKey; var consumerSecret = ImportConfiguration.GoogleTokenManager.ConsumerSecret; var accessToken = GoogleDocsAuthorizationHelper.BuildToken(authData.Token, tokenSecret, consumerKey, consumerSecret); var storage = new CloudStorage(); authData.Token = storage.SerializeSecurityTokenToBase64Ex(accessToken, typeof(GoogleDocsConfiguration), null); break; } return authData; }
public ProviderMapping(ProviderTypes type, Type paymentType, Type refundType) { ProviderType = type; PaymentType = paymentType; RefundType = refundType; }
private static AuthData GetEncodedAccesToken(AuthData authData, ProviderTypes provider) { switch (provider) { case ProviderTypes.GoogleDrive: var code = authData.Token; var token = OAuth20TokenHelper.GetAccessToken(GoogleLoginProvider.GoogleOauthTokenUrl, GoogleLoginProvider.GoogleOAuth20ClientId, GoogleLoginProvider.GoogleOAuth20ClientSecret, GoogleLoginProvider.GoogleOAuth20RedirectUrl, code); if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider)); authData.Token = EncryptPassword(token.ToJson()); break; case ProviderTypes.SkyDrive: code = authData.Token; token = OAuth20TokenHelper.GetAccessToken(OneDriveLoginProvider.OneDriveOauthTokenUrl, OneDriveLoginProvider.OneDriveOAuth20ClientId, OneDriveLoginProvider.OneDriveOAuth20ClientSecret, OneDriveLoginProvider.OneDriveOAuth20RedirectUrl, code); if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider)); var accessToken = AppLimit.CloudComputing.SharpBox.Common.Net.oAuth20.OAuth20Token.FromJson(token.ToJson()); var config = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.SkyDrive); var storage = new CloudStorage(); var base64AccessToken = storage.SerializeSecurityTokenToBase64Ex(accessToken, config.GetType(), new Dictionary<string, string>()); authData.Token = base64AccessToken; break; case ProviderTypes.SharePoint: case ProviderTypes.WebDav: break; default: authData.Url = null; break; } return authData; }
/// <summary> /// Checks if a provider with the given type exists at this instance /// </summary> /// <typeparam name="T">The type of service</typeparam> /// <param name="type">The provider type</param> /// <returns>Returns true if a service of the given type was registered at this instance</returns> public bool InstProviderExists <T>(ProviderTypes type) where T : IService { return(registeredProviders.ContainsKey(type)); }
public SchemaDumper(ProviderTypes provider, string connectionString, string defaultSchema) { _provider = ProviderFactory.Create(provider, connectionString, defaultSchema); }
public static SagePayment Fetch(ProviderTypes? type) { return FetchForConfiguration(type, GetSection(null)); }
void ParseArguments(string[] argv) { for (int i = 0; i < argv.Length; i++) { if (argv[i].Equals("-list")) { _list = true; } else if (argv[i].Equals("-trace")) { _trace = true; } else if (argv[i].Equals("-dryrun")) { _dryrun = true; } else if (argv[i].Equals("-version")) { _migrateTo = long.Parse(argv[i + 1]); i++; } else if (argv[i].EndsWith("-defaultSchema")) { _defaultSchema = argv[i + 1]; } else if (argv[i].Equals("-dump")) { _dumpTo = argv[i + 1]; i++; } else { if (i == 0) _provider = (ProviderTypes)Enum.Parse(typeof(ProviderTypes), argv[i]); if (i == 1) _connectionString = argv[i]; if (i == 2) _migrationsAssembly = argv[i]; } } }
public static SagePayment Fetch(ProviderTypes type, string vendorName) { var paymentType = Map.Single(x => x.ProviderType == type).PaymentType; return (SagePayment)Activator.CreateInstance(paymentType); }
public Migrator(ProviderTypes provider, string connectionString, string defaultSchema, Assembly migrationAssembly) : this(provider, connectionString, defaultSchema, migrationAssembly, false) { }
public static SageRefundRequest Fetch(ProviderTypes? type) { return FetchForConfiguration(type, GetSection(null)); }
public Migrator(ProviderTypes provider, string connectionString, string defaultSchema, params Type[] migrationTypes) : this(provider, connectionString, defaultSchema, false, migrationTypes) { }
public SageProviderConfiguration this[ProviderTypes index] { get { return (SageProviderConfiguration) BaseGet(index); } }
public Migrator(ProviderTypes provider, string connectionString, string defaultSchema, Assembly migrationAssembly, bool trace, ILogger logger) : this(ProviderFactory.Create(provider, connectionString, defaultSchema), migrationAssembly, trace, logger) { }
public SagePayment(ProviderTypes type) : base(type) { }
public Migrator(ProviderTypes provider, string connectionString, string defaultSchema, bool trace, ILogger logger, params Type[] migrationTypes) : this(ProviderFactory.Create(provider, connectionString, defaultSchema), trace, logger, migrationTypes) { }
/// <summary> /// Registers a new provider at the service manager /// </summary> /// <typeparam name="T">The type of service</typeparam> /// <param name="provider">The provider instance which should be registered at the ServiceManager</param> /// /// <param name="type">The type of provider which should be registered at the ServiceManager</param> public static void RegisterProvider <T>(T provider, ProviderTypes type) where T : IService { EnsureInstance(); instance.InstRegisterProvider(provider, type); }
/// <summary> /// Removes a service with the given type from the ServiceManager /// </summary> /// <typeparam name="T">The type of service</typeparam> /// <param name="type">The provider type that should be removed</param> public static void RemoveProvider <T>(ProviderTypes type) where T : IService { EnsureInstance(); instance.InstRemoveProvider <T>(type); }
public SIPProvider( ProviderTypes providerType, string owner, string name, string username, string password, SIPURI server, string outboundProxy, string from, string custom, SIPURI registerContact, int registerExpiry, SIPURI registerServer, string authUsername, string registerRealm, bool registerEnabled, bool registerEnabledAdmin, string gvCallbackNumber, string gvCallbackPattern, GoogleVoiceCallbackTypes? gvCallbackType) { m_providerType = providerType; m_owner = owner; m_id = Guid.NewGuid(); m_providerName = name; m_providerUsername = username; m_providerPassword = password; m_providerServer = server; m_providerOutboundProxy = outboundProxy; m_providerFrom = from; m_customHeaders = custom; m_registerContact = registerContact; m_registerExpiry = (registerExpiry < REGISTER_MINIMUM_EXPIRY) ? REGISTER_MINIMUM_EXPIRY : registerExpiry; m_registerServer = registerServer; m_providerAuthUsername = authUsername; m_registerRealm = registerRealm; m_registerEnabled = registerEnabled; m_registerAdminEnabled = registerEnabledAdmin; m_gvCallbackNumber = gvCallbackNumber; m_gvCallbackPattern = gvCallbackPattern; m_gvCallbackType = gvCallbackType; Inserted = DateTimeOffset.UtcNow; LastUpdate = DateTimeOffset.UtcNow; //if (m_registerContact != null) //{ // m_registerContact.Parameters.Set(CONTACT_ID_KEY, Crypto.GetRandomString(6)); //} //if (m_registerContact == null && m_registerEnabled) //{ // m_registerEnabled = false; // m_registerDisabledReason = "No Contact URI was specified for the registration."; // logger.Warn("Registrations for provider " + m_providerName + " owned by " + m_owner + " have been disabled due to an empty or invalid Contact URI."); //} }
/// <summary> /// Gets the provider instance with the given type /// </summary> /// <typeparam name="T">The type of service</typeparam> /// <param name="type">The provider type</param> /// <returns>Returns the registered provider instance</returns> public static T GetProvider <T>(ProviderTypes type) where T : IService { EnsureInstance(); return(instance.InstGetProvider <T>(type)); }
private static AuthData GetEncodedAccesToken(AuthData authData, ProviderTypes provider) { switch (provider) { case ProviderTypes.GoogleDrive: var code = authData.Token; var token = OAuth20TokenHelper.GetAccessToken(GoogleLoginProvider.GoogleOauthTokenUrl, GoogleLoginProvider.GoogleOAuth20ClientId, GoogleLoginProvider.GoogleOAuth20ClientSecret, GoogleLoginProvider.GoogleOAuth20RedirectUrl, code); if (token == null) { throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider)); } return(new AuthData(token: token.ToJson())); case ProviderTypes.Box: code = authData.Token; token = OAuth20TokenHelper.GetAccessToken(BoxLoginProvider.BoxOauthTokenUrl, BoxLoginProvider.BoxOAuth20ClientId, BoxLoginProvider.BoxOAuth20ClientSecret, BoxLoginProvider.BoxOAuth20RedirectUrl, code); if (token == null) { throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider)); } return(new AuthData(token: token.ToJson())); case ProviderTypes.DropboxV2: code = authData.Token; token = OAuth20TokenHelper.GetAccessToken(DropboxLoginProvider.DropboxOauthTokenUrl, DropboxLoginProvider.DropboxOAuth20ClientId, DropboxLoginProvider.DropboxOAuth20ClientSecret, DropboxLoginProvider.DropboxOAuth20RedirectUrl, code); if (token == null) { throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider)); } return(new AuthData(token: token.ToJson())); case ProviderTypes.DropBox: var dropBoxRequestToken = DropBoxRequestToken.Parse(authData.Token); var config = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.DropBox); var accessToken = DropBoxStorageProviderTools.ExchangeDropBoxRequestTokenIntoAccessToken(config as DropBoxConfiguration, ImportConfiguration.DropboxAppKey, ImportConfiguration.DropboxAppSecret, dropBoxRequestToken); var base64Token = new CloudStorage().SerializeSecurityTokenToBase64Ex(accessToken, config.GetType(), new Dictionary <string, string>()); return(new AuthData(token: base64Token)); case ProviderTypes.SkyDrive: code = authData.Token; token = OAuth20TokenHelper.GetAccessToken(OneDriveLoginProvider.OneDriveOauthTokenUrl, OneDriveLoginProvider.OneDriveOAuth20ClientId, OneDriveLoginProvider.OneDriveOAuth20ClientSecret, OneDriveLoginProvider.OneDriveOAuth20RedirectUrl, code); if (token == null) { throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider)); } accessToken = AppLimit.CloudComputing.SharpBox.Common.Net.oAuth20.OAuth20Token.FromJson(token.ToJson()); if (accessToken == null) { throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider)); } config = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.SkyDrive); var storage = new CloudStorage(); base64Token = storage.SerializeSecurityTokenToBase64Ex(accessToken, config.GetType(), new Dictionary <string, string>()); return(new AuthData(token: base64Token)); case ProviderTypes.SharePoint: case ProviderTypes.WebDav: break; default: authData.Url = null; break; } return(authData); }
public SageRefundRequest(ProviderTypes type) : base(type) { }