public AuthenticationHelper(ISettingsHelper settingsHelper, IAuthBroker authBroker, ISecretsProvider secretsProvider, IHttpClient httpClient) { SettingsHelper = settingsHelper; AuthBroker = authBroker; this.secretsProvider = secretsProvider; this.httpClient = httpClient; }
public QueryCommand(ISecretsProvider secrets) { this.secrets = secrets; Command = new Command("query", "Make a SQL query and retrieve up to 1000 rows") { new Argument <string>("query") { Arity = ArgumentArity.ExactlyOne, Description = "The SQL query to run", }, new Option <long>( alias: "--source-limit", description: "Maximum number of rows to read from each data source. " + "Values lower than 1 will disable this limit. Default: 100", getDefaultValue: () => 100 ), new Option <long>( alias: "--infer-schema-limit", description: "Maximum number of rows to read for inferring schema from RAW tables. " + "Values lower than 1 will disable this limit. Default: 100", getDefaultValue: () => 100 ), }; Command.Handler = CommandHandler.Create <string, string, long, long>(Handle); }
public SecretsHelper(ISettingsHelper settingsHelper, AuthenticationHelper authHelper, IVault vault, ISecretsProvider secretsProvider) { SettingsHelper = settingsHelper; AuthenticationHelper = authHelper; this.vault = vault; this.secretsProvider = secretsProvider; }
/// <summary> /// Gets blob credentials from the given secrets provider /// </summary> public static async Task <AzureBlobStorageCredentials> GetBlobCredentialsAsync( this ISecretsProvider secretsProvider, string secretName, bool useSasTokens, CancellationToken token) { if (useSasTokens) { var secrets = await secretsProvider.RetrieveSecretsAsync(new List <RetrieveSecretsRequest>() { new RetrieveSecretsRequest(secretName, SecretKind.SasToken) }, token); return(new AzureBlobStorageCredentials((UpdatingSasToken)secrets.Secrets[secretName])); } else { var secrets = await secretsProvider.RetrieveSecretsAsync(new List <RetrieveSecretsRequest>() { new RetrieveSecretsRequest(secretName, SecretKind.PlainText) }, token); return(new AzureBlobStorageCredentials((PlainTextSecret)secrets.Secrets[secretName])); } }
public RunCommand(ISecretsProvider secrets) { this.secrets = secrets; Command = new Command("run", "Start and/or watch transformation jobs") { new Option <int?>("--id") { Description = "The id of the transformation to run. Either this or --external-id must be specified." }, new Option <string>("--external-id") { Description = "The externalId of the transformation to run. Either this or --id must be specified." }, new Option <bool>("--watch") { Description = "Wait until job has completed" }, new Option <bool>("--watch-only") { Description = "Do not start a transformation job, only watch the most recent job for completion" }, new Option <TimeSpan>("--timeout", () => TimeSpan.FromHours(12)) { Description = "Maximum amount of time to wait for job to complete" }, new Option <TimeSpan>("--interval", () => TimeSpan.FromSeconds(5)) { Description = "Time interval for polling job status" } }; Command.Handler = CommandHandler.Create( (Func <IConsole, string, int?, string, bool, bool, TimeSpan, TimeSpan, Task <int> >)Handle ); }
public static IJetfireClient CreateClient(ISecretsProvider secrets, string cluster) { var baseUri = GetBaseUriFromCluster(secrets, cluster); var credentials = GetCredentials(secrets); return(new JetfireClient(baseUri, credentials)); }
public ListCommand(ISecretsProvider secrets) { Secrets = secrets; Command = new Command("list", "List transformations"); Command.Handler = CommandHandler.Create <string>(Handle); }
/// <summary> /// Gets the plain secret for the given secret name /// </summary> public static async Task <string> GetPlainSecretAsync(this ISecretsProvider secretsProvider, string secretName, CancellationToken token) { var secrets = await secretsProvider.RetrieveSecretsAsync(new List <RetrieveSecretsRequest>() { new RetrieveSecretsRequest(secretName, SecretKind.PlainText) }, token); return(((PlainTextSecret)secrets.Secrets[secretName]).Secret); }
/// <summary> /// Initializes a new instance of the <see cref="SecretsConfigurationProvider"/> class. /// </summary> /// <param name="secretsProvider"> /// An object that provides the secrets that make up the settings of this instance. /// </param> public SecretsConfigurationProvider(ISecretsProvider secretsProvider) { foreach (var secret in secretsProvider.Secrets) { string value; try { value = secret.GetValue(); } catch { continue; } Data.Add(secret.Key, value); } }
/// <summary> /// Initializes a new instance of <see cref="DefaultConfigProvider"/> /// </summary> public DefaultConfigProvider( string basePath, ISecretsProvider secretsProvider) { _secretsProvider = secretsProvider; _secretsAnalyzer = new SecretsAnalyzer(secretsProvider); ConfigsPath = Path.Combine(basePath, "configs"); OverridesPath = Path.Combine(basePath, "overrides"); IncludePath = Path.Combine(basePath, "includes"); }
private async void Init(ISecretsProvider secretsProvider) { var allConfig = await secretsProvider.GetSecrets(); var config = allConfig["Ad_Config"]; appKey = (string)config["App_Key"]; bannerId = (string)config["Banner_Id"]; AdDuplex.AdDuplexClient.Initialize(appKey); }
/// <summary> /// Initializes a new instance of the <see cref="OpenTibiaCosmosDbContext"/> class. /// </summary> /// <param name="cosmosDbConfigurationOptions">A reference to the CosmosDb configuration options.</param> /// <param name="secretsProvider">A reference to the secrets provider.</param> public OpenTibiaCosmosDbContext( IOptions <CosmosDbConfigurationOptions> cosmosDbConfigurationOptions, ISecretsProvider secretsProvider) { cosmosDbConfigurationOptions.ThrowIfNull(nameof(cosmosDbConfigurationOptions)); secretsProvider.ThrowIfNull(nameof(secretsProvider)); this.CosmosDbConfiguration = cosmosDbConfigurationOptions.Value; this.SecretsProvider = secretsProvider; }
public SecretAnalyzerBehavior() { var mock = new Mock <ISecretsProvider>(); mock .Setup(sp => sp.Provide()) .Returns(() => new Dictionary <string, string> { { "some-secret1", "some-val1" } }); _secretsProvider = mock.Object; }
/// <inheritdoc /> public LoggerFactoryArguments( ILogger logger, ISecretsProvider secretsProvider, LoggingSettings loggingSettings) { Contract.RequiresNotNull(logger); Logger = logger; LoggingSettings = loggingSettings; SecretsProvider = secretsProvider; }
static Uri GetBaseUriFromCluster(ISecretsProvider secrets, string cluster) { if (cluster == "localhost") { return(new Uri("http://localhost:8084")); } if (string.IsNullOrWhiteSpace(cluster)) { cluster = secrets.GetNamedSecret(ClusterEnvironmentVariable) ?? "europe-west1-1"; } return(new Uri($"https://jetfire.{cluster}.cogniteapp.com")); }
/// <summary> /// Initializes a new instance of the <see cref="FibulaCosmosDbContext"/> class. /// </summary> /// <param name="cosmosDbContextOptions">A reference to the CosmosDb context options.</param> /// <param name="secretsProvider">A reference to the secrets provider.</param> public FibulaCosmosDbContext( IOptions <FibulaCosmosDbContextOptions> cosmosDbContextOptions, ISecretsProvider secretsProvider) { cosmosDbContextOptions.ThrowIfNull(nameof(cosmosDbContextOptions)); secretsProvider.ThrowIfNull(nameof(secretsProvider)); DataAnnotationsValidator.ValidateObjectRecursive(cosmosDbContextOptions.Value); this.Options = cosmosDbContextOptions.Value; this.SecretsProvider = secretsProvider; }
public JwtTokenService( ISecretsProvider secretsProvider, IClaimsProvider claimsProvider, IJwtTokenProvider jwtTokenProvider, ISecurityKeyProvider securityKeyProvider, TokenServiceSettings tokenServiceSettings) { _secretsProvider = secretsProvider; _claimsProvider = claimsProvider; _jwtTokenProvider = jwtTokenProvider; _securityKeyProvider = securityKeyProvider; _tokenServiceSettings = tokenServiceSettings; }
public DeployCommand(ISecretsProvider secrets) { this.secrets = secrets; Command = new Command("deploy", "Deploy a set of transformations from a directory") { new Argument <string>("path", Directory.GetCurrentDirectory) { Arity = ArgumentArity.ZeroOrOne, Description = "A directory to search for transformation manifests. If omitted, the current directory is used.", }, }; Command.Handler = CommandHandler.Create <IConsole, string, string>(Handle); }
public SignInService( IPlatformClient platformClient, ILoggerFactory loggerFactory, IAuthenticationServiceErrorHandler serviceErrorHandler, IConnectivityService connectivityService, ISecretsProvider secretsProvider, IAuthenticationInfoService authenticationInfoService) { _platformClient = platformClient; _serviceErrorHandler = serviceErrorHandler; _connectivityService = connectivityService; _secretsProvider = secretsProvider; _authenticationInfoService = authenticationInfoService; _logger = loggerFactory.CreateLogger <SignInService>(); }
public OnBoardingViewModel( INavigationService navigationService, IMainRoute mainRoute, INotificationManager notificationManager, ITracingEngine tracingEngine, ISecretsProvider secretsProvider) { GoToNextStepCommand = ReactiveUI.ReactiveCommand.CreateFromTask(HandleNextStepAsync); _navigationService = navigationService; _mainRoute = mainRoute; _notificationManager = notificationManager; _tracingEngine = tracingEngine; _secretsProvider = secretsProvider; SetInstructions(); }
public JobsCommand(ISecretsProvider secrets) { Secrets = secrets; Command = new Command("jobs", "Show latest jobs for a given transformation") { new Option <int?>("--id") { Description = "The id of the transformation. Either this or --external-id must be specified." }, new Option <string>("--external-id") { Description = "The externalId of the transformation. Either this or --id must be specified." }, }; Command.Handler = CommandHandler.Create <string, int?, string>(Handle); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddHostedService <SecretsWatcherHostedService>(); services.AddControllers(); var clientOptions = K8sConfig.Load(@"C:\Users\linjm\.kube\config").ToKubeClientOptions( defaultKubeNamespace: "default" ); services.AddSingleton <KubeClientOptions>(clientOptions); var providers = new ISecretsProvider[] { new SecretsProvider() }; services.AddSingleton <IEnumerable <ISecretsProvider> >(providers); }
public OpenIdConnectHandler( IUsersService usersService, ISecretsProvider secretsProvider, ISystem system, ILogWriterFactory logWriterFactory) { if (logWriterFactory is null) { throw new ArgumentNullException(nameof(logWriterFactory)); } logger = logWriterFactory.CreateLogger <OpenIdConnectHandler>(); this.usersService = usersService ?? throw new ArgumentNullException(nameof(usersService)); this.secretsProvider = secretsProvider ?? throw new ArgumentNullException(nameof(secretsProvider)); this.system = system ?? throw new ArgumentNullException(nameof(system)); authHostName = new Lazy <Task <string> >(GetAuthHostName); cognitoSettings = new Lazy <CognitoSettings>(() => GetCognitoSettings().SafeGetResult()); }
public DeleteCommand(ISecretsProvider secrets) { this.secrets = secrets; Command = new Command("delete", "Delete a transformation") { new Option <int?>("--id") { Description = "The id of the transformation to delete. Either this or --external-id must be specified." }, new Option <string>("--external-id") { Description = "The externalId of the transformation to delete. Either this or --id must be specified." }, }; Command.Handler = CommandHandler.Create <string, int?, string>(Handle); }
/// <summary> /// Initializes a new instance of the <see cref="BotHttpAdapter"/> class. /// </summary> /// <param name="appSettings">App settings.</param> /// <param name="credentialProvider">Cred provider.</param> /// <param name="secretsProvider">Secrets provider..</param> /// <param name="middleWare">Auth middleware.</param> /// <param name="logger">Logger.</param> public BotHttpAdapter( IAppSettings appSettings, ICredentialProvider credentialProvider, ISecretsProvider secretsProvider, BotAuthMiddleware middleWare, ILogger <BotHttpAdapter> logger) : base(credentialProvider) { if (middleWare is null) { throw new ArgumentNullException(nameof(middleWare)); } this.Use(middleWare); this.appSettings = appSettings ?? throw new ArgumentNullException(nameof(appSettings)); this.secretsProvider = secretsProvider ?? throw new ArgumentNullException(nameof(secretsProvider)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public static void ApplySecrets(this ConfigDocument doc, ISecretsProvider secretsProvider) { if (doc == null) { throw new ArgumentNullException(nameof(doc)); } if (secretsProvider == null) { throw new ArgumentNullException(nameof(secretsProvider)); } var secretMap = secretsProvider.Provide(); foreach (var secret in doc.GetSecrets()) { if (secretMap.TryGetValue(secret.Key, out var secretVal)) { secret.Resolve(secretVal); } } }
public ShowCommand(ISecretsProvider secrets) { Secrets = secrets; Command = new Command("show", "Show detalis of a transformation") { new Option <int?>("--id") { Description = "The id of the transformation to show. Either this or --external-id must be specified." }, new Option <string>("--external-id") { Description = "The externalId of the transformation to show. Either this or --id must be specified." }, new Option <string>("--job") { Description = "The UUID of the job to show. Include this to show job details instead of transformation details." }, }; Command.Handler = CommandHandler.Create <string, int?, string, string>(Handle); }
static ICredentials GetCredentials(ISecretsProvider secrets) { var apiKey = secrets.GetNamedSecret(ApiKeyEnvironmentVariable).TrimToNull(); var tokenUrl = secrets.GetNamedSecret(TokenUrlEnvironmentVariable).TrimToNull(); var clientId = secrets.GetNamedSecret(ClientIdEnvironmentVariable).TrimToNull(); var clientSecret = secrets.GetNamedSecret(ClientSecretEnvironmentVariable).TrimToNull(); var tokenScopes = secrets.GetNamedSecret(TokenScopesEnvironmentVariable).TrimToNull(); var tokenAudience = secrets.GetNamedSecret(TokenAudienceEnvironmentVariable).TrimToNull(); var project = secrets.GetNamedSecret(ProjectEnvironmentVariable).TrimToNull(); if (apiKey != null) { return(new ApiKeyCredentials(apiKey)); } else if (tokenUrl != null && clientId != null && clientSecret != null && project != null) { var scopeList = new List <string>(); if (tokenScopes != null && tokenScopes != "") { scopeList = new List <string>(tokenScopes.Split(",")); } var authConfig = new AuthenticatorConfig { Implementation = AuthenticatorConfig.AuthenticatorImplementation.Basic, ClientId = clientId, Secret = clientSecret, TokenUrl = tokenUrl, Scopes = scopeList, Audience = tokenAudience }; return(new TokenCredentials(authConfig, project)); } else { throw new JetfireCliException($"Either the {ApiKeyEnvironmentVariable} environment variable, or the {TokenUrlEnvironmentVariable}, {ClientIdEnvironmentVariable}, {ClientSecretEnvironmentVariable}, {TokenScopesEnvironmentVariable} and {ProjectEnvironmentVariable} environment variables must be set"); } }
public ManifestResolver(ISecretsProvider secrets) { this.secrets = secrets; }
public RetryableSecretsProviderDecorator(ISecretsProvider secretsProvider) : base(secretsProvider) { }