Skip to content
Snippets Groups Projects
Commit 0ec487b0 authored by Alok Joshi's avatar Alok Joshi Committed by David Diederich
Browse files

bypass info and swagger apis in collaboration filter

(cherry picked from commit 761414f7)
parent d168ca34
No related branches found
No related tags found
2 merge requests!680Merge branch 'aws-integration-eks' into 'master',!629Cherry-pick 'Bypass info and swagger apis in collaboration filter' into release/0.19
......@@ -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