Hi everybody,
Currently i’'m trying to create my own class to authnticate users via a XML-RPC webservice.
I use MySQLfor the data storage.
I want to keep MySQL as storage, but not to authenticate users (except for the admin user).
So i read the documentation and i developped a class that implements AuthProvider interface.
Here is the code :
package org.jivesoftware.wildfire.auth;
import java.io.*;
import java.util.Vector;
import java.net.URL;
import org.apache.xmlrpc.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcException;
import org.jivesoftware.util.Log;
/**
-
Default AuthProvider implementation. It authenticates against the jiveUser
-
database table and supports plain text and digest authentication.
-
Because each call to authenticate() makes a database connection, the
-
results of authentication should be cached whenever possible.
- @author Matt Tucker
*/
public class XMLRPCAuthProvider implements AuthProvider {
private static final String SERVERURL =
"http://localhost:8080/";
public void authenticate(String username, String password) throws UnauthorizedException {
if (username == null || password == null) {
throw new UnauthorizedException();
}
username = username.trim().toLowerCase();
try {
XmlRpcClient client = new XmlRpcClient(SERVERURL);
Vector params = new Vector();
params.addElement( username );
params.addElement( password );
Vector result = (Vector) client.execute(“login”, params);
Object[] finalresult = result.toArray();
if (finalresult[0].toString() == “true”) {
Log.info("user logged: ");
}
else {
throw new UnauthorizedException();
}
}
catch (IOException e) {
Log.error("IO Exception: " + e.getMessage( ));
}
catch (XmlRpcException e) {
Log.error("Exception within XML-RPC: " + e.getMessage( ));
}
}
public void authenticate(String username, String token, String digest)
throws UnauthorizedException
{
throw new UnsupportedOperationException();
}
public boolean isPlainSupported() {
return true;
}
public boolean isDigestSupported() {
return false;
}
}
/codeI test my code in a standalone version and it works. In integrated the code within the wildfire source tree and i compiled wildfire without errors.
I added the following lines into the widlfire.xml config file :
[/code]
But it doesn’'t work, only users coming from MySQL can sign-in.
Maybe i forgot something in the configuration, or i need to modify the MySQL configuration in wildfire.xml.
I need help to understand what i’'m doing wrong …
Thanks in advance.
Message was edited by: ernieball_slinky
Message was edited by: ernieball_slinky
Message was edited by: ernieball_slinky