Skip to content

Commit

Permalink
passwordAuth
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1138 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
allo committed Nov 28, 2005
1 parent edaa820 commit b86d108
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions source/de/anomic/data/userDB.java
Expand Up @@ -162,7 +162,7 @@ public Entry proxyAuth(String auth) {
}catch(StringIndexOutOfBoundsException e){} //no valid Base64
String[] tmp=auth.split(":");
if(tmp.length == 2){
entry=this.getEntry(tmp[0]);
/*entry=this.getEntry(tmp[0]);
if( entry != null && entry.getMD5EncodedUserPwd().equals(serverCodings.encodeMD5Hex(auth)) ){
if(entry.isLoggedOut()){
try{
Expand All @@ -171,13 +171,17 @@ public Entry proxyAuth(String auth) {
return null;
}
return entry;
*/
entry=this.passwordAuth(tmp[0], tmp[1]);
if(entry != null){
//return entry;
}else{ //wrong/no auth, so auth is removed from browser
/*FIXME: This cannot work
try{
entry.setProperty(Entry.LOGGED_OUT, "false");
}catch(IOException e){}
*/
}catch(IOException e){}*/
}
return entry;
}
return null;
}
Expand Down Expand Up @@ -212,6 +216,19 @@ public Entry ipAuth(String ip) {
return null;
}
}
public Entry passwordAuth(String user, String password){
Entry entry=this.getEntry(user);
if( entry != null && entry.getMD5EncodedUserPwd().equals(serverCodings.encodeMD5Hex(user+":"+password)) ){
if(entry.isLoggedOut()){
try{
entry.setProperty(Entry.LOGGED_OUT, "false");
}catch(IOException e){}
return null;
}
}
return entry;

}

public class Entry {
public static final String MD5ENCODED_USERPWD_STRING = "MD5_user:pwd";
Expand Down

0 comments on commit b86d108

Please sign in to comment.