File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
PostService.Infrastructure Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 32
32
app . UseHttpsRedirection ( ) ;
33
33
}
34
34
35
+ // app.UseAuthentication();
36
+ // app.UseAuthorization();
37
+
35
38
app . MapGet ( "/health" , ( ) => Results . Ok ( "Healthy" ) ) ;
36
39
37
40
app . MapGraphQL ( ) ;
Original file line number Diff line number Diff line change
1
+ using Microsoft . AspNetCore . Authentication . JwtBearer ;
1
2
using Microsoft . Extensions . DependencyInjection ;
3
+ using Microsoft . IdentityModel . Tokens ;
2
4
3
5
namespace PostService . Infrastructure ;
4
6
5
7
public static class DependencyInjection
6
8
{
7
9
public static IServiceCollection AddInfrastructureServices ( this IServiceCollection services )
8
10
{
11
+ // ToDo: change hard code
12
+ // services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
13
+ // .AddJwtBearer(options =>
14
+ // {
15
+ // options.Authority = "http://localhost:8080/realms/fitness-app-realm/";
16
+ // options.Audience = "fitness-app-client";
17
+ // options.RequireHttpsMetadata = true;
18
+ // options.TokenValidationParameters = new TokenValidationParameters
19
+ // {
20
+ // ValidateIssuer = true,
21
+ // ValidateAudience = true,
22
+ // ValidateLifetime = true,
23
+ // ValidIssuer = "http://localhost:8080/realms/fitness-app-realm/",
24
+ // ValidAudience = "fitness-app-client"
25
+ // };
26
+ // });
27
+ //
28
+ // services.AddAuthorization();
29
+
9
30
return services ;
10
31
}
11
32
}
Original file line number Diff line number Diff line change 7
7
</PropertyGroup >
8
8
9
9
<ItemGroup >
10
+ <PackageReference Include =" Microsoft.AspNetCore.Authentication.JwtBearer" Version =" 8.0.0" />
10
11
<PackageReference Include =" Microsoft.Extensions.DependencyInjection" Version =" 8.0.0" />
11
12
</ItemGroup >
12
13
You can’t perform that action at this time.
0 commit comments