1
我正在將Shiro集成到我的dropwizard webapp中。我已經得到了該在Dropwizard中Shiro將我重定向到登錄頁面
- 四郎認識到需要認證的資源,並送我到登錄頁面(/ auth /中登錄)
- 四郎提醒我,如果登錄失敗,因爲密碼錯誤(點/認證/登錄?loginFailed =真)
- 四郎只有當我嘗試成功後
訪問受保護的資源(如/管理/ **)
我shiro.ini:
[main]
# some other stuff
authc = org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter
authc.loginUrl = /auth/login
# NOTE: URLs are evaluated in order, and the first matching pattern is accepted.
[urls]
/static/** = noSessionCreation, anon
/auth/** = authc
/admin/** = authc
/** = anon
另外值得注意的是:我收到說
0:0:0:0:0:0:0:1%0 - - [10/Oct/2013:18:23:54 +0000] "GET /auth/login;JSESSIONID=65e06b39-30e5-45dd-85f9-b2a1c29fc3af HTTP/1.1" 200 739 4 4
WARN [2013-10-10 18:24:08,485] com.sun.jersey.spi.container.servlet.WebComponent:
A servlet request, to the URI http://blah:8080/auth/login, contains form
parameters in the request body but the request body has been consumed by the servlet
or a servlet filter accessing the request parameters. Only resource methods using
@FormParam will work as expected. Resource methods consuming the request body by other
means will not work as expected.
錯誤,每次訪問/管理導致錯誤302我不不知道回答這個問題還有什麼相關的。我已經探索了其他幾個「Shiro不斷重定向我登錄」的問題,但大多數都直接使用web.xmls,Dropwizard並未使用,也不知道正在應用哪些過濾器。我的同事使用相同的方法來讓shiro與他的dropwizard項目一起工作。
在決定是否將他發送到登錄頁面之前,shiro如何驗證用戶身份?