Skip to content

Commit

Permalink
Merge pull request #12 from Cecropia/TG-12-AuthenticationProviderSetup
Browse files Browse the repository at this point in the history
TG-12 authentication provider setup
  • Loading branch information
cvillarongace authored Nov 5, 2024
2 parents 18f90f5 + 28dc4d9 commit 668c88b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions KeyCloakIntegration/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.2" />
<PackageVersion Include="Keycloak.AuthServices.Authentication" Version="2.5.3" />
<PackageVersion Include="MediatR" Version="12.4.0" />
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.8" />
Expand Down
7 changes: 6 additions & 1 deletion KeyCloakIntegration/src/Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using KeyCloakIntegration.Infrastructure.Data;
using Keycloak.AuthServices.Authentication;

var builder = WebApplication.CreateBuilder(args);

Expand All @@ -8,6 +9,8 @@
builder.Services.AddApplicationServices();
builder.Services.AddInfrastructureServices(builder.Configuration);
builder.Services.AddWebServices();
builder.Services.AddKeycloakWebApiAuthentication(builder.Configuration);
builder.Services.AddAuthorization();

var app = builder.Build();

Expand Down Expand Up @@ -42,9 +45,11 @@

app.UseExceptionHandler(options => { });


app.MapEndpoints();

app.UseAuthentication();
app.UseAuthorization();

app.Run();

public partial class Program { }
1 change: 1 addition & 0 deletions KeyCloakIntegration/src/Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<ItemGroup>
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Keycloak.AuthServices.Authentication" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
Expand Down
10 changes: 10 additions & 0 deletions KeyCloakIntegration/src/Web/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,15 @@
"Microsoft.AspNetCore.SpaProxy": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Keycloak": {
"realm": "Multiplied",
"auth-server-url": "http://localhost:8080/",
"ssl-required": "false",
"resource": "KeyCloakIntegration",
"credentials": {
"secret": "C9ZzKoldRgXoeVwDg0y9BdQlfb643Ppn"
},
"confidential-port": 0
}
}

0 comments on commit 668c88b

Please sign in to comment.