set a realm message to log-in input window which explains that a

password for the account 'admin' can be (re-)set with the script
bin/passwd.sh
pull/1/head
Michael Peter Christen 11 years ago
parent 7005ecdabd
commit ed06b5b94b

@ -211,11 +211,10 @@ public class WorkTables extends Tables {
/**
* execute an API call using a api table row which contains all essentials
* to access the server also the host, port and the authentication realm must be given
* to access the server also the host and port must be given
* @param pks a collection of primary keys denoting the rows in the api table
* @param host the host where the api shall be called
* @param port the port on the host
* @param realm authentification realm
* @return a map of the called urls and the http status code of the api call or -1 if any other IOException occurred
*/
public Map<String, Integer> execAPICalls(String host, int port, Collection<String> pks) {

@ -33,6 +33,7 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.security.KeyStore;
import java.util.Enumeration;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
@ -44,6 +45,7 @@ import net.yacy.http.servlets.YaCyProxyServlet;
import net.yacy.search.Switchboard;
import net.yacy.utils.PKCS12Tool;
import org.eclipse.jetty.security.LoginService;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
@ -133,10 +135,10 @@ public class Jetty8HttpServerImpl implements YaCyHttpServer {
// wrap all handlers by security handler
Jetty8YaCySecurityHandler securityHandler = new Jetty8YaCySecurityHandler();
securityHandler.setLoginService(new YaCyLoginService());
securityHandler.setRealmName("YaCy Admin Interface");
LoginService loginService = new YaCyLoginService();
securityHandler.setLoginService(loginService);
securityHandler.setRealmName(loginService.getName());
securityHandler.setHandler(new CrashProtectionHandler(allrequesthandlers));
server.setHandler(securityHandler);
}

@ -28,13 +28,14 @@ import java.io.IOException;
import java.security.Principal;
import javax.security.auth.Subject;
import net.yacy.data.UserDB.AccessRight;
import net.yacy.data.UserDB.Entry;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import org.eclipse.jetty.security.IdentityService;
import org.eclipse.jetty.security.LoginService;
import org.eclipse.jetty.security.MappedLoginService;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.security.Credential;
@ -42,11 +43,16 @@ import org.eclipse.jetty.util.security.Credential;
/**
* jetty login service, provides one admin user
*/
public class YaCyLoginService extends MappedLoginService {
public class YaCyLoginService extends MappedLoginService implements LoginService {
@Override
protected UserIdentity loadUser(String username) {
public String getName() {
return "YaCy 'admin' Account (reset your password with bin/passwd.sh <new password>)";
}
@Override
protected UserIdentity loadUser(String username) {
// TODO: implement legacy credentials
final Switchboard sb = Switchboard.getSwitchboard();
String adminuser = sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin");

Loading…
Cancel
Save