我對Spring安全和Spring社交相對較新。我正試圖通過標準的Spring Security或Spring社交Facebook來實現混合身份驗證。使用Spring安全性和Spring社交Facebook實現混合身份驗證
因此,用戶可以驗證:
- 或者用標準的Spring安全登錄形式如下:
片段從我Thymeleaf的模板:
<form name="f" th:action="@{/resources/j_spring_security_check}" method="POST">
<input id="j_username" type='text' name='j_username'/><br />
<input id="j_password" type='password' name='j_password'/><br />
<input id="proceed" type="submit" value="login" />
</form>
該工程確定,例如用戶向受保護的資源發送請求,例如, www.example.com/memberArea/editMyProfile
由以下攔截的URL保護:
<intercept-url pattern="/memberArea/**" access="hasRole('ROLE_USER')" />
用戶被重定向到登錄表單,並在成功登錄時,用戶最終重定向到受保護的資源,即www.example.com/memberArea/editMyProfile
- 或者用戶可以選擇春社會Facebook和認證/註冊,像這樣的鏈接:
從我Thymeleaf的模板段:
<a th:href="@{'https://www.facebook.com/dialog/oauth/?client_id=414113641982512&redirect_uri=http://www.example.com/&state=UNIQUE&scope=read_stream'}">Login with facebook</a>
在這種情況下,用戶當然是重定向到www.example.com
而不是www.example.com/memberArea/editMyProfile
我的問題是那麼,如何 - 仍然使用Spring安全和Spring社會Facebook的 - 我能以某種方式檢索請求的URL(這裏www.example.com/memberArea/editMyProfile
)並最終將用戶重定向到此URL?
嗨,謝謝你克雷格,我剛剛git克隆,建立和運行春季社交展示,它只是我期望的行爲。如果我還有其他問題,我將探討這些功能併發布到Spring社區論壇。再次感謝您花時間回覆! – balteo