Do a lookup with a service manager:
manager.lookup(org.apache.avalon.excalibur.datasource.DataSourceComponen
t.ROLE + "Selector");
But I don't have a reference to the service manager, at least I don't know
how to get it. Here is MyAuthenticator class code:
public class MyAuthenticator implements Authenticator {
public AuthenticationResult authenticate(
HandlerConfiguration configuration, SourceParameters parameters)
throws ProcessingException {
String userID = parameters.getParameter("userid");
String password = parameters.getParameter("password");
Connection conn = null;
CallableStatement cstmt = null;
ResultSet rs = null;
try {
// here comes the SQL query
if( /* wrong credentials */ )
return new AuthenticationResult(false, null);
} finally {
try{
if(rs != null)rs.close();
if(cstmt != null)cstmt.close();
if(conn != null)conn.close();
} catch(Exception e) {
// getLogger().error("Could not close DB connection",
e);
}
}
// Create authentication XML tree
Document doc = DOMUtil.createDocument();
Element authElement = doc.createElementNS(null, "authentication");
Element idElement = doc.createElementNS(null, "ID");
Text text = doc.createTextNode(userID);
idElement.appendChild(text);
authElement.appendChild(idElement);
doc.appendChild(authElement);
return new AuthenticationResult(true, doc);
}
public void logout(UserHandler userHandler) {
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]