Spring-web-security Issue (Access is denied. User must have one of the these roles: ACTUATOR)
前提条件(Prerequisite)
1.你的项目里引进了Spring web security
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>1.5.19.RELEASE</version
</dependency>
2. application.properties
management.context-path=/mgmt
3. 给Actuator相关的URL 加了另外的权限
http.authorizeRequests()
.antMatchers("/mgmt/**").hasAnyRole(ADMIN, SUPPORT, ACTUATOR)
.antMatchers("/**").hasRole(USER)
.and().formLogin().and().httpBasic();
出现的问题(Issue )-- 当登陆你的username and password 时 而且你这个user 是 ADMIN 或SUPPORT时, 出现下面错误页面。
Access is denied. User must have one of the these roles: ACTUATOR
解决方法(Solution)
disable manangement security in application.properties 或系统参数
management.security.enabled=false
原因(Cause)
Spring 会用一个MvcEndpointSecurityInterceptor 阻止所有非actuator角色的用户, 及时你已经重新自定义自己的权限管理。
private void sendFailureResponse(HttpServletRequest request,
HttpServletResponse response) throws Exception {
if (request.getUserPrincipal() != null) {
String roles = StringUtils.collectionToDelimitedString(this.roles, " ");
response.sendError(HttpStatus.FORBIDDEN.value(),
"Access is denied. User must have one of the these roles: " + roles);
}
Spring-web-security Issue (Access is denied. User must have one of the these roles: ACTUATOR)的更多相关文章
- SPRING SECURITY JAVA配置:Web Security
在前一篇,我已经介绍了Spring Security Java配置,也概括的介绍了一下这个项目方方面面.在这篇文章中,我们来看一看一个简单的基于web security配置的例子.之后我们再来作更多的 ...
- java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")
转自:https://blog.csdn.net/bluecard2008/article/details/80921682?utm_source=blogxgwz0 摘要: 今天在使用jetty做容 ...
- org.springframework.security.access.AccessDeniedException: Access is denied
org.springframework.security.access.AccessDeniedException: Access is denied at org.springframework.s ...
- StreamSets学习系列之启动StreamSets时出现Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "test.to.ensure.security.is.configured.correctly" "read")错误的解决办法
不多说,直接上干货! 问题详情 [hadoop@master streamsets-datacollector-]$ ./bin/streamsets dc Java 1.8 detected; ad ...
- Spring Boot Security And JSON Web Token
Spring Boot Security And JSON Web Token 说明 流程说明 何时生成和使用jwt,其实我们主要是token更有意义并携带一些信息 https://github.co ...
- 学习黑马教学视频SSM整合中Security遇到的问题org.springframework.security.access.AccessDeniedException: Access is denied
问题已解决. 总结: 报错:org.springframework.security.access.AccessDeniedException: Access is denied 当您遇到同样问题时, ...
- Spring Boot Security 整合 JWT 实现 无状态的分布式API接口
简介 JSON Web Token(缩写 JWT)是目前最流行的跨域认证解决方案.JSON Web Token 入门教程 - 阮一峰,这篇文章可以帮你了解JWT的概念.本文重点讲解Spring Boo ...
- Spring Web MVC框架简介
Web MVC framework框架 Spring Web MVC框架简介 Spring MVC的核心是`DispatcherServlet`,该类作用非常多,分发请求处理,配置处理器映射,处理视图 ...
- Access is denied (user is anonymous); redirecting to authentication entry point
Access is denied (user is anonymous); redirecting to authentication entry point org.springframework. ...
随机推荐
- day 26 面向对象知识网
1. 成员 - 变量 - 静态字段,类变量 - 方法 - 类方法 - 静态方法 - 实例方法 - 属性2. 对象的嵌套3. 特殊方法 __init__ new call getitem... add ...
- HashMap面试题,看这一篇就够了!
目录 序言 一.JDK7中的HashMap底层实现 1.1 基础知识 1.2 put()方法 1.2.1 特殊key值处理 1.2.2 扩容 1.2.3 如何计算bucket下标? 1.2.4 在目标 ...
- Sublime Text最好的中文教程
原文链接:http://lucida.me/blog/sublime-text-complete-guide/ 摘要(Abstract) 本文系统全面的介绍了Sublime Text,旨在成为最优秀的 ...
- 十、Spring boot 简单优雅的整合 Swagger2
前言 swagger2 是什么,我这里就不说了,就是一个简单的接口文档,方便前后端联调. 其实之前没有想要到要使用swagger 的.因为我之前用的是YAPI ,不过这个是一个单独的工具.并且是开源的 ...
- 2019-2020-2 20199317《Linux内核原理与分析》第二周作业
第一章 计算机工作原理 1 存储程序计算机工作模型 存储程序计算机的主要思想是将程序存放在计算机存储器中,然后按存储器中的存储程序的首地址执行程序的第一条指令,以后就按照该程序中编写 ...
- ssm三大框架整合基本配置
ssm三大框架整合基本配置 maven目录结构 数据库脚本mysql create database maven; use maven ; -- --------------------------- ...
- Snack3 一个新的微型JSON框架
Snack3 一个新的微型JSON框架 一个作品,一般表达作者的一个想法.因为大家想法不同,所有作品会有区别.就做技术而言,因为有很多有区别的框架,所以大家可以选择的框架很丰富. snack3.基于j ...
- NSUserdefaults清除存储内容
有两种方式 方式一:找到所有的key,然后删除对象 /** * 清除所有的存储本地的数据 */ - (void)clearAllUserDefaultsData { NSUserDefaults * ...
- iOS开发UI篇—Quartz2D使用(图形上下文栈
转自:http://www.cnblogs.com/wendingding/p/3782489.html 一.qurza2d是怎么将绘图信息和绘图的属性绘制到图形上下文中去的? 说明: 新建一个项目, ...
- [TimLinux] JavaScript 引用类型——Date
1. Date var now = new Date(); // 不传参数,获取当前日期.时间. now.getDay(); // 日期 now.getMonth(); // 月份 now.getFu ...