我在这里和这里看到了一些线程,但它们很旧,我不愿意添加任何各种过滤器和加载器的大型实现。
我正在按如下方式手动处理/logout
,然后使用自定义参数重定向到我的/login
(登录由Spring Security管理):
@GetMapping("/participant/logout")
public String logout(HttpServletRequest request, HttpServletResponse response, @RequestParam("exitMsg") String exitMsg){
SecurityContextLogoutHandler securityContextLogoutHandler = new SecurityContextLogoutHandler();
securityContextLogoutHandler.logout(request, response, null);
return "redirect:/participant/login?logout=true&exitMsg=" + exitMsg;
}
@GetMapping("/participant/login")
public ModelAndView loginPage(HttpServletRequest request, HttpServletResponse response,
@RequestParam("exitMsg") String exitMsg) {
// exitMsg is NULL here!
}
在调试器中,我看到了正确的URL格式,然后我正确地点击了/login
,但是请求参数to/login(exitsg)丢失了。
那么如何将自定义参数保留到/login
?
Spring Security配置:
http.antMatcher("/participant/**").authorizeRequests()
.antMatchers("/participant/id/**").permitAll()
.antMatchers("/participant/faq").permitAll()
.antMatchers("/participant/forgetPassword").permitAll()
.antMatchers("/participant/securityQuestions").permitAll()
.antMatchers("/participant/securityCheck").permitAll()
.antMatchers("/participant/resetPassword").permitAll()
.antMatchers("/participant/**").authenticated()
.and()
.formLogin().loginPage("/participant/login").permitAll()
.failureUrl("/participant/login?error").permitAll()
.defaultSuccessUrl("/participant/home")
.usernameParameter("username").passwordParameter("password")
.and()
.logout()
.and()
.csrf().disable();
找到了这个快速的解决方案——使用SavedRequest对象,它将Req参数保存到/login,
https://stackoverflow.com/a/30205815/1005607
我有一个查询字符串,可以是: 编辑:参数值的长度可以大于2 有人知道在String.ReplaceAll([regex],[replace])中使用什么好的regex表达式吗?
我想验证我的控制器中的一个请求参数。请求参数应该来自给定值列表中的一个,如果不是,则应该抛出错误。在下面的代码中,我希望请求参数orderBy来自@Values准许中存在的值列表。 我已经编写了一个自定义bean验证器,但不知何故,它不起作用。即使我为查询参数传递任何随机值,也不会验证并引发错误。
您好,我想使用截取标题和正文参数向服务器发送删除请求。但我无法成功发送请求 我试过的 这是我的截击请求课 当我尝试此代码时,我收到400响应代码错误。如果有人可以帮助我,请告诉我。。这就是我做错的地方。谢谢 这里是我测试的deleteapi的屏幕截图,它工作正常。
我通过SDK成功地创建了一个自定义度量,但无法删除它我无法从web控制台找到删除它的选项(从SDK中也无法找到删除/取消它的方法) 它创建了一个名为“MyCompany/MyResources”的度量,但我无法删除它
问题内容: 这是我的情况: 一个Web应用程序对许多应用程序执行某种SSO 登录的用户,而不是单击链接,该应用就会向正确的应用发布包含用户信息(名称,pwd [无用],角色)的帖子 我正在其中一个应用程序上实现SpringSecurity以从其功能中受益(会话中的权限,其类提供的方法等) 因此,我需要开发一个 自定义过滤器 -我猜想-能够从请求中检索用户信息,通过自定义 DetailsUserSe
我有个问题。当我发送删除请求时,我的Web服务器sinds 403响应。我不想删除请求中的内容,我只需要知道使用的方法是delete。如何配置Web服务器,使其不再发送403条消息?我不想启用WebDAV或类似的东西。我只想知道请求方法是否是DELETE(在我的php文件中,但由于403的原因,它没有被执行)。