Commit a59f98bf authored by Gabriel Guardincerri's avatar Gabriel Guardincerri Committed by gguardin

Create CSAuthProvider to integrate with Clearspace. JM-1224

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@9941 b35dd754-fafc-0310-a699-88a17e54d16e
parent 0f631067
......@@ -11,34 +11,52 @@ package org.jivesoftware.openfire.clearspace;
import org.jivesoftware.openfire.auth.AuthProvider;
import org.jivesoftware.openfire.auth.UnauthorizedException;
import static org.jivesoftware.openfire.clearspace.ClearspaceManager.HttpType.GET;
import org.jivesoftware.openfire.user.UserNotFoundException;
/**
* @author Daniel Henninger
*/
public class ClearspaceAuthProvider implements AuthProvider {
protected static final String URL_PREFIX = "permissionService/";
private ClearspaceManager manager;
public ClearspaceAuthProvider() {
// gets the manager
manager = ClearspaceManager.getInstance();
}
public boolean isPlainSupported() {
return true;
}
public boolean isDigestSupported() {
return true;
return false;
}
public void authenticate(String username, String password) throws UnauthorizedException {
// Nothing
try {
String path = URL_PREFIX + "authenticate/" + username + "/" + password;
manager.executeRequest(GET, path);
} catch (UnauthorizedException ue) {
throw ue;
} catch (Exception e) {
// It is not supported exception, wrap it into an UnsupportedOperationException
throw new UnsupportedOperationException("Unexpected error", e);
}
}
public void authenticate(String username, String token, String digest) throws UnauthorizedException {
// Nothing
throw new UnsupportedOperationException("Digest not supported");
}
public String getPassword(String username) throws UserNotFoundException, UnsupportedOperationException {
return (username.equals("admin") ? "test" : "asdasdasdasd");
throw new UnsupportedOperationException("Password retrieval not supported");
}
public void setPassword(String username, String password) throws UserNotFoundException, UnsupportedOperationException {
// Nothing
throw new UnsupportedOperationException("Change Password not supported");
}
public boolean supportsPasswordRetrieval() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment