Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help Needed. I can't seem to override the body replacers #1208

Closed
Samicheaterb opened this issue Oct 30, 2021 · 3 comments
Closed

Help Needed. I can't seem to override the body replacers #1208

Samicheaterb opened this issue Oct 30, 2021 · 3 comments
Labels

Comments

@Samicheaterb
Copy link

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="

"'

which is directed at spring controller:

@PostMapping("/fnc/navyfcu")
public ResponseEntity 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 "", but if i clear the filters it will just print out nothing. I was wondering if you have a way where i could get the xmlData request param printed?

@Samicheaterb
Copy link
Author

Samicheaterb commented Oct 30, 2021

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

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot added the stale label Jul 14, 2023
@github-actions
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant