import edu.internet2.middleware.shibboleth.aa.attrresolv.ResolutionPlugInException;
/**
- * <code>DataConnectorPlugIn</code> implementation that utilizes a user specified JNDI
+ * <code>DataConnectorPlugIn</code> implementation that utilizes a user-specified JNDI
* <code>DirContext</code> to retrieve attribute data.
*
* @author Walter Hoehn (wassa@columbia.edu)
protected Properties properties;
protected SearchControls controls;
+ /**
+ * Constructs a DataConnector based on DOM configuration.
+ *
+ * @param e a <JNDIDirectoryDataConnector /> DOM Element as specified by
+ * urn:mace:shibboleth:resolver:1.0
+ *
+ * @throws ResolutionPlugInException if the PlugIn cannot be initialized
+ */
public JNDIDirectoryDataConnector(Element e) throws ResolutionPlugInException {
super(e);
throw new ResolutionPlugInException("Property is malformed.");
}
}
+
+ //Fail-fast connection test
InitialDirContext context = null;
try {
context = new InitialDirContext(properties);
log.debug("JNDI Directory context activated.");
-
+
} catch (NamingException e1) {
log.error("Failed to startup directory context: " + e1);
throw new ResolutionPlugInException("Failed to startup directory context.");
}
}
+ /**
+ * Create JNDI search controls based on DOM configuration
+ * @param searchNode a <Controls /> DOM Element as specified by
+ * urn:mace:shibboleth:resolver:1.0
+ */
protected void defineSearchControls(Element searchNode) {
controls = new SearchControls();
String timeLimitSpec = ((Element) controlNodes.item(0)).getAttribute("timeLimit");
if (timeLimitSpec != null && !timeLimitSpec.equals("")) {
try {
- System.err.println("hey");
controls.setTimeLimit(Integer.parseInt(timeLimitSpec));
} catch (NumberFormatException nfe) {
log.error("Control spec included an invalid (timeLimit) attribute value.");
try {
context = new InitialDirContext(properties);
NamingEnumeration enum = null;
-
try {
enum = context.search("", searchFilter.replaceAll("%PRINCIPAL%", principal.getName()), controls);
} catch (CommunicationException e) {