2016-02-14 30 views
0

我有一個基於表單的身份驗證和基於Angular的客戶端的jboss web應用程序。 場景:j_security_check沒有重定向到角度#hash鍵

  1. 我去http://localhost:8082/my-app/#/dashboard,與會話超時
  2. 它重定向到登錄頁面(login.jsp的)。我輸入用戶名和密碼,然後提交。
  3. 它發出我爲localhost:8080 /我的應用程序內,http://localhost:8082/my-app/#/dashboard

j_security_check應該成功登錄後返回請求的URL。但它會忽略#後綴嗎?

的login.jsp

<form id="loginForm" method="post" action="/my-app/j_security_check"> 
 
      <input id="usernameInput" name="j_username" type="hidden" /> 
 
      <input id="password" name="j_password" type="password" required=""> 
 
      <button type="submit"> 
 
       Sign In 
 
       </button> 
 
      </form>

的web.xml

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
     version="2.4"> 

    <display-name>OpTierUI Application </display-name> 
    <security-constraint> 
    <web-resource-collection> 
     <web-resource-name>CSS</web-resource-name> 
     <url-pattern>/styles/*</url-pattern> 
     <url-pattern>/fonts/*</url-pattern> 
     <url-pattern>/assets/images/*</url-pattern> 
    </web-resource-collection> 
    </security-constraint> 
    <security-constraint> 
    <web-resource-collection> 
     <web-resource-name>Protected Area</web-resource-name> 
     <description>These pages are only accessible by authorized administrators.</description> 
     <url-pattern>/*</url-pattern> 
    </web-resource-collection> 
    </security-constraint> 
    <login-config> 
    <auth-method>FORM</auth-method> 
    <form-login-config> 
     <form-login-page>/login.jsp</form-login-page> 
     <form-error-page>/login.jsp?error=error</form-error-page> 
    </form-login-config> 
    </login-config> 
    <error-page> 
    <error-code>403</error-code> 
    <location>/login.jsp?unauthorized=unauthorized</location> 
    </error-page> 
    <welcome-file-list> 
    <welcome-file>index.html</welcome-file> 
    </welcome-file-list> 
</web-app> 

回答

1

瀏覽器後不發送#hash鍵或任何服務器。 #hash鍵只能被瀏覽器識別。