Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 70524 invoked from network); 20 Apr 2007 13:53:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Apr 2007 13:53:53 -0000 Received: (qmail 62590 invoked by uid 500); 20 Apr 2007 13:53:50 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 62540 invoked by uid 500); 20 Apr 2007 13:53:50 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 62491 invoked by uid 99); 20 Apr 2007 13:53:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Apr 2007 06:53:50 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of rickmcg@gmail.com designates 66.249.82.226 as permitted sender) Received: from [66.249.82.226] (HELO wx-out-0506.google.com) (66.249.82.226) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Apr 2007 06:53:42 -0700 Received: by wx-out-0506.google.com with SMTP id s18so938459wxc for ; Fri, 20 Apr 2007 06:53:21 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=LSOkPnnei0DrCmulSTkETKlgy++tFe9dUiExRJ8cdeO0+UwnzF14Kt0Jb0J8Zi1MDyQqzBk4uxqNsYoJJdLVbsKCqtw4FKGOaCaSMKJuagSFwokFjNqEer4NUuIjFrG/YAs1otvIlE63TyPjX1Rx7PvGsWia/5iPcScW1n0VzGk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=l0NVZ7/SMfo0vwGje5wA6UsB6nJlCnKT7G462Rwg+B+AO+U5TIAHqlAkO5s/QNLlI0zf7Tzmh05YPPpkaAnBaEBUS3UNIgdbJAZUwGGULJ3unleAioqyH+07w1sAtWbtECV7eoDStLWOaqhuSiy9bqYQr9nLK5fMszViYDDNWQU= Received: by 10.70.28.7 with SMTP id b7mr5502014wxb.1177077201165; Fri, 20 Apr 2007 06:53:21 -0700 (PDT) Received: from ?192.168.1.101? ( [68.191.49.248]) by mx.google.com with ESMTP id i11sm5402776wxd.2007.04.20.06.53.19; Fri, 20 Apr 2007 06:53:19 -0700 (PDT) Message-ID: <4628C614.5090209@gmail.com> Date: Fri, 20 Apr 2007 09:54:28 -0400 From: Rick McGuire Reply-To: rickmcg@gmail.com User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: Geronimo Dev Subject: Re: AppClient security call back handlers essentially broken in 2.0 References: <4628B5EE.7070107@gmail.com> In-Reply-To: <4628B5EE.7070107@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org There appears to be one more issue with this. I created a callback handler with a no-arg constructor so I could examine the behavior of what's going on, and I've discovered that there appears to be an issue with the classloader used to resolve the callback handler. My callback handler object is getting NoClassDefFound errors trying to access the org.apache.geronimo.security.realm.providers.CertificateChainCallback class. It's not clear to me why this is a problem, since it appears the client config has a dependency on the geronimo-security module. Rick Rick McGuire wrote: > I've run into a serious problem with app client security callback > handlers in Geronimo 2.0. These appear to be completely broken, and > I'm not sure I understand how to fix this. Here's the scenario: > > In 1.2, a security callback handler class can be specified in the > plan. In the main() method of the AppClientContainer, this was > handled thusly: > > if (callbackHandlerClass != null) { > //look for a constructor taking the args > CallbackHandler callbackHandler; > try { > Constructor cArgs = > callbackHandlerClass.getConstructor(new Class[] {String[].class}); > callbackHandler = (CallbackHandler) > cArgs.newInstance(new Object[] {args}); > } catch (NoSuchMethodException e) { > callbackHandler = (CallbackHandler) > callbackHandlerClass.newInstance(); > } > loginContext = new LoginContext(realmName, > callbackHandler); > try { > loginContext.login(); > } catch (LoginException e) { > loginContext = null; > throw e; > } > clientSubject = loginContext.getSubject(); > } > > > The appclient container looked for a constructor on the target > callback handler that took an array of Strings as an argument, and > constructed that callback handler using the string arguments passed to > the AppClientContainer main() method. The callback handler would scan > the application args looking for options that applied to its > authentication technique, and it was passed to the loginContext in an > initialized state, ready to provide addtional information to the login > process. > In 2.0, this has changed drastically, breaking any call back handlers > written for 1.2, and I don't even see an obvious method of fixing > this. Here's the new code for managing the callback handler: > > if (callbackHandlerClass != null) { > callbackHandler = (CallbackHandler) > holder.newInstance(callbackHandlerClass, classLoader, componentContext); > loginContext = new LoginContext(realmName, > callbackHandler); > try { > loginContext.login(); > } catch (LoginException e) { > loginContext = null; > throw e; > } > clientSubject = loginContext.getSubject(); > } > > Same relative point in the AppClientContainer startup, but with two > key differences: > > 1. The holder.newInstance() call appears to be looking for a > no-argument constructor on the callbackHandlerClass (which likely > fails with the 1.2 classes because they are expecting to have > their void CallbackHandler(String []) constructor called). > 2. The new callback handler instance is no longer being given access > to the appclient args to initialize. There appears to be some > injection processing going on in the holder.newInstance() call, > but it's not clear how to specify what information get injected, > or even if the information from the appclient args is available. > > So, how is this supposed to work, and if this is currently working > correctly in 2.0, what is the process for converting a handler written > for 1.2 into an equivalent for 2.0? > > Rick > >