honk
MassTransit: UseConsumeFilter throws nullreference exception on startup if I have batch consumers
MassTransit config
Batch Consumer:
Program runs when I comment out the
receiveEndpointConfig.ConfigureConsumer<MyBatchConsumer>(context);
. I need filters for logging purposes. Has anyone else ran into this issue?1 replies
ASP.NET Core 5 Identity reset password token is randomly invalid
Using IdentityServer4 + ASP.NET Core Identity with .NET 5.
Our password reset endpoint throws errors, however, if I re-send the request a few times (the exact same request), it works again.
Here's a summary of our process: after the user verifies, I generate the password reset token like this:
var token = await _userManager.GeneratePasswordResetTokenAsync(user);
Then I pass this token to the front end, which sends this token to the password reset endpoint, where this token is validated:
The VerifyUserTokenAsync
method returns false most of the time, but after several retries (between 2 to 10 tries), it eventually works.
This issue only occurs in our production environment; our testing environments do not exhibit this problem. The issue seems isolated to the PasswordResetTokenProvider
, as our custom OTP provider functions correctly without failure.
Steps I've taken so far:
Verified that the token generated by GeneratePasswordResetTokenAsync
and the token sent in the request are identical.
Ensured the token is sent in the request body to prevent encoding/decoding mismatches.
Confirmed that the SecurityStamp
is not null during the process.
Any idea what could be causing this? at this point I'm feeling lost and don't know where to look. One suspicion I have, is that there might be several instances of our identity app running, and that maybe causing the issue (although I don't know if that would cause an issue in the first place). I'd be happy to provide more code if needed.
(reposted from SO, as I got no answers there :harold: )
Thanks!3 replies
❔ Force log out the user after account deletion with JWT bearer auth.
Hello, I'm working on adding a feature that allows administrators to delete users. As things currently stand, when a user is deleted, their account is successfully removed, but their JWT token remains in the browser, allowing them to still access most of the website without any issues. I've come up with a few possible solutions, such as regularly checking from the frontend using an API call or websockets to see if the user has been deleted or not. However, I would prefer to use a built-in functionality if available. I came across SecurityStampValidationOptions, but it doesn't seem to work when I tried using it after AddIdentity with services.Configure<>. Is there a simpler way to achieve this?
15 replies
❔ Auto incremented Id not sequential
Hello, I have an auto increment on an Id(integer) column on a database, however values are not sequential. The gaps aren't caused by deletion, as we have no functionality for it on our website( unless someone is intentionally deleting them by hand :p ).
For example, these are the Id's for the first 22 records from the db:
Is this something to worry about? I'm using EF core.
11 replies
❔ Performance of many small requests vs less but bigger requests
I have 2 projects: an API hosted on aws and a desktop application. Currently, I'm fetching around 4k records from an API(let's call these "ParentObjects"), each of them with a list of objects("ChildObjects") containing 50~ records on average. I'm fetching 10 ParentObjects at a time in a for loop, so in total, I'm hitting the API endpoint for around 400 times to display the full data. Would it be better to increase the number of fetched records per http request?
16 replies
Validating an object not received during a request(FluentValidation) [Answered]
Hi, I'm trying to achieve this: I receive Id and someRequest model from an endpoint(separate ID because I'm trying to comply to REST standards and don't want to cram [FromRoute] into the request model]. I also have a different someCommand model,the takes aforementioned id and model into the constructor and creates an object that will be queried against database)This model has validation using
AbstractValidation<T>
class of FluentValidation. I'm wondering, would these validators even work, considering I'm not receiving this model from the request?10 replies