Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
upd to Jetty 9.4.6.v20170531 Modify loginservice to the changes in Jetty, partially based on pull request #101 https://github.com/yacy/yacy_search_server/pull/101 bu @automenta
regere6e20dab5279
diff --git a/.classpath b/.classpathindex a3944fe8a..d6db524d1 100644--- a/.classpath+++ b/.classpath@@ -45,20 +45,20 @@<classpathentry kind="lib" path="lib/commons-io-2.5.jar"/><classpathentry kind="lib" path="lib/slf4j-api-1.7.24.jar"/><classpathentry kind="lib" path="lib/chardet.jar"/>- <classpathentry kind="lib" path="lib/jetty-client-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-continuation-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-deploy-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-http-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-io-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-jmx-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-proxy-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-security-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-server-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-servlet-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-servlets-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-util-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-webapp-9.2.21.v20170120.jar"/>- <classpathentry kind="lib" path="lib/jetty-xml-9.2.21.v20170120.jar"/>+ <classpathentry kind="lib" path="lib/jetty-client-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-continuation-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-deploy-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-http-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-io-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-jmx-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-proxy-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-security-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-server-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-servlet-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-servlets-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-util-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-webapp-9.4.6.v20170531.jar"/>+ <classpathentry kind="lib" path="lib/jetty-xml-9.4.6.v20170531.jar"/><classpathentry kind="lib" path="lib/httpclient-4.5.3.jar"/><classpathentry kind="lib" path="lib/httpmime-4.5.3.jar"/><classpathentry kind="lib" path="lib/noggit-0.6.jar"/>diff --git a/build.xml b/build.xmlindex 0df47f6e4..635b068cb 100644--- a/build.xml+++ b/build.xml@@ -202,20 +202,20 @@<pathelement location="${lib}/javax.servlet-api-3.1.0.jar" /><pathelement location="${lib}/jcifs-1.3.17.jar" /><pathelement location="${lib}/jcl-over-slf4j-1.7.24.jar" />- <pathelement location="${lib}/jetty-client-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-continuation-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-deploy-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-http-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-io-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-jmx-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-proxy-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-security-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-server-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-servlet-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-servlets-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-util-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-webapp-9.2.21.v20170120.jar" />- <pathelement location="${lib}/jetty-xml-9.2.21.v20170120.jar" />+ <pathelement location="${lib}/jetty-client-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-continuation-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-deploy-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-http-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-io-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-jmx-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-proxy-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-security-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-server-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-servlet-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-servlets-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-util-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-webapp-9.4.6.v20170531.jar" />+ <pathelement location="${lib}/jetty-xml-9.4.6.v20170531.jar" /><pathelement location="${lib}/jsch-0.1.54.jar" /><pathelement location="${lib}/json-simple-1.1.1.jar" /><pathelement location="${lib}/jsonic-1.2.0.jar" />diff --git a/htroot/ConfigUser_p.java b/htroot/ConfigUser_p.javaindex 4572a1ae4..134b1bf16 100644--- a/htroot/ConfigUser_p.java+++ b/htroot/ConfigUser_p.java@@ -25,6 +25,7 @@ import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.util.ConcurrentLog;import net.yacy.data.UserDB;import net.yacy.data.UserDB.AccessRight;+import net.yacy.http.Jetty9HttpServerImpl;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;import net.yacy.server.serverObjects;@@ -153,7 +154,8 @@ public class ConfigUser_p {} catch (final Exception e) {ConcurrentLog.logException(e);}-+ Jetty9HttpServerImpl jhttpserver = (Jetty9HttpServerImpl) sb.getHttpServer();+ jhttpserver.resetUser(entry.getUserName());} else {prop.put("error", "1");}@@ -163,6 +165,8 @@ public class ConfigUser_p {prop.putHTML("username", username);} else if (post.containsKey("delete")) {sb.userDB.removeEntry(post.get("username"));+ Jetty9HttpServerImpl jhttpserver = (Jetty9HttpServerImpl) sb.getHttpServer();+ jhttpserver.removeUser(post.get("username"));prop.put(serverObjects.ACTION_LOCATION, "ConfigAccountList_p.html"); // jump back to user list}diff --git a/lib/jetty-client-9.2.21.v20170120.jar b/lib/jetty-client-9.2.21.v20170120.jardeleted file mode 100644index 40ab95909..000000000Binary files a/lib/jetty-client-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-client-9.4.6.v20170531.jar b/lib/jetty-client-9.4.6.v20170531.jarnew file mode 100644index 000000000..8ff920208Binary files /dev/null and b/lib/jetty-client-9.4.6.v20170531.jar differdiff --git a/lib/jetty-continuation-9.2.21.v20170120.jar b/lib/jetty-continuation-9.2.21.v20170120.jardeleted file mode 100644index 4aac6404c..000000000Binary files a/lib/jetty-continuation-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-continuation-9.4.6.v20170531.jar b/lib/jetty-continuation-9.4.6.v20170531.jarnew file mode 100644index 000000000..fb572848eBinary files /dev/null and b/lib/jetty-continuation-9.4.6.v20170531.jar differdiff --git a/lib/jetty-deploy-9.2.21.v20170120.jar b/lib/jetty-deploy-9.2.21.v20170120.jardeleted file mode 100644index d535a6b2e..000000000Binary files a/lib/jetty-deploy-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-deploy-9.4.6.v20170531.jar b/lib/jetty-deploy-9.4.6.v20170531.jarnew file mode 100644index 000000000..6b2759351Binary files /dev/null and b/lib/jetty-deploy-9.4.6.v20170531.jar differdiff --git a/lib/jetty-http-9.2.21.v20170120.jar b/lib/jetty-http-9.2.21.v20170120.jardeleted file mode 100644index 507952734..000000000Binary files a/lib/jetty-http-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-http-9.4.6.v20170531.jar b/lib/jetty-http-9.4.6.v20170531.jarnew file mode 100644index 000000000..db4c0b89eBinary files /dev/null and b/lib/jetty-http-9.4.6.v20170531.jar differdiff --git a/lib/jetty-io-9.2.21.v20170120.jar b/lib/jetty-io-9.2.21.v20170120.jardeleted file mode 100644index 5eafefc7c..000000000Binary files a/lib/jetty-io-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-io-9.4.6.v20170531.jar b/lib/jetty-io-9.4.6.v20170531.jarnew file mode 100644index 000000000..170c6711aBinary files /dev/null and b/lib/jetty-io-9.4.6.v20170531.jar differdiff --git a/lib/jetty-jmx-9.2.21.v20170120.jar b/lib/jetty-jmx-9.2.21.v20170120.jardeleted file mode 100644index 5f11c2fd4..000000000Binary files a/lib/jetty-jmx-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-jmx-9.4.6.v20170531.jar b/lib/jetty-jmx-9.4.6.v20170531.jarnew file mode 100644index 000000000..6dd99d777Binary files /dev/null and b/lib/jetty-jmx-9.4.6.v20170531.jar differdiff --git a/lib/jetty-proxy-9.2.21.v20170120.jar b/lib/jetty-proxy-9.2.21.v20170120.jardeleted file mode 100644index b6469d17c..000000000Binary files a/lib/jetty-proxy-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-proxy-9.4.6.v20170531.jar b/lib/jetty-proxy-9.4.6.v20170531.jarnew file mode 100644index 000000000..df606c047Binary files /dev/null and b/lib/jetty-proxy-9.4.6.v20170531.jar differdiff --git a/lib/jetty-security-9.2.21.v20170120.jar b/lib/jetty-security-9.2.21.v20170120.jardeleted file mode 100644index f54d07c38..000000000Binary files a/lib/jetty-security-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-security-9.4.6.v20170531.jar b/lib/jetty-security-9.4.6.v20170531.jarnew file mode 100644index 000000000..e7d0eedacBinary files /dev/null and b/lib/jetty-security-9.4.6.v20170531.jar differdiff --git a/lib/jetty-server-9.2.21.v20170120.jar b/lib/jetty-server-9.2.21.v20170120.jardeleted file mode 100644index 8a4c5fad4..000000000Binary files a/lib/jetty-server-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-server-9.4.6.v20170531.jar b/lib/jetty-server-9.4.6.v20170531.jarnew file mode 100644index 000000000..4772d729fBinary files /dev/null and b/lib/jetty-server-9.4.6.v20170531.jar differdiff --git a/lib/jetty-servlet-9.2.21.v20170120.jar b/lib/jetty-servlet-9.2.21.v20170120.jardeleted file mode 100644index 4fd13be32..000000000Binary files a/lib/jetty-servlet-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-servlet-9.4.6.v20170531.jar b/lib/jetty-servlet-9.4.6.v20170531.jarnew file mode 100644index 000000000..a6138dc64Binary files /dev/null and b/lib/jetty-servlet-9.4.6.v20170531.jar differdiff --git a/lib/jetty-servlets-9.2.21.v20170120.jar b/lib/jetty-servlets-9.2.21.v20170120.jardeleted file mode 100644index c11519c1a..000000000Binary files a/lib/jetty-servlets-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-servlets-9.4.6.v20170531.jar b/lib/jetty-servlets-9.4.6.v20170531.jarnew file mode 100644index 000000000..2387bb312Binary files /dev/null and b/lib/jetty-servlets-9.4.6.v20170531.jar differdiff --git a/lib/jetty-util-9.2.21.v20170120.jar b/lib/jetty-util-9.2.21.v20170120.jardeleted file mode 100644index edf6b9bea..000000000Binary files a/lib/jetty-util-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-util-9.4.6.v20170531.jar b/lib/jetty-util-9.4.6.v20170531.jarnew file mode 100644index 000000000..c24989025Binary files /dev/null and b/lib/jetty-util-9.4.6.v20170531.jar differdiff --git a/lib/jetty-webapp-9.2.21.v20170120.jar b/lib/jetty-webapp-9.2.21.v20170120.jardeleted file mode 100644index a7f7dcd76..000000000Binary files a/lib/jetty-webapp-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-webapp-9.4.6.v20170531.jar b/lib/jetty-webapp-9.4.6.v20170531.jarnew file mode 100644index 000000000..8665d3bf9Binary files /dev/null and b/lib/jetty-webapp-9.4.6.v20170531.jar differdiff --git a/lib/jetty-xml-9.2.21.v20170120.jar b/lib/jetty-xml-9.2.21.v20170120.jardeleted file mode 100644index f82eba9cf..000000000Binary files a/lib/jetty-xml-9.2.21.v20170120.jar and /dev/null differdiff --git a/lib/jetty-xml-9.4.6.v20170531.jar b/lib/jetty-xml-9.4.6.v20170531.jarnew file mode 100644index 000000000..62b47dc5bBinary files /dev/null and b/lib/jetty-xml-9.4.6.v20170531.jar differdiff --git a/lib/jetty-9.2.19.v20160908.License b/lib/jetty.Licensesimilarity index 100%rename from lib/jetty-9.2.19.v20160908.Licenserename to lib/jetty.Licensediff --git a/pom.xml b/pom.xmlindex 3cb733c61..be816c3d2 100644--- a/pom.xml+++ b/pom.xml@@ -36,7 +36,7 @@<!-- the Solr version used in dependency section for all related dependencies --><solr.version>6.6.0</solr.version><!-- the Jetty version used in dependency section for all related dependencies -->- <jetty.version>9.2.21.v20170120</jetty.version>+ <jetty.version>9.4.6.v20170531</jetty.version><!-- properties used for filtering yacyBuildProperties.java --><REPL_DATE>${DSTAMP}</REPL_DATE>diff --git a/source/net/yacy/http/Jetty9HttpServerImpl.java b/source/net/yacy/http/Jetty9HttpServerImpl.javaindex 4571cb34e..942ae52d9 100644--- a/source/net/yacy/http/Jetty9HttpServerImpl.java+++ b/source/net/yacy/http/Jetty9HttpServerImpl.java@@ -340,7 +340,9 @@ public class Jetty9HttpServerImpl implements YaCyHttpServer {Jetty9YaCySecurityHandler hx = this.server.getChildHandlerByClass(Jetty9YaCySecurityHandler.class);if (hx != null) {YaCyLoginService loginservice = (YaCyLoginService) hx.getLoginService();- loginservice.loadUser(username);+ if (loginservice.removeUser(username)) { // remove old credential from cache+ loginservice.loadUserInfo(username);+ }}}diff --git a/source/net/yacy/http/MonitorHandler.java b/source/net/yacy/http/MonitorHandler.javaindex 8a7d22f63..e5b0c2acc 100644--- a/source/net/yacy/http/MonitorHandler.java+++ b/source/net/yacy/http/MonitorHandler.java@@ -59,7 +59,7 @@ public class MonitorHandler extends AbstractHandler {final ConnectionInfo info = new ConnectionInfo(baseRequest.getScheme(),baseRequest.getRemoteAddr() + ":" + baseRequest.getRemotePort(),- baseRequest.getMethod() + " " + baseRequest.getUri().getPathAndParam(),+ baseRequest.getMethod() + " " + baseRequest.getHttpURI().getPathQuery(),connection.hashCode(),baseRequest.getTimeStamp(),-1);diff --git a/source/net/yacy/http/YaCyLegacyCredential.java b/source/net/yacy/http/YaCyLegacyCredential.javaindex 13c217002..cb2f3785a 100644--- a/source/net/yacy/http/YaCyLegacyCredential.java+++ b/source/net/yacy/http/YaCyLegacyCredential.java@@ -87,7 +87,7 @@ public class YaCyLegacyCredential extends Credential {}// normal users (and new admin pwd) for BASIC auth- if (hash.startsWith(MD5.__TYPE) && hash != null) {+ if (hash.startsWith("MD5:") && hash != null) {boolean success = (Digest.encodeMD5Hex(foruser + ":" + Switchboard.getSwitchboard().getConfig(SwitchboardConstants.ADMIN_REALM,"YaCy")+":" + pw).equals(hash.substring(4)));// exception: allow the hash as pwd (used in bin/apicall.sh)if (!success && foruser.equals(Switchboard.getSwitchboard().getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin"))) {diff --git a/source/net/yacy/http/YaCyLoginService.java b/source/net/yacy/http/YaCyLoginService.javaindex 998e73b98..cbcd1af92 100644--- a/source/net/yacy/http/YaCyLoginService.java+++ b/source/net/yacy/http/YaCyLoginService.java@@ -2,7 +2,7 @@// YaCyLoginService// Copyright 2011 by Florian Richter// First released 16.04.2011 at http://yacy.net-//+//// $LastChangedDate$// $LastChangedRevision$// $LastChangedBy$@@ -11,12 +11,12 @@// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2.1 of the License, or (at your option) any later version.-//+//// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details.-//+//// You should have received a copy of the GNU Lesser General Public License// along with this program in the file lgpl21.txt// If not, see <http://www.gnu.org/licenses/>.@@ -24,68 +24,118 @@package net.yacy.http;-import java.io.IOException;import java.util.ArrayList;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.AbstractLoginService;+import org.eclipse.jetty.security.HashLoginService;import org.eclipse.jetty.security.LoginService;-import org.eclipse.jetty.security.MappedLoginService;+import org.eclipse.jetty.security.UserStore;import org.eclipse.jetty.server.UserIdentity;import org.eclipse.jetty.util.security.Credential;/**- * jetty login service, provides admin and YaCy.UserDB users with role assignment- * with DIGEST auth by default Jetty uses the name of the loginSevice as realmname (which is part of all password hashes)+ * jetty login service, provides admin and YaCy.UserDB users with role+ * assignment with DIGEST auth by default Jetty uses the name of the loginSevice+ * as realmname (which is part of all password hashes)*/-public class YaCyLoginService extends MappedLoginService implements LoginService {+public class YaCyLoginService extends HashLoginService implements LoginService {++ private UserStore _userStore; // user cache for known/authenticated users++ /**+ * Initialize a user cache+ * @throws Exception+ */+ @Override+ protected void doStart() throws Exception {+ _userStore = new UserStore();+ this.setUserStore(_userStore);+ super.doStart();+ }++ /**+ * Free space used by user cache+ * @throws Exception+ */+ @Override+ protected void doStop() throws Exception {+ super.doStop();+ if (_userStore != null) {+ _userStore.stop();+ _userStore = null;+ }+ }+ /**+ * Load the user from cache (of authenticated users) or from the YaCy user db+ * @param username+ * @return known user or null+ */@Override- protected UserIdentity loadUser(String username) {- if (username == null || username.isEmpty()) return null; // quick exit+ protected AbstractLoginService.UserPrincipal loadUserInfo(String username) {+ if (username == null || username.isEmpty()) {+ return null; // quick exit+ }- final Switchboard sb = Switchboard.getSwitchboard();- String adminuser = sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin");- Credential credential = null;- String[] roles = null;- if (username.equals(adminuser)) {- final String adminAccountBase64MD5 = sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, "");- // in YaCy the credential hash is composed of username:pwd so the username is needed to create valid credential- // not just the password (as usually in Jetty). As the accountname for the std. adminuser is not stored a useridentity- // is created for current user (and the pwd checked against the stored username:pwd setting)- credential = YaCyLegacyCredential.getCredentialForAdmin(username, adminAccountBase64MD5);- // TODO: YaCy user:pwd hashes should longterm likely be switched to separable username + pwd-hash entries- // and/or the standard admin account username should be fix = "admin"- roles = new String[]{AccessRight.ADMIN_RIGHT.toString()};- } else {- Entry user = sb.userDB.getEntry(username);- if (user != null && user.getMD5EncodedUserPwd() != null) {- // assigning roles from userDB- ArrayList<String> roletmp = new ArrayList<String>();- for (final AccessRight right : AccessRight.values()) {- if (user.hasRight(right)) {- roletmp.add(right.toString());+ AbstractLoginService.UserPrincipal theUser = super.loadUserInfo(username); // load from cache (the internal _userStore)+ if (theUser == null) {+ final Switchboard sb = Switchboard.getSwitchboard();+ String adminuser = sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin");+ Credential credential = null;+ String[] roles = null;+ if (username.equals(adminuser)) {+ final String adminAccountBase64MD5 = sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, "");+ // in YaCy the credential hash is composed of username:pwd so the username is needed to create valid credential+ // not just the password (as usually in Jetty). As the accountname for the std. adminuser is not stored a useridentity+ // is created for current user (and the pwd checked against the stored username:pwd setting)+ credential = YaCyLegacyCredential.getCredentialForAdmin(username, adminAccountBase64MD5);+ // TODO: YaCy user:pwd hashes should longterm likely be switched to separable username + pwd-hash entries+ // and/or the standard admin account username should be fix = "admin"+ roles = new String[]{AccessRight.ADMIN_RIGHT.toString()};+ } else {+ Entry user = sb.userDB.getEntry(username);+ if (user != null && user.getMD5EncodedUserPwd() != null) {+ // assigning roles from userDB+ ArrayList<String> roletmp = new ArrayList<String>();+ for (final AccessRight right : AccessRight.values()) {+ if (user.hasRight(right)) {+ roletmp.add(right.toString());+ }}+ if (roletmp.size() > 0) {+ roles = roletmp.toArray(new String[roletmp.size()]);+ }+ credential = YaCyLegacyCredential.getCredentialForUserDB(username, user.getMD5EncodedUserPwd());}- if (roletmp.size() > 0) roles = roletmp.toArray(new String[roletmp.size()]);- credential = YaCyLegacyCredential.getCredentialForUserDB(username, user.getMD5EncodedUserPwd());}- }- if (credential != null) {- if (roles != null) {- return putUser(username, credential, roles);+ if (credential != null) { // if credential exist, user is known, create or get info+ theUser = new AbstractLoginService.UserPrincipal(username, credential);+ _userStore.addUser(username, credential, roles); // add to jetty user cache+ _userStore.getUserIdentity(username).getUserPrincipal();+ theUser.authenticate(credential);}- return putUser(username, credential); // w/o role makes not much sense, but succeeds login....}- return null;+ return theUser;}- @Override- protected void loadUsers() throws IOException {- // don't load any users into MappedLoginService on startup- // we use loadUser for dynamic checking+ /**+ * Delete a user from the internal cache. If user found in cache user is+ * loged out before delete.+ * @param username+ * @return true if user deleted, if not found in user cache false+ */+ public boolean removeUser(String username) {+ UserIdentity uid = _userStore.getUserIdentity(username);+ if (uid != null) {+ logout(uid);+ _userStore.removeUser(username);+ return true;+ }+ return false;}-}+}\ No newline at end of file