I'm working on a prototype of a claims-based authorisation for our MVC application. We use Asp.Net Identity for authentication.
We would like to have a claim for every controller action and then give/take away users' claims so we have a very fine control over who can go where.
Our application already has 800+ actions and keeps growing. I have made a little test app to see how this number of claims can be handled. And run into a problem: cookies are limited to 4092 bytes.
And having a large number of claims increases Identity Authentication cookie. About 600 claims with short names/values (5 chars each) give me cookie sized over 4K and user with this number of claims just can't login - cookie can't be set in a browser.
And 600 claims is not a limit for our app. We'll probably need more than that.
Is there a way to separate auth-cookie into a few smaller cookies?
p.s. If you are curious, here is my code for claims "profiler" along with the rest of the project.
p.p.s. I know about performance implications of large cookies. Not to worry about it just now.
Update Currently there is no out of the box solution to my answer. But it looks like I'm not the only one with this problem. Microsoft.Owin
is handling the auth-cookie. And current source code for Owin.Cookies has ChunkingCookieManager which is assigned by default in CookieAuthenticationMiddleware.
Bad news that this code is very fresh (was checked in on 10th of July 2014, only 20 days old). It is available through pre-release of nuget Microsoft.Owin.Security.Cookies. Not sure I'd want to use RC2 in production site.
Any other way?