package <%=packageName%>.config;

import <%=packageName%>.gateway.ratelimiting.RateLimitingFilter;
import <%=packageName%>.gateway.ratelimiting.RateLimitingRepository;
import <%=packageName%>.gateway.accesscontrol.AccessControlFilter;

import javax.inject.Inject;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Session;

@Configuration
public class GatewayConfiguration {

    @Configuration
    public static class AccessControl {

        @Bean
        public AccessControlFilter accessControlFilter(){
            return new AccessControlFilter();
        }
    }

    /**
     * Configures the Zuul filter that limits the number of API calls per user.
     * <p>
     * For this filter to work, you need to have:
     * <p><ul>
     * <li>A working Cassandra cluster
     * <li>A schema with the JHipster rate-limiting tables configured, using the
     * "create_keyspace.cql" and "create_tables.cql" scripts from the
     * "src/main/resources/config/cql" directory
     * <li>Your cluster configured in your application-*.yml files, using the
     * "spring.data.cassandra" keys
     * <li>Spring Data Cassandra running, by removing in your application-*.yml the
     * "spring.autoconfigure.exclude" key that excludes the Cassandra and Spring Data
     * Cassandra auto-configuration.
     * </ul><p>
     */
    @Configuration
    @ConditionalOnProperty("jhipster.gateway.rate-limiting.enabled")
    public static class RateLimitingConfiguration {

        @Inject
        private JHipsterProperties jHipsterProperties;

        @Bean
        public RateLimitingRepository rateLimitingRepository() {
            return new RateLimitingRepository();
        }

        @Bean
        public RateLimitingFilter rateLimitingFilter() {
            return new RateLimitingFilter(rateLimitingRepository(), jHipsterProperties);
        }
    }
}

@@ -227,16 +227,98 @@
 lFilter;
+%0Aimport %3C%25=packageName%25%3E.gateway.responserewriting.SwaggerBasePathRewritingFilter;
 %0A%0Aimport
@@ -664,24 +664,276 @@
 guration %7B%0A%0A
+    @Configuration%0A    public static class SwaggerBasePathRewritingConfiguration %7B%0A%0A        @Bean%0A        public SwaggerBasePathRewritingFilter swaggerBasePathRewritingFilter()%7B%0A            return new SwaggerBasePathRewritingFilter();%0A        %7D%0A    %7D%0A%0A
     @Configu
@@ -976,16 +976,22 @@
 sControl
+Filter
  %7B%0A%0A    

configure the gateway to use the swagger docs rewrite filter