Return-Path: Delivered-To: apmail-incubator-clerezza-dev-archive@minotaur.apache.org Received: (qmail 32728 invoked from network); 9 Feb 2010 10:47:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Feb 2010 10:47:51 -0000 Received: (qmail 7363 invoked by uid 500); 9 Feb 2010 10:47:51 -0000 Delivered-To: apmail-incubator-clerezza-dev-archive@incubator.apache.org Received: (qmail 7331 invoked by uid 500); 9 Feb 2010 10:47:51 -0000 Mailing-List: contact clerezza-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: clerezza-dev@incubator.apache.org Delivered-To: mailing list clerezza-dev@incubator.apache.org Received: (qmail 7321 invoked by uid 99); 9 Feb 2010 10:47:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Feb 2010 10:47:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Feb 2010 10:47:50 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 79BBD234C052 for ; Tue, 9 Feb 2010 02:47:30 -0800 (PST) Message-ID: <229829623.147191265712450494.JavaMail.jira@brutus.apache.org> Date: Tue, 9 Feb 2010 10:47:30 +0000 (UTC) From: =?utf-8?Q?Oliver_Str=C3=A4sser_=28JIRA=29?= To: clerezza-dev@incubator.apache.org Subject: [jira] Created: (CLEREZZA-108) problem with Cookie Authentication Bundle / Access via Java HTTP Call MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 problem with Cookie Authentication Bundle / Access via Java HTTP Call --------------------------------------------------------------------- Key: CLEREZZA-108 URL: https://issues.apache.org/jira/browse/CLEREZZA-108 Project: Clerezza Issue Type: Question Reporter: Oliver Str=C3=A4sser I try to connect to the Trialox and have problems with the redirecting to t= he login screen. I tried the following code to connect to the Trialox system. if I deactivate the Clerezza - Platform Security Cookie Authentication Bund= le, the code worked correctly and the authentication is successful. if I activate the bundle my response is: Server returned HTTP response cod= e: 500 for URL: http://localhost:8080/login?referer=3D%2Fmacc%2Fcontent%2Fo= rg.greenpeace.ch&cause=3D1 is that an error on my side or at the cookie bundle How is the correct way ? /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package test; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.Authenticator; import java.net.InetAddress; import java.net.MalformedURLException; import java.net.PasswordAuthentication; import java.net.URL; /** * * @author osr */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("Starting request"); // TODO code application logic here // Access the page try { Authenticator.setDefault(new MyAuthenticator()); // Create a URL for the desired page URL url =3D new URL("http://localhost:8080/macc/content/org.gre= enpeace.ch"); // Read all the text returned by the server BufferedReader in =3D new BufferedReader(new InputStreamReader(= url.openStream())); String str; while ((str =3D in.readLine()) !=3D null) { // str is one line of text; readLine() strips the newline c= haracter(s) System.out.println(str); } in.close(); } catch (MalformedURLException e) { System.out.println("MalformedURLException"); } catch (IOException e) { System.out.println("IOException: " + e.getMessage()); } } public static class MyAuthenticator extends Authenticator { // This method is called when a password-protected URL is accessed @Override protected PasswordAuthentication getPasswordAuthentication() { System.out.println("getPasswordAuthentication"); // Get information about the request String promptString =3D getRequestingPrompt(); String hostname =3D getRequestingHost(); InetAddress ipaddr =3D getRequestingSite(); int port =3D getRequestingPort(); // Get the username from the user... String username =3D "admin"; // Get the password from the user... String password =3D "admin"; // Return the information return new PasswordAuthentication(username, password.toCharArra= y()); } } } --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.