Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.6
-
Unknown
Description
When using OAuthRequestFilter to protect a resource if we don't set any member for its "tokenHandlers" list, a request without an "Authorization" header will generate a response like:
Response-Code: 401
Content-Type: text/xml
Headers:
And when trying to process it at the client layer a "java.lang.IllegalArgumentException" will be thrown:
URL uri = new URL("http://SomeFilteredResource");
HttpURLConnection conn = (HttpURLConnection)uri.openConnection();
int code = conn.getResponseCode();
Receives:
java.lang.RuntimeException: java.lang.IllegalArgumentException: invalid start or end
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1137)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2338)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:388)
I suppose the reason could be the empty "WWW-Authenticate" header's value, so the method AuthorizationUtils.throwAuthorizationFailure() should be fixed to avoid this situation
Regards