Changes made in UniTime

Project:Integration of Scheduling component UniTime (University Timetabling) with CAS Campus
Component:Documentation
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description
1) The following servlet filter was added in the web.xml CAS Filter edu.yale.its.tp.cas.client.filter.CASFilter edu.yale.its.tp.cas.client.filter.loginUrl https://localhost:8443/cas-server-webapp-3.4.2.1/login edu.yale.its.tp.cas.client.filter.validateUrl https://localhost:8443/cas-server-webapp-3.4.2.1/serviceValidate edu.yale.its.tp.cas.client.filter.serverName localhost:8080 CAS Filter /* 2) Added the following jars to the WebContent/lib folder - casclient-2.1.1.jar, commons-logging-1.0.4.jar 3) Added the following code to execute method of LoginAction.java /* Added for CAS Integration */ String iExternalUid = null; //Get the userid from the CAS authenticated session String n = (String) request.getSession().getAttribute("edu.yale.its.tp.cas.client.filter.user"); //Create a User object from it org.unitime.timetable.model.User u = new UserDAO().get(n); String username = n; String password = null; //Get the password using the username if (u!=null) { String pwd = u.getPassword(); iExternalUid = u.getExternalUniqueId(); //setUser(n); -- not required password = pwd; } Date attemptDateTime = new Date(); try { if (iExternalUid==null || iExternalUid.trim().length()==0) throw new LoginException ("External UID not found"); org.unitime.commons.User p = new org.unitime.commons.User(); //Set the user properties p.setLogin(n); p.setId(iExternalUid); p.setName(n); p.setAdmin(false); p.setRoles(new Vector()); p.setDepartments(new Vector()); TimetableManager manager = TimetableManager.findByExternalId(iExternalUid); if (manager!=null) { p.setName(manager.getName()); // Get roles for (Iterator i=manager.getManagerRoles().iterator();i.hasNext();) { ManagerRole role = (ManagerRole)i.next(); p.getRoles().add(role.getRole().getReference()); } // Get departments for (Iterator i=manager.getDepartments().iterator();i.hasNext();) { Department dept = (Department)i.next(); p.getDepartments().add(dept.getDeptCode()); } } // Check at least one role is found if (p.getRoles().isEmpty() && !"true".equals(ApplicationProperties.getProperty("tmtbl.authentication.norole","false"))) { throw new LoginException ("Role not found. Access Denied to User: " + n); } // Add user object to subjects public credentials // getSubject().getPublicCredentials().add(p); -- not required List creds = new ArrayList(); creds.add(p); /* End of added for CAS Integration */ 4) Modified the login.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> Insert title here //This function is written for CAS Authentication. //The login page no longer contains the username //and password textboxes. This function submits //the login form to the Login servlet, passing //the value of the parameter cs. function sendToLoginServlet(){ document.LoginForm.submit(); }
Copyright 2009 KenElements. Powered by Open Source Software from projects like Apache, Drupal, Linux, MySQL, PHP, JQuery