Unauthorized Access in Grails App with Spring Security
<p>App Info:</p>

<ul>
<li>Grails Version: 3.1.8 </li>
<li>Groovy Version: 2.4.6 </li>
<li>JVM Version: 1.8.0_60</li>
<li>Spring Security: spring-security-core:3.1.1</li>
</ul>

<p>I have a School Controller. This contains various methods. The Admin user has access to this method. </p>

<pre><code>@Secured(['ROLE_ADMIN'])
def saveSchool(School newSchool) {
    def theSchool = schoolService.saveSchool(newSchool)

    if (theSchool) {
        render theSchool as JSON
    } else {
        render newSchool as JSON
    }
}
</code></pre>

<p>I'm trying to save the school using AJAX as if there are any error messages I want them to appear on the same form. </p>

<pre><code>&lt;g:javascript&gt;

    $('#insertSchool').submit(function () {

        $.ajax({
            type: 'POST',
            url: '&lt;g:createLink controller="school" action="saveSchool"/&gt;',
            data: $("#insertSchool").serialize(),
            success: function(theSchool) {
           '&lt;g:createLink controller="school" view="saveSchool" model="theSchool"/&gt;'
            }
        })

    });

&lt;/g:javascript&gt;
</code></pre>

<p>The data is persisting to the database and I am being redirected to the saveSchool view however I'm getting a 403. </p>