/*
 * CODENVY CONFIDENTIAL
 * __________________
 *
 *  [2012] - [2016] Codenvy, S.A.
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Codenvy S.A. and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Codenvy S.A.
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Codenvy S.A..
 */
package com.codenvy.im.service;

import com.codenvy.auth.sso.client.LoginFilter;
import com.codenvy.auth.sso.client.deploy.SsoClientServletModule;
import com.google.inject.name.Names;
import com.google.inject.servlet.ServletModule;

import org.eclipse.che.inject.DynaModule;
import org.eclipse.che.swagger.deploy.BasicSwaggerConfigurationModule;
import org.everrest.guice.servlet.GuiceEverrestServlet;

/** @author Dmytro Nochevnov */
@DynaModule
public class InstallationManagerServerServletModule extends ServletModule {

    @Override
    protected void configureServlets() {
        bindConstant().annotatedWith(Names.named("auth.sso.client_allow_anonymous")).to(false);
        bindConstant().annotatedWith(Names.named("auth.sso.login_page_url")).to("/site/login");
        bindConstant().annotatedWith(Names.named("auth.sso.cookies_disabled_error_page_url")).to("/site/error/error-cookies-disabled");

        bind(com.codenvy.auth.sso.client.WebAppClientUrlExtractor.class);
        bind(com.codenvy.auth.sso.client.EmptyContextResolver.class);
        bind(com.codenvy.auth.sso.client.token.ChainedTokenExtractor.class);
        bind(com.codenvy.auth.sso.client.TokenHandler.class).to(com.codenvy.auth.sso.client.RecoverableTokenHandler.class);

        filterRegex("/(?!_sso/).*$").through(LoginFilter.class);
        install(new SsoClientServletModule());
        install(new BasicSwaggerConfigurationModule());
        serve("/*").with(GuiceEverrestServlet.class);
    }
}

@@ -775,24 +775,71 @@
 vletModule;%0A
+import com.google.common.collect.ImmutableMap;%0A
 import com.g
@@ -958,79 +958,8 @@
 le;%0A
-import org.eclipse.che.swagger.deploy.BasicSwaggerConfigurationModule;%0A
 impo
@@ -1998,13 +1998,10 @@
 new 
-Basic
+IM
 Swag
@@ -2086,11 +2086,536 @@
 );%0A    %7D
+%0A%0A    public class IMSwaggerConfigurationModule extends ServletModule %7B%0A        @Override%0A        protected void configureServlets() %7B%0A            bind(io.swagger.jaxrs.config.DefaultJaxrsConfig.class).asEagerSingleton();%0A            serve(%22/swaggerinit%22).with(io.swagger.jaxrs.config.DefaultJaxrsConfig.class, ImmutableMap%0A                .of(%22api.version%22, %221.0%22,%0A                    %22swagger.api.title%22, %22Installation Manager REST API%22,%0A                    %22swagger.api.basepath%22, %22/im%22%0A                ));%0A        %7D%0A    %7D
 %0A%7D%0A

fix swagger config for installation manager server