带有jolokia的spring-boot 2:如何禁用身份验证

时间:2018-10-02 13:40:47

标签: spring-boot spring-boot-actuator spring-boot-admin

ENV:springboot 2.0.5.RELEASE,jolokia 1.5.0

如何禁用jokolia身份验证? 端点jolokia响应如下:

{
  "request": {
    "type": "version"
  },
  "value": {
    "agent": "1.5.0",
    "protocol": "7.2",
    "config": {
      "listenForHttpService": "true",
      "authIgnoreCerts": "false",
      "agentId": "172.22.0.3-7-72f8afb3-servlet",
      "debug": "false",
      "agentType": "servlet",
      "policyLocation": "classpath:/jolokia-access.xml",
      "agentContext": "/jolokia",
      "serializeException": "false",
      "mimeType": "text/plain",
      "dispatcherClasses": "org.jolokia.http.Jsr160ProxyNotEnabledByDefaultAnymoreDispatcher",
      "authMode": "basic",
      "streaming": "true",
      "canonicalNaming": "true",
      "historyMaxEntries": "10",
      "allowErrorDetails": "true",
      "allowDnsReverseLookup": "true",
      "realm": "jolokia",
      "includeStackTrace": "true",
      "useRestrictorService": "false",
      "debugMaxEntries": "100"
    },
    "info": {
      "product": "tomcat",
      "vendor": "Apache",
      "version": "8.5.34"
    }
  },
  "timestamp": 1538476345,
  "status": 200
}

使用springboot 1.5.9.RELEASE和jokolia 1.3.7的相同用户应用程序环境,无需身份验证。端点jokolia的响应如下:

{
  "request": {
    "type": "version"
  },
  "value": {
    "agent": "1.3.7",
    "protocol": "7.2",
    "config": {
      "agentId": "172.27.0.2-6-57fcc568-servlet",
      "agentType": "servlet"
    },
    "info": {
      "product": "tomcat",
      "vendor": "Apache",
      "version": "8.5.23"
    }
  },
  "timestamp": 1538487291,
  "status": 200
}

2 个答案:

答案 0 :(得分:0)

您应该将文件jolokia-access.xml放在src/main/resources中,使其成为类路径的一部分。

答案 1 :(得分:0)

从我的评论中引用:完全使用忽略管理端口来解决。我正在使用web.ignoring().requestMatchers(EndpointRequest.toAnyEndpoint())。似乎它只将请求匹配到这些端点的级别,而不能匹配更深的级别。