Reputation: 4520
I am trying to build Blazor server side app using cookie authentication without ASP.NET Core Identity. I did manage to get authentication following sample above.
In my app I skipped services.AddIdentity
and app working so far without problems, I am able to login, logout, determine user roles and others.
What I am not quite sure that I understand is RevalidatingServerAuthenticationStateProvider
class and its service, services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<AppUser>>();
Does Blazor app need this service to continue communicating with client, or it is just security barrier?
I am ok to client remains logged in as long as cookie is not expire.
If I need RevalidatingServerAuthenticationStateProvider
service how I can confirm that user is valid from passed AuthenticationState
? (looking in claim or something else).
Upvotes: 7
Views: 4471
Reputation: 92
here,
protected override TimeSpan RevalidationInterval => TimeSpan.FromMinutes(30);
means, in every 30 minutes, this mechanism will call ValidateAuthenticationStateAsync to check whether current auth is valid or not.
Upvotes: 4