In typical B2B commerce applications we would do some post user login activities. Two most common post login activities are
1. Load user roles from LDAP/Roles Management System.
2. Update shopping cart with latest status from order fulfillment system.
The best place to abstarct above listed behavior or similar behavior is the postLoginUser method in ProfileFormHandler component.
Profile form handler static design.
Extend CommerceProfileFormHandler
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
package com.ourownjava.atg.web; import java.io.IOException; import javax.servlet.ServletException; import atg.commerce.profile.CommerceProfileFormHandler; import atg.servlet.DynamoHttpServletRequest; import atg.servlet.DynamoHttpServletResponse; import atg.userdirectory.UserDirectoryTools; /** * @author ourownjava.com */ public class YourProfileFormHandler extends CommerceProfileFormHandler { private UserDirectoryTools userDirectoryTools; /** * @param userDirectoryTools * the userDirectoryTools to set */ public void setUserDirectoryTools(UserDirectoryTools userDirectoryTools) { this.userDirectoryTools = userDirectoryTools; } @Override protected void postLoginUser(final DynamoHttpServletRequest request, final DynamoHttpServletResponse response) throws ServletException, IOException { // load roles from LDAP and map it to ATG roles. // userDirectoryTools.assignRolesToUser(<atg_roles>, <profile_id>); } } |
Reconfigure ProfileFormHandler with your class
1 2 3 |
# /atg/userprofiling/ProfileFormHandler $class=info.atgblog.profile.DistributionProfileFormHandler userDirectoryTools=/atg/userprofiling/ProfileUserDirectoryTools |