Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authrorization response caching and spring cloud bus integration #52

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading