[java-shib-idp2 COMMIT] in /branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp: authn/provider/Exte...

noreply at shibboleth.net noreply at shibboleth.net
Fri Feb 10 18:53:48 GMT 2012


Author: lajoie
Date: Fri Feb 10 18:53:48 2012
New Revision: 3098

URL: http://svn.shibboleth.net/view/java-shib-idp2?rev=3098&view=rev
Log:
Fix how external authn login handler gets hold of the LoginContext... some one should tell the developer form the last checkin not to use non-public APIs...

Modified:
    branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/authn/provider/ExternalAuthnSystemLoginHandler.java
    branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/util/HttpServletHelper.java

Modified: branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/authn/provider/ExternalAuthnSystemLoginHandler.java
URL: http://svn.shibboleth.net/view/java-shib-idp2/branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/authn/provider/ExternalAuthnSystemLoginHandler.java?rev=3098&r1=3097&r2=3098&view=diff
==============================================================================
--- branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/authn/provider/ExternalAuthnSystemLoginHandler.java (original)
+++ branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/authn/provider/ExternalAuthnSystemLoginHandler.java Fri Feb 10 18:53:48 2012
@@ -20,10 +20,12 @@
 import java.io.IOException;
 
 import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.opensaml.util.storage.StorageService;
 import org.opensaml.xml.util.DatatypeHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -115,7 +117,14 @@
      * @param httpRequest current HTTP request
      */
     protected void populateRequestAttributes(HttpServletRequest httpRequest) {
-        LoginContext loginContext = HttpServletHelper.getLoginContext(httpRequest);
+        ServletContext servletContext = httpRequest.getSession().getServletContext();
+        StorageService storageService = HttpServletHelper.getStorageService(servletContext);
+
+        LoginContext loginContext = HttpServletHelper.getLoginContext(storageService, servletContext, httpRequest);
+        if(loginContext == null){
+            log.error("Unable to lookup login context for this request");
+            return;
+        }
 
         if (loginContext.isForceAuthRequired()) {
             httpRequest.setAttribute(FORCE_AUTHN_PARAM, Boolean.TRUE);

Modified: branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/util/HttpServletHelper.java
URL: http://svn.shibboleth.net/view/java-shib-idp2/branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/util/HttpServletHelper.java?rev=3098&r1=3097&r2=3098&view=diff
==============================================================================
--- branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/util/HttpServletHelper.java (original)
+++ branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/util/HttpServletHelper.java Fri Feb 10 18:53:48 2012
@@ -289,9 +289,13 @@
      * @param httpRequest current HTTP request
      * 
      * @return the login context or null if no login context is bound to the request
+     * 
+     * @deprecated use {@link #getLoginContext(StorageService, ServletContext, HttpServletRequest)} instead
      */
     public static LoginContext getLoginContext(HttpServletRequest httpRequest) {
-        return (LoginContext) httpRequest.getAttribute(LOGIN_CTX_KEY_NAME);
+        ServletContext servletContext = httpRequest.getSession().getServletContext();
+        StorageService storageService = HttpServletHelper.getStorageService(servletContext);
+        return HttpServletHelper.getLoginContext(storageService, servletContext, httpRequest);        
     }
 
     /**



More information about the commits mailing list