Skip to content
Snippets Groups Projects
Commit 761414f7 authored by Alok Joshi's avatar Alok Joshi
Browse files

bypass info and swagger apis in collaboration filter

parent 1bc9698b
No related branches found
No related tags found
2 merge requests!744Upgraded packages to mitigated vulns in netty, guava, snakeyaml,!626Bypass info and swagger apis in collaboration filter
Pipeline #167352 failed
......@@ -22,8 +22,6 @@ import static org.opengroup.osdu.storage.util.StringConstants.COLLABORATIONS_FEA
@Component
public class CollaborationFilter implements Filter {
public static final String X_COLLABORATION_HEADER_NAME = "x-collaboration";
private static final String DATA_PARTITION_ID = "data-partition-id";
@Autowired
public IFeatureFlag collaborationFeatureFlag;
......@@ -31,10 +29,18 @@ public class CollaborationFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
if(httpRequest.getRequestURI().contains("info") ||
httpRequest.getRequestURI().contains("swagger") ||
httpRequest.getRequestURI().contains("health") ||
httpRequest.getRequestURI().contains("api-docs"))
return;
HttpServletResponse httpResponse = (HttpServletResponse) response;
if (!collaborationFeatureFlag.isFeatureEnabled(COLLABORATIONS_FEATURE_NAME)) {
String collaborationHeader = ((HttpServletRequest) request).getHeader(X_COLLABORATION_HEADER_NAME);
String collaborationHeader = httpRequest.getHeader(X_COLLABORATION_HEADER_NAME);
if (!Strings.isNullOrEmpty(collaborationHeader)) {
httpResponse.setContentType(MediaType.APPLICATION_JSON_VALUE);
httpResponse.setStatus(HttpStatus.SC_LOCKED);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment