-
Notifications
You must be signed in to change notification settings - Fork 6k
permitAll() broken? #13303
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
Comments
Hi @UglyHobbitFeet, thanks for the report. Can you share more details about your request? Are you sending any kind of authentication with it, even if it permits all?
This is odd, 405 means that the HTTP method is not supported. Can you also add the code of the controller that handles that method? |
I am sending X509 authentication that extends (
org.springframework.security.authentication.AbstractAuthenticationToken)
along with the request. Unfortunately I cannot share that code nor do I
have a small reproducible sample.
…On Tue, Jun 13, 2023 at 8:07 AM Marcus Hert Da Coregio < ***@***.***> wrote:
Hi @UglyHobbitFeet <https://github.com/UglyHobbitFeet>, thanks for the
report.
Can you share more details about your request? Are you sending any kind of
authentication with it, even if it permits all?
Ideally, it would be great if you can provide a minimal, reproducible
sample, if not, please try to share as much detail as possible.
A direct call with authorizeHttpRequests generates a 403 code whereas
authorizeRequests generates a 405 code.
This is odd, 405 means that the HTTP method is not supported. Can you also
add the code of the controller that handles that method?
—
Reply to this email directly, view it on GitHub
<#13303 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALBDS7WQJKFLIK2ABKFOMKTXLBJXXANCNFSM6AAAAAAZA62JM4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
In that case, I would recommend adding You do not need to share the details as is, you can mask them and just share the pertinent parts. |
|
The x509 part of your code seems to be customized, so there is not much we can assume from here. It is important to remember that
What is working fine? Which request? What clues did you get from making that change? |
I am not sure what other logging I can provide. I know the X509 code works with the deprecated authroizeRequests call My application has two modes of authentication. One is X509, the other is username/password. Based off your comments I decided to switch to username/password to see if it worked, and it did. So I thought I would mention that in my response because it helped confirm that the X509 is what is tripping up the authorizeHttpRequests call. |
I am sorry but I still do not understand what you mean by working/not working. You mentioned:
and
But you haven't explained what happens when it's working and vice-versa. Your configuration permitted all on |
Regarding the first comment. By 'Working" I mean I am allowed to hit the endpoint and get back expected results. By "Not Working" I mean I am not getting back expected results. Regarding the second comment, it should be /'authenticate'. I just manually edited the log files to say '/myEndpoint' when I was cleaning them up for posting in this issue. My apologies for causing confusion on this due to cleaning up log file output. |
It is strange that you have an authentication token in the security context with no authorities:
However, your logs do not show the 403 happening. If there is any security-related error, the exception should be printed to the console. Can you find it in the logs output? |
I went through the code and created a cleaned up version of what I'm doing. I hope this helps to make sense of why it's failing. |
Hi @UglyHobbitFeet, since you did not share the logs where the 403 is happening, and based on what I could assume from your code, here are my thoughts:
With that said I suggest that you put a breakpoint on the code I linked above to check the behavior described and you should revisit your custom filter implementation in order to validate the authentication token against the |
@marcusdacoregio You nailed it, thanks! I made the edits you mentioned in your latest post and it started working with the authorizeHttpRequests. Thanks again for all your help! |
I am upgrading from Spring 2.7.10 to 3.1. Part of that is converting authorizeRequests to authorizeHttpRequests.
I'm using the example here as a guideline:
https://docs.spring.io/spring-security/reference/servlet/authorization/authorize-http-requests.html#favor-permitall
My old code looked like so and still works in v3.1 but throws deprecation warnings:
When I modify it to get rid of the deprecation warnings it no longer works:
Note that all other config code is identical. The only difference is the one line above to remove the deprecation warning.
Am I doing something wrong or is this a bug? I am calling a url similar to https://someserver/authenticate/blah from a frontend service. FWIW if I call it directly in the browser I notice I do get different HTTP responses for both. i.e. A direct call with authorizeHttpRequests generates a 403 code whereas authorizeRequests generates a 405 code.
The text was updated successfully, but these errors were encountered: