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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:24:43+00:00 2026-06-01T03:24:43+00:00

I have inherited a Grails app, which uses the Acegi 0.5.3 plugin. The application

  • 0

I have inherited a Grails app, which uses the Acegi 0.5.3 plugin.

The application can be accessed via two completely different URLs e.g., app.domainone.com and app.domaintwo.com. The domain names map to two different user communities. Now I have been tasked with restricting user access from only the domain that they are related to. At the moment the users can visit any of the domains and login to the application.

I have some clue about how Acegi works but, can’t say I understand all of it yet. So wanted to ask how I would be able to achieve this.

In an ideal scenario, when the user tries to login, I would like to redirect (if required) to their ‘relevant’ domain and automagically sign them in with their given credentials. However, as an interim solution even a plain redirect to the relevant login page would suffice.

  • 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-06-01T03:24:45+00:00Added an answer on June 1, 2026 at 3:24 am

    Here goes my CustomAuthenticationProcessingFilter. There is probably a better solution out there but this helped me with the little knowledge that I have of Grails and Spring Security.

        class CustomAuthenticationProcessingFilter extends GrailsAuthenticationProcessingFilter implements
        InitializingBean {
    
            //def authenticationManager
            @Override
            public int getOrder() {
                return FilterChainOrder.AUTHENTICATION_PROCESSING_FILTER
            }
    
            @Override
            void doFilterHttp(HttpServletRequest request,
            HttpServletResponse response, FilterChain chain) throws IOException,
            ServletException {
                if (SecurityContextHolder.getContext().getAuthentication() == null) {
                    def loginUrl = "${request.getRequestURL().toString() - request.getRequestURI().toString()}${request.contextPath}"
                    def username = request.getParameter("j_username")
                    def password = request.getParameter("j_password")
    
                    if ( loginUrl && username && password) {
                        def user = User.findByEmailOrCompanyEmail(username,username)
                        if(user) {
                            def query = """select c from Community c, UserCommunity uc
                                            where c.id = uc.comm.id
                                            and uc.user.id = :userId"""
                            def comm = Community.executeQuery(query,[userId:user.id])
                            comm = comm?(comm?.get(0)):null
                            if(loginUrl!=comm?.url) {
                                println "Trying to login using the wrong URL"
                                response.sendRedirect(comm.url+'/login/auth')
                                return
                            }
    
                        }
                    }
                }
    //Resume the normal flow
                super.doFilterHttp(request, response, chain)
            }
    
            @Override
            public void afterPropertiesSet() throws Exception {
                // TODO Auto-generated method stub
    
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're developing an app (using Grails Spring Security (formerly Acegi)) in which we'll have
I have inherited a c# class 'Button' (which I can't change) which clashes with
I have inherited a visual studio 2003 project which uses some custom build steps.
I have inherited an Excel spreadsheet which contains an external data query. I can
I have inherited a VB.NET application that I need to compile so I can
I have inherited a site which the css links on all of the 100+
I have inherited a client site which crashes every 3 or 4 days. It
I have inherited an old crusty PHP application , and I'd like to refactor
I have inherited a VB6/Access application that we have developed and sold for many
I have inherited a poorly written web application that seems to have errors when

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.