-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Authrorization response caching and spring cloud bus integration
Implement a caching `AuthorizationService`, and integrate with the GeoServer plugin. Enabled by default through the `geoserver.acl.client.caching` boolean configuration property. Integrate server and client event-bus communication through `RuleEvent` and `AdminRuleEvent`, using the spring-cloud-bus and RabbitMQ as default binder. Cache eviction occurs upon rule events, evicting the cached authorization responses affected by the changed rules. Disabled by default, and enabled through the `geoserver.bus.enabled` boolean configuration property. The server configuration got the following new properties in `values.yml` (copied to /etc/geoserver/acl-service.yml in the Docker image): ``` geoserver.bus.enabled: false rabbitmq.host: rabbitmq rabbitmq.port: 5672 rabbitmq.user: guest rabbitmq.password: guest ``` The client plugin configuration got the following new properties: ``` geoserver.acl.client.caching: true geoserver.acl.client.startupCheck: true geoserver.acl.client.initTimeout: 10 ```
- Loading branch information
Showing
44 changed files
with
1,472 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...ion-api/src/main/java/org/geoserver/acl/authorization/ForwardingAuthorizationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* (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. | ||
* | ||
* Original from GeoFence 3.6 under GPL 2.0 license | ||
*/ | ||
package org.geoserver.acl.authorization; | ||
|
||
import lombok.Getter; | ||
import lombok.NonNull; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.experimental.Delegate; | ||
|
||
/** | ||
* @since 2.0 | ||
*/ | ||
@RequiredArgsConstructor | ||
public abstract class ForwardingAuthorizationService implements AuthorizationService { | ||
|
||
@NonNull @Delegate @Getter private final AuthorizationService delegate; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ifacts/api/src/main/java/org/geoserver/acl/autoconfigure/bus/RabbitAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* (c) 2023 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.acl.autoconfigure.bus; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.context.annotation.Import; | ||
|
||
import javax.annotation.PostConstruct; | ||
|
||
/** | ||
* {@link org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration} is disabled in | ||
* {@literal application.yml}; this auto configuration enables it when the {@literal | ||
* geoserver.bus.enabled} configuration property is {@code true}. | ||
*/ | ||
@AutoConfiguration | ||
@ConditionalOnProperty(name = "geoserver.bus.enabled", havingValue = "true", matchIfMissing = false) | ||
@Import(org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration.class) | ||
@Slf4j | ||
public class RabbitAutoConfiguration { | ||
|
||
@PostConstruct | ||
void log() { | ||
log.info("Loading RabbitMQ bus bridge"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.