Index: lams_central/src/java/org/lamsfoundation/lams/web/ShibLoginServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/Attic/ShibLoginServlet.java,v diff -u -r1.1.2.1 -r1.1.2.2 --- lams_central/src/java/org/lamsfoundation/lams/web/ShibLoginServlet.java 30 Mar 2007 00:12:31 -0000 1.1.2.1 +++ lams_central/src/java/org/lamsfoundation/lams/web/ShibLoginServlet.java 19 Apr 2007 03:02:45 -0000 1.1.2.2 @@ -66,13 +66,21 @@ log.debug("request.getContextPath: "+request.getContextPath()); // TODO use header name based on sysadmin's configuration - String username = request.getHeader("Shib-Person-commonName"); + String username = request.getHeader("LAMS-Login"); if (username != null && username.trim().length()>0) { User user = service.getUserByLogin(username); if (user != null) { // TODO check shib user matches lams user log.info("Shib username exists!"); - response.sendRedirect("j_security_check?j_username="+username+"&j_password=dummy"); + // If user is a shib user, login + if (user.getAuthenticationMethod().equals(service.findById(AuthenticationMethod.class, AuthenticationMethod.SHIBBOLETH))) { + response.sendRedirect("j_security_check?j_username="+username+"&j_password=dummy"); + } else { + //log.error("Shib username appears to already exist on LAMS system!"); + // flag so that login.jsp knows not to redirect user to this servlet again + request.getSession().setAttribute("shibLoginExists", "true"); + response.sendRedirect("/lams/"); + } } else { // create user account for new shib user log.info("Creating new user: "+username); Index: lams_central/web/login.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/login.jsp,v diff -u -r1.26.2.2 -r1.26.2.3 --- lams_central/web/login.jsp 30 Mar 2007 00:14:38 -0000 1.26.2.2 +++ lams_central/web/login.jsp 19 Apr 2007 03:02:45 -0000 1.26.2.3 @@ -9,10 +9,11 @@ if (JspRedirectStrategy.loginPageRedirected(request,response)) { return; - } + } - String shibUser = (String) request.getHeader("Shib-Person-commonName"); - if (shibUser != null) { + String shibUsername = (String) request.getHeader("LAMS-Login"); + String shibLoginExists = (String) session.getAttribute("shibLoginExists"); + if (shibUsername != null && shibLoginExists != "true") { response.sendRedirect("ShibLogin"); } @@ -120,7 +121,17 @@
- + + + <% if (shibLoginExists == "false") { %> +
+ <% } %> +
+ <% if (shibLoginExists == "false") { %> +
+ Shibboleth username '<%= shibUsername %>' is taken. +
+ <% } %>

: