/// <summary> /// Get the OAuth API endpoint from settings. /// </summary> /// <param name="key">The key.</param> /// <returns>The OAuth API endpoint from settings.</returns> private static string GetOAuthApiFromSettingsUrl(string key = "OAuthApiEndpoint") { var url = SettingsUtils.GetAppSettings(key); if (!string.IsNullOrEmpty(url)) { MicrosoftAppCredentials.TrustServiceUrl(url, DateTime.MaxValue); } return(url); }
public SkillAuthenticationConfiguration() { if (string.IsNullOrEmpty(ConfigurationManager.AppSettings[AllowedCallersConfigKey])) { throw new AuthenticationException($"{AllowedCallersConfigKey} is required in AppSettings."); } var allowedCallersValue = SettingsUtils.GetAppSettings(AllowedCallersConfigKey); var allowedCallers = allowedCallersValue.Split(',').Select(s => s.Trim().ToUpperInvariant()).ToList(); ClaimsValidator = new DefaultAllowedCallersClaimsValidator(allowedCallers); }
private static bool GetEmulateOAuthCardsSetting(string key = "EmulateOAuthCards") { var value = SettingsUtils.GetAppSettings(key); bool result = false; if (!string.IsNullOrEmpty(value) && !bool.TryParse(value, out result)) { // default back to false result = false; } return(result); }
static SearchDialogIndexClient() { var indexName = SettingsUtils.GetAppSettings("SearchDialogsIndexName"); var adminKey = SettingsUtils.GetAppSettings("SearchDialogsServiceAdminKey"); if (adminKey != null) { var adminClient = new SearchServiceClient(SettingsUtils.GetAppSettings("SearchDialogsServiceName"), new SearchCredentials(adminKey)); schema = new SearchSchema().AddFields(adminClient.Indexes.Get(indexName).Fields); } var client = new SearchServiceClient(SettingsUtils.GetAppSettings("SearchDialogsServiceName"), new SearchCredentials(SettingsUtils.GetAppSettings("SearchDialogsServiceKey"))); searchClient = client.Indexes.GetClient(indexName); }
/// <summary> /// Loads core bot library configuration from the cloud service configuration /// </summary> /// <returns>MessagingBotServiceSettings</returns> public static CallingBotServiceSettings LoadFromCloudConfiguration() { CallingBotServiceSettings settings; try { settings = new CallingBotServiceSettings { CallbackUrl = SettingsUtils.GetAppSettings("Microsoft.Bot.Builder.Calling.CallbackUrl") }; } catch (Exception e) { throw new BotConfigurationException( "A mandatory configuration item is missing or invalid", e); } settings.Validate(); return(settings); }
/// <summary> /// Get the state api endpoint from settings. /// </summary> /// <param name="key">The key.</param> /// <returns>The state api endpoint from settings.</returns> private static string GetSettingsStateApiUrl(string key = "BotStateEndpoint") { return(SettingsUtils.GetAppSettings(key)); }