Skip to content

Commit

Permalink
Merge pull request #52 from groldan/caching_auth_responses
Browse files Browse the repository at this point in the history
Authrorization response caching and spring cloud bus integration
  • Loading branch information
groldan authored Mar 12, 2024
2 parents 4fa8ea0 + 389ffa5 commit 27573aa
Show file tree
Hide file tree
Showing 44 changed files with 1,587 additions and 515 deletions.
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,21 @@
<artifactId>gs-acl-domain-spring-integration</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.geoserver.acl.integration</groupId>
<artifactId>gs-acl-cache</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.geoserver.acl.integration</groupId>
<artifactId>spring-boot-simplejndi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.geoserver.acl.integration</groupId>
<artifactId>gs-acl-spring-cloud-bus</artifactId>
<version>${project.version}</version>
</dependency>
<!-- GeoServer plugin components -->
<dependency>
<groupId>org.geoserver.acl.plugin</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,19 @@ public class AccessInfo {

@Override
public String toString() {
return String.format(
"AccessInfo[grant: %s, catalogMode: %s, area: %s, clip: %s, styles[def: %s, allowed: %s], cql[r: %s, w: %s], atts: %s",
grant,
catalogMode,
area == null ? "no" : "yes",
clipArea == null ? "no" : "yes",
defaultStyle,
allowedStyles == null || allowedStyles.isEmpty() ? "no" : allowedStyles.size(),
cqlFilterRead == null ? "no" : "yes",
cqlFilterWrite == null ? "no" : "yes",
attributes == null || attributes.isEmpty() ? "no" : attributes.size());
StringBuilder sb = new StringBuilder("AccessInfo[grant: ").append(grant);
if (catalogMode != null) sb.append(", catalogMode: ").append(catalogMode);
if (area != null) sb.append(", area: yes");
if (clipArea != null) sb.append(", clipArea: yes");
if (defaultStyle != null) sb.append(", def style: ").append(defaultStyle);
if (null != allowedStyles && !allowedStyles.isEmpty())
sb.append("allowed styles: ").append(allowedStyles);
if (cqlFilterRead != null) sb.append(", cql read filter: present");
if (cqlFilterWrite != null) sb.append(", cql write filter: present");
if (null != attributes && !attributes.isEmpty())
sb.append(", attributes: ").append(attributes.size());
sb.append(", matchingRules: ").append(matchingRules);
return sb.append("]").toString();
}

public static class Builder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,16 @@ public AccessRequest validate() {
}

public @Override String toString() {
return String.format(
"%s[from:%s, by: %s(%s), for:%s:%s%s, layer:%s%s]",
getClass().getSimpleName(),
sourceAddress == null ? "<no IP>" : sourceAddress,
user,
roles.stream().collect(Collectors.joining(", ")),
service,
request,
subfield == null ? "" : "(" + subfield + ")",
workspace == null ? "<null ws>" : (workspace.isEmpty() ? "" : workspace + ":"),
layer);
StringBuilder sb = new StringBuilder("AccessRequest[");
sb.append("user: ").append(user == null ? "" : user);
sb.append(", roles: ").append(roles.stream().collect(Collectors.joining(",")));
if (null != sourceAddress) sb.append(", origin IP: ").append(sourceAddress);
if (null != service) sb.append(", service: ").append(service);
if (null != request) sb.append(", request: ").append(request);
if (null != subfield) sb.append(", subfield: ").append(subfield);
if (null != workspace) sb.append(", workspace: ").append(workspace);
if (null != layer) sb.append(", layer: ").append(layer);
return sb.append("]").toString();
}

public static class Builder {
Expand Down
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;
}
Loading

0 comments on commit 27573aa

Please sign in to comment.