Skip to content

Commit

Permalink
auth with userDB in IndexMonitor
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1243 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
allo committed Dec 22, 2005
1 parent 395626d commit f2f8867
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion htroot/IndexMonitor.java
Expand Up @@ -43,6 +43,7 @@
// javac -classpath .:../Classes Settings_p.java
// if the shell's current path is HTROOT

import de.anomic.data.userDB;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCodings;
Expand Down Expand Up @@ -80,14 +81,15 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
(post.containsKey("clearlist")) ||
(post.containsKey("deleteentry"))) {
String authorization = ((String) header.get("Authorization", "xxxxxx")).trim().substring(6);
userDB.Entry entry = switchboard.userDB.proxyAuth(authorization);
if (authorization.length() == 0) {
// force log-in
prop.put("AUTHENTICATE", "admin log-in");
return prop;
}
String adminAccountBase64MD5 = switchboard.getConfig("adminAccountBase64MD5", "");
boolean authenticated = (adminAccountBase64MD5.equals(serverCodings.encodeMD5Hex(authorization)));
if (!authenticated) {
if (!authenticated && !entry.hasAdminRight()) {
// force log-in (again, because wrong password was given)
prop.put("AUTHENTICATE", "admin log-in");
return prop;
Expand Down

0 comments on commit f2f8867

Please sign in to comment.