Grails + Acegi + IntelliJ

  • Create new Grails application project.
  • Create a new domain class using ‘grails create-domain-class domain’ and make sure the name does not have ‘order’ in it. For some reason, the IntelliJ generated domain is not recognized as a valid domain class by grails.
  • Added some fields to the domain class
  • Generate the Controllerclass using IntelliJ (grails create-controller script is not good enough)
  • Modified the ‘def index = …’ into ‘def scaffold = …’
  • run-app
  • grails install-plugin acegi
  • grails create-auth-domains User Role Requestmap
  • grails generate-manager
  • grails generate-registration
  • grails run-app
  • Create userroles : ROLEADMIN and ROLEUSER
  • Create user: admin with ROLEADMIN and user with ROLEUSER
  • Create mapping: i.e. /Inventory/** for ROLE_ADMIN
  • grails run-app

To enable HTTPS: Look here http://www.stainlesscode.com/site/comments/acegi_spring_security_https_and_grails/ basically:

  • grails install-templates, ( the following code is generated from http://www.simplebits.com )

      <filter-name>Acegi Channel Processing Filter</filter-name>  
      <filter-name>Acegi Channel Processing Filter</filter-name>  
  • Navigate to the src/templates/war and add the filter to the web.xml template there:- This following code should be put into yout grails-app/conf/spring/resource.groovy file (the entire file is reproduced here):

    import org.springframework.security.securechannel.ChannelProcessingFilter  
    import org.springframework.security.securechannel.ChannelDecisionManagerImpl  
    import org.springframework.security.securechannel.SecureChannelProcessor  
    import org.springframework.security.securechannel.InsecureChannelProcessor  
    // Place your Spring DSL code here
    beans = {
        channelDecisionManager(ChannelDecisionManagerImpl) {  
            channelProcessors = [secureChannelProcessor, insecureChannelProcessor]  
        channelProcessingFilter(ChannelProcessingFilter) {  
    • grails run-app —https

Links: http://luxsci.com/blog/256-bit-aes-encryption-for-ssl-and-tls-maximal-security.html

Subscribe to Lydon's blog

Get the latest posts delivered right to your inbox



Grow and grow and grow

Read More