Grails JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile
Spring Security Core Plugin
  • Spring Security Core Plugin
  • GPSPRINGSECURITYCORE-104

login failure

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Not A Bug
  • Affects Version/s: Grails-Spring-Security-Core 1.2
  • Fix Version/s: None
  • Labels:
    None
  • Environment:
    Windows 7
    Grails 1.4.0.M1
  • Testcase included:
    yes

Description

I've created the simplest possible Grails app with the Spring Security plugin installed. I ran the following commands:

grails create-app test
cd test
grails install-plugin spring-security-core
grails s2-quickstart com.yourapp User Role

Then I added the following to Bootstrap.groovy to create a single user and role on startup:

    def init = { servletContext ->
        def adminRole = Role.findByAuthority('ROLE_ADMIN') ?: new Role(authority: 'ROLE_ADMIN').save(failOnError: true)

        def adminUser = User.findByUsername('admin') ?: new User(
                username: 'admin',
                password: springSecurityService.encodePassword('admin'),
                enabled: true).save(failOnError: true)

        if (!adminUser.authorities.contains(adminRole)) {
            UserRole.create adminUser, adminRole
            println "Added $adminUser.username to role $adminRole.authority"
        }
    }

Then when I go to the login form and enter username "admin" and password "admin" login fails. I'm confident that the user exists, because when the app starts I see the following message in the console

Added admin to role ROLE_ADMIN

When LoginController.authFail() is called back after the login failure, the exception is of type

org.springframework.security.authentication.BadCredentialsException
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    test.zip
    06/Aug/11 9:24 AM
    116 kB
    Donal Murtagh
    1. File
      test/.classpath 0.7 kB
    2. File
      test/.project 0.5 kB
    3. File
      test/.../org.codehaus.groovy.eclipse.preferences.prefs 0.1 kB
    4. File
      test/application.properties 0.2 kB
    5. File
      test/grails-app/conf/BootStrap.groovy 0.7 kB
    6. File
      test/grails-app/conf/BuildConfig.groovy 1 kB
    7. File
      test/grails-app/conf/Config.groovy 4 kB
    8. File
      test/grails-app/conf/DataSource.groovy 0.7 kB
    9. File
      test/grails-app/.../spring/resources.groovy 0.0 kB
    10. File
      test/grails-app/conf/UrlMappings.groovy 0.2 kB
    11. File
      test/grails-app/.../LoginController.groovy 4 kB
    12. File
      test/grails-app/.../LogoutController.groovy 0.3 kB
    13. File
      test/grails-app/.../yourapp/Role.groovy 0.2 kB
    14. File
      test/grails-app/.../yourapp/User.groovy 0.6 kB
    15. File
      test/grails-app/.../yourapp/UserRole.groovy 1 kB
    16. File
      test/grails-app/i18n/messages.properties 3 kB
    17. File
      test/grails-app/.../messages_da.properties 3 kB
    18. File
      test/grails-app/.../messages_de.properties 4 kB
    19. File
      test/grails-app/.../messages_es.properties 3 kB
    20. File
      test/grails-app/.../messages_fr.properties 2 kB
    21. File
      test/grails-app/.../messages_it.properties 2 kB
    22. File
      test/grails-app/.../messages_ja.properties 2 kB
    23. File
      test/grails-app/.../messages_nl.properties 3 kB
    24. File
      test/.../messages_pt_BR.properties 3 kB
    25. File
      test/.../messages_pt_PT.properties 3 kB
    26. File
      test/grails-app/.../messages_ru.properties 4 kB
    27. File
      test/grails-app/.../messages_sv.properties 3 kB
    28. File
      test/grails-app/.../messages_th.properties 5 kB
    29. File
      test/.../messages_zh_CN.properties 2 kB
    30. File
      test/grails-app/views/error.gsp 2 kB
    Showing 30 of 67 items Download Zip
    Show
    Zip Archive
    test.zip
    06/Aug/11 9:24 AM
    116 kB
    Donal Murtagh

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Burt Beckwith added a comment - 06/Aug/11 10:27 AM

In 1.2 the password is encoded in the domain class, so you're double-encoding in BootStrap.

Show
Burt Beckwith added a comment - 06/Aug/11 10:27 AM In 1.2 the password is encoded in the domain class, so you're double-encoding in BootStrap.
Hide
Permalink
Donal Murtagh added a comment - 06/Aug/11 10:38 AM

Thanks for that. I got this Bootstrap code from a Spring blog post which I presume was written for an earlier version of the plugin: http://jira.grails.org/browse/GPSPRINGSECURITYCORE-104?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#issue-tabs

I've left a comment there to highlight that it won't work with v.1.2

Show
Donal Murtagh added a comment - 06/Aug/11 10:38 AM Thanks for that. I got this Bootstrap code from a Spring blog post which I presume was written for an earlier version of the plugin: http://jira.grails.org/browse/GPSPRINGSECURITYCORE-104?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#issue-tabs I've left a comment there to highlight that it won't work with v.1.2

People

  • Assignee:
    Burt Beckwith
    Reporter:
    Donal Murtagh
Vote (0)
Watch (0)

Dates

  • Created:
    06/Aug/11 9:24 AM
    Updated:
    06/Aug/11 10:38 AM
    Resolved:
    06/Aug/11 10:27 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.2.1#813-sha1:277a546)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Grails project. Try JIRA - bug tracking software for your team.