From jsecurity-commits-return-68-apmail-incubator-jsecurity-commits-archive=incubator.apache.org@incubator.apache.org Tue Jan 27 05:30:18 2009 Return-Path: Delivered-To: apmail-incubator-jsecurity-commits-archive@minotaur.apache.org Received: (qmail 11538 invoked from network); 27 Jan 2009 05:30:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Jan 2009 05:30:18 -0000 Received: (qmail 94242 invoked by uid 500); 27 Jan 2009 05:30:18 -0000 Delivered-To: apmail-incubator-jsecurity-commits-archive@incubator.apache.org Received: (qmail 94231 invoked by uid 500); 27 Jan 2009 05:30:18 -0000 Mailing-List: contact jsecurity-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jsecurity-dev@incubator.apache.org Delivered-To: mailing list jsecurity-commits@incubator.apache.org Received: (qmail 94220 invoked by uid 99); 27 Jan 2009 05:30:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jan 2009 21:30:18 -0800 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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jan 2009 05:30:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 905E7238895D; Tue, 27 Jan 2009 05:29:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r738006 - in /incubator/jsecurity/trunk/core: src/org/jsecurity/subject/PrincipalCollection.java src/org/jsecurity/subject/Subject.java test/org/jsecurity/mgt/DefaultSecurityManagerTest.java Date: Tue, 27 Jan 2009 05:29:57 -0000 To: jsecurity-commits@incubator.apache.org From: lhazlewood@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090127052957.905E7238895D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: lhazlewood Date: Tue Jan 27 05:29:55 2009 New Revision: 738006 URL: http://svn.apache.org/viewvc?rev=738006&view=rev Log: updated JavaDoc Modified: incubator/jsecurity/trunk/core/src/org/jsecurity/subject/PrincipalCollection.java incubator/jsecurity/trunk/core/src/org/jsecurity/subject/Subject.java incubator/jsecurity/trunk/core/test/org/jsecurity/mgt/DefaultSecurityManagerTest.java Modified: incubator/jsecurity/trunk/core/src/org/jsecurity/subject/PrincipalCollection.java URL: http://svn.apache.org/viewvc/incubator/jsecurity/trunk/core/src/org/jsecurity/subject/PrincipalCollection.java?rev=738006&r1=738005&r2=738006&view=diff ============================================================================== --- incubator/jsecurity/trunk/core/src/org/jsecurity/subject/PrincipalCollection.java (original) +++ incubator/jsecurity/trunk/core/src/org/jsecurity/subject/PrincipalCollection.java Tue Jan 27 05:29:55 2009 @@ -24,7 +24,21 @@ import java.util.Set; /** - * A collection of all principals associated with a corresponding {@link Subject Subject}. + * A collection of all principals associated with a corresponding {@link Subject Subject}. A principal is + * just a security term for an identifying attribute, such as a username or user id or social security number or + * anything else that can be considered an 'identifying' attribute for a {@code Subject}. + *

+ * Note that by convention however, the 'first' principal returned from this collection is considered to be the + * Subject's primary principal used by the application, usually a user ID or username, based on the + * {@code Realm} implementation. The 'first' principal is that which is returned by + * {@link #asList() asList()}{@code .iterator().next()}. + *

+ * A PrincipalCollection orgainizes its internal principals based on the {@code Realm} where they came from when the + * Subject was first created. To obtain the principal(s) for a specific Realm, see the {@link #fromRealm} method. You + * can also see which realms contributed to this collection via the {@link #getRealmNames() getRealmNames()} method. + * + * @see #fromRealm(String realmName) + * @see #getRealmNames() * * @author Les Hazlewood * @since 0.9 @@ -35,7 +49,8 @@ * Returns a single principal assignable from the specified type, or null if there are none of the * specified type. * - *

Note that this would return null List always if the corresponding subject has not logged in.

+ *

Note that this would return null List always if the corresponding subject has not yet + * logged in.

* * @param type the type of the principal that should be returned. * @return a principal of the specified type or null if there isn't one of the specified type. @@ -46,7 +61,8 @@ * Returns all principals assignable from the specified type, or an empty Collection if no principals of that * type are contained. * - *

Note that this would return an empty Collection always if the corresponding subject has not logged in.

+ *

Note that this would return an empty Collection always if the corresponding subject has not yet + * logged in.

* * @param type the type of the principals that should be returned. * @return a Collection of principals that are assignable from the specified type, or @@ -58,7 +74,7 @@ * Returns a single Subject's principals retrieved from all configured Realms as a List, or an empty List if * there are not any principals. * - *

Note that this would return an empty List always if the corresponding subject has not logged in.

+ *

Note that this would return an empty List always if the corresponding subject has not yet logged in.

* * @return a single Subject's principals retrieved from all configured Realms as a List. */ @@ -68,7 +84,7 @@ * Returns a single Subject's principals retrieved from all configured Realms as a Set, or an empty Set if there * are not any principals. * - *

Note that this would return an empty Set always if the corresponding subject has not logged in.

+ *

Note that this would return an empty Set always if the corresponding subject has not yet logged in.

* * @return a single Subject's principals retrieved from all configured Realms as a Set. */ @@ -78,7 +94,7 @@ * Returns a single Subject's principals retrieved from the specified Realm only as a Collection, or an empty * Collection if there are not any principals from that realm. * - *

Note that this would return an empty Collection always if the corresponding subject has not logged in.

+ *

Note that this would return an empty Collection always if the corresponding subject has not yet logged in.

* * @param realmName the name of the Realm from which the principals were retrieved. * @return the Subject's principals from the specified Realm only as a Collection or an empty Collection if there Modified: incubator/jsecurity/trunk/core/src/org/jsecurity/subject/Subject.java URL: http://svn.apache.org/viewvc/incubator/jsecurity/trunk/core/src/org/jsecurity/subject/Subject.java?rev=738006&r1=738005&r2=738006&view=diff ============================================================================== --- incubator/jsecurity/trunk/core/src/org/jsecurity/subject/Subject.java (original) +++ incubator/jsecurity/trunk/core/src/org/jsecurity/subject/Subject.java Tue Jan 27 05:29:55 2009 @@ -357,7 +357,8 @@ /** * Logs out this Subject and invalidates and/or removes any associated entities - * (such as a {@link Session Session} and authorization data. + * (such as a {@link Session Session} and authorization data. After this method is called, the Subject is + * considered 'anonymous' and may continue to be used for another log-in if desired. */ void logout(); Modified: incubator/jsecurity/trunk/core/test/org/jsecurity/mgt/DefaultSecurityManagerTest.java URL: http://svn.apache.org/viewvc/incubator/jsecurity/trunk/core/test/org/jsecurity/mgt/DefaultSecurityManagerTest.java?rev=738006&r1=738005&r2=738006&view=diff ============================================================================== --- incubator/jsecurity/trunk/core/test/org/jsecurity/mgt/DefaultSecurityManagerTest.java (original) +++ incubator/jsecurity/trunk/core/test/org/jsecurity/mgt/DefaultSecurityManagerTest.java Tue Jan 27 05:29:55 2009 @@ -111,6 +111,7 @@ * Test that validates functionality for issue * JSEC-22 */ + @Test public void testSubjectReuseAfterLogout() { Subject subject = SecurityUtils.getSubject();