try generating a new certificate, this topic has been discussed at https://abp.io/support/questions/8266/Generating-CRUD-using-abp-suite-for-module#answer-3a163c11-d8c4-b919-6178-9901f37c352e
I generated using
dotnet dev-certs https -v -ep openiddict. pfx -p 00000000-0000-0000-0000-000000000000 command to generate the openiddict. pfx certificate
but I'm looking for solution where I don't need to worry about its expiry, it should generate using code.
ABP Framework version: v8.1.1
UI Type:React
Database System: EF Core (SQL Server)
Tiered (for MVC) or Auth Server Separated (for Angular): yes
Exception message and full stack trace: NA
Steps to reproduce the issue: NA
Hi,
I'm not able to launch my application suddenly and below is the error in logs
2025-01-22 10:26:22.972 +08:00 [ERR] An unhandled exception has occurred while executing the request.
System.InvalidOperationException: When using X.509 encryption credentials, at least one of the registered certificates must be valid.
To use key rollover, register both the new certificate and the old one in the credentials collection.
at OpenIddict.Server.OpenIddictServerConfiguration.PostConfigure(String name, OpenIddictServerOptions options)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at Microsoft.Extensions.Options.OptionsMonitor`1.<>c.<Get>b__10_0(String name, IOptionsFactory`1 factory)
at Microsoft.Extensions.Options.OptionsCache`1.<>c__DisplayClass3_1`1.<GetOrAdd>b__2()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd[TArg](String name, Func`3 createOptions, TArg factoryArgument)
at Microsoft.Extensions.Options.OptionsMonitor`1.Get(String name)
at Microsoft.Extensions.Options.OptionsMonitor`1.get_CurrentValue()
at OpenIddict.Validation.ServerIntegration.OpenIddictValidationServerIntegrationConfiguration.Configure(OpenIddictValidationOptions options)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at Microsoft.Extensions.Options.OptionsMonitor`1.<>c.<Get>b__10_0(String name, IOptionsFactory`1 factory)
at Microsoft.Extensions.Options.OptionsCache`1.<>c__DisplayClass3_1`1.<GetOrAdd>b__2()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location ---
at System.LazyHelper.ThrowException()
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd[TArg](String name, Func`3 createOptions, TArg factoryArgument)
at Microsoft.Extensions.Options.OptionsMonitor`1.Get(String name)
at Microsoft.Extensions.Options.OptionsMonitor`1.get_CurrentValue()
at OpenIddict.Validation.OpenIddictValidationFactory.CreateTransactionAsync()
at OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandler.HandleRequestAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at eFC.Web.eFCWebModule.<>c.<<OnApplicationInitialization>b__14_0>d.MoveNext() in /work/3/747/s/src/src/eFC.Web/eFCWebModule.cs:line 430
--- End of stack trace from previous location ---
at eFC.Web.eFCWebModule.<>c.<<OnApplicationInitialization>b__14_0>d.MoveNext() in /work/3/747/s/src/src/eFC.Web/eFCWebModule.cs:line 430
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>g__AwaitMatcher|10_0(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task`1 matcherTask)
at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
after further analysis I found openiddict cert is expired. Is there any way by which I can create cert from code automatically whenever cert is about to expire?
thanks
Hi,
It store
access_tokenandrefresh_tokento the cookies, It will not affect your application. And the default value isfalse. we usually don't recommend setting it to true.It will be useful when you need to call the Azure AD API(I assume you are using Azure external login).
ok, thank you.
You can consider set
SaveTokenstofalse
Thank you. It is working with this, but may I know the use of it, is there any possibility that it can impact some other functionality ?
SaveTokens
ok, let me try this
Hi,
can we use zoom https://us05web.zoom.us/j/5929668302?pwd=UXl2M2RUeG5PazVSY2ZCOW1NMUxtZz09
sure, Iet me join
Can I check it remotely? my email is shiwei.liang@volosoft.com
sure, let me send you the meeting invite.
Hi,
How do I reproduce the problem?
Or can you share a test project with me? i will check it. shiwei.liang@volosoft.com
Hi, I'll be able to share sample code only, but I cannot assure that you will be able to replicate the issue as in my case, I'm redirecting it to my application from some external application, also I'm using external login. Let me know if it is fine.
below is the error log https://abp.io/support/questions/8635/Bad-Request---Request-Too-Long#answer-3a1775dc-aad6-8d64-4a56-5a23a2169434
I didn't see any error message there.
BTW,will it work if you try this
Configure<IISServerOptions>(options => { options.MaxRequestBodySize = 209715200; }); Configure<KestrelServerOptions>(options => { options.Limits.MaxRequestBodySize = 209715200; });
yes, error is not there but still I'm getting bad request.
I tried below code, it's not working, I'm still getting bad request.
Configure<IISServerOptions>(options =>
{ options.MaxRequestBodySize = 209715200; });
Hi,
You can try this, and put a breakpoint to debug
options.Events.OnTicketReceived += receivedContext => { //Remove unnecessary claims receivedContext.Principal!.RemoveClaims("..."); return Task.CompletedTask; };
In my token I can see below claims
"iss": "exp": "iat": "aud": "sub": "oi_au_id": "preferred_username": "azp": "at_hash": "oi_tkn_id":
also, I have manually added given_name, permissionClaim, and concurrentUserId, I believe I cannot delete these, am I supposed to delete other JWTClaims even if it is not in token?