[opencms-dev] Problem accesing protected resources from image taglib

Thomas Maerz thomasmaerz at gmx.de
Tue Aug 23 14:28:14 CEST 2005


Jorge González <informatico at hotelparadisepark.com> writes:

> THE WEIRD thing is, accesing this page directly from the outside world
> (http://localhost:8080/opencms/opencms/opt/www-test/test.jpg) Using a fresh
> browser to fire the auth process.
>
> First, the browser shows the login box, and then /opt/www-test/test.jpg is
> shown correctly


Doesn't seem weird at all.

|     protected InputStream getImageStream() throws JspException, IOException {
|         URLConnection connection = getCorrectedUrl(src).openConnection();
|         //TODO: Auth only if it is the same server
|         String auth = hreq.getHeader(AUTHORIZATION);
|         if (auth != null && auth.length() > 0) {
|             connection.setRequestProperty(AUTHORIZATION, auth);
|         }
|         return connection.getInputStream();
|     }

So if you send the Authorization-Header the Taglib will, too.
If not, the Taglib won't.

You could modify the source to acceppt cookies as well.
Or write the generated thumbnails to the VFS.


Regards,
Thomas




More information about the opencms-dev mailing list