Skip to content

Instantly share code, notes, and snippets.

@eogiles
Last active December 18, 2015 04:08
Show Gist options
  • Save eogiles/5723186 to your computer and use it in GitHub Desktop.
Save eogiles/5723186 to your computer and use it in GitHub Desktop.
Grails spring bean setup for shib auth
beans = {
userDetailsServiceWrapper(org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper) {
userDetailsService = ref('userDetailsService')
}
preauthAuthenticationProvider(org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider) {
preAuthenticatedUserDetailsService = ref('userDetailsServiceWrapper')
}
shibAuthFilter(org.springframework.security.web.authentication.preauth.RequestHeaderAuthenticationFilter) {
principalRequestHeader = 'eppn' //this is the shib header that contains the user ID
checkForPrincipalChanges = true
invalidateSessionOnPrincipalChange = true
continueFilterChainOnUnsuccessfulAuthentication = false
authenticationManager = ref('authenticationManager')
}
//needed for mock authentication on local dev tier
mockTestFilter(com.example.test.util.MockRequestHeaderAuthenticationFilter) {
mockPrincipal = 'test' //Change this if you want to log in as a different user
checkForPrincipalChanges = true
invalidateSessionOnPrincipalChange = true
continueFilterChainOnUnsuccessfulAuthentication = false
authenticationManager = ref('authenticationManager')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment