Skip to content

Commit

Permalink
Merge pull request #50 from Etherna/fix/EC-73-register-access-token-m…
Browse files Browse the repository at this point in the history
…anagement

fix EC-73
  • Loading branch information
tmm360 authored May 23, 2022
2 parents b123913 + 679efc8 commit 61c68a7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/EthernaCredit.Domain/EthernaCredit.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="Etherna.DomainEvents" Version="1.3.1" />
<PackageReference Include="MongODM.Core" Version="0.23.0-alpha.105" />
<PackageReference Include="MongODM.Core" Version="0.23.0-alpha.106" />
<PackageReference Include="Nethereum.Util" Version="4.5.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/EthernaCredit.Services/EthernaCredit.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ItemGroup>
<PackageReference Include="Etherna.DomainEvents.AspNetCore" Version="1.3.1" />
<PackageReference Include="EthernaACR" Version="0.3.0" />
<PackageReference Include="EthernaServicesClient.AspNetCore" Version="0.3.0-alpha.34" />
<PackageReference Include="EthernaServicesClient.AspNetCore" Version="0.3.0-alpha.38" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Etherna" Version="0.3.0-alpha.7" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/EthernaCredit/EthernaCredit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.28" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.29" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
<PackageReference Include="MongODM" Version="0.23.0-alpha.105" />
<PackageReference Include="MongODM.AspNetCore.UI" Version="0.23.0-alpha.105" />
<PackageReference Include="MongODM" Version="0.23.0-alpha.106" />
<PackageReference Include="MongODM.AspNetCore.UI" Version="0.23.0-alpha.106" />
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog.Exceptions" Version="8.2.0" />
Expand Down
12 changes: 11 additions & 1 deletion src/EthernaCredit/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,21 @@ public void ConfigureServices(IServiceCollection services)
});

// Configure Etherna SSO Client services.
services.AddEthernaSsoClientForServices(
var ethernaServiceClientBuilder = services.AddEthernaSsoClientForServices(
new Uri(Configuration["SsoServer:BaseUrl"] ?? throw new ServiceConfigurationException()),
Configuration["SsoServer:Clients:SsoServer:ClientId"] ?? throw new ServiceConfigurationException(),
Configuration["SsoServer:Clients:SsoServer:Secret"] ?? throw new ServiceConfigurationException());

var clientCredentialTask = ethernaServiceClientBuilder.GetClientCredentialsTokenRequestAsync();
clientCredentialTask.Wait();
var clientCredential = clientCredentialTask.Result;

// Register token manager.
services.AddAccessTokenManagement(options =>
{
options.Client.Clients.Add(ethernaServiceClientBuilder.ClientName, clientCredential);
});

// Configure setting.
var assemblyVersion = new AssemblyVersion(GetType().GetTypeInfo().Assembly);
services.Configure<ApplicationSettings>(options =>
Expand Down

0 comments on commit 61c68a7

Please sign in to comment.