Bug 9880 - URL-Authentication in org.apache.fop.image
Summary: URL-Authentication in org.apache.fop.image
Status: CLOSED DUPLICATE of bug 14419
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: images (show other bugs)
Version: 0.20.3
Hardware: PC Windows XP
: P3 enhancement
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-14 19:47 UTC by ms
Modified: 2012-04-01 13:54 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ms 2002-06-14 19:47:39 UTC
Dear Eric,

in a project we needed an Apache Webserver authentication via URL. 

The project is a content management system based on the Tamino
XML-Server. Documents can be presented either in HTML or in 
PDF format, this is where FOP comes in the place.

Due to security issues we protected an URL-path with Basic Authentication.
This lead to HTTP 401 errors when trying to get image files into the
FOP process by an HttpRequest.

We added some lines of code to the following classes from the 
package org.apache.fop.image:
BmpImage 
JimiImage 
JAIImage 
JpegImage 
GifImage 
FopImageFactory

We replaced the invocation of the methods URL.getContent() and
URL.openStream() by this code (with slight differences in either
class):

<!--------- snip ------------>

java.net.URLConnection urlCon = this.m_href.openConnection(); 
String userpass = this.m_href.getUserInfo(); 
String auth = "Basic " + new 
             sun.misc.BASE64Encoder().encode(userpass.getBytes()); 
urlCon.setRequestProperty("Authorization", auth); 
ImageProducer ip = (ImageProducer)urlCon.getContent();

<!--------- snap ------------>

We made a straight forward approch with hard encoding of our 
user/password requirements. You should of course better replace
this by invocation of the URL-method getUserInfo() which returns
a colon seperated string "user:password". Maybe you still have
to check whether it is null or not.

Thanks for your good work in the ASF, we hope this info is
helpful for your work!

with best regards

Marko Petersen
Malte Schnack

PS: If you need the amended source files pls contact either
Marko (mp@bitset.de) or me (ms@bitset.de)
Comment 1 Oleg Tkachenko 2002-11-21 20:09:02 UTC

*** This bug has been marked as a duplicate of 14419 ***
Comment 2 Glenn Adams 2012-04-01 13:54:50 UTC
batch transition to closed remaining pre-FOP1.0 resolved bugs