package org.eclipse.che.keycloak.server;

import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

/**
 * Base abstract class for the Keycloak-related servlet filters.
 * 
 * In particular it defines commnon use-cases when the
 * authentication / multi-user logic should be skipped
 *
 */
public abstract class AbstractKeycloakFilter implements Filter {

  protected boolean shouldSkipAuthentication(HttpServletRequest request, String token) {
    return request.getScheme().startsWith("ws") || (token != null && token.startsWith("machine"));
  }

  @Override
  public void init(FilterConfig filterConfig) throws ServletException {}

  @Override
  public void destroy() {}
}

@@ -1,8 +1,374 @@
+/*%0A * Copyright (c) 2012-2017 Red Hat, Inc.%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A *%0A * Contributors:%0A *   Red Hat, Inc. - initial API and implementation%0A */%0A
 package 

Add missing license copyright