logbook
logbook copied to clipboard
Help Needed. I can't seem to override the body replacers
I have a custom sink, which allows me to persist everything to the database. The problem is when we get a request like this:
curl --location --request POST 'localhost:8083/fnc/navyfcu'
--header 'Cookie: JSESSIONID=8A529625489AE1E82A6305A559EEECFB'
--form 'XMLData="<PUSHORDER>
</PUSHORDER>"'
which is directed at spring controller:
@PostMapping("/fnc/navyfcu") public ResponseEntity<String> dorequest(@RequestParam(value = "XMLData") String payload) { logger.info("Handling request: {}", payload);
return handleResponse(integrationService.handleRequest(IntegrationName.FNC, payload));
}
logbook filter: public LogbookFilterConfig(HttpTraceService httpTraceService) { this.httpTraceService = httpTraceService; }
public Logbook build(HttpTraceType type) {
return Logbook.builder()
.sink(
new Sink() {
@Override
public void write(Precorrelation precorrelation, HttpRequest request) {
logger.trace(request.getRequestUri());
}
@Override
public void write(Correlation correlation, HttpRequest request, HttpResponse response) {
try {
httpTraceService.handleNewTrace(request, response, type);
}
catch (Exception e) {
logger.error("failed in logbook trace", e);
}
}
}
)
.build();
}
which gets put in the WebSecurityConfigurerAdapter like so:
@Override
protected void configure(final HttpSecurity http) throws Exception {
http
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.headers().frameOptions().disable()
.and()
.csrf().disable()
.authorizeRequests()
.antMatchers(HttpMethod.GET,"/*.js", "/libraries/**/*.js", "/*.css", "/libraries/**/*.css", "/*.ico", "/*.png").permitAll()
.antMatchers(HttpMethod.GET, "/encompass/standalone/**", "/encompass/authenticate/**", "/encompass/ui", "encompass/error", "encompass/error/*", "/encompass/transaction/**/files/**").permitAll()
.antMatchers(HttpMethod.GET,"/public/**").permitAll()
.antMatchers(HttpMethod.POST,"/encompass/webhook/**").permitAll()
.antMatchers(HttpMethod.POST, "/api/v1/push", "/realec", "/fnc/bok", "/test", "/fnc/navyfcu").permitAll()
.anyRequest().fullyAuthenticated()
.and().addFilterBefore(jwtTokenFilter(), UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(new LogbookFilter(logbookFilterConfig.build(HttpTraceType.INCOMING)), JwtTokenFilter.class);
}
every way via adding properties such as logbook.servlet.form-request = parameter
and the form-request-mode i think it is. as well as doing "clearRequestFilters()" in the builder (i tried doing clear*all filters as well) I tried implementing my own filters. Seemingly no matter what, if I have the default it prints out "
curl --location --request POST 'localhost:8083/fnc/navyfcu'
--header 'Cookie: JSESSIONID=8A529625489AE1E82A6305A559EEECFB'
--form 'XMLData="PUSHORDER></PUSHORDER"'
heres the request again, looks like it may have been trunicated before, its actually xml, but i had to delete the outside tags for it to show up
In order to prioritize the support for Logbook, we would like to check whether the old issues are still relevant. This issue has not been updated for over a year.
- Please check if it is still relevant in latest version of the Logbook.
- If so, please add a descriptive comment to keep the issue open.
- Otherwise, the issue will automatically be closed after a week.
This issue has automatically been closed due to no activities. If the issue still exists in the latest version of the Logbook, please feel free to re-open it.