私はこれをやろうとしています:Make spring security add the return to url in the query string for the login page、つまり:私が来たログインページを伝えるためにspringを取得します。私はいくつかのSSOの統合を持っているので、私はそれらにURLを送信するか、彼らは私のためにリファラーを追加するので、ユーザーがログインして、/some/url
に送信されるべきであることを知っている。それはすべてダンディです。あなたが私にAuthenticationEntryPoint
を実装する正当な理由を教えてくれない限り、私が抱えている問題はLoginUrlAuthenticationEntryPoint
を拡張することにあります。LoginUrlAuthenticationEntryPointを拡張する方法またはAuthenticationEntryPointを実装する方法
RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
// only append returnto to '/login' urls
if(request.getServletPath() == "/login") {
// indicates we want to return to this page after login
redirectStrategy.sendRedirect(request, response, "/login?returnto=" + request.getServletPath());
}
私は残りのリクエストを自分たちの行いにすることができますか?これは、(私は何をやっていた)間違っています:
RequestDispatcher dispatcher = request.getRequestDispatcher("/login");
// just forward the request
dispatcher.forward(request, response);
それはリダイレクトループで私たちを置くため。しかし、それはwhat spring does in its version of commence
のようです。よくわかりません。私がLoginUrlAuthenticationEntryPoint
への私のカスタム拡張のcommence
で何をしているのですか?