content: package org.jboss.aerogear.unifiedpush.service.filter;
  
  import javax.ws.rs.container.ContainerRequestContext;
  import javax.ws.rs.container.ContainerResponseContext;
  import javax.ws.rs.container.ContainerResponseFilter;
  import javax.ws.rs.ext.Provider;
  import java.io.IOException;
  
  /**
   * This class provides CORS headers to all of the APIs.  Before 2020 we only used them for the client APIs and not the admin apis.
   */
  @Provider
  public class CORSFilter implements ContainerResponseFilter {
  
      @Override
      public void filter(ContainerRequestContext requestContext,
                         ContainerResponseContext responseContext) throws IOException {
          responseContext.getHeaders().add(
                  "Access-Control-Allow-Origin", "*");
          responseContext.getHeaders().add(
                  "Access-Control-Allow-Credentials", "true");
          responseContext.getHeaders().add(
                  "Access-Control-Allow-Headers",
                  "origin, content-type, accept, authorization, aerogear-sender");
          responseContext.getHeaders().add(
                  "Access-Control-Allow-Methods",
                  "GET, POST, PUT, DELETE, OPTIONS, HEAD");
          responseContext.getHeaders().add(
                  "Access-Control-Expose-Headers", "*");
      }
  }
  