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 vk...@apache.org on 2008/09/09 16:32:53 UTC
svn commit: r693470 -
/portals/jetspeed-2/applications/j2-admin/branches/security-refactoring/src/main/java/org/apache/jetspeed/portlets/security/ChangePasswordPortlet.java
Author: vkumar
Date: Tue Sep 9 07:32:51 2008
New Revision: 693470
URL: http://svn.apache.org/viewvc?rev=693470&view=rev
Log:
Changes for new Security API's
Modified:
portals/jetspeed-2/applications/j2-admin/branches/security-refactoring/src/main/java/org/apache/jetspeed/portlets/security/ChangePasswordPortlet.java
Modified: portals/jetspeed-2/applications/j2-admin/branches/security-refactoring/src/main/java/org/apache/jetspeed/portlets/security/ChangePasswordPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/branches/security-refactoring/src/main/java/org/apache/jetspeed/portlets/security/ChangePasswordPortlet.java?rev=693470&r1=693469&r2=693470&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/branches/security-refactoring/src/main/java/org/apache/jetspeed/portlets/security/ChangePasswordPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/branches/security-refactoring/src/main/java/org/apache/jetspeed/portlets/security/ChangePasswordPortlet.java Tue Sep 9 07:32:51 2008
@@ -28,11 +28,10 @@
import javax.portlet.PortletRequest;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.security.auth.Subject;
import org.apache.jetspeed.CommonPortletServices;
import org.apache.jetspeed.PortalReservedParameters;
-import javax.security.auth.Subject;
-
import org.apache.jetspeed.audit.AuditActivity;
import org.apache.jetspeed.portlets.security.users.UserDetailsPortlet;
import org.apache.jetspeed.request.RequestContext;
@@ -41,6 +40,7 @@
import org.apache.jetspeed.security.PasswordAlreadyUsedException;
import org.apache.jetspeed.security.PasswordCredential;
import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.User;
import org.apache.jetspeed.security.UserManager;
import org.apache.portals.bridges.common.GenericServletPortlet;
@@ -169,11 +169,18 @@
{
try
{
- manager.setPassword(userName, currPassword, newPassword);
+ //manager.setPassword(userName, currPassword, newPassword);
+ // Changes for new Security API's
+ User user = manager.getUser(userName);
+ PasswordCredential credential = manager.getPasswordCredential(user);
+ credential.setPassword(currPassword, newPassword);
+
audit.logUserActivity(userName, getIPAddress(actionRequest), AuditActivity.PASSWORD_CHANGE_SUCCESS, UserDetailsPortlet.USER_ADMINISTRATION);
// refresh/update Subject in session to reflect the changed PasswordCredential
- Subject subject = manager.getUser(userName).getSubject();
+ //Subject subject = manager.getUser(userName).getSubject();
+ Subject subject = manager.getSubject(user);
+
RequestContext requestContext = (RequestContext)actionRequest.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
requestContext.setSessionAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org