summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-11-17 11:52:24 -0500
committerAdam Young <ayoung@redhat.com>2011-12-22 16:39:30 -0500
commitfd669390a16a0bce341df685c990f3159df11d53 (patch)
tree7be051a021fe74773a081a48dd3a10789b75780e /pki/base/common/src/com/netscape/cms
parentee93fc8f86eb62d52811ce2458e8ccd12bc1cd20 (diff)
downloadpki-fd669390a16a0bce341df685c990f3159df11d53.tar.gz
pki-fd669390a16a0bce341df685c990f3159df11d53.tar.xz
pki-fd669390a16a0bce341df685c990f3159df11d53.zip
type safety for certserv.authorization
Diffstat (limited to 'pki/base/common/src/com/netscape/cms')
-rw-r--r--pki/base/common/src/com/netscape/cms/authorization/AAclAuthz.java52
-rw-r--r--pki/base/common/src/com/netscape/cms/authorization/DirAclAuthz.java7
2 files changed, 30 insertions, 29 deletions
diff --git a/pki/base/common/src/com/netscape/cms/authorization/AAclAuthz.java b/pki/base/common/src/com/netscape/cms/authorization/AAclAuthz.java
index c3b0a8535..0bb36f288 100644
--- a/pki/base/common/src/com/netscape/cms/authorization/AAclAuthz.java
+++ b/pki/base/common/src/com/netscape/cms/authorization/AAclAuthz.java
@@ -72,17 +72,17 @@ public abstract class AAclAuthz {
private IConfigStore mConfig = null;
- private Hashtable mACLs = new Hashtable();
- private Hashtable mEvaluators = new Hashtable();
+ private Hashtable<String, ACL> mACLs = new Hashtable<String, ACL>();
+ private Hashtable<String, IAccessEvaluator> mEvaluators = new Hashtable<String, IAccessEvaluator>();
private ILogger mLogger = null;
/* Vector of extendedPluginInfo strings */
- protected static Vector mExtendedPluginInfo = null;
+ protected static Vector<String> mExtendedPluginInfo = null;
protected static String[] mConfigParams = null;
static {
- mExtendedPluginInfo = new Vector();
+ mExtendedPluginInfo = new Vector<String>();
}
/**
@@ -108,7 +108,7 @@ public abstract class AAclAuthz {
IConfigStore i = evalConfig.getSubStore(PROP_IMPL);
IAccessEvaluator evaluator = null;
- Enumeration mImpls = i.getSubStoreNames();
+ Enumeration<String> mImpls = i.getSubStoreNames();
while (mImpls.hasMoreElements()) {
String type = (String) mImpls.nextElement();
@@ -181,11 +181,11 @@ public abstract class AAclAuthz {
return (ACL) mACLs.get(target);
}
- protected Enumeration getTargetNames() {
+ protected Enumeration<String> getTargetNames() {
return mACLs.keys();
}
- public Enumeration getACLs() {
+ public Enumeration<ACL> getACLs() {
return mACLs.elements();
}
@@ -343,7 +343,7 @@ public abstract class AAclAuthz {
return false;
}
- Enumeration e = acl.entries();
+ Enumeration<ACLEntry> e = acl.entries();
if ((e == null) || (e.hasMoreElements() == false)) {
// no acis for node, pass down to next node
@@ -391,7 +391,7 @@ public abstract class AAclAuthz {
CMS.debug("evaluating expressions: " + s);
- Vector v = new Vector();
+ Vector<Object> v = new Vector<Object>();
while (s.length() > 0) {
int orIndex = s.indexOf("||");
@@ -503,10 +503,10 @@ public abstract class AAclAuthz {
String perm)
throws EACLsException {
- Vector nodev = getNodes(name);
- Enumeration nodes = nodev.elements();
+ Vector<String> nodev = getNodes(name);
+ Enumeration<String> nodes = nodev.elements();
String order = getOrder();
- Enumeration entries = null;
+ Enumeration<ACLEntry> entries = null;
if (order.equals("deny"))
entries = getDenyEntries(nodes, perm);
@@ -567,11 +567,11 @@ public abstract class AAclAuthz {
}
}
- protected Enumeration getAllowEntries(Enumeration nodes, String operation) {
+ protected Enumeration<ACLEntry> getAllowEntries(Enumeration<String> nodes, String operation) {
String name = "";
ACL acl = null;
- Enumeration e = null;
- Vector v = new Vector();
+ Enumeration<ACLEntry> e = null;
+ Vector<ACLEntry> v = new Vector<ACLEntry>();
while (nodes.hasMoreElements()) {
name = (String) nodes.nextElement();
@@ -592,11 +592,11 @@ public abstract class AAclAuthz {
return v.elements();
}
- protected Enumeration getDenyEntries(Enumeration nodes, String operation) {
+ protected Enumeration<ACLEntry> getDenyEntries(Enumeration<String> nodes, String operation) {
String name = "";
ACL acl = null;
- Enumeration e = null;
- Vector v = new Vector();
+ Enumeration<ACLEntry> e = null;
+ Vector<ACLEntry> v = new Vector<ACLEntry>();
while (nodes.hasMoreElements()) {
name = (String) nodes.nextElement();
@@ -605,7 +605,7 @@ public abstract class AAclAuthz {
continue;
e = acl.entries();
while (e.hasMoreElements()) {
- ACLEntry entry = (ACLEntry) e.nextElement();
+ ACLEntry entry = e.nextElement();
if (entry.isNegative() &&
entry.containPermission(operation)) {
@@ -628,7 +628,7 @@ public abstract class AAclAuthz {
// XXX - could use some optimization ... later
CMS.debug("evaluating expressions: " + s);
- Vector v = new Vector();
+ Vector<Object> v = new Vector<Object>();
while (s.length() > 0) {
int orIndex = s.indexOf("||");
@@ -688,9 +688,9 @@ public abstract class AAclAuthz {
return left;
}
- public Vector getNodes(String resourceID) {
- Enumeration parents = getTargetNames();
- Vector v = new Vector();
+ public Vector<String> getNodes(String resourceID) {
+ Enumeration<String> parents = getTargetNames();
+ Vector<String> v = new Vector<String>();
if (resourceID != null && !resourceID.equals("")) {
v.addElement(resourceID);
@@ -808,7 +808,7 @@ public abstract class AAclAuthz {
* gets an enumeration of resources
* @return an enumeration of resources contained in the ACL table
*/
- public Enumeration aclResElements() {
+ public Enumeration<ACL> aclResElements() {
return (mACLs.elements());
}
@@ -816,7 +816,7 @@ public abstract class AAclAuthz {
* gets an enumeration of access evaluators
* @return an enumeraton of access evaluators
*/
- public Enumeration aclEvaluatorElements() {
+ public Enumeration<IAccessEvaluator> aclEvaluatorElements() {
return (mEvaluators.elements());
}
@@ -824,7 +824,7 @@ public abstract class AAclAuthz {
* gets the access evaluators
* @return handle to the access evaluators table
*/
- public Hashtable getAccessEvaluators() {
+ public Hashtable<String, IAccessEvaluator> getAccessEvaluators() {
return mEvaluators;
}
diff --git a/pki/base/common/src/com/netscape/cms/authorization/DirAclAuthz.java b/pki/base/common/src/com/netscape/cms/authorization/DirAclAuthz.java
index ee22bb592..820bf97bf 100644
--- a/pki/base/common/src/com/netscape/cms/authorization/DirAclAuthz.java
+++ b/pki/base/common/src/com/netscape/cms/authorization/DirAclAuthz.java
@@ -164,10 +164,11 @@ public class DirAclAuthz extends AAclAuthz
LDAPEntry entry = (LDAPEntry) res.nextElement();
LDAPAttribute aclRes = entry.getAttribute("resourceACLS");
- Enumeration en = aclRes.getStringValues();
+ @SuppressWarnings("unchecked")
+ Enumeration<String> en = (Enumeration<String> )aclRes.getStringValues();
for (; en != null && en.hasMoreElements();) {
- addACLs((String) en.nextElement());
+ addACLs(en.nextElement());
}
} else {
log(ILogger.LL_INFO, "ldap search found no cn=aclResources");
@@ -295,7 +296,7 @@ public class DirAclAuthz extends AAclAuthz
LDAPAttribute attrs = new LDAPAttribute("resourceACLS");
LDAPModificationSet mod = new LDAPModificationSet();
- Enumeration en = aclResElements();
+ Enumeration<ACL> en = aclResElements();
if (en.hasMoreElements() == true) {
while (en.hasMoreElements()) {