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

can logbook log custom Filter log #1358

Closed
ethfun opened this issue Sep 19, 2022 · 2 comments
Closed

can logbook log custom Filter log #1358

ethfun opened this issue Sep 19, 2022 · 2 comments

Comments

@ethfun
Copy link

ethfun commented Sep 19, 2022

i created an authentication Filter for validate user info, if user validate pass, then go to Spring Controller, otherwise return directly from custom Filter.

i had set Filter priority, but it did't work.

how can i set logbook log all request into custom Filter, but return directly.?

@whiskeysierra
Copy link
Collaborator

Did you take a look at https://github.com/zalando/logbook#security?

@ethfun
Copy link
Author

ethfun commented Sep 19, 2022

I solved it by disabled add logbookFilter by springboot autoconfig

manual add logbookFilter in filter config, set logbookFilter priority = Ordered.HIGHEST_PRECEDENCE, it worked

filter.enabled: false

    @Bean
    FilterRegistrationBean logbookFilter() {
        LogbookFilter filter = new LogbookFilter(logbook);
        final FilterRegistrationBean registration = new FilterRegistrationBean(filter);
        registration.setName("logbookFilter");
        registration.setDispatcherTypes(REQUEST, ASYNC);
        registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return registration;
    }

@ethfun ethfun closed this as completed Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants