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 6052223
In Process

The Archive Base Latest Questions

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

This is not one of the simple questions.. So let me explain it in

  • 0

This is not one of the simple questions.. So let me explain it in detail…

The background:
In my grails application I have this mapping:

class UrlMappings {
    static mappings = {
        "/$storeId/$controller/$action?/$id?"
        ...
    }
}

This means that all url’s my application will process has preceding url parameter “storeId”. All controllers will use this parameter to render content and perform other actions…

Also I have controller with annotation

@Secured(['IS_AUTHENTICATED_REMEMBERED'])
class SomeController {
    def index = {   
        // ...
    }
}

Let’s say user is trying to access this page:

/555/some/index

If this is unauthenticated user, security-plugin will redirect him to the

/login/auth

The issue is:
When spring-security will redirect to this page, user will see 404. This happens because login controller will handle only urls like

/555/login/auth

The question is:
What should I do to dynamically build this url?

p.s.
It turns out that:

  • There is config param for
    spring-security, called
    “auth.loginFormUrl”. But this is just
    static text. And I need to build this
    url based on what url influenced this
    redirection
  • The redirection is done (I’m not 100%
    sure) in org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint#commence.
    But how to override it?
  • 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:54:18+00:00Added an answer on May 23, 2026 at 7:54 am

    Typically that’s a static value, but it’s called from LoginUrlAuthenticationEntryPoint.getLoginFormUrl(), so you could subclass that and do a dynamic calculation of the url in an overridden method. The plugin already subclasses it with org.codehaus.groovy.grails.plugins.springsecurity.AjaxAwareAuthenticationEntryPoint so you should extend that.

    To register your implementation instead of the plugins, add a bean override in grails-app/conf/spring/resources.groovy:

    import com.yourcompany.yourapp.YourAuthenticationEntryPoint
    beans = {
       authenticationEntryPoint(YourAuthenticationEntryPoint) {
          loginFormUrl = '/login/auth' // has to be specified even though it's ignored
          ajaxLoginFormUrl = '/login/authAjax'
          portMapper = ref('portMapper')
          portResolver = ref('portResolver')
       }
    }
    

    You don’t have direct access to the request in this method, but it’s available in a thread-local – call org.codehaus.groovy.grails.plugins.springsecurity.SecurityRequestHolder.getRequest().

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

Sidebar

Related Questions

Let me explain, this is about displaying class source code in IDEs. I have
This is not one of the regular questions if sleep is counted for timeout
I have seen a few posts regarding this issue but not one specific to
This is not a homework problem. This questions was asked to one of my
I have two questions. First one is simple: Is there any way to control
Let's say we have very simple Java class MyClass . public class MyClass {
Ugh, how do I explain this one... Probably a simple question but my mind
Why it's a syntax error: my @hash{1..4}=(1..4); but not this one: my %hash; @hash{1..4}=(1..4);
Example: /** * This function will determine whether or not one string starts with
this one is not homework, it just the fact that i've been out of

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.