You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by dl...@apache.org on 2004/09/18 21:29:19 UTC
cvs commit: jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users UserManagerPortlet.java
dlestrat 2004/09/18 12:29:19
Modified: applications/pam/src/java/org/apache/jetspeed/portlets/security/users
UserManagerPortlet.java
Log:
getUsers now throws a SecurityException.
Revision Changes Path
1.4 +28 -22 jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/UserManagerPortlet.java
Index: UserManagerPortlet.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/UserManagerPortlet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- UserManagerPortlet.java 17 Sep 2004 00:18:58 -0000 1.3
+++ UserManagerPortlet.java 18 Sep 2004 19:29:19 -0000 1.4
@@ -25,6 +25,7 @@
import javax.security.auth.Subject;
import org.apache.jetspeed.portlets.pam.PortletApplicationResources;
+import org.apache.jetspeed.security.SecurityException;
import org.apache.jetspeed.security.User;
import org.apache.jetspeed.security.UserManager;
import org.apache.jetspeed.security.UserPrincipal;
@@ -33,52 +34,58 @@
import tyrex.naming.MemoryContext;
import tyrex.tm.RuntimeContext;
-
/**
* Provides maintenance capabilities for User Administration.
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
* @version $Id$
*/
public class UserManagerPortlet extends FacesPortlet
{
private UserManager userManager;
-
- public void init(PortletConfig config)
- throws PortletException
+
+ public void init(PortletConfig config) throws PortletException
{
super.init(config);
- userManager = (UserManager)getPortletContext().getAttribute(PortletApplicationResources.CPS_USER_MANAGER_COMPONENT);
+ userManager = (UserManager) getPortletContext().getAttribute(
+ PortletApplicationResources.CPS_USER_MANAGER_COMPONENT);
if (null == userManager)
{
throw new PortletException("Failed to find the User Manager on portlet initialization");
}
System.out.println("user manager = " + userManager);
- Iterator users = userManager.getUsers("");
- while (users.hasNext())
+ try
{
- User user = (User)users.next();
- System.out.println("++++ User = " + user);
- Principal principal = getPrincipal(user.getSubject(), UserPrincipal.class);
- System.out.println("principal = " + principal.getName());
+ Iterator users = userManager.getUsers("");
+ while (users.hasNext())
+ {
+ User user = (User) users.next();
+ System.out.println("++++ User = " + user);
+ Principal principal = getPrincipal(user.getSubject(), UserPrincipal.class);
+ System.out.println("principal = " + principal.getName());
+ }
+ }
+ catch (SecurityException se)
+ {
+ throw new PortletException(se);
}
try
{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "tyrex.naming.MemoryContextFactory");
- Context root = new MemoryContext(null);
+ Context root = new MemoryContext(null);
Context ctx = root.createSubcontext("comp");
- ctx.bind("UserManager", userManager);
+ ctx.bind("UserManager", userManager);
RuntimeContext runCtx = RuntimeContext.newRuntimeContext(root, null);
- RuntimeContext.setRuntimeContext(runCtx);
+ RuntimeContext.setRuntimeContext(runCtx);
}
catch (Exception e)
{
- e.printStackTrace();
+ e.printStackTrace();
}
-
+
}
-
+
public Principal getPrincipal(Subject subject, Class classe)
{
Principal principal = null;
@@ -94,6 +101,5 @@
}
return principal;
}
-
-}
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org