stavroskasidis / BlazorWithIdentity

A project template for a blazor hosted app using cookie based authentication with ef core identity.
MIT License
458 stars 106 forks source link

IsLoggedIn issue #4

Closed dradovic closed 5 years ago

dradovic commented 5 years ago

Thanks for this nice sample!

I've noticed that the cookie inspection logic (Authorization_LoginCookieExists) also reports true if the user is logged in at any other ASP.NET Core Identity site that uses cookie authentication because that other site would also set a cookie.

Would it be possible to instead simply try and get the user info right away as it's going to be needed anyway (and as suggested by #3)? Then, the IsLoggedIn method becomes a simple this.userInfo != null check and there would be no JS interopping. Would that make sense?

stavroskasidis commented 5 years ago

Indeed, that seems like a better approach. I will try it.

stavroskasidis commented 5 years ago

The ideal scenario would be to use Claims, but I don't want to invest that much time, since preview-6 will probably contain proper Auth for blazor.

stavroskasidis commented 5 years ago

I changed the sample based on your suggestions

dradovic commented 5 years ago

Great!