Before I begin, please excuse my illiteracy on security. I have googled a solution, but I do not quite know which or how the solutions can be applied. I have an application that makes a call to my tomcat server (it serves JasperReport reports). The call is something like:
http://example.com/ReportServlet?report_id=123¶m1=a¶m2=b
If you call this the servlet will return the report. My problem is as long as you keep making this call it will return the report no matter how many times you call it. What I want is to only be able to run the report when you click the 'run report' button inside my application. So if you run that url in a browser it should not work. I was thinking of using some sort of nonce, that when the button is clicked it gets generated and can only be used to call the report once. Right now I have a solution implemented when the button is clicked a random string is generated, inserted into a database, this string is passed in the url as a parameter (http://example.com/ReportServlet?report_id=123¶m1=a¶m2=b&nonce=somesha256
, the servlet reads this parameter and checks with the database, if it is valid it marks the string no longer valid. This isn't a clean solution, I was wondering if tomcat (or even JasperReports) has a solution similar to a nonce?