Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 73412 invoked from network); 27 Dec 2004 19:56:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 27 Dec 2004 19:56:53 -0000 Received: (qmail 4116 invoked by uid 500); 27 Dec 2004 19:56:42 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 4082 invoked by uid 500); 27 Dec 2004 19:56:42 -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 Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 4064 invoked by uid 99); 27 Dec 2004 19:56:41 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from Unknown (HELO mgd.gluecode.com) (64.14.202.141) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 27 Dec 2004 11:56:38 -0800 Received: from [192.168.1.105] (dsl093-038-137.pdx1.dsl.speakeasy.net [66.93.38.137]) (authenticated bits=0) by mgd.gluecode.com (8.12.10/8.12.10) with ESMTP id iBRJuFCW004904 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Mon, 27 Dec 2004 11:56:15 -0800 Mime-Version: 1.0 (Apple Message framework v619) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <68D00968-5841-11D9-8400-000D93361CAA@gluecode.com> Content-Transfer-Encoding: 7bit From: David Jencks Subject: Re: Including loginDomainName in realm principal might not be useful Date: Mon, 27 Dec 2004 11:56:33 -0800 To: dev@geronimo.apache.org X-Mailer: Apple Mail (2.619) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Dec 27, 2004, at 5:46 AM, Alan D. Cabrera wrote: > > >> -----Original Message----- >> From: David Jencks [mailto:djencks@gluecode.com] >> Sent: Monday, December 27, 2004 1:49 AM >> To: dev@geronimo.apache.org >> Subject: Including loginDomainName in realm principal might not be > useful >> >> I've been trying to understand the creation of RealmPrincipals to wrap >> principals added to a Subject by LoginModules and I wonder if > including >> the loginDomainName (i.e., a name for a LoginModule) actually is of > any >> use or if it serves to provide a false sense of security. Here's the >> problem I see: >> >> suppose we have a realm with two login domains D1 and D2 that each use >> the same principal classes, but are attached to different backend >> systems. This seems to me to be the situation that including the >> loginDomainName is intended to help with, by distinguishing whether a >> principal was added by D1 or D2. So, we imagine that D1 and D2 both >> have a group Foo, but with very different meaning and hence role >> mappings. >> >> If only D1 adds a group principal named Foo, that's fine, we get a >> RealmPrincipal labeled with D1 wrapping a Foo group principal. >> >> Similarly, if only D2 adds a group principal named Foo, that is also >> fine, we get a RealmPrincipal labeled with D2 wrapping a Foo group >> principal. >> >> However, if both D1 and D2 add a group principal named Foo, that is > not >> fine, since we will only get a single RealmPrincipal, labeled with D1, >> wrapping a Foo group principal. We should get two RealmPrincipals, >> each wrapping a (separate, but that is unimportant) Foo group >> principal, one labeled with D1 and the other labeled with D2. >> >> The reason this happens is that all the login modules are adding >> principals to a set in a single Subject, so after D1 adds its Foo > group >> principal, D2's effort to add another copy of the same principal has > no >> effect. > > Here is the outcome from logging in under vanilla JAAS: > > Principal(Foo) > > Here is the outcome from logging in under Geronimo: > > Principal(Foo) > RealmPrincipal(D1, Principal(Foo)) > RealmPrincipal(D2, Principal(Foo)) > > You should get two realm principals. I agree this is what we would like the result to be. Do you have a test that verifies that this occurs? I didn't find one. From looking at the code, I think that we will get Principal(Foo) RealmPrincipal(D1, Principal(Foo)) If there's an existing test, please point it out to me. If not, and if, after looking at this method from JaasSecurityContext: public void processPrincipals(String loginDomainName) { List list = new LinkedList(); for (Iterator it = subject.getPrincipals().iterator(); it.hasNext();) { Principal p = (Principal) it.next(); if(!(p instanceof RealmPrincipal) && !processedPrincipals.contains(p)) { list.add(ContextManager.registerPrincipal(new RealmPrincipal(realmName, loginDomainName, p))); processedPrincipals.add(p); } } subject.getPrincipals().addAll(list); } you think the results are as you suggest, I will write a test to find out what happens. many thanks, david jencks > > > Regards, > Alan > > >