Spring Boot 2执行器Httptrace主体为null

时间:2019-06-19 16:34:03

标签: spring-boot spring-security spring-boot-actuator

我有一个宁静的Web应用程序,它使用弹簧靴2,执行器和弹簧安全装置。

在进行一些测试时,我正在检查/ httptrace路径,并意识到主体返回为null。我很困惑为什么会这样,因为当我调试日志 SecurityContextHolder.getContext()。getAuthentication()。getPrincipal()时,我会返回实现UserDetails的Application对象。< / p>

所以我很好奇为什么当我有一个委托人时,委托人又返回空值。如果有更多详细信息,我可以提供以帮助解决此问题,请在评论中告诉我,我将包括在内。

{
    "traces":[
        {
            "timestamp":"2019-06-19T16:14:33.252994100Z",
            "principal":null,
            "session":null,
            "request":{
                "method":"GET",
                "uri":"http://localhost:8080/api/ims/oneroster/v1p1/orgs",
                "headers":{
                    "cookie":[
                        "JSESSIONID=095BD749...."
                    ],
                    "postman-token":[
                        "54c241d7-8810-459c-b62a-bd64e9c73e9f"
                    ],
                    "host":[
                        "localhost:8080"
                    ],
                    "connection":[
                        "keep-alive"
                    ],
                    "cache-control":[
                        "no-cache"
                    ],
                    "accept-encoding":[
                        "gzip, deflate"
                    ],
                    "user-agent":[
                        "PostmanRuntime/7.15.0"
                    ],
                    "accept":[
                        "*/*"
                    ]
                },
                "remoteAddress":null
            },
            "response":{
                "status":"200",
                "headers":{
                    "X-Frame-Options":[
                        "DENY"
                    ],
                    "Transfer-Encoding":[
                        "chunked"
                    ],
                    "Cache-Control":[
                        "no-cache, no-store, max-age=0, must-revalidate"
                    ],
                    "X-Content-Type-Options":[
                        "nosniff"
                    ],
                    "Pragma":[
                        "no-cache"
                    ],
                    "Expires":[
                        "0"
                    ],
                    "X-XSS-Protection":[
                        "1; mode=block"
                    ],
                    "Date":[
                        "Wed, 19 Jun 2019 16:14:33 GMT"
                    ],
                    "Content-Type":[
                        "application/json;charset=UTF-8"
                    ]
                }
            },
            "timeTaken":"389"
        }
    ]
}

1 个答案:

答案 0 :(得分:0)

默认情况下,Spring Actuator HTTP跟踪仅包含值的子集。您必须configure Spring才能包含该原则,例如:

.data | map(.values[].value) | @csv