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

Static authorization server interceptor implementation #8934

Merged
merged 15 commits into from
Dec 21, 2022
Merged
Prev Previous commit
Next Next commit
formatting
  • Loading branch information
ashithasantosh committed Dec 10, 2022
commit 417290886ba6d47664bb3917686e8192a6baa899
19 changes: 11 additions & 8 deletions xds/src/main/java/io/grpc/xds/InternalRbacFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@
import io.grpc.xds.RbacConfig;
import io.grpc.xds.RbacFilter;

/*
* Parses RBAC filter config and creates AuthorizationServerInterceptor.
*/
@Internal
public final class InternalRbacFilter {
public static ServerInterceptor createInterceptor(RBAC rbac) throws IllegalArgumentException {
ConfigOrError<RbacConfig> filterConfig = RbacFilter.parseRbacConfig(rbac);
if (filterConfig.errorDetail != null) {
throw new IllegalArgumentException(
String.format("Failed to parse Rbac policy: %s", filterConfig.errorDetail));
}
return new RbacFilter().buildServerInterceptor(filterConfig.config, null);
public static ServerInterceptor createInterceptor(RBAC rbac) throws IllegalArgumentException {
ConfigOrError<RbacConfig> filterConfig = RbacFilter.parseRbacConfig(rbac);
if (filterConfig.errorDetail != null) {
throw new IllegalArgumentException(
String.format("Failed to parse Rbac policy: %s", filterConfig.errorDetail));
}
}
return new RbacFilter().buildServerInterceptor(filterConfig.config, null);
}
}
1 change: 1 addition & 0 deletions xds/src/main/java/io/grpc/xds/RbacFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,4 @@ private static InetAddress resolve(CidrRange cidrRange) {
}
}
}