Skip to content

Code returns hard instance of HttpURLConnection rather than URLConnection #27142

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

Closed
richardcs opened this issue Jul 7, 2021 · 5 comments
Closed
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: feedback-provided Feedback has been provided status: invalid An issue that we don't feel is valid

Comments

@richardcs
Copy link

URLConnection urlConnection = (proxy != null ? url.openConnection(proxy) : url.openConnection());

As documented here : https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrations.html the code should be able to handle classpath:, file: and http: but since it just uses a RestTemplate.getForObject, which delegates to SimpleClientHttpRequestFactory, there is nothing that will work except a http request. Im not sure where to place this issue, but the offending code error is here and the URLConnection is there for the taking. The actual instance returned for file is "sun.net.www.protocol.file.FileURLConnection" which extends URLConnection (https://github.com/frohoff/jdk8u-jdk/blob/master/src/share/classes/sun/net/www/protocol/file/FileURLConnection.java)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 7, 2021
@mdeinum
Copy link
Contributor

mdeinum commented Jul 7, 2021

The RelyingPartyRegistrations uses a ResourceLoader and to be more precise a DefaultResourceLoader. There is no reference in either the RelyingPartyRegistrations nor the DefaultResourceLoader to a RestTemplate.

The DefaultResourceLoader is more than capable of loading file:, classpath: or http(s): based resources.

@rstoyanchev
Copy link
Contributor

Indeed this doesn't seem to be Spring Framework related. @jzheaux do you have any suggestions?

@rstoyanchev rstoyanchev added the status: waiting-for-feedback We need additional information before we can continue label Jul 9, 2021
@crazyguyonabike
Copy link

This was an issue with 5.4.5. Upgrading to 5.5 the code changed to use the Resource
Loader

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 9, 2021
@mdeinum
Copy link
Contributor

mdeinum commented Jul 10, 2021

The documentation linked is for the 5.5.x version, the 5.4.x doesn't have that documentation. Looks like a case of reading uptodate documentation but using an older version instead.

The support for reading files has been added explicitly in 5.5.x (see spring-projects/spring-security#9028), so apparently it wasn't supported before that.

@jzheaux
Copy link
Contributor

jzheaux commented Jul 19, 2021

@richardcs I agree with @mdeinum's analysis here. If you still feel like this is an issue, please feel free to use Spring Security's issue tracker , and I'd be happy to take a closer look.

@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Nov 8, 2021
@jhoeller jhoeller added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 24, 2023
@sbrannen sbrannen closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: feedback-provided Feedback has been provided status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

8 participants