Added back support for customized username header.
authorcantor <cantor@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 18 Mar 2003 15:46:55 +0000 (15:46 +0000)
committercantor <cantor@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 18 Mar 2003 15:46:55 +0000 (15:46 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@549 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/conf/origin.properties
src/edu/internet2/middleware/shibboleth/hs/HandleServlet.java

index 8e3f8c9..fa3ccd6 100755 (executable)
@@ -15,6 +15,8 @@
  # [Required] URL at which the corresponding Attribute Authority can be reached
  #edu.internet2.middleware.shibboleth.hs.HandleServlet.AAUrl = http://host.test.edu/shibboleth/AA
 
+ # [Optional] HTTP Request Header to get principal name from (defaults to REMOTE_USER)
+ #edu.internet2.middleware.shibboleth.hs.HandleServlet.username = REMOTE_USER
 
 ##### Assertion Signing #####
 
index 2f3af8d..5e8be01 100644 (file)
@@ -98,6 +98,7 @@ public class HandleServlet extends HttpServlet {
 
                //Set defaults
                Properties defaultProps = new Properties();
+        defaultProps.setProperty("edu.internet2.middleware.shibboleth.hs.HandleServlet.username","REMOTE_USER");
                defaultProps.setProperty(
                        "edu.internet2.middleware.shibboleth.hs.HandleRepository.implementation",
                        "edu.internet2.middleware.shibboleth.hs.provider.MemoryHandleRepository");
@@ -255,9 +256,12 @@ public class HandleServlet extends HttpServlet {
 
                        req.setAttribute("shire", req.getParameter("shire"));
                        req.setAttribute("target", req.getParameter("target"));
+            
+            String header=configuration.getProperty("edu.internet2.middleware.shibboleth.hs.HandleServlet.username");
+            String username=header.equalsIgnoreCase("REMOTE_USER") ? req.getRemoteUser() : req.getHeader(header);
 
-                       String handle = handleRepository.getHandle(new AuthNPrincipal(req.getRemoteUser()));
-                       log.info("Issued Handle (" + handle + ") to (" + req.getRemoteUser() + ")");
+                       String handle = handleRepository.getHandle(new AuthNPrincipal(username));
+                       log.info("Issued Handle (" + handle + ") to (" + username + ")");
 
                        byte[] buf = generateAssertion(handle, req.getParameter("shire"), req.getRemoteAddr(), req.getAuthType());