You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by as...@apache.org on 2017/06/26 11:35:04 UTC

svn commit: r1799874 - in /sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core: AuthConstants.java impl/SlingAuthenticator.java

Author: asanso
Date: Mon Jun 26 11:35:04 2017
New Revision: 1799874

URL: http://svn.apache.org/viewvc?rev=1799874&view=rev
Log:
SLING-6972 - Add a request attribute in the SlingAuthenticator containing the list of request URI suffixes handled by the default authenticator

Modified:
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthConstants.java
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthConstants.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthConstants.java?rev=1799874&r1=1799873&r2=1799874&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthConstants.java (original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthConstants.java Mon Jun 26 11:35:04 2017
@@ -126,6 +126,15 @@ public final class AuthConstants {
      */
     public static final String AUTH_REQUIREMENTS = "sling.auth.requirements";
 
+    /**
+    * The name of the request attribute containing the list of
+    * request URI suffixes handled by the default authenticator
+    * <code>org.apache.sling.auth.core.impl.SlingAuthenticator<code>.
+    * The authenticator will populate this attribute so that login JSPs
+    * can post j_username and j_password to the correct URI.
+    */
+    public static final String ATTR_REQUEST_AUTH_URI_SUFFIX = "org.apache.sling.api.include.auth_uri_suffix";
+    
     private AuthConstants() {
     }
 

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java?rev=1799874&r1=1799873&r2=1799874&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java (original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java Mon Jun 26 11:35:04 2017
@@ -471,6 +471,11 @@ public class SlingAuthenticator implemen
 
     private boolean doHandleSecurity(HttpServletRequest request, HttpServletResponse response) {
 
+    	// 0. Check for request attribute; set if not present
+    	Object authUriSufficesAttr = request.getAttribute(AuthConstants.ATTR_REQUEST_AUTH_URI_SUFFIX);
+    	if (authUriSufficesAttr == null && authUriSuffices != null)
+    		request.setAttribute(AuthConstants.ATTR_REQUEST_AUTH_URI_SUFFIX, authUriSuffices);
+
         // 1. Ask all authentication handlers to try to extract credentials
         final AuthenticationInfo authInfo = getAuthenticationInfo(request, response);