public boolean isLoginRequest(ServletRequest request, ServletResponse response) {
        boolean rv = methods.isLoginRequest(request, response);
        if (request instanceof HttpServletRequest) {
            saveRequestReferer(rv, WebUtils.toHttp(request), WebUtils.toHttp(response));
        }
        return rv;
    }
in case the login link is clicked directly,
redirect to referer

@param request
@param response
@return
support/jakarta-ee/src/main/java/org/apache/shiro/ee/filters/AuthenticationFilterDelegate.java