Author: ate
Date: Thu Sep  4 04:36:59 2008
New Revision: 691973

URL: http://svn.apache.org/viewvc?rev=691973&view=rev
Log:
UserSubjectPrincipal is now a concrete class which should be used as Subject 
Principal to represent the authenticated User.
The User interface (and its implementation) no longer provide and maintain the 
Subject as it is *only* needed for an authenticated User through its Subject.
Retrieving and managing User instances (like for the administration) therefore 
can be much more lightweight.

Modified:
    
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java
    
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserSubjectPrincipal.java
   (contents, props changed)

Modified: 
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java?rev=691973&r1=691972&r2=691973&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java
 (original)
+++ 
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java
 Thu Sep  4 04:36:59 2008
@@ -16,31 +16,14 @@
  */
 package org.apache.jetspeed.security;
 
-import javax.security.auth.Subject;
-
 /**
  * <p>User simply extending JetspeedPrincipal interface.</p>
  * @version $Id
  */
 public interface User extends JetspeedPrincipal
 {
-    
     /**
      * the subsite path for a given user stored as a user attribute
      */
     final static String USER_INFO_SUBSITE = "subsite";
-    
-    /**
-     * <p>Getter for the user [EMAIL PROTECTED] Subject} populated with the 
-     * application principals.</p>
-     * @return The [EMAIL PROTECTED] Subject}.
-     */
-    Subject getSubject();
-
-    /**
-     * <p>Setter for the user [EMAIL PROTECTED] Subject} populated with the 
-     * application principals.</p>
-     * @param subject The [EMAIL PROTECTED] Subject}.
-     */
-    void setSubject(Subject subject);
 }

Modified: 
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserSubjectPrincipal.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserSubjectPrincipal.java?rev=691973&r1=691972&r2=691973&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserSubjectPrincipal.java
 (original)
+++ 
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserSubjectPrincipal.java
 Thu Sep  4 04:36:59 2008
@@ -4,26 +4,46 @@
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jetspeed.security;
-
-import javax.security.auth.Subject;
-
-/**
- * <p>The user principal.</p>
- * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
- * @version $Id: UserPrincipal.java 187022 2004-07-16 19:31:24Z weaver $
- */
-public interface UserSubjectPrincipal extends User
-{
-    Subject getSubject();
-}
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security;
+
+import java.security.Principal;
+
+import javax.security.auth.Subject;
+
+/**
+ * <p>The Principal representing the User of a Subject</p>
+ * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class UserSubjectPrincipal implements Principal
+{
+    private final User user;
+    private final Subject subject;
+    public UserSubjectPrincipal(User user, Subject subject)
+    {
+        this.user = user;
+        this.subject = subject;
+    }
+    public String getName()
+    {
+        return user.getName();
+    }
+    public User getUser()
+    {
+        return user;
+    }
+    public Subject getSubject()
+    {
+        return subject;
+    }
+}

Propchange: 
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserSubjectPrincipal.java
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to