So I want to create a dynamic image resizer and want to protect it.
Let's say I get request like
/SomeID/400x300/{MyToken}.jpg
{MyToken}
should only be valid for width 400
, height 300
, extension jpg
and ID SomeID
. This token should not be editable by the client, so I can prevent a DOS attac (Requesting thousand of combinations).
With not editable I mean, the client is not able to change the token to something else, that would be valid for other parameters.
If I recall correctly, ASP.NET Formauthentifcation has a algorythm to generate a readonly token. I am searching for something like this.
How does the Formauthentifaction work? How is the principe called? I am stuck at google, because I am not sure what are the right keywords.
What I could do, is a HtmlHelper, which does a File.Exists()
and generates the image if the file does not exist. But since IO is expensive, I would want to get the file on the request, and catch a FileNotFoundException
by generating the image, if the token is valid.