-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency Injection issue in AuthFilter #8455
Comments
Hi @count-emmolgus. Thanks for reporting this! After some debugging your problem seems to be caused by the different 'injection type'. All of our docs and tests regarding However, this doesn't seem to be an issue for resource classes. When changing the signature of fun helloWorld2(@Context ref: Ref<HttpServletRequest>): String the request ref gets injected just fine although you're registering the resource as a class. Having that said, I'm not sure where the issue is caused from. I'll need some further investigation on this topic and maybe raise a Jersey issue for this. |
Hi @zUniQueX, thanks for looking into this. For now being able to declare the filter as an object should work, since we'd be able to declare the injection on a per-field bases rather than in the constructor (even if we prefer using the constructor). Another caveat that I forgot to mention that I find even more strange is that if you don't wrap the filter in the Ergo changing: That was the initial thing that made me suspect a Dropwizard issue, since that class is a Dropwizard class. |
@count-emmolgus After further investigation I've just filed a Jersey issue for this case because I could reproduce the behavior without any dropwizard-related classes. So I'll mark this issue as blocked for now. |
@count-emmolgus The issue is fixed in Jersey, so we'll just have to wait for the next release. |
Hello.
While upgrading from Dropwizard 4.0.1 to Dropwizard 4.0.6 we noticed that we were getting Dependency Injection issues in the AuthFilter.
Digging some more, we noticed it seems as it is Dropwizard 4.0.3 that introduced the issue.
(I've had the same issue with Java 11 & 17)
I've created an simple poc that reproduces the issue (written in Kotlin, but should still be easily understood).
https://github.com/count-emmolgus/dropwizard-filter-issue
Debugging seems to imply that it occurs after authentication, when it tries to set the principal.
Initially I thought it was related to: #7989
But since the tests use
DropwizardAppExtension
instead ofResourceExtension
to hoist the tests, together with it failing outside of the during ordinary runtime it shouldn't be the case.This is the complete stacktrace:
The text was updated successfully, but these errors were encountered: