summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/cms
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2013-09-17 12:24:25 -0400
committerAde Lee <alee@redhat.com>2013-09-17 20:13:16 -0400
commitacee138537287f202c1a009c0352b9cf9d438a1f (patch)
tree190fa323d16e849e7cf4f35e21b511ccd21a7448 /base/common/src/com/netscape/cms
parent6ba09084f6b3f4360393b49153c76c9d4dcb608d (diff)
downloadpki-acee138537287f202c1a009c0352b9cf9d438a1f.tar.gz
pki-acee138537287f202c1a009c0352b9cf9d438a1f.tar.xz
pki-acee138537287f202c1a009c0352b9cf9d438a1f.zip
Added new link for resteasy dependency
Resteasy 3.0.1 uses apache-commons-io. Also fixed PKIErrorInterceptor with correct method call and reformatted the interceptors.
Diffstat (limited to 'base/common/src/com/netscape/cms')
-rw-r--r--base/common/src/com/netscape/cms/authorization/ACLInterceptor.java11
-rw-r--r--base/common/src/com/netscape/cms/authorization/AuthMethodInterceptor.java21
2 files changed, 17 insertions, 15 deletions
diff --git a/base/common/src/com/netscape/cms/authorization/ACLInterceptor.java b/base/common/src/com/netscape/cms/authorization/ACLInterceptor.java
index 590f548f7..1a3a09752 100644
--- a/base/common/src/com/netscape/cms/authorization/ACLInterceptor.java
+++ b/base/common/src/com/netscape/cms/authorization/ACLInterceptor.java
@@ -43,7 +43,6 @@ import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.ForbiddenException;
import com.netscape.cmscore.realm.PKIPrincipal;
-
/**
* @author Endi S. Dewata
*/
@@ -60,7 +59,8 @@ public class ACLInterceptor implements ContainerRequestFilter {
public synchronized void loadAuthProperties() throws IOException {
- if (authProperties != null) return;
+ if (authProperties != null)
+ return;
URL url = servletContext.getResource("/WEB-INF/auth.properties");
authProperties = new Properties();
@@ -69,7 +69,8 @@ public class ACLInterceptor implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
- ResourceMethodInvoker methodInvoker = (ResourceMethodInvoker) requestContext.getProperty("org.jboss.resteasy.core.ResourceMethodInvoker");
+ ResourceMethodInvoker methodInvoker = (ResourceMethodInvoker) requestContext
+ .getProperty("org.jboss.resteasy.core.ResourceMethodInvoker");
Method method = methodInvoker.getMethod();
ACLMapping aclMapping = method.getAnnotation(ACLMapping.class);
@@ -100,7 +101,7 @@ public class ACLInterceptor implements ContainerRequestFilter {
throw new ForbiddenException("Invalid user principal.");
}
- PKIPrincipal pkiPrincipal = (PKIPrincipal)principal;
+ PKIPrincipal pkiPrincipal = (PKIPrincipal) principal;
IAuthToken authToken = pkiPrincipal.getAuthToken();
// If missing auth token, reject request.
@@ -147,7 +148,7 @@ public class ACLInterceptor implements ContainerRequestFilter {
CMS.debug("ACLInterceptor: " + e.getMessage());
throw new ForbiddenException(e.toString());
- } catch (IOException|EBaseException e) {
+ } catch (IOException | EBaseException e) {
e.printStackTrace();
throw new Failure(e);
}
diff --git a/base/common/src/com/netscape/cms/authorization/AuthMethodInterceptor.java b/base/common/src/com/netscape/cms/authorization/AuthMethodInterceptor.java
index 527b9f685..257e0ae81 100644
--- a/base/common/src/com/netscape/cms/authorization/AuthMethodInterceptor.java
+++ b/base/common/src/com/netscape/cms/authorization/AuthMethodInterceptor.java
@@ -42,7 +42,6 @@ import com.netscape.certsrv.authentication.IAuthToken;
import com.netscape.certsrv.base.ForbiddenException;
import com.netscape.cmscore.realm.PKIPrincipal;
-
/**
* @author Endi S. Dewata
*/
@@ -59,7 +58,8 @@ public class AuthMethodInterceptor implements ContainerRequestFilter {
public synchronized void loadAuthProperties() throws IOException {
- if (authProperties != null) return;
+ if (authProperties != null)
+ return;
authProperties = new Properties();
@@ -79,11 +79,12 @@ public class AuthMethodInterceptor implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
- ResourceMethodInvoker methodInvoker = (ResourceMethodInvoker) requestContext.getProperty("org.jboss.resteasy.core.ResourceMethodInvoker");
+ ResourceMethodInvoker methodInvoker = (ResourceMethodInvoker) requestContext
+ .getProperty("org.jboss.resteasy.core.ResourceMethodInvoker");
Method method = methodInvoker.getMethod();
Class<?> clazz = methodInvoker.getResourceClass();
- CMS.debug("AuthMethodInterceptor: "+clazz.getSimpleName()+"."+method.getName()+"()");
+ CMS.debug("AuthMethodInterceptor: " + clazz.getSimpleName() + "." + method.getName() + "()");
// Get authentication mapping for the method.
AuthMethodMapping authMapping = method.getAnnotation(AuthMethodMapping.class);
@@ -102,7 +103,7 @@ public class AuthMethodInterceptor implements ContainerRequestFilter {
name = authMapping.value();
}
- CMS.debug("AuthMethodInterceptor: mapping name: "+name);
+ CMS.debug("AuthMethodInterceptor: mapping name: " + name);
try {
loadAuthProperties();
@@ -115,7 +116,7 @@ public class AuthMethodInterceptor implements ContainerRequestFilter {
}
}
- CMS.debug("AuthMethodInterceptor: required auth methods: "+authMethods);
+ CMS.debug("AuthMethodInterceptor: required auth methods: " + authMethods);
Principal principal = securityContext.getUserPrincipal();
@@ -135,7 +136,7 @@ public class AuthMethodInterceptor implements ContainerRequestFilter {
throw new ForbiddenException("Unknown user principal");
}
- PKIPrincipal pkiPrincipal = (PKIPrincipal)principal;
+ PKIPrincipal pkiPrincipal = (PKIPrincipal) principal;
IAuthToken authToken = pkiPrincipal.getAuthToken();
// If missing auth token, reject request.
@@ -144,8 +145,8 @@ public class AuthMethodInterceptor implements ContainerRequestFilter {
throw new ForbiddenException("Missing authentication token.");
}
- String authManager = (String)authToken.get(AuthToken.TOKEN_AUTHMGR_INST_NAME);
- CMS.debug("AuthMethodInterceptor: authentication manager: "+authManager);
+ String authManager = (String) authToken.get(AuthToken.TOKEN_AUTHMGR_INST_NAME);
+ CMS.debug("AuthMethodInterceptor: authentication manager: " + authManager);
if (authManager == null) {
CMS.debug("AuthMethodInterceptor: missing authentication manager");
@@ -153,7 +154,7 @@ public class AuthMethodInterceptor implements ContainerRequestFilter {
}
if (authMethods.isEmpty() || authMethods.contains(authManager) || authMethods.contains("*")) {
- CMS.debug("AuthMethodInterceptor: "+authManager+" allowed");
+ CMS.debug("AuthMethodInterceptor: " + authManager + " allowed");
return;
}