1
0
arkha 1 жил өмнө
parent
commit
a96bdcf0b2

+ 19 - 5
MWUI/dev/config/server.xml

@@ -10,17 +10,31 @@
         <feature>appSecurity-3.0</feature>
     </featureManager>
 
+    <httpSession id="defaultHttpSession">
+        <cookieSecure>true</cookieSecure>
+        <cookieHttpOnly>true</cookieHttpOnly>
+        <cookieSameSite>None</cookieSameSite> <!-- Or "Lax" if using cross-origin requests -->
+    </httpSession>
+
     <basicRegistry>
+        <user name="wpsadmin" password="wpsadmin" />
         <user name="wpsadmindev" password="wpsadmindev" />
-        <group name="MWSecurity_">
+        <group name="MWSecurity">
+            <member name="wpsadmin" />
             <member name="wpsadmindev" />
         </group>
     </basicRegistry>
 
-    <ldapRegistry id="LDAP" ldapType="OpenLDAP" host="localhost" port="389"
-        baseDN="dc=btn,dc=co,dc=id" bindDN="cn=admin,dc=btn,dc=co,dc=id"
-        bindPassword="adminpassword"
-        ignoreCase="true" sslEnabled="false">
+    <ldapRegistry
+        id="LDAP"
+        ldapType="OpenLDAP"
+        host="localhost"
+        port="389"
+        baseDN="dc=btn,dc=co,dc=id"
+        bindDN="cn=wpsbinddev,ou=middleware,dc=btn,dc=co,dc=id"
+        bindPassword="wpsbinddev"
+        ignoreCase="true"
+        sslEnabled="false">
         <ldapSearchFilter objectClass="person" idAttribute="cn" />
     </ldapRegistry>
 

+ 30 - 33
MWUI/src/main/java/id/co/hanoman/log/action/LdapLoginAction.java

@@ -1,29 +1,14 @@
 package id.co.hanoman.log.action;
 
-import id.co.hanoman.service.PersistanceServiceInterface;
-import id.co.hanoman.shared.Constant;
-import id.co.hanoman.service.ServiceUtil;
-import id.co.hanoman.shared.Util;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
 import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
 import javax.naming.Context;
 import javax.naming.NamingEnumeration;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.InitialDirContext;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
-import javax.security.auth.Subject;
-import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -32,12 +17,9 @@ import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
 
-import com.ibm.websphere.security.auth.WSSubject;
-import com.ibm.websphere.security.cred.WSCredential;
-import com.scupid.util.BeanUtil;
-
 /**
- * LoginAction merupakan action yang dipanggil untuk menjalankan fungsi-fungsi login user ke aplikasi
+ * LoginAction merupakan action yang dipanggil untuk menjalankan fungsi-fungsi
+ * login user ke aplikasi
  * 
  * @author Hanoman Interaktif<BR>
  *         (C) <a href="http://www.hanoman.co.id">Hanoman Interaktif.</a>
@@ -54,45 +36,60 @@ public class LdapLoginAction extends Action {
 			String userName = request.getParameter("j_username");
 			String password = request.getParameter("j_password");
 			Hashtable env = new Hashtable();
-			String pn = "cn="+userName+",ou=middleware,dc=btn,dc=co,dc=id";
+			String pn = "cn=" + userName + ",ou=middleware,dc=btn,dc=co,dc=id";
+			System.out.println("username: " + userName);
+			System.out.println("password: " + password);
+			System.out.println("pn: " + pn);
 			env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
-			env.put(Context.PROVIDER_URL, "ldap://172.15.30.73:389");				        	
 			env.put(Context.SECURITY_AUTHENTICATION, "simple");
 			env.put(Context.SECURITY_PRINCIPAL, pn);
 			env.put(Context.SECURITY_CREDENTIALS, password);
 			InitialDirContext ctx = null;
 			try {
 				ctx = new InitialDirContext(env);
-			}catch (Exception e) {
+			} catch (Exception e) {
 				e.printStackTrace();
 			}
-			
-			if(ctx!=null) {
+
+			if (ctx != null) {
 				SearchControls ctrls = new SearchControls();
 				ctrls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-				//wpsadmindev
-				//wpsbinddev
-				NamingEnumeration<javax.naming.directory.SearchResult> results = ctx.search("ou=middleware,dc=btn,dc=co,dc=id", "(&(sAMAccountName="+userName+")(objectClass=user))", ctrls);
+				NamingEnumeration<javax.naming.directory.SearchResult> results = ctx.search("ou=middleware,dc=btn,dc=co,dc=id", "(&(sAMAccountName=" + userName + ")(objectClass=user))", ctrls);
 				SearchResult result = results.next();
 				System.out.println("distinguisedName: " + result.getNameInNamespace());
+				Attribute cn = result.getAttributes().get("cn");
 				Attribute memberOf = result.getAttributes().get("memberOf");
-				if(memberOf!=null) {
-					for(int idx=0; idx<memberOf.size(); idx++) {
+				if (memberOf != null) {
+					for (int idx = 0; idx < memberOf.size(); idx++) {
 						String strGroupIdCallerSubjectItem = memberOf.get(idx).toString();
 						strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(strGroupIdCallerSubjectItem.toLowerCase().indexOf("cn=") + 3);
 						strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(0, strGroupIdCallerSubjectItem.indexOf(','));
 						System.out.println("memberOf: " + strGroupIdCallerSubjectItem);
 					}
+				} else {
+					if (cn != null) {
+						SearchControls ctrls2 = new SearchControls();
+						ctrls2.setSearchScope(SearchControls.SUBTREE_SCOPE);
+						ctrls2.setReturningAttributes(new String[] { "dn" });
+						NamingEnumeration<javax.naming.directory.SearchResult> results2 = ctx.search("dc=btn,dc=co,dc=id", "(member=" + result.getNameInNamespace() + ")", ctrls2);
+						while (results2.hasMore()) {
+							SearchResult result2 = results2.next();
+							String dn = result2.getNameInNamespace();
+
+							String cnValue = dn.replaceAll("cn=([^,]+).*", "$1");
+							System.out.println("Group DN: " + cnValue.toString());
+						}
+					}
 				}
 				request.getSession().setAttribute("login.user", userName);
 				response.sendRedirect("login.do");
 				return null;
-			}else {
+			} else {
 				response.sendRedirect("login.jsp");
 				return null;
 			}
-			
-		}catch (Exception e) {
+
+		} catch (Exception e) {
 			e.printStackTrace();
 		}
 		return forward;

+ 56 - 41
MWUI/src/main/java/id/co/hanoman/log/action/LoginAction.java

@@ -23,7 +23,8 @@ import id.co.hanoman.shared.Constant;
 import id.co.hanoman.shared.Util;
 
 /**
- * LoginAction merupakan action yang dipanggil untuk menjalankan fungsi-fungsi login user ke aplikasi
+ * LoginAction merupakan action yang dipanggil untuk menjalankan fungsi-fungsi
+ * login user ke aplikasi
  * 
  * @author Hanoman Interaktif<BR>
  *         (C) <a href="http://www.hanoman.co.id">Hanoman Interaktif.</a>
@@ -37,7 +38,8 @@ public class LoginAction extends Action {
 	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
 		System.out.println("******************************* LOGIN ******************************* ");
 		AS400ServiceInterface as400ServiceInterface = new AS400ServiceInterface();
-		//System.out.println("queryBiller ::::::::::::::::::;; "+as400ServiceInterface.queryBiller(Constant.MWAPP_EPAY_DS, null));
+		// System.out.println("queryBiller ::::::::::::::::::;;
+		// "+as400ServiceInterface.queryBiller(Constant.MWAPP_EPAY_DS, null));
 		ActionForward forward = null;
 		String action = request.getParameter("action");
 		response.setHeader("Pragma", "no-cache");
@@ -48,15 +50,15 @@ public class LoginAction extends Action {
 		}
 		request.getSession().setAttribute("currentLocale", Constant.locale);
 
-		/*todo:sena*/
+		/* todo:sena */
 		String callerPrincipal = request.getUserPrincipal().getName();
 		if (callerPrincipal != null) {
 			clearSession(request);
 		} else
 			clearSession(request);
 
