(this IServiceCollection services)
| 7 | public static class AuthExtensions |
| 8 | { |
| 9 | public static IServiceCollection AddKeycloakAuthentication(this IServiceCollection services) |
| 10 | { |
| 11 | services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) |
| 12 | .AddKeycloakJwtBearer( |
| 13 | serviceName: "keycloak", |
| 14 | realm: "overflow", |
| 15 | options => |
| 16 | { |
| 17 | options.RequireHttpsMetadata = false; |
| 18 | options.Audience = "overflow"; |
| 19 | options.TokenValidationParameters = new TokenValidationParameters |
| 20 | { |
| 21 | ValidIssuers = [ |
| 22 | "http://localhost:6001/realms/overflow", |
| 23 | "http://keycloak:8080/realms/overflow", |
| 24 | "http://id.overflow.local/realms/overflow", |
| 25 | "https://id.overflow.local/realms/overflow", |
| 26 | "https://overflow-id.trycatchlearn.com/realms/overflow", |
| 27 | ], |
| 28 | ClockSkew = TimeSpan.Zero, |
| 29 | }; |
| 30 | }); |
| 31 | |
| 32 | services.AddAuthorizationBuilder(); |
| 33 | |
| 34 | return services; |
| 35 | } |
| 36 | } |
no outgoing calls
no test coverage detected