TASVideos / tasvideos

The code for the live TASVideos website
https://tasvideos.org/
GNU General Public License v3.0
62 stars 29 forks source link

Permissions are sometimes broken, Require Attribute not allowing anything #1883

Closed Masterjun3 closed 3 months ago

Masterjun3 commented 3 months ago

Anyone who logs out and back in can't make e.g. Posts or Topics.

This seems to be the cause eac610fe9734671064897641fd7e2b192552a614 . Sometimes I can post, sometimes I can't, I can't figure out when this happens.

Via code debugging it seems sometimes the user claims simply don't include the permissions.

Masterjun3 commented 3 months ago

Okay, I figured out what could be the problem:

When logging in, we first execute aspnetcore's login (which sets the cookie), and then we add our claims. However, according to internet search, we have to add the claims before logging in. That, or we have to refresh the login immediately afterwards using RefreshSignInAsync, but that feels weird.

So what we can do is this: