PMD Issue

This commit is contained in:
pmm
2025-04-24 20:35:57 +05:30
parent 0f45c3e1fd
commit f6483b6522
3 changed files with 10 additions and 6 deletions

View File

@@ -349,14 +349,14 @@ public class RemoteUserAuthenticatorFactory extends BasicHttpAuthenticatorFactor
private boolean shouldUseTimeoutForAdminAccessingAdminConsole(RequiredAuthentication required, boolean isGuest) private boolean shouldUseTimeoutForAdminAccessingAdminConsole(RequiredAuthentication required, boolean isGuest)
{ {
boolean useTimeoutForAdminAccessingAdminConsole = RequiredAuthentication.admin.equals(required) && !isGuest && boolean adminConsoleTimeout = RequiredAuthentication.admin.equals(required) && !isGuest &&
servletReq.getServiceMatch() != null && isAdminConsoleWebScript(servletReq.getServiceMatch().getWebScript()); servletReq.getServiceMatch() != null && isAdminConsoleWebScript(servletReq.getServiceMatch().getWebScript());
if (LOGGER.isTraceEnabled()) if (LOGGER.isTraceEnabled())
{ {
LOGGER.trace("Should ensure that the admins can login with basic auth: " + useTimeoutForAdminAccessingAdminConsole); LOGGER.trace("Should ensure that the admins can login with basic auth: " + adminConsoleTimeout);
} }
return useTimeoutForAdminAccessingAdminConsole; return adminConsoleTimeout;
} }
private boolean shouldUseTimeoutForAdminAccessingWebScriptHome(RequiredAuthentication required, boolean isGuest) private boolean shouldUseTimeoutForAdminAccessingWebScriptHome(RequiredAuthentication required, boolean isGuest)

View File

@@ -63,8 +63,6 @@ public abstract class AbstractIdentityServiceAuthenticator
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractIdentityServiceAuthenticator.class); private static final Logger LOGGER = LoggerFactory.getLogger(AbstractIdentityServiceAuthenticator.class);
protected abstract boolean isWebScriptHome();
protected IdentityServiceConfig identityServiceConfig; protected IdentityServiceConfig identityServiceConfig;
protected IdentityServiceFacade identityServiceFacade; protected IdentityServiceFacade identityServiceFacade;
protected AdminAuthenticationCookiesService cookiesService; protected AdminAuthenticationCookiesService cookiesService;
@@ -74,6 +72,8 @@ public abstract class AbstractIdentityServiceAuthenticator
public static final String ALFRESCO_REFRESH_TOKEN = "ALFRESCO_REFRESH_TOKEN"; public static final String ALFRESCO_REFRESH_TOKEN = "ALFRESCO_REFRESH_TOKEN";
public static final String ALFRESCO_TOKEN_EXPIRATION = "ALFRESCO_TOKEN_EXPIRATION"; public static final String ALFRESCO_TOKEN_EXPIRATION = "ALFRESCO_TOKEN_EXPIRATION";
protected abstract boolean isWebScriptHome();
public String resolveUser(HttpServletRequest request, HttpServletResponse response) public String resolveUser(HttpServletRequest request, HttpServletResponse response)
{ {
String username = remoteUserMapper.getRemoteUser(request); String username = remoteUserMapper.getRemoteUser(request);
@@ -224,8 +224,11 @@ public abstract class AbstractIdentityServiceAuthenticator
} }
} }
catch (Exception e) catch (Exception e)
{
if (LOGGER.isDebugEnabled())
{ {
LOGGER.debug("Token refresh failed: {}", e.getMessage()); LOGGER.debug("Token refresh failed: {}", e.getMessage());
}
bearerToken = null; bearerToken = null;
resetCookies(response); resetCookies(response);
} }

View File

@@ -102,6 +102,7 @@ public class IdentityServiceWebScriptHomeAuthenticator extends AbstractIdentityS
return false; return false;
} }
@Override
protected String getRedirectUri(String requestURL) protected String getRedirectUri(String requestURL)
{ {
return getWebScriptHomeRedirectUri(requestURL); return getWebScriptHomeRedirectUri(requestURL);