Announcement Announcement Module
Collapse
No announcement yet.
Grails application with CAS Server Authentication Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Grails application with CAS Server Authentication

    Hi All,

    I have configured the CAS server and successfully configured my sample java web application with CAS authentication but now I want to configure the Grails application with CAS authentication.

    I am very new to Grails so by following the help doc I have created a grails application by executing the following command.

    D:\baji> grails create-app webapp

    It create one webapp folder in d:\baji folder then I run the run-app command as follows

    D:\baji\webapp>grails run-app

    It runs successfully but now I have created a MainController by executing the following command

    D:\baji\webapp>grails CreateController main

    The MainController code is as follows:

    package webapp

    class MainController {

    def index() { render "Hello"}
    }


    But now I want configure the CAS server against to my grails application i.e webapp for that I have downloaded grails-cas-client-1.2.zip and I run the install-plugin command as follows

    D:\baji\webapp>grails install-plugin d:\ grails-cas-client-1.2.zip

    It added successfully and I have added the following properties to the config.groovy file

    grails.plugins.springsecurity.cas.loginUri = '/login'
    grails.plugins.springsecurity.cas.serviceUrl = 'http://localhost:8080/webapp/j_spring_cas_security_check'
    grails.plugins.springsecurity.cas.serverUrlPrefix = 'http://localhost:8081/cas-server'
    grails.plugins.springsecurity.cas.proxyCallbackUrl = 'http://localhost:8080/webapp/main'
    grails.plugins.springsecurity.cas.proxyReceptorUrl = '/main'



    Now I run the application again by run-app command as follows

    D:\baji\webapp>grails run-app

    It�s up the application on http://localhost:8080/webapp

    When I navigated to the http://localhost:8080/webapp/main url in browser it is showing the �hello� on webpage but my question is why it is not redirecting to CAS server for asking credentials?

    So could you please help me out how to configure the CAS server authentication for my Grails application?

    NOTE: I referred the following links to configure the grails with CAS Server

    http://grails.org/plugin/cas-client-plugin

    http://burtbeckwith.github.com/grail...20Introduction




    Regards,
    BSK

  • #2
    You're confusing the CAS client plugin with the spring-security-cas plugin. Also, for 2.0 + don't use install-plugin and there's no need to download the zip file, just add the plugin dependency to your BuildConfig.groovy:

    Code:
    grails.project.dependency.resolution = {
    
       inherits 'global'
       log 'warn'
       checksums true
    
    ...
    
       plugins {
          runtime ":hibernate:$grailsVersion"
          runtime ':jquery:1.7.1'
          runtime ':resources:1.1.6'
          build ":tomcat:$grailsVersion"
    
          compile ":spring-security-cas:1.0.3"
          compile ":spring-security-core:1.2.7.3"
          compile ":web-xml:1.4.1"
       }
    }
    I've also added the spring-security-core and web-xml plugins since the transitive install can fail, but if you have explicit dependencies it will work fine.

    You should probably ask further questions on the Grails User mailing list (see http://grails.org/Mailing+Lists to sign up) since there are more users there and you'll get better support.

    Comment


    • #3
      Ye! Thank you very much for your quick response



      Originally posted by burtbeckwith View Post
      You're confusing the CAS client plugin with the spring-security-cas plugin. Also, for 2.0 + don't use install-plugin and there's no need to download the zip file, just add the plugin dependency to your BuildConfig.groovy:

      Code:
      grails.project.dependency.resolution = {
      
         inherits 'global'
         log 'warn'
         checksums true
      
      ...
      
         plugins {
            runtime ":hibernate:$grailsVersion"
            runtime ':jquery:1.7.1'
            runtime ':resources:1.1.6'
            build ":tomcat:$grailsVersion"
      
            compile ":spring-security-cas:1.0.3"
            compile ":spring-security-core:1.2.7.3"
            compile ":web-xml:1.4.1"
         }
      }
      I've also added the spring-security-core and web-xml plugins since the transitive install can fail, but if you have explicit dependencies it will work fine.

      You should probably ask further questions on the Grails User mailing list (see http://grails.org/Mailing+Lists to sign up) since there are more users there and you'll get better support.

      Comment

      Working...
      X