From 89fc4a570cf646ffc5c76145bd24794d299eafe8 Mon Sep 17 00:00:00 2001 From: car031 Date: Thu, 23 Jan 2025 15:50:50 +0100 Subject: [PATCH] fixed admin authentication provider --- .../security/spring/AdminAuthenticationProvider.java | 12 +++++++++--- logicaldoc-gui/war/login.jsp | 5 ++--- logicaldoc-gui/war/skin-Shiva/style.css | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/logicaldoc-core/src/main/java/com/logicaldoc/core/security/spring/AdminAuthenticationProvider.java b/logicaldoc-core/src/main/java/com/logicaldoc/core/security/spring/AdminAuthenticationProvider.java index 416d9e673..8436dd25a 100644 --- a/logicaldoc-core/src/main/java/com/logicaldoc/core/security/spring/AdminAuthenticationProvider.java +++ b/logicaldoc-core/src/main/java/com/logicaldoc/core/security/spring/AdminAuthenticationProvider.java @@ -1,5 +1,6 @@ package com.logicaldoc.core.security.spring; +import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collection; @@ -50,6 +51,11 @@ public Authentication authenticate(Authentication authentication) throws Authent User user = new User(); user.setUsername(ADMIN); + try { + user.setDecodedPassword(String.valueOf(auth.getCredentials())); + } catch (NoSuchAlgorithmException e) { + log.error(e.getMessage(), e); + } UserDAO uDao = Context.get(UserDAO.class); @@ -62,7 +68,7 @@ public Authentication authenticate(Authentication authentication) throws Authent long userId = uDao.queryForLong("select ld_id from ld_user where ld_username='admin' and ld_deleted=0"); dbAvailable = userId == 1L; } catch (Exception t) { - // Noting to do + log.error(t.getMessage(), t); } String adminPasswd = null; @@ -73,7 +79,7 @@ public Authentication authenticate(Authentication authentication) throws Authent adminPasswd = uDao .queryForString("select ld_password from ld_user where ld_username='admin' and ld_deleted=0"); } catch (Exception t) { - // Noting to do + log.error(t.getMessage(), t); } } else { // If the database is not available, get the password from the @@ -82,7 +88,7 @@ public Authentication authenticate(Authentication authentication) throws Authent ContextProperties config = Context.get().getProperties(); adminPasswd = config.getProperty("adminpasswd"); } catch (Exception t) { - // Noting to do + log.error(t.getMessage(), t); } } diff --git a/logicaldoc-gui/war/login.jsp b/logicaldoc-gui/war/login.jsp index 10eb473ed..733402fff 100644 --- a/logicaldoc-gui/war/login.jsp +++ b/logicaldoc-gui/war/login.jsp @@ -7,7 +7,6 @@ <%! static String LOGIN_PAGE="login.jsp"; %> <%@ include file="header.jsp" %> <%@ include file="detectmobile.jsp" %> -