portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vku...@apache.org
Subject svn commit: r693046 - /portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
Date Mon, 08 Sep 2008 10:23:24 GMT
Author: vkumar
Date: Mon Sep  8 03:23:23 2008
New Revision: 693046

URL: http://svn.apache.org/viewvc?rev=693046&view=rev
Log:
Adding new Method getSubject(User user)

Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java?rev=693046&r1=693045&r2=693046&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
Mon Sep  8 03:23:23 2008
@@ -26,6 +26,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.security.AuthenticatedUser;
+import org.apache.jetspeed.security.AuthenticatedUserImpl;
 import org.apache.jetspeed.security.DependentPrincipalException;
 import org.apache.jetspeed.security.GroupManager;
 import org.apache.jetspeed.security.JetspeedPrincipal;
@@ -92,7 +93,7 @@
         User user = newUser(username, mapped);
 		try
 		{
-            super.addPrincipal(user, null);
+            super.addPrincipal(user, null);           
 		}
 		catch (PrincipalAlreadyExistsException e)
 		{
@@ -131,6 +132,21 @@
         return null;
 	}
 
+	public Subject getSubject(User user) throws SecurityException
+	{
+		if (credentialManager != null)
+		{
+			PasswordCredential pwc = getPasswordCredential(user);
+			if (pwc != null)
+			{
+				HashSet<Object> privateCred = new HashSet<Object>();
+				privateCred.add(pwc);
+				return getSubject(new AuthenticatedUserImpl(user, null, privateCred));
+			}
+		}
+		return getSubject(new AuthenticatedUserImpl(user, null, null));
+	}
+	
 	public Subject getSubject(AuthenticatedUser user) throws SecurityException
 	{
         Set<Principal> principals = new PrincipalsSet();



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message