/*
 * Copyright (c) 2012-2017 Red Hat, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Red Hat, Inc. - initial API and implementation
 */
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() {}
}

@@ -626,13 +626,15 @@
 .%0A *
- 
 %0A * 
+%3Cp%3E
 In p
@@ -680,19 +680,16 @@
 when the
-%0A *
  authent
@@ -721,16 +721,19 @@
 c should
+%0A *
  be skip
@@ -736,19 +736,16 @@
 skipped%0A
- *%0A
  */%0Apubl

Format code