javaajaxdwr

Restrict Access to DWR(Easy Ajax for Java) from URL bar


I am using DWR, which is commonly known as Easy Ajax for Java .

But it can be accessed directly via URL bar like this

http://localhost:8080/myProjectName/dwr/

from here I can execute each and every Ajax Call, which is considered as a threat to Application Security ,

Is there a way to restrict this ?


Solution

  • I'm not sure what you're trying to accomplish, but here are some suggestions:

    in your servlet-declaration in web.xml. Set param-value to false and http://localhost:8080/myProjectName/dwr/ will return a 404 (page not found).

    then at the beginning of every function that is available through the web, i do something like

        Person user=getLoggedInUser();
        if(user)==null return null;