Bug #6252

HTTP with UserPass context

Added by Hajnal Akos almost 7 years ago. Updated over 6 years ago.

Status:ResolvedStart date:02/24/2014
Priority:HighDue date:
Assigned To:Schwarz Lionel% Done:

0%

Category:Non-grid adaptors
Target version:1.0.1

Description

Dear Developers,

JSAGA's HTTP offers UserPass authentication as a valid context type,
but I don't see userpass data in HTTP header,
and I cannot access pages like: http://svn.liferay.com/repos/public/ with user: "guest", pass: "".

The sent header should contain the entry:

Authorization: Basic Z3Vlc3Q6

where Z3Vlc3Q6 is the base64 encoded form of user:pass string ("guest:" in this example).
(There are authentication types in HTTP other than Basic, but I would be satisfied with Basic.)

Now I get: NoSuccess: HTTP/1.1 401 Authorization Required.

Thank you,
Akos

Example code producing this error:

import org.ogf.saga.context.*;
import org.ogf.saga.namespace.*;
import org.ogf.saga.session.*;
import org.ogf.saga.url.*;
public class HttpUserPass {
    public static void main(String[] args) throws Exception {
            String url = "http://svn.liferay.com/repos/public/";
            Session session = SessionFactory.createSession(false);
            Context ctx = ContextFactory.createContext("UserPass");
            ctx.setAttribute(Context.USERID, "guest");
            ctx.setAttribute(Context.USERPASS, "");
            session.addContext(ctx);
            URL dirUrl = URLFactory.createURL(url);
            NSDirectory dir = NSFactory.createNSDirectory(session, dirUrl);
            for (URL dirEntry: dir.list()) System.out.println(dirEntry.getPath());
            dir.close();
    }
}

History

#1 Updated by Schwarz Lionel almost 7 years ago

  • Category set to Non-grid adaptors
  • Assigned To set to Schwarz Lionel
  • Priority changed from Normal to High
  • Target version set to 1.0.1

#2 Updated by Schwarz Lionel over 6 years ago

  • Status changed from New to Resolved

Also available in: Atom PDF