Skip to content

Commit

Permalink
Merge pull request #498 from groldan/gateway_shared_auth_tests
Browse files Browse the repository at this point in the history
Split gateway shared authentication filter into pre and post filters
  • Loading branch information
groldan authored Jul 28, 2024
2 parents 372d3a3 + e200514 commit bf0c138
Show file tree
Hide file tree
Showing 15 changed files with 990 additions and 209 deletions.
2 changes: 1 addition & 1 deletion config
Submodule config updated 1 files
+6 −1 gateway-service.yml
5 changes: 5 additions & 0 deletions src/apps/infrastructure/gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@
*/
package org.geoserver.cloud.autoconfigure.gateway;

import lombok.extern.slf4j.Slf4j;

import org.geoserver.cloud.gateway.filter.GatewaySharedAuhenticationGlobalFilter;
import org.geoserver.cloud.gateway.filter.RouteProfileGatewayFilterFactory;
import org.geoserver.cloud.gateway.filter.StripBasePathGatewayFilterFactory;
import org.geoserver.cloud.gateway.predicate.RegExpQueryRoutePredicateFactory;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

@AutoConfiguration
@Slf4j
public class GatewayApplicationAutoconfiguration {

/**
Expand Down Expand Up @@ -66,14 +61,4 @@ RouteProfileGatewayFilterFactory routeProfileGatewayFilterFactory(Environment en
StripBasePathGatewayFilterFactory stripBasePathGatewayFilterFactory() {
return new StripBasePathGatewayFilterFactory();
}

@Bean
@ConditionalOnProperty(
name = "geoserver.security.gateway-shared-auth.enabled",
havingValue = "true",
matchIfMissing = true)
GatewaySharedAuhenticationGlobalFilter gatewaySharedAuhenticationGlobalFilter() {
log.info("gateway-shared-auth is enabled");
return new GatewaySharedAuhenticationGlobalFilter();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* (c) 2024 Open Source Geospatial Foundation - all rights reserved This code is licensed under the
* GPL 2.0 license, available at the root application directory.
*/
package org.geoserver.cloud.autoconfigure.gateway;

import lombok.extern.slf4j.Slf4j;

import org.geoserver.cloud.security.gateway.sharedauth.GatewaySharedAuhenticationPostFilter;
import org.geoserver.cloud.security.gateway.sharedauth.GatewaySharedAuhenticationPreFilter;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;

import javax.annotation.PostConstruct;

@AutoConfiguration
@ConditionalOnProperty(
name = "geoserver.security.gateway-shared-auth.enabled",
havingValue = "true",
matchIfMissing = true)
@Slf4j
public class GatewaySharedAuthAutoConfiguration {

@PostConstruct
void logEnabled() {
log.info("gateway-shared-auth is enabled");
}

@Bean
GatewaySharedAuhenticationPreFilter gatewaySharedAuhenticationGlobalPreFilter() {
return new GatewaySharedAuhenticationPreFilter();
}

@Bean
GatewaySharedAuhenticationPostFilter gatewaySharedAuhenticationGlobalPostFilter() {
return new GatewaySharedAuhenticationPostFilter();
}
}

This file was deleted.

Loading

0 comments on commit bf0c138

Please sign in to comment.