Thomas Rasmussen
06/19/2025, 8:12 AMDave
06/19/2025, 2:52 PMBrandon Ray
06/19/2025, 4:44 PMThomas Rasmussen
06/23/2025, 6:55 AMuser
06/24/2025, 9:24 AMuser
06/24/2025, 3:29 PMIndianerJones
06/25/2025, 6:33 AMrepositories {
inherits true
grailsCentral()
mavenCentral()
mavenRepo("<https://gitlab.company.net/api/v4/groups/dev/-/packages/maven>") {
auth([
username: "oauth",
password: props.get("gitlabMavenPassword") as String ?: System.getenv("CI_JOB_TOKEN")
])
}
}
Since the change, Grails only sends the authentication header after receiving a 401 response, but GitLab now expects the authentication header on the very first request (preemptive authentication).
I tried something like this (hoping to force preemptive authentication):
repositories {
inherits true
grailsCentral()
mavenCentral()
mavenRepo("<https://gitlab.company.net/api/v4/groups/dev/-/packages/maven>") {
auth([
username: "oauth",
password: props.get("gitlabMavenPassword") as String ?: System.getenv("CI_JOB_TOKEN"),
type : "basic"
])
}
}
But it doesn’t seem to help—Grails still only sends the header after the 401 response.
Question:
Is there a way to configure Grails (in BuildConfig.groovy or elsewhere) to force sending the authentication header on the first request (i.e., enable preemptive HTTP Basic Auth for Maven repositories)? Or is there another workaround for this situation?
Thanks in advance for your help!user
06/26/2025, 11:44 AMrss
06/26/2025, 12:04 PMuser
06/26/2025, 1:58 PMOncePerRequestFilter
which I use to do some authentication. How do I make them work or skip based on path pattern by using grails.plugin.springsecurity.filterChain.chainMap
? Now no matter what I specify in the chainMap it gets invoked for every request that lands in our app.user
06/26/2025, 2:34 PM/process/object
which works fine without any auth, and by default my filterChain in application.groovy
looks like this
grails.plugin.springsecurity.filterChain.chainMap = [
[pattern: '/**', filters: 'JOINED_FILTERS']
]
Now, I have defined a new filter called tokenAuthenticationFilter
by extending OncePerRequestFilter
and I am registering this filter under application.groovy like
grails.plugin.springsecurity.filterChain.filterNames = ['tokenAuthenticationFilter']
grails.plugin.springsecurity.filterChain.chainMap = [
[pattern: '/**', filters: 'JOINED_FILTERS,-tokenAuthenticationFilter']
]
As soon as I do this, I get the below chain of exceptions,
2025-06-26 15:32:54.366 [http-nio-8080-exec-1] ERROR o.a.c.c.C.[.[.[.[dispatcherServletRegistration] - Servlet.service() for servlet [dispatcherServletRegistration] in context with path [] threw exception
org.springframework.security.authentication.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext
at org.springframework.security.access.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:350)
at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:214)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
How can I explicity disable Auth for this? All I have done is introduce a new filteruser
06/26/2025, 2:50 PManonymousAuthenticationFilter
to pass through this?lmatuszewski
06/30/2025, 9:52 AMStephen Lynch
06/30/2025, 12:19 PMseanleblanc
07/01/2025, 8:37 PMuser
07/03/2025, 1:01 AMTung
07/03/2025, 3:38 PMRichard Rice
07/03/2025, 7:26 PMapplication.groovy
it seems to be looking for a username
when I want it to only read the properties in the props I provide. (@jdaugherty chatting with @gsandrew on this issue and he said you might have an idea)cjchalmers
07/11/2025, 9:06 AMuser
07/13/2025, 8:49 PMcjchalmers
07/14/2025, 7:24 PMJohn Moore
07/15/2025, 2:31 PMTask :compileGroovy startup failed: /root/src/borderbus/grails-app/controllers/borderbus/AdminController.groovy: 11: The return type of java.lang.Object getGrailsApplication() in borderbus.AdminController is incompatible with grails.core.GrailsApplication in grails.web.api.WebAttributes . At [11:1] @ line 11, column 1. class AdminController implements BrevoTrait { ^ 1 errorThis presumably means there's a conflict between the getGrailsApplication() method from two different sources, the trait and the service. Am I doing this right? How can I get around this problem without overcomplicating things? And is a Trait a natural fit for this, or is there a better way? I presume I could create my own plugin but it's not something I've ever done before and I imagine it might be more cumbersome than is ideal.
gopichand.bhaskaruni
07/15/2025, 3:50 PMuser
07/15/2025, 5:56 PM/src/
directory under the project and we have dependency to retrieve the configuration from application.yml
. To achieve that we are using GrailsApplication grailsApplication = Holders.grailsApplication
but found it here https://github.com/apache/grails-core/issues/12090#issuecomment-934592118 that using holders to load properties is not a good approach. So may I know whats the best and right approach?
If holders is the right way to go, I am unable to stub it for unit-testing, can you please educate me how may I stub the Holders+application data?giangio
07/16/2025, 2:03 PMJohn Moore
07/16/2025, 3:16 PMuser
07/18/2025, 7:40 AMrss
07/21/2025, 4:44 PMJohn Moore
07/21/2025, 6:45 PMimplementation 'dk.glasius:external-config:4.0.1'
and can just use the grails.config.locations as if it is part of Grails (which it presumably is as of 7)?John Moore
07/22/2025, 12:02 PM