java - 我在哪里可以找到 "j_security_check"?

标签 java jsp tomcat servlets

“j_security_check”是否有标准位置以便我查看?

搜索我的电脑没有找到该文件,只是对它的引用。那么它是出于安全原因隐藏还是不是文件?

我被锁定在一个应用程序之外,这是我第一个查看解决方案的地方。

最佳答案

它是 Servlet API 的一部分并由 servletcontainer 实现。在您的例子中,它是由 Tomcat 实现的。更具体地说,org.apache.catalina.authenticator.FormAuthenticator类。

227        // Is this the action request from the login page?
228        boolean loginAction =
229            requestURI.startsWith(contextPath) &&
230            requestURI.endsWith(Constants.FORM_ACTION);
231
232        // No -- Save this request and redirect to the form login page
233        if (!loginAction) {
234            session = request.getSessionInternal(true);
235            if (log.isDebugEnabled())
236                log.debug("Save request in session '" + session.getIdInternal() + "'");
237            try {
238                saveRequest(request, session);
239            } catch (IOException ioe) {
240                log.debug("Request body too big to save during authentication");
241                response.sendError(HttpServletResponse.SC_FORBIDDEN,
242                        sm.getString("authenticator.requestBodyTooBig"));
243                return (false);
244            }
245            forwardToLoginPage(request, response, config);
246            return (false);
247        }
248
249        // Yes -- Validate the specified credentials and redirect
250        // to the error page if they are not correct
251        Realm realm = context.getRealm();
252        if (characterEncoding != null) {
253            request.setCharacterEncoding(characterEncoding);
254        }
255        String username = request.getParameter(Constants.FORM_USERNAME);
256        String password = request.getParameter(Constants.FORM_PASSWORD);
257        if (log.isDebugEnabled())
258            log.debug("Authenticating username '" + username + "'");
259        principal = realm.authenticate(username, password);
260        if (principal == null) {
261            forwardToErrorPage(request, response, config);
262            return (false);
263        }

Constants.FORM_ACTION/j_security_check

至于被锁定的具体问题,只需确保提供正确的用户名和密码即可。用户数据库通常由 realm 配置.

关于java - 我在哪里可以找到 "j_security_check"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10723138/

相关文章:

Java 泛型/通配符类型不匹配

java - Servlet 异常

java - 如何在 Eclipse IDE 中的 Apache Tomcat 服务器中部署创建的 .jar 文件?

java - 在 [game.Game] 类型的 bean 中找不到有关属性 [bankOffer] 的任何信息

Linux Server 部署JSP - Http 404 请求的资源不可用

java - 如何防止XSS攻击

maven - 如何让 Jenkins 构建正确的 .war 文件?

java - XSSFCellStyle setFillForegroundColor 和 setFillBackgroundColor 不起作用

java - 使用 Apache POI 创建的文档在 Microsoft Word 中与在 LibreOffice Writer 中不同

java - 使用 javapackager 工具重定向打包在可执行文件中的 java 应用程序的标准输出