/*******************************************************************************
 * 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.deploy;

import com.google.inject.servlet.ServletModule;

import org.eclipse.che.keycloak.server.KeycloakAuthenticationFilter;
import org.eclipse.che.keycloak.server.KeycloakEnvironmentInitalizationFilter;

import javax.inject.Singleton;


public class KeycloakServletModule extends ServletModule {
    @Override
    protected void configureServlets() {
        bind(KeycloakAuthenticationFilter.class).in(Singleton.class);

        // Not contains '/websocket' and not ends with '/ws' or '/eventbus' or '/settings/'
        filterRegex("^(?!.*/websocket)(?!.*(/ws|/eventbus|/settings)$).*").through(KeycloakAuthenticationFilter.class);
        filterRegex("^(?!.*/websocket)(?!.*(/ws|/eventbus|/settings)$).*").through(KeycloakEnvironmentInitalizationFilter.class);
    }
}

@@ -793,16 +793,48 @@
 gleton;%0A
+import java.util.regex.Pattern;%0A
 %0A%0Apublic
@@ -1010,16 +1010,130 @@
 .class);
+%0A        Pattern compile = Pattern.compile(%22%5E(?!.*(/websocket/%7C/docs/))(?!.*(/ws/?%7C/eventbus/?%7C/settings/?)$).*%22);
 %0A%0A      
@@ -1237,32 +1237,33 @@
 terRegex(%22%5E(?!.*
+(
 /websocket)(?!.*
@@ -1248,32 +1248,41 @@
 (?!.*(/websocket
+/%7C/docs/)
 )(?!.*(/ws%7C/even
@@ -1267,32 +1267,34 @@
 docs/))(?!.*(/ws
+/?
 %7C/eventbus%7C/sett
@@ -1279,32 +1279,34 @@
 (/ws/?%7C/eventbus
+/?
 %7C/settings)$).*%22
@@ -1291,32 +1291,34 @@
 tbus/?%7C/settings
+/?
 )$).*%22).through(
@@ -1381,16 +1381,17 @@
 (%22%5E(?!.*
+(
 /websock
@@ -1392,16 +1392,25 @@
 ebsocket
+/%7C/docs/)
 )(?!.*(/
@@ -1411,16 +1411,18 @@
 ?!.*(/ws
+/?
 %7C/eventb
@@ -1423,16 +1423,18 @@
 eventbus
+/?
 %7C/settin
@@ -1435,16 +1435,18 @@
 settings
+/?
 )$).*%22).

Fix regexp