Skip to content

Commit

Permalink
Merge branch 'master' into chore/upgrade-to-webpack-5
Browse files Browse the repository at this point in the history
  • Loading branch information
byronantak authored Oct 25, 2024
2 parents 8bb4d25 + e528de1 commit 7d1162f
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.box.l10n.mojito.security;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CommonsRequestLoggingFilter;

@Configuration
public class RequestLoggingConfig {

@Value("${l10n.logging.requests.includesQueryString:false}")
public boolean includesQueryString;

@Value("${l10n.logging.requests.includesHeader:false}")
public boolean includesHeader;

@Value("${l10n.logging.requests.includesPayload:true}")
public boolean includesPayload;

@Value("${l10n.logging.requests.maxPayloadLength:10000}")
public int maxPayloadLength;

@Value("${l10n.logging.requests.beforeMessagePrefix:}")
public String beforeMessagePrefix;

@Value("${l10n.logging.requests.afterMessagePrefix:Request Data: }")
public String afterMessagePrefix;

@Bean
@ConditionalOnProperty(value = "l10n.logging.requests.enabled", havingValue = "true")
public CommonsRequestLoggingFilter logFilter() {
CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter();
filter.setIncludeQueryString(includesQueryString);
filter.setIncludePayload(includesPayload);
filter.setMaxPayloadLength(maxPayloadLength);
filter.setIncludeHeaders(includesHeader);
filter.setBeforeMessagePrefix(beforeMessagePrefix);
filter.setAfterMessagePrefix(afterMessagePrefix);
return filter;
}
}

0 comments on commit 7d1162f

Please sign in to comment.