I have just been struggling with this for a few days and ended up with doing the following in a plain Grails 2.4.4 project:
grails create-app
grails install-templates
Then modification of BuildConfig.groovy
dependencies {
...
compile "com.google.guava:guava:18.0"
compile "com.github.dblock.waffle:waffle-jna:1.7.3"
compile "net.java.dev.jna:jna:4.1.0"
compile "net.java.dev.jna:jna-platform:4.1.0"
compile "org.slf4j:slf4j-api:1.7.9"
....
}
I then created context.xml below ..\META-INF with the following content:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE Context>
<Context>
<Valve className="waffle.apache.NegotiateAuthenticator" principalFormat="fqn" roleFormat="both" protocols="Negotiate,NTLM" />
<Realm className="waffle.apache.WindowsRealm" />
</Context>
And then added the following to the ..\templates\web.xml file:
<display-name>/@grails.project.key@</display-name>
<security-constraint>
<display-name>Waffle Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Everyone</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>Everyone</role-name>
</security-role>
....
....
To verify that it actually worked, I added a line to index.gsp
<p>You are logged in as remote user <b>${request.getRemoteUser()}</b> in session <b>${session.getId()}</b>.</p>
I tested this under Tomcat 7.0.57 and had to add some jars to the Tomcat lib to get i to work. I added slf4j-api-1.7.9.jar, guava-18.0.jar, jna-platform-4.1.0.jar, jna-4.1.0.jar, waffle-tomcat7-1.7.3.jar, waffle-jna-1.7.3.jar. Still wonder why this is actually necessary when the same jars are also added to BuildConfig.groovy.