-
Notifications
You must be signed in to change notification settings - Fork 2
Fix #258 #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Fix #258 #266
Changes from all commits
e50831a
345f781
964e73f
3033df1
d87ea75
4880301
4a95177
3b705e7
0a17b0f
05b6b93
e3420c8
a0fbe1c
dc28773
53cb664
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| using AutoMapper; | ||
| using Contract.DTOs.UserDTO; | ||
| using IdentityService.Application.Account.Commands; | ||
|
|
||
| namespace DuendeIdentityServer.DTOs; | ||
|
|
||
| public class IdentityProfile : Profile | ||
| { | ||
| public IdentityProfile() | ||
| { | ||
| CreateMap<RegisterAccountDTO, RegisterAccountCommand>().ReverseMap(); | ||
| CreateMap<ApplicationAccount, ApplicationUserResponseDTO>().ReverseMap(); | ||
| CreateMap<VerifyAccountDTO, VerifyAccountCommand>().ReverseMap(); | ||
| CreateMap<ApplicationAccount, AccountDTO>().ReverseMap(); | ||
| } | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |||||||||||||||||||||||||||
| using Microsoft.AspNetCore.Authentication; | ||||||||||||||||||||||||||||
| using Microsoft.AspNetCore.DataProtection; | ||||||||||||||||||||||||||||
| using Microsoft.AspNetCore.HttpOverrides; | ||||||||||||||||||||||||||||
| using Microsoft.EntityFrameworkCore; | ||||||||||||||||||||||||||||
| using Newtonsoft.Json; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| namespace DuendeIdentityServer; | ||||||||||||||||||||||||||||
|
|
@@ -43,9 +44,12 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde | |||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Register automapper | ||||||||||||||||||||||||||||
| IMapper mapper = MappingConfig.RegisterMaps().CreateMapper(); | ||||||||||||||||||||||||||||
| services.AddSingleton(mapper); | ||||||||||||||||||||||||||||
| services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); | ||||||||||||||||||||||||||||
| services.AddAutoMapper( | ||||||||||||||||||||||||||||
| cfg => | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| cfg.LicenseKey = DotNetEnv.Env.GetString("LUCKYPENNYSOFTWARE_LICENSE_KEY", "Not Found"); | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| AppDomain.CurrentDomain.GetAssemblies()); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| services.AddCommonAPIWithoutAuthServices(); | ||||||||||||||||||||||||||||
| services | ||||||||||||||||||||||||||||
|
|
@@ -68,6 +72,20 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde | |||||||||||||||||||||||||||
| // keep old key for 7 days in discovery for validation of tokens | ||||||||||||||||||||||||||||
| options.KeyManagement.RetentionDuration = TimeSpan.FromDays(7); | ||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||
| .AddOperationalStore(options => | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| options.ConfigureDbContext = builder => | ||||||||||||||||||||||||||||
| builder.UseNpgsql(EnvUtility.GetConnectionString(), | ||||||||||||||||||||||||||||
| options => options.MigrationsAssembly("IdentityService.Infrastructure") | ||||||||||||||||||||||||||||
| .EnableRetryOnFailure( | ||||||||||||||||||||||||||||
| maxRetryCount: 10, | ||||||||||||||||||||||||||||
| maxRetryDelay: TimeSpan.FromSeconds(15), | ||||||||||||||||||||||||||||
| errorCodesToAdd: null | ||||||||||||||||||||||||||||
| )); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| options.EnableTokenCleanup = true; | ||||||||||||||||||||||||||||
| options.TokenCleanupInterval = 3600; | ||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||
| .AddInMemoryIdentityResources(Config.IdentityResources) | ||||||||||||||||||||||||||||
| .AddInMemoryApiScopes(Config.ApiScopes) | ||||||||||||||||||||||||||||
| .AddInMemoryClients(Config.Clients) | ||||||||||||||||||||||||||||
|
|
@@ -123,7 +141,7 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde | |||||||||||||||||||||||||||
| return builder.Build(); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| public static async Task<WebApplication> ConfigurePipelineAsync(this WebApplication app) | ||||||||||||||||||||||||||||
| public static Task<WebApplication> ConfigurePipeline(this WebApplication app) | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| if (EnvUtility.IsProduction() || EnvUtility.IsStaging()) | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
|
|
@@ -184,11 +202,11 @@ public static async Task<WebApplication> ConfigurePipelineAsync(this WebApplicat | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| app.UseSignalRServiceAsync(); | ||||||||||||||||||||||||||||
| app.Use(async (context, next) => | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| Console.WriteLine($"RemoteIp: {context.Connection.RemoteIpAddress}"); | ||||||||||||||||||||||||||||
| await next(); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| Console.WriteLine($"RemoteIp: {context.Connection.RemoteIpAddress}"); | ||||||||||||||||||||||||||||
| await next(); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
Comment on lines
204
to
+208
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid logging raw client IPs to stdout on every request. This writes PII from every auth request into unstructured logs. If you still need this for debugging, gate it behind Suggested change- app.Use(async (context, next) =>
- {
- Console.WriteLine($"RemoteIp: {context.Connection.RemoteIpAddress}");
- await next();
- });
+ app.Use(async (context, next) =>
+ {
+ await next();
+ });📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| return app; | ||||||||||||||||||||||||||||
| return Task.FromResult(app); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -128,7 +128,7 @@ public async Task<IActionResult> OnPost() | |||||||||||||||||||
| } | ||||||||||||||||||||
| catch (Exception ex) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| ModelState.AddModelError(string.Empty, "Send OTP failed! Please try again"); | ||||||||||||||||||||
| ModelState.AddModelError(string.Empty, $"Send OTP failed! Please try again ({ex.Message})"); | ||||||||||||||||||||
|
Comment on lines
129
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't echo exception details back to the forgot-password UI.
Suggested change catch (Exception ex)
{
- ModelState.AddModelError(string.Empty, $"Send OTP failed! Please try again ({ex.Message})");
+ ModelState.AddModelError(string.Empty, "Send OTP failed! Please try again");
+ // Log `ex` with the server-side logger instead of exposing it in the UI.
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| } | ||||||||||||||||||||
| break; | ||||||||||||||||||||
| case "ReturnFind": | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -71,7 +71,7 @@ public async Task<IActionResult> OnGet() | |||||
| externalUser.FindFirst(ClaimTypes.NameIdentifier) ?? | ||||||
| throw new InvalidOperationException("Unknown userid"); | ||||||
|
|
||||||
| var provider = result.Properties.Items["scheme"] ?? throw new InvalidOperationException("Null scheme in authentiation properties"); | ||||||
| var provider = result.Properties?.Items["scheme"] ?? throw new InvalidOperationException("Null scheme in authentiation properties"); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typo in exception message. The exception message contains a typo: "authentiation" should be "authentication". 📝 Proposed fix- var provider = result.Properties?.Items["scheme"] ?? throw new InvalidOperationException("Null scheme in authentiation properties");
+ var provider = result.Properties?.Items["scheme"] ?? throw new InvalidOperationException("Null scheme in authentication properties");📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| var providerUserId = userIdClaim.Value; | ||||||
|
|
||||||
| // find external user | ||||||
|
|
@@ -87,7 +87,7 @@ public async Task<IActionResult> OnGet() | |||||
| Provider = provider, | ||||||
| ProviderUserId = providerUserId, | ||||||
| Claims = externalUser.Claims, | ||||||
| AccessToken = accessToken | ||||||
| AccessToken = accessToken! | ||||||
| }); | ||||||
| response.ThrowIfFailure(); | ||||||
| user = response.Value; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| using AutoMapper; | ||
| using Google.Protobuf.Collections; | ||
| using IdentityService.Application.Configs.MapperConverters; | ||
|
|
||
| namespace IdentityService.Application.Configs; | ||
|
|
||
| public class IdentityProfile : Profile | ||
| { | ||
| public IdentityProfile() | ||
| { | ||
| CreateMap(typeof(List<>), typeof(RepeatedField<>)).ConvertUsing(typeof(ListToRepeatedFieldConverter<,>)); | ||
| CreateMap(typeof(RepeatedField<>), typeof(List<>)).ConvertUsing(typeof(RepeatedFieldToListConverter<,>)); | ||
| } | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,9 +27,23 @@ public static IServiceCollection AddInfrastructureServices(this IServiceCollecti | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public static IServiceCollection AddMinimalInfrastructureServices(this IServiceCollection services) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var connectionString = Contract.Utilities.EnvUtility.GetConnectionString(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| services.AddDbContext<IApplicationDbContext, ApplicationDbContext>(options => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options.UseNpgsql(Contract.Utilities.EnvUtility.GetConnectionString())); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options.UseNpgsql(connectionString)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| services.AddIdentityServer() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .AddOperationalStore(options => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options.ConfigureDbContext = builder => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| builder.UseNpgsql(connectionString, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options => options.MigrationsAssembly("IdentityService.Infrastructure") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .EnableRetryOnFailure( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| maxRetryCount: 10, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| maxRetryDelay: TimeSpan.FromSeconds(15), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| errorCodesToAdd: null | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
32
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Verify Npgsql registrations and retry-policy presence across related contexts.
rg -n --type=cs -C3 'UseNpgsql\(' \
app/server/IdentityService/src/IdentityService.Infrastructure/DependencyInjection.cs \
app/server/IdentityService/src/DuendeIdentityServer/HostingExtensions.cs \
app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/ApplicationDbContext.cs
rg -n --type=cs -C3 'EnableRetryOnFailure' \
app/server/IdentityService/src/IdentityService.Infrastructure/DependencyInjection.cs \
app/server/IdentityService/src/DuendeIdentityServer/HostingExtensions.cs \
app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/ApplicationDbContext.csRepository: Carl-Johnsons/tastopia Length of output: 4597 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Show relevant code blocks for operational-store wiring
sed -n '1,120p' app/server/IdentityService/src/IdentityService.Infrastructure/DependencyInjection.cs
echo "----"
sed -n '1,140p' app/server/IdentityService/src/DuendeIdentityServer/HostingExtensions.cs
echo "----"
sed -n '1,120p' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/ApplicationDbContext.cs
echo "----"
# Trace whether operational-store uses ApplicationDbContext or a different Duende context
rg -n --type=cs 'OperationalStore|AddOperationalStore|ConfigureDbContext|ApplicationDbContext|IApplicationDbContext' \
app/server/IdentityService/src/IdentityService.Infrastructure/DependencyInjection.cs \
app/server/IdentityService/src/DuendeIdentityServer/HostingExtensions.cs \
app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/ApplicationDbContext.csRepository: Carl-Johnsons/tastopia Length of output: 14374 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n --type=cs 'AddOperationalStore\(' app/server/IdentityService/src
rg -n --type=cs 'EnableRetryOnFailure' app/server/IdentityService/srcRepository: Carl-Johnsons/tastopia Length of output: 464 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n --type=cs 'PersistedGrant|OperationalStore|DeviceFlow|ConfigurationDbContext|PersistedGrantDbContext|Granular?DbContext' app/server/IdentityService/srcRepository: Carl-Johnsons/tastopia Length of output: 7543 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Locate the actual DbContext classes used by Duende operational store
rg -n --type=cs 'class\s+PersistedGrantDbContext\b|DbContext\s*:\s*' \
app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer
# Show PersistedGrantDbContext and any other operational-store DbContext implementations
fd -a 'PersistedGrantDbContext*.cs' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer || true
fd -a '*.cs' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer | wc -l
# Print the relevant DbContext class bodies (small files/sections only)
for f in $(fd -a 'PersistedGrantDbContext*.cs' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer); do
echo "---- $f ----"
sed -n '1,160p' "$f"
done
# Also check DeviceFlow (if present)
for f in $(rg -l --type=cs 'class\s+\w*DeviceFlow\w*DbContext|DeviceFlow.*DbContext' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer); do
echo "---- $f ----"
sed -n '1,200p' "$f"
done
# Confirm how AppCommandHandler migrates persisted grant DbContext
sed -n '1,120p' app/server/IdentityService/src/DuendeIdentityServer/AppCommandHandler.csRepository: Carl-Johnsons/tastopia Length of output: 48 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Identify operational-store DbContext classes in our repo
# (we expect ones like PersistedGrantDbContext, DeviceFlowCodesDbContext, etc.)
mapfile -t ctx_files < <(
fd -a '*.cs' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer \
| head -n 200
)
echo "Context candidate files: ${`#ctx_files`[@]} (showing up to 200)"
for f in "${ctx_files[@]}"; do
rg -n --type=cs 'class\s+\w*DbContext\b|:?\s*DbContext\b|\[DbContext' "$f" || true
done
# Specifically look for PersistedGrantDbContext definition and any DbContext base with retry
mapfile -t target_files < <(
(fd -a 'PersistedGrantDbContext*.cs' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer || true)
)
echo "PersistedGrantDbContext files: ${`#target_files`[@]}"
for f in "${target_files[@]}"; do
echo "---- $f ----"
sed -n '1,220p' "$f"
done
# Also inspect the persisted grant model snapshot file where retry might be set/expected via configuration
sed -n '1,140p' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer/PersistedGrant/PersistedGrantDbContextModelSnapshot.cs
# Inspect AppCommandHandler migration wiring
sed -n '1,120p' app/server/IdentityService/src/DuendeIdentityServer/AppCommandHandler.csRepository: Carl-Johnsons/tastopia Length of output: 123 🏁 Script executed: #!/bin/bash
set -euo pipefail
base="app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer"
echo "Listing DbContext-related files under $base (first 200):"
fd -a '*.cs' "$base" | head -n 200
echo "---- PersistedGrantDbContext* ----"
fd -a 'PersistedGrantDbContext*.cs' "$base" || true
echo "---- Files containing 'class' + 'DbContext' under $base ----"
rg -n --type=cs 'class\s+\w*DbContext\b' "$base" || true
rg -n --type=cs '\[DbContext\(' "$base" || true
echo "---- AppCommandHandler migration wiring ----"
sed -n '1,160p' app/server/IdentityService/src/DuendeIdentityServer/AppCommandHandler.cs
echo "---- HostingExtensions AddOperationalStore block ----"
sed -n '50,120p' app/server/IdentityService/src/DuendeIdentityServer/HostingExtensions.cs
echo "---- DependencyInjection AddMinimalInfrastructureServices operational store block ----"
sed -n '1,120p' app/server/IdentityService/src/IdentityService.Infrastructure/DependencyInjection.csRepository: Carl-Johnsons/tastopia Length of output: 508 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Show top of files to see using directives for TimeSpan (and EF Core types)
sed -n '1,80p' app/server/IdentityService/src/IdentityService.Infrastructure/DependencyInjection.cs
echo "----"
sed -n '1,110p' app/server/IdentityService/src/DuendeIdentityServer/HostingExtensions.cs
echo "----"
sed -n '1,120p' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/ApplicationDbContext.cs
echo "----"
base="app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer"
echo "Listing ${base} (few levels):"
find "$base" -maxdepth 4 -type f -name '*.cs' | head -n 200
echo "----"
rg -n --type=cs 'PersistedGrantDbContext|DeviceFlowCodes|ConfigurationDbContext|AddOperationalStore|ConfigureDbContext' "$base" app/server/IdentityService/src/DuendeIdentityServer/HostingExtensions.cs app/server/IdentityService/src/IdentityService.Infrastructure/DependencyInjection.csRepository: Carl-Johnsons/tastopia Length of output: 13683 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Check for global usings that might provide TimeSpan
rg -n --type=cs 'global using\s+System;' . || true
rg -n --type=cs 'global using\s+System\.Collections|global using\s+System\.Threading|global using\s+System\.' . || true
# Check if DependencyInjection.cs or nearby files use TimeSpan already (without an explicit using)
rg -n --type=cs 'TimeSpan\.FromSeconds' app/server/IdentityService/src/IdentityService.Infrastructure/DependencyInjection.cs || trueRepository: Carl-Johnsons/tastopia Length of output: 287 🏁 Script executed: #!/bin/bash
set -euo pipefail
# 1) Find any global usings / using System in IdentityService project
rg -n --type=cs 'global using System\b|using System;' app/server/IdentityService || true
rg -n --type=cs 'TimeSpan\.From' app/server/IdentityService || true
# 2) Find where PersistedGrantDbContext is implemented and whether it sets retries
rg -n --type=cs 'class\s+PersistedGrantDbContext\b|PersistedGrantDbContext\s*:\s*DbContext' app/server/IdentityService/src || true
rg -n --type=cs 'EnableRetryOnFailure' app/server/IdentityService/src || true
rg -n --type=cs 'OnConfiguring\s*\(' app/server/IdentityService/src/IdentityService.Infrastructure/Persistence/IdentityServer || trueRepository: Carl-Johnsons/tastopia Length of output: 4792 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find any definition of PersistedGrantDbContext in the repo
rg -n --type=cs 'class\s+PersistedGrantDbContext\b' app/server/IdentityService/src || true
rg -n --type=cs 'PersistedGrantDbContext\b' app/server/IdentityService/src/DuendeIdentityServer app/server/IdentityService/src/IdentityService.Infrastructure || true
# Inspect AppCommandHandler where persisted grant DbContext is migrated
sed -n '1,140p' app/server/IdentityService/src/DuendeIdentityServer/AppCommandHandler.csRepository: Carl-Johnsons/tastopia Length of output: 2031 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find IdentityService csproj(s)
fd -a -e csproj 'IdentityService*.csproj' . || true
fd -a -e csproj '*IdentityService*.csproj' app/server/IdentityService || true
# If exactly one, print relevant property lines around ImplicitUsings / TargetFramework
for proj in $(fd -a -e csproj '*IdentityService*.csproj' app/server/IdentityService || true); do
echo "---- $proj ----"
sed -n '1,200p' "$proj" | rg -n 'ImplicitUsings|TargetFramework|LangVersion' || true
done
# Also check for repo-wide Directory.Build.props that could set ImplicitUsings
for f in $(fd -a 'Directory.Build.props' . || true); do
echo "---- $f (ImplicitUsings) ----"
rg -n 'ImplicitUsings' "$f" || true
doneRepository: Carl-Johnsons/tastopia Length of output: 674 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find IdentityService csproj(s) using glob (fd defaults to regex)
projs=$(fd -a --glob '*IdentityService*.csproj' app/server || true)
echo "$projs"
for proj in $projs; do
echo "---- $proj ----"
sed -n '1,200p' "$proj" | rg -n 'ImplicitUsings|TargetFramework|LangVersion' || true
done
# Check for repo-wide Directory.Build.props / Directory.Build.targets
for f in $(fd -a --glob 'Directory.Build.props' . || true); do
echo "---- $f ----"
rg -n 'ImplicitUsings|TargetFramework|LangVersion' "$f" || true
done
for f in $(fd -a --glob 'Directory.Build.targets' . || true); do
echo "---- $f ----"
rg -n 'ImplicitUsings|TargetFramework|LangVersion' "$f" || true
doneRepository: Carl-Johnsons/tastopia Length of output: 1036 Add Npgsql
Suggested patch services.AddDbContext<IApplicationDbContext, ApplicationDbContext>(options =>
- options.UseNpgsql(Contract.Utilities.EnvUtility.GetConnectionString()));
+ options.UseNpgsql(
+ Contract.Utilities.EnvUtility.GetConnectionString(),
+ sql => sql.EnableRetryOnFailure(
+ maxRetryCount: 10,
+ maxRetryDelay: TimeSpan.FromSeconds(15),
+ errorCodesToAdd: null)));
services.AddIdentityServer()
.AddOperationalStore(options =>
{
options.ConfigureDbContext = b =>
b.UseNpgsql(
Contract.Utilities.EnvUtility.GetConnectionString(),
- sql => sql.MigrationsAssembly("IdentityService.Infrastructure"));
+ sql =>
+ {
+ sql.MigrationsAssembly("IdentityService.Infrastructure");
+ sql.EnableRetryOnFailure(
+ maxRetryCount: 10,
+ maxRetryDelay: TimeSpan.FromSeconds(15),
+ errorCodesToAdd: null);
+ });
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| services.AddIdentity<ApplicationAccount, IdentityRole>() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .AddEntityFrameworkStores<ApplicationDbContext>() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .AddDefaultTokenProviders(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't short-circuit role checks on an empty provider list.
This now returns
truebeforeRouteClaimsRequirementis evaluated. If a route is configured withAuthenticationProviderKeys: []but still carries arolerequirement, this method will authorize it anyway and skip the claim check entirely.Suggested fix
🤖 Prompt for AI Agents