Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6234071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:24:58+00:00 2026-05-24T10:24:58+00:00

EDITED HEADER: more related with the actual problem I’m trying to setup spring security

  • 0

EDITED HEADER: more related with the actual problem

I’m trying to setup spring security for my test application

i installed the plugin , created User and Role classes ;

put this to UrlMappings.groovy;

        "/login/$action?"(controller: "login")
    "/logout/$action?"(controller: "logout")

then I put a user in the bootstrap as follows,

import org.project.auth.Role
import org.project.auth.User
import org.project.auth.UserRole;

class BootStrap {
    def springSecurityService
    def init = { servletContext ->
        def userRole = Role.findByAuthority('ROLE_USER') ?: new Role(authority: 'ROLE_USER').save(failOnError: true,flush:true)
        def adminRole = Role.findByAuthority('ROLE_ADMIN') ?: new Role(authority: 'ROLE_ADMIN').save(failOnError: true,flush:true)

        def adminUser = User.findByUsername('admin') ?: new User(

                username: 'admin',

                password: springSecurityService.encodePassword('admin'),

                enabled: true).save(failOnError: true,flush:true)

        print User.count()          

        if (!adminUser.authorities.contains(adminRole)) {
                    print "TEST"
            UserRole.create adminUser, adminRole,true
        }
    }
    def destroy = {
    }
}

this print User.count() returns 1 so i know the user is created , print “TEST” works as well so i know that it goes into the if block but when i run the server it fails with

Sorry, we were not able to find a user with that username and password.

I use Grails 2.0.0.M1 , do you think it might be the issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:24:59+00:00Added an answer on May 24, 2026 at 10:24 am

    The User domain class in the 1.2 version of the plugin encrypts the password for you. So older code like this that uses the springSecurityService double-encodes. Change password: springSecurityService.encodePassword('admin') to password: 'admin' and it should work.

    If not, turn up the debugging and you should see a message about why it’s failing. Add this to Config.groovy in the log4j block:

    debug 'org.springframework.security'
    

    Also to be safe I’d change
    if (!adminUser.authorities.contains(adminRole)) { to if (!UserRole.findByUserAndRole(adminUser, adminRole)) {
    `

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDITED I'm trying to have source files recompiled without having to specify header files
I am trying to merge two or more postscript files into one. I tried
Here is the problem: I have to change header of WAVE file, to be
I'm trying to set more information in each day instead of just the day.
i'm trying to get a Outline view to display a directory, now I've edited
I'm trying to play around with netcat to learn more about how HTTP works.
EDITED: Java httpPost into .asp form I am trying to understand .asp a little
I'm trying to overide the default appearance of cflayout tabs. By putting an edited
what is wrong to this code? header('Content-type: application/x-shockwave-flash'); $video_id = $_REQUEST['id']; $content = readfile(http://www.youtube.com/watch?v=$video_id);
I have a problem obtaining Location header from the WebResponse: private CookieContainer _cookieContainer =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.