-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathRecaptchaSpringSecurityGrailsPlugin.groovy
44 lines (34 loc) · 1.94 KB
/
RecaptchaSpringSecurityGrailsPlugin.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import org.codehaus.groovy.grails.plugins.recaptchaspringsecurity.AuthenticationFailureListener
import org.codehaus.groovy.grails.plugins.recaptchaspringsecurity.AuthenticationSuccessListener
import org.codehaus.groovy.grails.plugins.recaptchaspringsecurity.CaptchaCaptureFilter
import grails.plugin.springsecurity.SecurityFilterPosition
import grails.plugin.springsecurity.SpringSecurityUtils
class RecaptchaSpringSecurityGrailsPlugin {
def version = "0.2"
def grailsVersion = "2.3.2 > *"
def pluginExcludes = ["grails-app/conf/RecaptchaConfig.groovy"]
def loadAfter = ['springSecurityCore']
def title = "Recaptcha Spring Security Plugin"
def author = "Roberto Pérez Alcolea"
def authorEmail = "[email protected]"
def description = 'Prevents brute force attack with Spring security and Recaptcha.'
def documentation = "http://grails.org/plugin/recaptcha-spring-security"
def license = "APACHE"
// def organization = [ name: "My Company", url: "http://www.my-company.com/" ]
// def developers = [ [ name: "Joe Bloggs", email: "[email protected]" ]]
def issueManagement = [system: "Github", url: "https://github.com/rpalcolea/recaptcha-spring-security/issues"]
def scm = [url: "https://github.com/rpalcolea/recaptcha-spring-security"]
def doWithSpring = {
authenticationFailureListener(AuthenticationFailureListener) {
loginAttemptCacheService = ref('loginAttemptCacheService')
}
authenticationSuccessEventListener(AuthenticationSuccessListener) {
loginAttemptCacheService = ref('loginAttemptCacheService')
}
captchaCaptureFilter(CaptchaCaptureFilter) {
failureUrl = SpringSecurityUtils.securityConfig.failureHandler.defaultFailureUrl
recaptchaService = ref('recaptchaService')
}
SpringSecurityUtils.registerFilter 'captchaCaptureFilter', SecurityFilterPosition.SECURITY_CONTEXT_FILTER.order + 10
}
}