Skip to content
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
5 changes: 0 additions & 5 deletions common/src/main/java/feast/common/logging/AuditLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import feast.common.logging.config.LoggingProperties.AuditLogProperties;
import feast.common.logging.entry.ActionAuditLogEntry;
import feast.common.logging.entry.AuditLogEntry;
import feast.common.logging.entry.AuditLogEntryKind;
import feast.common.logging.entry.LogResource;
import feast.common.logging.entry.LogResource.ResourceType;
import feast.common.logging.entry.MessageAuditLogEntry;
Expand Down Expand Up @@ -112,10 +111,6 @@ private static void log(Level level, AuditLogEntry entry) {
if (!properties.isEnabled()) {
return;
}
if (entry.getKind().equals(AuditLogEntryKind.MESSAGE)
&& !properties.isMessageLoggingEnabled()) {
return;
}

// Log event to audit log through enabled formats
String entryJSON = entry.toJSON();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import feast.common.auth.config.SecurityProperties.AuthenticationProperties;
import feast.common.auth.utils.AuthUtils;
import feast.common.logging.AuditLogger;
import feast.common.logging.config.LoggingProperties;
import feast.common.logging.entry.MessageAuditLogEntry;
import io.grpc.ForwardingServerCall.SimpleForwardingServerCall;
import io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener;
Expand All @@ -48,18 +49,30 @@
@Component
public class GrpcMessageInterceptor implements ServerInterceptor {
private SecurityProperties securityProperties;
private LoggingProperties loggingProperties;

/**
* Construct GrpcMessageIntercetor. If provided securityProperties, will output the subject claim
* specified in securityProperties as identity in {@link MessageAuditLogEntry} instead.
* Construct GrpcMessageIntercetor.
*
* @param loggingProperties properties used to configure logging interceptor.
* @param securityProperties If provided, will output the subject claim specified in
* securityProperties as identity in {@link MessageAuditLogEntry} instead.
*/
@Autowired
public GrpcMessageInterceptor(@Nullable SecurityProperties securityProperties) {
public GrpcMessageInterceptor(
LoggingProperties loggingProperties, @Nullable SecurityProperties securityProperties) {
this.securityProperties = securityProperties;
this.loggingProperties = loggingProperties;
}

@Override
public <ReqT, RespT> Listener<ReqT> interceptCall(
ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) {
// Disable the message logging interceptor entirely if message logging is disabled.
if (!loggingProperties.getAudit().isMessageLoggingEnabled()) {
return next.startCall(call, headers);
}

MessageAuditLogEntry.Builder entryBuilder = MessageAuditLogEntry.newBuilder();
// default response message to empty proto in log entry.
entryBuilder.setResponse(Empty.newBuilder().build());
Expand Down