-		if ("logout".equalsIgnoreCase(action)) {			
-			request.getSession().invalidate();			
+		if ("logout".equalsIgnoreCase(action)) {
+			request.getSession().invalidate();
 			response.sendRedirect("login.do");
 			return null;
 		}
@@ -71,40 +73,42 @@ public class LoginAction extends Action {
 	}
 
 	public ActionForward doLoginOk(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
-		if (request.getParameter(Constant.CLEAR) != null && Constant.TRUE.equalsIgnoreCase(request.getParameter(Constant.CLEAR))) clearSession(request);
+		if (request.getParameter(Constant.CLEAR) != null && Constant.TRUE.equalsIgnoreCase(request.getParameter(Constant.CLEAR)))
+			clearSession(request);
 		ActionForward forward = null;
 
 		try {
-			log.info("remote address == "+ request.getRemoteAddr());
+			log.info("remote address == " + request.getRemoteAddr());
 			Address();
 
 			ServletContext ctx = getServlet().getServletContext();
 			PersistanceServiceInterface psiConfig = ServiceUtil.getDaoClient(ctx);
-			/*todo:sena*/	
-			String callerPrincipal = request.getUserPrincipal().getName();			
+			/* todo:sena */
+			String callerPrincipal = request.getUserPrincipal().getName();
 			log.info("User Login ::::::::::::::::::::::::::::::::::::::::::::::::" + callerPrincipal);
-			
-			
-			//			Subject subject = WSSubject.getCallerSubject();
-			//			Set credSet = subject.getPublicCredentials(WSCredential.class);
-			//			List objRoleCaller = new ArrayList();
-			//			for (Iterator iterator = credSet.iterator(); iterator.hasNext();) {
-			//				WSCredential objectWSCredential = (WSCredential) iterator.next();
-			//				List groupIdCallerSubject = objectWSCredential.getGroupIds();
-			//				// log.info("user group"+BeanUtil.dumpBean(groupIdCallerSubject));
-			//				for (Object groupIdCallerSubjectItem : groupIdCallerSubject) {
-			//					String strGroupIdCallerSubjectItem = (String) groupIdCallerSubjectItem;
-			//					strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(strGroupIdCallerSubjectItem.toLowerCase().indexOf("cn=") + 3);
-			//					strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(0, strGroupIdCallerSubjectItem.indexOf(','));
-			//					objRoleCaller.add(strGroupIdCallerSubjectItem);
-			//				}
-			//				log.info("user group from ldap : " + BeanUtil.dumpBean(objRoleCaller));
+
+			// Subject subject = WSSubject.getCallerSubject();
+			// Set credSet = subject.getPublicCredentials(WSCredential.class);
+			// List objRoleCaller = new ArrayList();
+			// for (Iterator iterator = credSet.iterator(); iterator.hasNext();) {
+			// WSCredential objectWSCredential = (WSCredential) iterator.next();
+			// List groupIdCallerSubject = objectWSCredential.getGroupIds();
+			// // log.info("user group"+BeanUtil.dumpBean(groupIdCallerSubject));
+			// for (Object groupIdCallerSubjectItem : groupIdCallerSubject) {
+			// String strGroupIdCallerSubjectItem = (String) groupIdCallerSubjectItem;
+			// strGroupIdCallerSubjectItem =
+			// strGroupIdCallerSubjectItem.substring(strGroupIdCallerSubjectItem.toLowerCase().indexOf("cn=")
+			// + 3);
+			// strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(0,
+			// strGroupIdCallerSubjectItem.indexOf(','));
+			// objRoleCaller.add(strGroupIdCallerSubjectItem);
+			// }
+			// log.info("user group from ldap : " + BeanUtil.dumpBean(objRoleCaller));
 			//
-			//			}
+			// }
 			Util util = new Util();
 			List objRoleCaller = util.objRoller(callerPrincipal);
 
-
 			if (callerPrincipal != null) {
 				log.info("START MENU LOGIN ACTION");
 				String menu = Util.getMenu(psiConfig, request, callerPrincipal, objRoleCaller);
@@ -144,10 +148,10 @@ public class LoginAction extends Action {
 	private void Address() throws UnknownHostException {
 		InetAddress address = InetAddress.getLocalHost();
 
-		log.info("address.getHostAddress() == "+address.getHostAddress());
-		log.info("address.getHostName() == "+address.getHostName());
+		log.info("address.getHostAddress() == " + address.getHostAddress());
+		log.info("address.getHostName() == " + address.getHostName());
 		try {
-			log.info("address.getLocalHost() == "+InetAddress.getLocalHost().getCanonicalHostName());
+			log.info("address.getLocalHost() == " + InetAddress.getLocalHost().getCanonicalHostName());
 		} catch (UnknownHostException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
@@ -155,18 +159,29 @@ public class LoginAction extends Action {
 
 	}
 
-
 	/*
-	 * private void setBillerDataPageList(HttpServletRequest request, PersistanceServiceInterface psiEpay, AS400ServiceInterface psiBiller) { Thread t = new Thread(new Runnable() { HttpServletRequest request; AS400ServiceInterface psiBiller; public Runnable init(HttpServletRequest request, AS400ServiceInterface psiBiller) { this.request = request; this.psiBiller = psiBiller; return this; }
+	 * private void setBillerDataPageList(HttpServletRequest request,
+	 * PersistanceServiceInterface psiEpay, AS400ServiceInterface psiBiller) {
+	 * Thread t = new Thread(new Runnable() { HttpServletRequest request;
+	 * AS400ServiceInterface psiBiller; public Runnable init(HttpServletRequest
+	 * request, AS400ServiceInterface psiBiller) { this.request = request;
+	 * this.psiBiller = psiBiller; return this; }
 	 * 
-	 * @Override public void run() { synchronized (LoginAction.class) { try { BillerQuery[] billers = psiBiller.queryBiller(""); request.getSession().setAttribute("billers", billers); log.info("biller:::::"+BeanUtil.dumpBean(billers)); } catch (Exception e) { log.error(e.getMessage(), e); } LoginAction.class.notifyAll(); } } }.init(request, psiBiller)); t.start(); }
+	 * @Override public void run() { synchronized (LoginAction.class) { try {
+	 * BillerQuery[] billers = psiBiller.queryBiller("");
+	 * request.getSession().setAttribute("billers", billers);
+	 * log.info("biller:::::"+BeanUtil.dumpBean(billers)); } catch (Exception e) {
+	 * log.error(e.getMessage(), e); } LoginAction.class.notifyAll(); } }
+	 * }.init(request, psiBiller)); t.start(); }
 	 */
 
 	/**
 	 * Method untuk logout dari web EPAYMENT
-	 * @param mapping Action untuk melakukan redirect ke action form yang ingin dipanggil.
-	 * @param form Action yang dipanggil sesuai dengan form yang ada di jsp.
-	 * @param request Memanggil informasi HTTP servlet.
+	 * 
+	 * @param mapping  Action untuk melakukan redirect ke action form yang ingin
+	 *                 dipanggil.
+	 * @param form     Action yang dipanggil sesuai dengan form yang ada di jsp.
+	 * @param request  Memanggil informasi HTTP servlet.
 	 * @param response Mengirimkan response informasi HTTP servlet
 	 * @return object forward yang berisi action form yang dipanggil
 	 */
@@ -177,12 +192,12 @@ public class LoginAction extends Action {
 			request.getSession().invalidate();
 			HttpSession s = request.getSession(false);
 			s = null;
-			//response.sendRedirect("ibm_security_logout?logoutExitPage=login.jsp");
-			//forward = mapping.findForward("logout");
-			//response.sendRedirect("logout.jsp");
-			//return null;
+			// response.sendRedirect("ibm_security_logout?logoutExitPage=login.jsp");
+			// forward = mapping.findForward("logout");
+			// response.sendRedirect("logout.jsp");
+			// return null;
 		} catch (Exception e) {
-			e.printStackTrace();	
+			e.printStackTrace();
 		}
 		return forward;
 	}

+ 19 - 22
MWUI/src/main/java/id/co/hanoman/shared/AS400Conn.java

@@ -17,34 +17,35 @@ public class AS400Conn {
 		try {
 			System.out.println("--------------- AS400 NEW ----------------");
 			Class.forName("com.ibm.as400.access.AS400JDBCDriver");
-//			172.18.3.104
-//			172.15.30.73
+			// 172.18.3.104
+			// 172.15.30.73
 			Connection conn = DriverManager.getConnection("jdbc:as400://172.18.3.104/BWIDAT", "BTNSOA", "BTNSOA");
-			if(conn!=null) {
+			if (conn != null) {
 				System.out.println("Koneksi Berhasil");
 				conn.close();
 			}
 
-		}catch (Exception e) {
+		} catch (Exception e) {
 			e.printStackTrace();
 		}
 	}
 
 	public static void main2(String[] args) {
 		try {
-			//			System.out.println("--------------- AS400 ----------------");
-			//			Class.forName("com.ibm.as400.access.AS400JDBCDriver");
-			//			172.18.3.104
-			//			172.15.30.73
-			//			Connection conn = DriverManager.getConnection("jdbc:as400://172.15.30.73/BWIDAT", "BTNSOA", "BTNSOA");
-			//			if(conn!=null) {
-			//				System.out.println("Koneksi Berhasil");
-			//			}
+			// System.out.println("--------------- AS400 ----------------");
+			// Class.forName("com.ibm.as400.access.AS400JDBCDriver");
+			// 172.18.3.104
+			// 172.15.30.73
+			// Connection conn =
+			// DriverManager.getConnection("jdbc:as400://172.15.30.73/BWIDAT", "BTNSOA",
+			// "BTNSOA");
+			// if(conn!=null) {
+			// System.out.println("Koneksi Berhasil");
+			// }
 
 			Hashtable env = new Hashtable();
 			String pn = "cn=wpsbinddev,ou=middleware,dc=btn,dc=co,dc=id";
 			env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
-			env.put(Context.PROVIDER_URL, "ldap://172.15.30.73:389");				        	
 			env.put(Context.SECURITY_AUTHENTICATION, "simple");
 			env.put(Context.SECURITY_PRINCIPAL, pn);
 			env.put(Context.SECURITY_CREDENTIALS, "wpsbinddev");
@@ -53,28 +54,24 @@ public class AS400Conn {
 				ctx = new InitialDirContext(env);
 				SearchControls ctrls = new SearchControls();
 				ctrls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-				//wpsadmindev
-				//wpsbinddev
 				NamingEnumeration<javax.naming.directory.SearchResult> results = ctx.search("ou=middleware,dc=btn,dc=co,dc=id", "(&(sAMAccountName=wpsbinddev)(objectClass=user))", ctrls);
 				SearchResult result = results.next();
 				System.out.println("distinguisedName: " + result.getNameInNamespace());
 				Attribute memberOf = result.getAttributes().get("memberOf");
-				if(memberOf!=null) {
-					for(int idx=0; idx<memberOf.size(); idx++) {
+				if (memberOf != null) {
+					for (int idx = 0; idx < memberOf.size(); idx++) {
 						String strGroupIdCallerSubjectItem = memberOf.get(idx).toString();
 						strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(strGroupIdCallerSubjectItem.toLowerCase().indexOf("cn=") + 3);
 						strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(0, strGroupIdCallerSubjectItem.indexOf(','));
 						System.out.println("memberOf: " + strGroupIdCallerSubjectItem);
 					}
-				}			    
+				}
 
-
-			}catch (Exception e) {
+			} catch (Exception e) {
 				e.printStackTrace();
 			}
 
-
-		}catch (Exception e) {
+		} catch (Exception e) {
 			e.printStackTrace();
 		}
 

+ 101 - 100
MWUI/src/main/java/id/co/hanoman/shared/HanomanAction.java

@@ -29,16 +29,14 @@ public class HanomanAction extends ActionServlet {
 	@Override
 	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
 		log.info("doGet");
-		log.info("------------------------- SENA ------------------------------");		
+		log.info("------------------------- SENA ------------------------------");
 		initSessionTimeout(request, response);
-		//String callerPrincipal = ;
-		// String callerPrincipal = request.getUserPrincipal().getName();
-		String callerPrincipal = "wpsadmin";
+		String callerPrincipal = request.getUserPrincipal().getName();
 		log.info("--------- callerPrincipal = " + callerPrincipal);
 		if (callerPrincipal != null) {
 			// request.getSession().setAttribute("login.user", callerPrincipal);
 			String menu = (String) request.getSession().getAttribute("myMenu");
-//			log.info("menu : " + menu);
+			// log.info("menu : " + menu);
 			if (!Util.isNullOrEmpty(menu)) {
 				log.info(" request.getRequestURL().toString()" + request.getRequestURL().toString());
 				String[] splitResults = request.getRequestURL().toString().split("/");
@@ -75,41 +73,43 @@ public class HanomanAction extends ActionServlet {
 						e.printStackTrace();
 					}
 
-//					callerPrincipal = WSSubject.getCallerPrincipal();
-//					Subject subject = null;
-//					try {
-//						subject = WSSubject.getCallerSubject();
-//					} catch (WSSecurityException e) {
-//						e.printStackTrace();
-//					}
-//					Set credSet = subject.getPublicCredentials(WSCredential.class);
-//					List objRoleCaller = new ArrayList();
-//					for (Iterator iterator = credSet.iterator(); iterator.hasNext();) {
-//						WSCredential objectWSCredential = (WSCredential) iterator.next();
-//						List groupIdCallerSubject = null;
-//						try {
-//							groupIdCallerSubject = objectWSCredential.getGroupIds();
-//						} catch (CredentialExpiredException e) {
-//							e.printStackTrace();
-//						} catch (CredentialDestroyedException e) {
-//							e.printStackTrace();
-//						}
-//						for (Object groupIdCallerSubjectItem : groupIdCallerSubject) {
-//							String strGroupIdCallerSubjectItem = (String) groupIdCallerSubjectItem;
-//							strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(strGroupIdCallerSubjectItem.toLowerCase().indexOf("cn=") + 3);
-//							strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(0, strGroupIdCallerSubjectItem.indexOf(','));
-//							objRoleCaller.add(strGroupIdCallerSubjectItem);
-//						}
-//
-//					}
-					
-					/*todo:sena*/
-					// callerPrincipal = request.getUserPrincipal().getName();
-					callerPrincipal = "wpsadmin";
+					// callerPrincipal = WSSubject.getCallerPrincipal();
+					// Subject subject = null;
+					// try {
+					// subject = WSSubject.getCallerSubject();
+					// } catch (WSSecurityException e) {
+					// e.printStackTrace();
+					// }
+					// Set credSet = subject.getPublicCredentials(WSCredential.class);
+					// List objRoleCaller = new ArrayList();
+					// for (Iterator iterator = credSet.iterator(); iterator.hasNext();) {
+					// WSCredential objectWSCredential = (WSCredential) iterator.next();
+					// List groupIdCallerSubject = null;
+					// try {
+					// groupIdCallerSubject = objectWSCredential.getGroupIds();
+					// } catch (CredentialExpiredException e) {
+					// e.printStackTrace();
+					// } catch (CredentialDestroyedException e) {
+					// e.printStackTrace();
+					// }
+					// for (Object groupIdCallerSubjectItem : groupIdCallerSubject) {
+					// String strGroupIdCallerSubjectItem = (String) groupIdCallerSubjectItem;
+					// strGroupIdCallerSubjectItem =
+					// strGroupIdCallerSubjectItem.substring(strGroupIdCallerSubjectItem.toLowerCase().indexOf("cn=")
+					// + 3);
+					// strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(0,
+					// strGroupIdCallerSubjectItem.indexOf(','));
+					// objRoleCaller.add(strGroupIdCallerSubjectItem);
+					// }
+					//
+					// }
+
+					/* todo:sena */
+					callerPrincipal = request.getUserPrincipal().getName();
 					List objRoleCaller = new ArrayList();
 					objRoleCaller.add("mdwadmin");
 					objRoleCaller.add("epaymentadmin");
-					
+
 					if (callerPrincipal != null) {
 						log.info("START MENU HANOMAN ACTION");
 						String menu2 = Util.getMenu(psiConfig, request, callerPrincipal, objRoleCaller);
@@ -145,14 +145,14 @@ public class HanomanAction extends ActionServlet {
 	@Override
 	public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
 		log.info("doPost invoke hanoman action");
-		
+
 		initSessionTimeout(request, response);
-		//todo:sena
+		// todo:sena
 		String callerPrincipal = "admin";
 		log.info("--------- callerPrincipal = " + callerPrincipal);
 		if (callerPrincipal != null) {
 			String menu = (String) request.getSession().getAttribute("myMenu");
-//			log.info("dopost menu = " + menu);
+			// log.info("dopost menu = " + menu);
 			if (!Util.isNullOrEmpty(menu)) {
 				String[] splitResults = request.getRequestURL().toString().split("/");
 
@@ -166,7 +166,7 @@ public class HanomanAction extends ActionServlet {
 						super.doGet(request, response);
 					} else {
 						request.getSession().setAttribute("userError", "You don't have access");
-						//response.sendRedirect("error.jsp");
+						// response.sendRedirect("error.jsp");
 						getServletConfig().getServletContext().getRequestDispatcher("/error.jsp").forward(request, response);
 					}
 				} else {
@@ -176,19 +176,18 @@ public class HanomanAction extends ActionServlet {
 
 				/*
 				 * String name = ""; log.info("NOT equal...."); if
-				 * (splitResults[splitResults.length - 1].endsWith(".do")) name
-				 * = splitResults[splitResults.length - 1].split(".do")[0]; if
-				 * (menu.contains(name)) { super.doPost(request, response); }
-				 * else { request.getSession().setAttribute("userError",
-				 * "You don't have access"); response.sendRedirect("error.jsp");
-				 * }
+				 * (splitResults[splitResults.length - 1].endsWith(".do")) name =
+				 * splitResults[splitResults.length - 1].split(".do")[0]; if
+				 * (menu.contains(name)) { super.doPost(request, response); } else {
+				 * request.getSession().setAttribute("userError", "You don't have access");
+				 * response.sendRedirect("error.jsp"); }
 				 */
 			} else {
 				log.info("masuk menu kosong==null");
 				callerPrincipal = (String) request.getSession().getAttribute("login.user");
 				if (callerPrincipal == null) {
 					log.info("MASUK sendRedirect after session user == null");
-					//response.sendRedirect("./login.jsp");
+					// response.sendRedirect("./login.jsp");
 					getServletConfig().getServletContext().getRequestDispatcher("/login.jsp").forward(request, response);
 				} else {
 					if (Util.isNullOrEmpty(menu)) {
@@ -199,44 +198,48 @@ public class HanomanAction extends ActionServlet {
 						} catch (Exception e) {
 							e.printStackTrace();
 						}
-						//todo:sena
+						// todo:sena
 						callerPrincipal = "admin";
 						log.info("callerPrincipal from" + callerPrincipal);
-//						Subject subject = null;
-//						try {
-//							subject = "subject";
-//							log.info("WSSubject.getCallerSubject()" + "subject");
-//						} catch (WSSecurityException e) {
-//							e.printStackTrace();
-//						}
-//						Set credSet = subject.getPublicCredentials(WSCredential.class);
-//						log.info("credSet" + credSet.size());
-//						List objRoleCaller = new ArrayList();
-//						for (Iterator iterator = credSet.iterator(); iterator.hasNext();) {
-//
-//							WSCredential objectWSCredential = (WSCredential) iterator.next();
-//							List groupIdCallerSubject = null;
-//							try {
-//								groupIdCallerSubject = objectWSCredential.getGroupIds();
-//								log.info("groupIdCallerSubject size: " + groupIdCallerSubject.size());
-//							} catch (CredentialExpiredException e) {
-//								e.printStackTrace();
-//							} catch (CredentialDestroyedException e) {
-//								e.printStackTrace();
-//							}
-//							for (Object groupIdCallerSubjectItem : groupIdCallerSubject) {
-//								String strGroupIdCallerSubjectItem = (String) groupIdCallerSubjectItem;
-//								strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(strGroupIdCallerSubjectItem.toLowerCase().indexOf("cn=") + 3);
-//								strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(0, strGroupIdCallerSubjectItem.indexOf(','));
-//								objRoleCaller.add(strGroupIdCallerSubjectItem);
-//							}
-//							log.info("user group from ldap dari hanoman action dopost: " + BeanUtil.dumpBean(objRoleCaller));
-//
-//						}
+						// Subject subject = null;
+						// try {
+						// subject = "subject";
+						// log.info("WSSubject.getCallerSubject()" + "subject");
+						// } catch (WSSecurityException e) {
+						// e.printStackTrace();
+						// }
+						// Set credSet = subject.getPublicCredentials(WSCredential.class);
+						// log.info("credSet" + credSet.size());
+						// List objRoleCaller = new ArrayList();
+						// for (Iterator iterator = credSet.iterator(); iterator.hasNext();) {
+						//
+						// WSCredential objectWSCredential = (WSCredential) iterator.next();
+						// List groupIdCallerSubject = null;
+						// try {
+						// groupIdCallerSubject = objectWSCredential.getGroupIds();
+						// log.info("groupIdCallerSubject size: " + groupIdCallerSubject.size());
+						// } catch (CredentialExpiredException e) {
+						// e.printStackTrace();
+						// } catch (CredentialDestroyedException e) {
+						// e.printStackTrace();
+						// }
+						// for (Object groupIdCallerSubjectItem : groupIdCallerSubject) {
+						// String strGroupIdCallerSubjectItem = (String) groupIdCallerSubjectItem;
+						// strGroupIdCallerSubjectItem =
+						// strGroupIdCallerSubjectItem.substring(strGroupIdCallerSubjectItem.toLowerCase().indexOf("cn=")
+						// + 3);
+						// strGroupIdCallerSubjectItem = strGroupIdCallerSubjectItem.substring(0,
+						// strGroupIdCallerSubjectItem.indexOf(','));
+						// objRoleCaller.add(strGroupIdCallerSubjectItem);
+						// }
+						// log.info("user group from ldap dari hanoman action dopost: " +
+						// BeanUtil.dumpBean(objRoleCaller));
+						//
+						// }
 						List objRoleCaller = new ArrayList();
 						objRoleCaller.add("mdwadmin");
 						objRoleCaller.add("epaymentadmin");
-						
+
 						if (callerPrincipal != null) {
 							log.info("START MENU HANOMAN ACTION");
 							String menu2 = Util.getMenu(psiConfig, request, callerPrincipal, objRoleCaller);
@@ -255,13 +258,10 @@ public class HanomanAction extends ActionServlet {
 
 						/*
 						 * if (callerPrincipal != null) {
-						 * request.getSession().setAttribute("login.user",
-						 * callerPrincipal);
-						 * request.getSession().setAttribute("objRoleCaller",
-						 * objRoleCaller); // Panggil Menu
-						 * log.info("update menu from HanomanAction");
-						 * Util.updateMenu(psiConfig, request, callerPrincipal,
-						 * objRoleCaller);
+						 * request.getSession().setAttribute("login.user", callerPrincipal);
+						 * request.getSession().setAttribute("objRoleCaller", objRoleCaller); // Panggil
+						 * Menu log.info("update menu from HanomanAction"); Util.updateMenu(psiConfig,
+						 * request, callerPrincipal, objRoleCaller);
 						 * 
 						 * }
 						 */
@@ -274,7 +274,7 @@ public class HanomanAction extends ActionServlet {
 			log.info("MASUK ERROR POST");
 			String error = (String) request.getSession().getAttribute("userError");
 			if (!Util.isNullOrEmpty(error)) {
-				//response.sendRedirect("error.jsp");
+				// response.sendRedirect("error.jsp");
 				getServletConfig().getServletContext().getRequestDispatcher("/error.jsp").forward(request, response);
 			} else {
 				log.info("doPost");
@@ -287,28 +287,29 @@ public class HanomanAction extends ActionServlet {
 	public void initSessionTimeout(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
 		// is old session
 		HttpSession session = request.getSession(true);
-		/*if (!session.isNew()) {
-			log.info("-------------------------------------------- session is old");
-			return;
-		}*/
-		log.info("request.getRequestURL() = "+request.getRequestURL().toString());
-		log.info("request.getRequestURI() = "+request.getRequestURI().toString());
-		log.info("request.getRemoteAddr()) = "+request.getRemoteAddr().toString());
-				
+		/*
+		 * if (!session.isNew()) {
+		 * log.info("-------------------------------------------- session is old");
+		 * return; }
+		 */
+		log.info("request.getRequestURL() = " + request.getRequestURL().toString());
+		log.info("request.getRequestURI() = " + request.getRequestURI().toString());
+		log.info("request.getRemoteAddr()) = " + request.getRemoteAddr().toString());
+
 		ServletContext ctx = getServletContext();
 		PersistanceServiceInterface psiEpay;
 		try {
 			log.info("-------------------------------------------- session is new");
 			psiEpay = ServiceUtil.getDaoClient(ctx);
 			AppSetting appSetting = (AppSetting) psiEpay.queryById(Constant.MWAPP_EPAY_DS, "AppSetting", Constant.WEB_SESSION_TIMEOUT, null);
-			if(appSetting == null) {
+			if (appSetting == null) {
 				appSetting = new AppSetting();
 				appSetting.setCode("WEB_SESSION_TIMEOUT");
 				appSetting.setDescription("WEB_SESSION_TIMEOUT");
 				appSetting.setSettingValue("540");
 			}
-			log.info("WEB_SESSION_TIMEOUT [][][][][]"+BeanUtil.dumpBean(appSetting));
-			//log.info("session time out: " + BeanUtil.dumpBean(appSetting));
+			log.info("WEB_SESSION_TIMEOUT [][][][][]" + BeanUtil.dumpBean(appSetting));
+			// log.info("session time out: " + BeanUtil.dumpBean(appSetting));
 			if (appSetting == null) {
 				throw new RuntimeException("There is no " + Constant.WEB_SESSION_TIMEOUT + " in application setting");
 			}

+ 19 - 49
MWUI/src/main/java/id/co/hanoman/shared/Util.java

@@ -11,7 +11,6 @@ import java.util.Calendar;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -48,8 +47,6 @@ import id.co.hanoman.service.config.Dbconn;
 import id.co.hanoman.service.mwapp.Privilege;
 import id.co.hanoman.service.mwapp.Role;
 
-//import com.ibm.websphere.security.auth.WSSubject;
-
 public class Util {
 	protected static Log log = LogFactory.getLog(Class.class);
 
@@ -199,9 +196,7 @@ public class Util {
 
 	public static void clearSession(HttpServletRequest request) {
 		try {
-			// long sessionTimeout = 300000;
 			long sessionTimeout = 50000;
-			// log.info("masuk sini ga yahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
 			for (Iterator iterator = Collections.list(request.getSession().getAttributeNames()).iterator(); iterator.hasNext();) {
 				String s = (String) iterator.next();
 				if (s.equals("org.apache.struts.action.LOCALE") || s.equals("myMenu") || s.equals("login.user")) {
@@ -233,15 +228,7 @@ public class Util {
 	 */
 	public static void clearSession(HttpServletRequest request, PersistanceServiceInterface psi) {
 		try {
-			// String sysParam_filterStr = "code=" +Constant.SESSION_TIMEOUT;
-			// SysParam sysParam = (SysParam) psi.queryUnique("FROM SysParam WHERE code =
-			// :code ", sysParam_filterStr);
 			long sessionTimeout = 300000;
-			// if (sysParam == null) {
-			// log.warn("Sys Param " +Constant.SESSION_TIMEOUT+ " not exist");
-			// } else {
-			// sessionTimeout = sysParam.getNumValue().longValue();
-			// }
 			for (Iterator iterator = Collections.list(request.getSession().getAttributeNames()).iterator(); iterator.hasNext();) {
 				String s = (String) iterator.next();
 				if (s.equals("org.apache.struts.action.LOCALE") || s.equals("myMenu") || s.equals("login.user") || s.indexOf("session.") > -1) {
@@ -351,6 +338,7 @@ public class Util {
 		return props.getProperty("wpsPort");
 	}
 
+	@SuppressWarnings({ "unchecked", "null" })
 	public ArrayList objRoller(String callerPrincipal) {
 		ArrayList rs = new ArrayList();
 		try {
@@ -368,14 +356,10 @@ public class Util {
 			System.out.println("passBind : " + passBind);
 
 			Hashtable env = new Hashtable();
-			String pn = "cn=wpsadmindev,ou=middleware,dc=btn,dc=co,dc=id";
 			env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
-			// env.put(Context.PROVIDER_URL, "ldap://172.15.30.73:389");
-			// env.put(Context.PROVIDER_URL, "ldap://172.18.2.21:389"); //live
-			env.put(Context.PROVIDER_URL, "ldap://localhost:389"); // local
 			env.put(Context.SECURITY_AUTHENTICATION, "simple");
-			env.put(Context.SECURITY_PRINCIPAL, pn);
-			env.put(Context.SECURITY_CREDENTIALS, "wpsadmindev");
+			env.put(Context.SECURITY_PRINCIPAL, userBind);
+			env.put(Context.SECURITY_CREDENTIALS, passBind);
 			InitialDirContext ctx = null;
 			try {
 				ctx = new InitialDirContext(env);
@@ -386,11 +370,10 @@ public class Util {
 			if (ctx != null) {
 				SearchControls ctrls = new SearchControls();
 				ctrls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-				// wpsadmindev
-				// wpsbinddev
 				NamingEnumeration<javax.naming.directory.SearchResult> results = ctx.search("dc=btn,dc=co,dc=id", "(&(sAMAccountName=" + callerPrincipal + ")(objectClass=user))", ctrls);
 				SearchResult result = results.next();
 				System.out.println("distinguisedName: " + result.getNameInNamespace());
+				Attribute cn = result.getAttributes().get("cn");
 				Attribute memberOf = result.getAttributes().get("memberOf");
 				if (memberOf != null) {
 					for (int idx = 0; idx < memberOf.size(); idx++) {
@@ -400,6 +383,21 @@ public class Util {
 						System.out.println("memberOf: " + strGroupIdCallerSubjectItem);
 						rs.add(strGroupIdCallerSubjectItem);
 					}
+				} else {
+					if (cn != null) {
+						SearchControls ctrls2 = new SearchControls();
+						ctrls2.setSearchScope(SearchControls.SUBTREE_SCOPE);
+						ctrls2.setReturningAttributes(new String[] { "dn" });
+						NamingEnumeration<javax.naming.directory.SearchResult> results2 = ctx.search("dc=btn,dc=co,dc=id", "(member=" + result.getNameInNamespace() + ")", ctrls2);
+						while (results2.hasMore()) {
+							SearchResult result2 = results2.next();
+							String dn = result2.getNameInNamespace();
+
+							String cnValue = dn.replaceAll("cn=([^,]+).*", "$1");
+							System.out.println("Group DN: " + cnValue.toString());
+							rs.add(cnValue.toString());
+						}
+					}
 				}
 				ctx.close();
 			}
@@ -430,26 +428,18 @@ public class Util {
 							String filterStr = "$INCLUDE=privileges/*";
 							id.co.hanoman.service.List roleIdList = psiConfig.query(Constant.MWAPP_CONFIG_DS, "FROM Role role WHERE 1=1 " + filterRole + " AND role.id in (" + id + ")" + "ORDER BY " + orderRole, filterStr, 0, 0);
 							Object[] roleIdItems = roleIdList.getItems();
-							// System.out.println("ROLE LIST roleItems.length
-							// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+roleItems.length);
 
 							// new Role
 							if (roleIdItems != null) {
 								for (Object objectRoleIdItem : roleIdItems) {
 									Role role = (Role) objectRoleIdItem;
-									// System.out.println("ROLE LIST role.getName()
-									// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+role.getName());
 									if ("ACTIVE".equals(role.getStatus())) {
 										Collection<Privilege> privileges = role.getPrivileges();
-										// System.out.println("ROLE LIST role.privileges()
-										// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+privileges);
 										if (privileges != null) {
 											Iterator itrPrivileges = privileges.iterator();
 											while (itrPrivileges.hasNext()) {
 												Privilege privilege = (Privilege) itrPrivileges.next();
 												if (privilege.getType().equalsIgnoreCase("PRIV_TYPE_MENU")) {
-													// System.out.println("ROLE LIST role.privileges().add
-													// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+privilege.getName());
 													privilegeList.add(privilege);
 												}
 
@@ -470,24 +460,18 @@ public class Util {
 					});
 
 					StringBuffer sb = new StringBuffer();
-					// sb.append("[['LIST MENU',0,0,");
 					sb.append("[[null,' HOME &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',' home.jsp',null,null ],");
 					for (int i = 0; i < privilegeList.size(); i++) {
 						if (privilegeList.get(i).getParent() == null && "ACTIVE".equals(privilegeList.get(i).getStatus())) {
 							if (!sb.toString().contains("'" + privilegeList.get(i).getName() + "'")) {
-								// sb.append("['"+
-								// privilegeList.get(i).getName()+"','"+privilegeList.get(i).getPath()+"',0,0");
-								// sb.append("[null,'" + privilegeList.get(i).getName() + "',null,null");
 								sb.append("[null,'" + privilegeList.get(i).getName() + "','" + privilegeList.get(i).getPath() + "&ts=trxZ\'" + ",null,null");
 								getChilds(sb, privilegeList, privilegeList.get(i), false);
 								sb.append("],");
 							}
 						}
 					}
-					// sb.append("]]");
 					sb.append("];");
 					String menu = sb.toString().replaceAll("trxZ", String.valueOf(System.currentTimeMillis()));
-					// log.info("MENU : "+BeanUtil.dumpBean(menu));
 					request.getSession().setAttribute("myMenu", menu);
 				}
 			}
@@ -500,7 +484,6 @@ public class Util {
 		Util.updateMenu(psiConfig, request, callerPrincipal, objRoleCaller);
 		String menu = "";
 		menu = (String) request.getSession().getAttribute("myMenu");
-		// log.info("MENU : "+BeanUtil.dumpBean(menu));
 		return menu;
 	}
 
@@ -589,7 +572,6 @@ public class Util {
 			}
 			sb.append("]]");
 			String menu = sb.toString().replaceAll("trxZ", String.valueOf(System.currentTimeMillis()));
-			// log.info("MENU <> "+BeanUtil.dumpBean(menu));
 			request.getSession().setAttribute("myMenu", menu);
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -687,18 +669,6 @@ public class Util {
 		NodeList listOfField = doc.getElementsByTagName("field");
 
 		for (int i = 0; i < listOfField.getLength(); i++) {
-
-			// get field element
-			// Map map = new HashMap();
-			// Element el = (Element)listOfField.item(i);
-			// log.info("GET ID::"+el.getAttribute("id"));
-			// map.put("id", el.getAttribute("id"));
-			// map.put("type", el.getAttribute("type"));
-			// map.put("charset", el.getAttribute("charset"));
-			// map.put("decimal-format", el.getAttribute("decimal-format"));
-			// map.put("length", el.getAttribute("length"));
-			// list.add(map);
-
 			Node field = listOfField.item(i);
 			if (field.getNodeType() == Node.ELEMENT_NODE) {
 				NamedNodeMap attributes = field.getAttributes();

+ 18 - 51
MWUI/src/main/webapp/WEB-INF/web.xml

@@ -1,16 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?><web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 	<display-name>MWUI</display-name>
-	
+
 	<context-param>
 		<param-name>contextConfigLocation</param-name>
 		<param-value>/WEB-INF/ServiceContext.xml</param-value>
 	</context-param>
-	
+
 	<listener>
 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 	</listener>
-		
-	
+
 	<jsp-config>
 		<taglib>
 			<taglib-uri>struts-bean.tld</taglib-uri>
@@ -37,13 +39,13 @@
 			<taglib-location>/WEB-INF/tld/taglibs-string-edit.tld</taglib-location>
 		</taglib>
 	</jsp-config>
-	
+
 	<servlet>
 		<description>
 		</description>
 		<servlet-name>ActionServlet</servlet-name>
 		<servlet-class>
-		id.co.hanoman.shared.HanomanAction</servlet-class>
+			id.co.hanoman.shared.HanomanAction</servlet-class>
 		<init-param>
 			<description>
 			</description>
@@ -74,15 +76,15 @@
 		<servlet-name>ActionServlet</servlet-name>
 		<url-pattern>*.do</url-pattern>
 	</servlet-mapping>
-	
+
 	<!-- servlet COdex -->
 	<servlet>
 		<description>
 		</description>
-		<display-name>CodexServlet</display-name>  
+		<display-name>CodexServlet</display-name>
 		<servlet-name>CodexServlet</servlet-name>
 		<servlet-class>
-		id.co.hanoman.shared.CodexServlet</servlet-class>
+			id.co.hanoman.shared.CodexServlet</servlet-class>
 		<load-on-startup>2</load-on-startup>
 	</servlet>
 	<servlet-mapping>
@@ -93,7 +95,7 @@
 	<session-config>
 		<session-timeout>3</session-timeout>
 	</session-config>
-	
+
 	<welcome-file-list>
 		<welcome-file>login.jsp</welcome-file>
 		<welcome-file>index.jsp</welcome-file>
@@ -118,52 +120,17 @@
 			<http-method>DELETE</http-method>
 			<http-method>OPTIONS</http-method>
 		</web-resource-collection>
-		<!--auth-constraint>
-			<description>
-			Auto generated Authorization Constraint</description>
-			<role-name>MWSecurity</role-name>
-		</auth-constraint-->		
-	</security-constraint>
-	<security-constraint>
-		<display-name>MWSecurity_Constraint</display-name>
-		<web-resource-collection>
-			<web-resource-name>MWSecurity_Collection</web-resource-name>
-			<url-pattern>/*</url-pattern>
-			<http-method>GET</http-method>
-			<http-method>PUT</http-method>
-			<http-method>HEAD</http-method>
-			<http-method>TRACE</http-method>
-			<http-method>POST</http-method>
-			<http-method>DELETE</http-method>
-			<http-method>OPTIONS</http-method>
-		</web-resource-collection>
-		<auth-constraint>
-			<description>
-			Auto generated Authorization Constraint</description>
-			<role-name>MWSecurity_</role-name>
-		</auth-constraint>
 	</security-constraint>
+	<security-role>
+		<role-name>MWSecurity</role-name>
+	</security-role>
+
 	<login-config>
 		<auth-method>FORM</auth-method>
+		<realm-name>LDAP</realm-name>
 		<form-login-config>
 			<form-login-page>/login.jsp</form-login-page>
 			<form-error-page>/failure.jsp</form-error-page>
 		</form-login-config>
 	</login-config>
-	<security-role>
-		<role-name>MWSecurity</role-name>
-	</security-role>
-	<security-role>
-		<role-name>MWSecurity_</role-name>
-	</security-role>
-	
-	<!-- login-config>
-		<auth-method>FORM</auth-method>
-		<form-login-config>
-			<form-login-page>/index.jsp</form-login-page>
-			<form-error-page>/error.jsp</form-error-page>
-		</form-login-config>
-	</login-config-->
-	
-	
 </web-app>