(Quick Reference)

20 Voters - Reference Documentation

Authors: Burt Beckwith, Beverley Talbott

Version: 2.0.0

20 Voters

You can register a list of voters by implementing the AccessDecisionVoter interface. The list confirms whether a successful authentication is applicable for the current request.

PropertyDefault ValueMeaning
voterNames['authenticatedVoter', 'roleVoter', 'webExpressionVoter']Bean names of voters.

By default a roleVoter bean is registered to ensure users have the required roles for the request, and an authenticatedVoter bean is registered to support IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED, and IS_AUTHENTICATED_ANONYMOUSLY tokens.

To customize this list, you define a voterNames attribute with a list of bean names. The beans must be declared either by the plugin, or yourself in resources.groovy or resources.xml. Suppose you have a custom MyAccessDecisionVoter in resources.groovy:

beans = {
   myAccessDecisionVoter(com.foo.MyAccessDecisionVoter) {
      // attributes
   }
}

You register it in grails-app/conf/Config.groovy as:

grails.plugin.springsecurity.voterNames = [
   'authenticatedVoter', 'roleVoter',
   'webExpressionVoter', 'myAccessDecisionVoter'
]