SLING-6972 - Add a request attribute in the SlingAuthenticator containing the list of request URI suffixes handled by the default authenticator
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1799874 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/auth/core/AuthConstants.java b/src/main/java/org/apache/sling/auth/core/AuthConstants.java
index 6ef1151..6827f03 100644
--- a/src/main/java/org/apache/sling/auth/core/AuthConstants.java
+++ b/src/main/java/org/apache/sling/auth/core/AuthConstants.java
@@ -126,6 +126,15 @@
*/
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() {
}
diff --git a/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java b/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java
index a1cfc52..adb8b02 100644
--- a/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java
+++ b/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java
@@ -471,6 +471,11 @@
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);