package com.google.rolecall.authentication;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

import com.google.rolecall.Constants;

import org.springframework.http.HttpHeaders;

public class CustomResponseAttributesFilter implements Filter {
  @Override
  public void init(FilterConfig filterConfig) throws ServletException {
  }

  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws IOException, ServletException {
    chain.doFilter(request, response);
    addSameSiteCookieAttribute((HttpServletResponse) response);
    addAuthorizatinAttribute((HttpServletResponse) response);
  }

  private void addSameSiteCookieAttribute(HttpServletResponse response) {
    response.setHeader(HttpHeaders.SET_COOKIE,
        String.format("%s; %s",response.getHeader(HttpHeaders.SET_COOKIE), "SameSite=None"));
  }

  private void addAuthorizatinAttribute(HttpServletResponse response) {
    response.setHeader(Constants.Headers.AUTHORIZATION, "Bearer");
  }
}

@@ -952,32 +952,48 @@
  response) %7B%0A   
+ String header =
  response.setHea
@@ -978,33 +978,33 @@
 ader = response.
-s
+g
 etHeader(HttpHea
@@ -1022,41 +1022,63 @@
 OKIE
-,
+);
 %0A    
-    String.format(%22%25s; %25s%22,
+if(header != null & !header.equals(%22%22)) %7B%0A      
 resp
@@ -1074,33 +1074,33 @@
 %0A      response.
-g
+s
 etHeader(HttpHea
@@ -1114,17 +1114,47 @@
 T_COOKIE
-)
+,String.format(%22%25s; %25s%22, header
 , %22SameS
@@ -1166,16 +1166,22 @@
 one%22));%0A
+    %7D%0A
   %7D%0A%0A  p

Set different on corner case