我設置了spring安全性來驗證和授權進入我的應用程序的請求。我已經設置了這樣的配置:從HttpServletRequest獲取目的地控制器
public class OAuth2ServerConfiguration extends ResourceServerConfigurerAdapter {
@Override
public void configure(ResourceServerSecurityConfigurer resources) {
// ...set up token store here
resources.authenticationEntryPoint(new AuthenticationEntryPoint() {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
//QUESTION
// How do I get the destination controller that this request was going to go to?
// Really, I'd like to get some information about the annotations that were on the destination controller.
response.setStatus(401);
}
});
}
我想要獲取有關此請求要去的目標控制器的一些信息。在這種情況下,控制器實際上不會受到影響,因爲彈簧安全措施已經啓動並在響應到達控制器之前丟棄了響應。
任何提示? 謝謝!
這是給我一個錯誤說 – Jeff
@Jeff,看到我ammendements –
那工作 - 很好的工作! – Jeff