summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2013-01-23 12:10:52 -0600
committerEndi Sukma Dewata <edewata@redhat.com>2013-02-04 12:06:40 -0500
commit6259ba064f4c17b7f6891fcb61501103348936be (patch)
treeae79ff683cb7e7b2c53b2b3fcef1740810c3d89d /base/common/src/com/netscape/cms/servlet/base/CMSServlet.java
parent9c6f3df2193de627f83c1f22fe47cd61e6e3578a (diff)
downloadpki-6259ba064f4c17b7f6891fcb61501103348936be.tar.gz
pki-6259ba064f4c17b7f6891fcb61501103348936be.tar.xz
pki-6259ba064f4c17b7f6891fcb61501103348936be.zip
Session-based nonces.
Previously nonces were stored in a global map which might not scale well due to some issues: 1. The map uses the nonces as map keys. There were possible nonce collisions which required special handling. 2. The collision handling code was not thread safe. There were possible race conditions during concurrent modifications. 3. The map was shared and size limited. If there were a lot of users using the system, valid nonces could get pruned. 4. The map maps the nonces to client certificates. This limits the possible authentication methods that can be supported. Now the code has been modified such that each user has a private map in the user's session to store the nonces. Additional locking has been implemented to protect against concurrent modifications. The map now uses the target of the operation as the map key, eliminating possible collisions and allowing the use of other authentication methods. Since this is a private map, it's not affected by the number of users using the system. Ticket #474
Diffstat (limited to 'base/common/src/com/netscape/cms/servlet/base/CMSServlet.java')
-rw-r--r--base/common/src/com/netscape/cms/servlet/base/CMSServlet.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java b/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java
index 72ced2c53..744a000e3 100644
--- a/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java
+++ b/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java
@@ -226,6 +226,7 @@ public abstract class CMSServlet extends HttpServlet {
// the authority, RA, CA, KRA this servlet is serving.
protected IAuthority mAuthority = null;
+ protected ICertificateAuthority certAuthority;
protected IRequestQueue mRequestQueue = null;
// system logger.
@@ -301,9 +302,11 @@ public abstract class CMSServlet extends HttpServlet {
authority = sc.getInitParameter(PROP_AUTHORITYID);
}
- if (authority != null)
- mAuthority = (IAuthority)
- CMS.getSubsystem(authority);
+ if (authority != null) {
+ mAuthority = (IAuthority) CMS.getSubsystem(authority);
+ if (mAuthority instanceof ICertificateAuthority)
+ certAuthority = (ICertificateAuthority) mAuthority;
+ }
if (mAuthority != null)
mRequestQueue = mAuthority.getRequestQueue();