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

  • SEARCH
  • Home
  • 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 6051655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:50:33+00:00 2026-05-23T07:50:33+00:00

This is a follow up to this question . I have a custom AuthenticationProvider

  • 0

This is a follow up to this question.

I have a custom AuthenticationProvider that extends AbstractUserDetailsAuthenticationProvider. In the additionalAuthenticationChecks I am doing some custom auth work and part of this process is to display some messages to the user on the login screen. Currently, for testing, I created a UserNotActivatedException:

class UserNotActivatedException extends AuthenticationException {

  public UserNotActivatedException(String message, Throwable t) {
    super(message, t)
  }

  public UserNotActivatedException(String message) {
    super(message)
  }

  public UserNotActivatedException(String message, Object extraInformation) {
    super(message, extraInformation)
  }

}

And in the additionalAuthenticationChecks I am just immediately throwing it for testing. Now, I need to know what I need to do to get my own fail message to show up on the login screen. In the spring-security-core default config, we can override the following:

errors.login.disabled = "Sorry, your account is disabled."
errors.login.expired = "Sorry, your account has expired."
errors.login.passwordExpired = "Sorry, your password has expired."
errors.login.locked = "Sorry, your account is locked."
errors.login.fail = "Sorry, we were not able to find a user with that username and password."

But I don’t see how I can add my own additional messages.

  • 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-23T07:50:33+00:00Added an answer on May 23, 2026 at 7:50 am

    It looks like those messages just get used by the authfail action of the LoginController that gets generated into grails-app/controllers. Here’s the code from the template (in the plugin):

    /**
     * Callback after a failed login. Redirects to the auth page with a warning message.
     */
    def authfail = {
    
        def username = session[UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY]
        String msg = ''
        def exception = session[WebAttributes.AUTHENTICATION_EXCEPTION]
        if (exception) {
            if (exception instanceof AccountExpiredException) {
                msg = SpringSecurityUtils.securityConfig.errors.login.expired
            }
            else if (exception instanceof CredentialsExpiredException) {
                msg = SpringSecurityUtils.securityConfig.errors.login.passwordExpired
            }
            else if (exception instanceof DisabledException) {
                msg = SpringSecurityUtils.securityConfig.errors.login.disabled
            }
            else if (exception instanceof LockedException) {
                msg = SpringSecurityUtils.securityConfig.errors.login.locked
            }
            else {
                msg = SpringSecurityUtils.securityConfig.errors.login.fail
            }
        }
    
        if (springSecurityService.isAjax(request)) {
            render([error: msg] as JSON)
        }
        else {
            flash.message = msg
            redirect action: auth, params: params
        }
    }
    

    (from ~/.grails/1.3.7/projects/project-name/plugins/spring-security-core-1.1.2/src/templates/LoginController.groovy.template)

    You can probably just add your UserNotActivatedException type to the conditions there.

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

Sidebar

Related Questions

I have a follow up question to this one . Now that I have
this is a follow-up question of mine. Suppose now I have a URL :
I have a follow-up question to this one . I created a new form,
I have a follow up question to this question . Is it possible to
This is somewhat of a follow-up question to this question . Suppose I have
This is a follow-up to my question from yesterday . I have Scott Meyers'
Follow up to this question . I have the following code: string[] names =
As a follow on from this question I'm building a custom server control to
This question is a follow up to this previous question: Ruby on Rails: Custom
This is a running question that I have updated to hopefully be a little

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.