Spring Boot 2执行器Httptrace主体为空

问题描述 投票:3回答:1

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

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

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

{
    "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"
        }
    ]
}
spring-boot spring-security spring-boot-actuator
1个回答
0
投票

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

management.trace.http.include=principal,request-headers,response-headers,cookie-headers,time-taken,authorization-header,remote-address,session-id
© www.soinside.com 2019 - 2024. All rights reserved.