Skip to content

Commit

Permalink
Don't expose trust key when env enum is used
Browse files Browse the repository at this point in the history
  • Loading branch information
icecoldfire committed May 24, 2023
1 parent b0977fa commit 494a0cc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
26 changes: 13 additions & 13 deletions src/Viren.Core/Helpers/VirenOptionsEnvironmentExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ namespace Viren.Core.Helpers
{
public static class VirenOptionsEnvironmentExtensions
{
public static VirenExecutionOptions UseProduction(this VirenExecutionOptions options, string clientSecret, string trustKey = null)
public static VirenExecutionOptions UseProduction(this VirenExecutionOptions options, string clientSecret)
{
return options.Use(clientSecret, "https://execution.viren.be", trustKey);
return options.Use(clientSecret, "https://execution.viren.be");
}

public static VirenExecutionOptions UseAcceptance(this VirenExecutionOptions options, string clientSecret, string trustKey = null)
public static VirenExecutionOptions UseAcceptance(this VirenExecutionOptions options, string clientSecret)
{
return options.Use(clientSecret, "https://execution-acc.viren.be", trustKey);
return options.Use(clientSecret, "https://execution-acc.viren.be");
}

public static VirenExecutionOptions UseDevelopment(this VirenExecutionOptions options, string clientSecret, string trustKey = null)
public static VirenExecutionOptions UseDevelopment(this VirenExecutionOptions options, string clientSecret)
{
return options.Use(clientSecret, "https://execution-dev.viren.be", trustKey);
return options.Use(clientSecret, "https://execution-dev.viren.be");
}

public static VirenExecutionOptions UseLocal(this VirenExecutionOptions options, string clientSecret, string trustKey = null)
public static VirenExecutionOptions UseLocal(this VirenExecutionOptions options, string clientSecret)
{
return options.Use(clientSecret, "http://dev.calc-exec.be", trustKey);
return options.Use(clientSecret, "http://dev.calc-exec.be");
}

public static VirenExecutionOptions Use(this VirenExecutionOptions options, string clientSecret, string baseUrl, string trustKey = null)
Expand All @@ -34,18 +34,18 @@ public static VirenExecutionOptions Use(this VirenExecutionOptions options, stri
}


public static VirenExecutionOptions UseEnvironment(this VirenExecutionOptions options, Environment environment, string clientSecret, string trustKey = null)
public static VirenExecutionOptions UseEnvironment(this VirenExecutionOptions options, Environment environment, string clientSecret)
{
switch (environment)
{
case Environment.Production:
return options.UseProduction(clientSecret, trustKey);
return options.UseProduction(clientSecret);
case Environment.Acceptance:
return options.UseAcceptance(clientSecret, trustKey);
return options.UseAcceptance(clientSecret);
case Environment.Develop:
return options.UseDevelopment(clientSecret, trustKey);
return options.UseDevelopment(clientSecret);
case Environment.Local:
return options.UseLocal(clientSecret, trustKey);
return options.UseLocal(clientSecret);
default:
throw new Exception($"Environment '{environment}', does not exist.");
}
Expand Down
4 changes: 2 additions & 2 deletions src/Viren.Core/Viren.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFrameworks Condition="'$(LibraryFrameworks)'!=''">$(LibraryFrameworks)</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<Authors>Teal Partners</Authors>
<Company>Teal Partners</Company>
<Product>Viren .NET client core library</Product>
Expand All @@ -21,7 +21,7 @@
<PackageTags>Viren; API; Client</PackageTags>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<RepositoryType>git</RepositoryType>
<PackageVersion>1.1.1</PackageVersion>
<PackageVersion>1.1.2</PackageVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net46'">
<AssemblyTitle>Viren.Core .NET 4.6</AssemblyTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<Authors>Teal Partners</Authors>
<Product>Viren execution .NET client</Product>
<RepositoryUrl>https://github.com/tealpartners/viren.net</RepositoryUrl>
Expand All @@ -19,7 +19,7 @@
<RootNamespace>Viren.Execution.Extensions.DependencyInjection</RootNamespace>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<RepositoryType>git</RepositoryType>
<PackageVersion>1.1.1</PackageVersion>
<PackageVersion>1.1.2</PackageVersion>
<TargetFrameworks>net6.0;netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace Viren.Execution.Extensions.DependencyInjection
{
public static class VirenExtensions
{
public static IServiceCollection AddVirenExecution(this IServiceCollection serviceCollection, Environment environment, string clientSecret, string trustKey = null)
public static IServiceCollection AddVirenExecution(this IServiceCollection serviceCollection, Environment environment, string clientSecret)
{
return serviceCollection.AddVirenExecution(ops => ops.UseEnvironment(environment, clientSecret, trustKey));
return serviceCollection.AddVirenExecution(ops => ops.UseEnvironment(environment, clientSecret));
}

public static IServiceCollection AddVirenExecution(this IServiceCollection serviceCollection, Action<VirenExecutionOptions> configureOptions,
Expand Down
4 changes: 2 additions & 2 deletions src/Viren.Execution/Viren.Execution.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks Condition="'$(LibraryFrameworks)'!=''">$(LibraryFrameworks)</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<Authors>Teal Partners</Authors>
<Product>Viren execution .NET client</Product>
<RepositoryUrl>https://github.com/tealpartners/viren.net</RepositoryUrl>
Expand All @@ -21,7 +21,7 @@
<RootNamespace>Viren.Execution</RootNamespace>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<RepositoryType>git</RepositoryType>
<PackageVersion>1.1.1</PackageVersion>
<PackageVersion>1.1.2</PackageVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net46'">
<AssemblyTitle>Viren.Core .NET 4.6</AssemblyTitle>
Expand Down
4 changes: 2 additions & 2 deletions src/Viren.Execution/VirenHttpClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public static HttpClient Create(string secretKey, string virenDomain, string tru
return Create(new VirenExecutionOptions {ClientSecret = secretKey, BaseUrl = virenDomain, TrustKey = trustKey});
}

public static HttpClient Create(string secretKey, Viren.Core.Enums.Environment environment, string trustKey = null)
public static HttpClient Create(string secretKey, Viren.Core.Enums.Environment environment)

{
return Create(new VirenExecutionOptions().UseEnvironment(environment, secretKey, trustKey));
return Create(new VirenExecutionOptions().UseEnvironment(environment, secretKey));
}


Expand Down

0 comments on commit 494a0cc

Please sign in to comment.