You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2016/08/17 09:44:13 UTC
svn commit: r1756602 - in
/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl:
AuthenticationHandlerHolder.java SlingAuthenticator.java
Author: cziegeler
Date: Wed Aug 17 09:44:13 2016
New Revision: 1756602
URL: http://svn.apache.org/viewvc?rev=1756602&view=rev
Log:
SLING-5792 : API to manage Authentication Requirement. Use PropertiesUtil instead of OsgiUtil
Modified:
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/AuthenticationHandlerHolder.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/impl/AuthenticationHandlerHolder.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/AuthenticationHandlerHolder.java?rev=1756602&r1=1756601&r2=1756602&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/AuthenticationHandlerHolder.java (original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/AuthenticationHandlerHolder.java Wed Aug 17 09:44:13 2016
@@ -28,7 +28,7 @@ import org.apache.sling.auth.core.AuthUt
import org.apache.sling.auth.core.spi.AuthenticationFeedbackHandler;
import org.apache.sling.auth.core.spi.AuthenticationHandler;
import org.apache.sling.auth.core.spi.AuthenticationInfo;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
import org.osgi.framework.ServiceReference;
/**
@@ -53,11 +53,11 @@ final class AuthenticationHandlerHolder
final ServiceReference serviceReference) {
super(fullPath, serviceReference);
- final String browserOnly = OsgiUtil.toString(serviceReference.getProperty(AuthConstants.AUTH_HANDLER_BROWSER_ONLY), null);
+ final String browserOnly = PropertiesUtil.toString(serviceReference.getProperty(AuthConstants.AUTH_HANDLER_BROWSER_ONLY), null);
// assign the fields
this.handler = handler;
- this.authType = OsgiUtil.toString(serviceReference.getProperty(TYPE_PROPERTY), null);
+ this.authType = PropertiesUtil.toString(serviceReference.getProperty(TYPE_PROPERTY), null);
this.browserOnlyRequestCredentials = "true".equalsIgnoreCase(browserOnly)
|| "yes".equalsIgnoreCase(browserOnly);
}
@@ -70,11 +70,13 @@ final class AuthenticationHandlerHolder
return null;
}
+ @Override
public AuthenticationInfo doExtractCredentials(HttpServletRequest request,
HttpServletResponse response) {
return handler.extractCredentials(request, response);
}
+ @Override
public boolean doRequestCredentials(HttpServletRequest request,
HttpServletResponse response) throws IOException {
@@ -87,6 +89,7 @@ final class AuthenticationHandlerHolder
return false;
}
+ @Override
public void doDropCredentials(HttpServletRequest request,
HttpServletResponse response) throws IOException {
handler.dropCredentials(request, response);
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=1756602&r1=1756601&r2=1756602&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 Wed Aug 17 09:44:13 2016
@@ -67,7 +67,6 @@ import org.apache.sling.auth.core.spi.Au
import org.apache.sling.auth.core.spi.AuthenticationInfo;
import org.apache.sling.auth.core.spi.AuthenticationInfoPostProcessor;
import org.apache.sling.auth.core.spi.DefaultAuthenticationFeedbackHandler;
-import org.apache.sling.commons.osgi.OsgiUtil;
import org.apache.sling.commons.osgi.PropertiesUtil;
import org.osgi.framework.AllServiceListener;
import org.osgi.framework.BundleContext;
@@ -1591,7 +1590,7 @@ public class SlingAuthenticator implemen
}
private void addService(final ServiceReference ref) {
- final String[] authReqPaths = OsgiUtil.toStringArray(ref.getProperty(PAR_AUTH_REQ));
+ final String[] authReqPaths = PropertiesUtil.toStringArray(ref.getProperty(PAR_AUTH_REQ));
ArrayList<AuthenticationRequirementHolder> authReqList = new ArrayList<AuthenticationRequirementHolder>();
for (String authReq : authReqPaths) {
@@ -1670,7 +1669,7 @@ public class SlingAuthenticator implemen
}
private void bindAuthHandler(final Object handler, final ServiceReference ref) {
- final String paths[] = OsgiUtil.toStringArray(ref.getProperty(AuthenticationHandler.PATH_PROPERTY));
+ final String paths[] = PropertiesUtil.toStringArray(ref.getProperty(AuthenticationHandler.PATH_PROPERTY));
if (paths != null && paths.length > 0) {
// generate the holders