Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalidate user in Identity Core when roles/account changes

First - I'm still learning Identity Core (and .NET core in general). I'm using Google Authentication (internal only project). I tested an account and deleted it. I noticed even after deleting it from the database I can still browse around in secured parts of the page.

Is there a way to automatically log the user out if the account is no longer valid?

like image 305
mackhax0r Avatar asked Jan 25 '26 12:01

mackhax0r


1 Answers

This is what the validation interval is supposed to do

Configure<SecurityStampValidatorOptions>(options => options.ValidationInterval = TimeSpan.FromSeconds(10));

There is also a callback OnRefreshingPrincipal you can use to plug custom logic

like image 124
Stilgar Avatar answered Jan 27 '26 04:01

Stilgar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!