我正在Spring上開發Web應用程序,使用Spring Security 3和LDAP進行身份驗證。spring security 3 authentication-failure-url change
這是我的代碼的形式登錄片段:
<security:form-login
authentication-failure-url="/index.xhtml?error=true"
default-target-url="/SomeDefaultUrl.xhtml"
login-page="/index.xhtml" />
身份驗證失敗時我的應用程序將被重定向到「/index.xhtml?error=true」網址。問題是我不知道如何捕獲「error」變量並在index.xhtml文件中顯示一些身份驗證失敗消息。我沒有使用Spring mvc。
第二個問題是更改authentication-failure-url不起作用。
<security:form-login
authentication-failure-url="/error.xhtml"
default-target-url="/SomeDefaultUrl.xhtml"
login-page="/index.xhtml" />
我改變了認證失敗的URL,但儘管這樣的改變,它仍然重定向到的index.xhtml文件,而無需任何變量。
我怎樣才能解決這個問題?
謝謝你的偉大的建議。 關於第二個問題:我重建項目,它注意到我的變化,因爲它被重定向到'index.xhtml'文件而不是'index.xhtml?error = true' 我認爲當authentication-failure-url參數的值不是_acceptable_它會自動重定向到index.xhtml。但我不知道如何解決它 – mariami