Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ASP.NET ValidateAntiForgeryToken feature #2206

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Jan 5, 2019

  1. Add ASP.NET ValidateAntiForgeryToken fix

    Jtable ajax calls to controler actions marked with [ValidateAntiForgeryToken]  may not work because Antiforgery checks the request header for an antiforgery token which is then compared with the  cookies token. If they don't match or the token is missing, the server responds with error 400. All this is to prevent Cross-Site Request Forgery (CSRF) Attacks. This fix attempts to manage this by adding a security option where a antiforgerytoken can be passed, this is then added to the ajax call header for server side validation. usage would be like:
    
     var token = 'gettokenvalue'
            $('#CategoriesContainer').jtable(
                {
                    title: 'Categories',
                    paging: false,
                    sorting: false,
                    security:
                    {
                        antiforgerytoken: token
                    },
                    actions: {----------
    bmacharia committed Jan 5, 2019
    Configuration menu
    Copy the full SHA
    e49de02 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    424338f View commit details
    Browse the repository at this point in the history