0
我想通過使用j_security_control設置webapp的登錄功能,但最近當我登錄時,我一直在從標題中獲取錯誤。下面是相關登錄JSP:Tomcat 8 - 無效的直接引用到表單登錄頁
<div class="loginContainer">
<form role="form" method="POST" action="<%=request.getContextPath()%>/j_security_check">
<c:if test="${not empty param.Retry}">
<div class="errorText">
<p>Login failed. Please try again.</p>
</div>
</c:if>
<div class="username">
<label class="loginText" for="inputUser">User</label>
<input type="text" class="form-control" id="inputUser" placeholder="Username" name="j_username" autofocus>
</div>
<div class="password">
<label class="loginText" for="inputPassword">Password</label>
<input type="password" class="form-control" id="inputPassword" placeholder="Password" name="j_password">
</div>
<div>
<button type="submit" class="btn loginButton" id="loginButton">Login</button>
</div>
</form>
</div>
它正在從一個標題稱爲例如:
<c:choose>
<c:when test="${not empty pageContext.request.userPrincipal}">
<a id="logout" href="${base}/jsp/login/logout.jsp"
class="fse-hid-small navbartext"
data-ng-class="{'selected': idSelected === 'logout'}"
title="Goodbye!">LOGOUT</a>
</c:when>
<c:otherwise>
<a id="login" href="${base}/jsp/login/login.jsp"
class="fse-hid-small navbartext"
data-ng-class="{'selected': idSelected === 'login'}"
title="Login Here!">LOGIN</a>
</c:otherwise>
</c:choose>
而且在web.xml中定義的:前一段時間
<security-constraint>
<web-resource-collection>
<web-resource-name>InternalUserRole</web-resource-name>
<url-pattern>/jsp/internal/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>InternalUser</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/jsp/login/login.jsp</form-login-page>
<form-error-page>/jsp/login/login.jsp?Retry=True</form-error-page>
</form-login-config>
</login-config>
這是工作不幸的是,我不知道它何時破裂。無論如何,我做這項工作?
我試過清除我的緩存和編碼的URL,但我有同樣的問題。 –
我試圖做一個安全的重定向,並給我一個本地主機拒絕連接錯誤 –