purushah commented on code in PR #2269: URL: https://github.com/apache/zookeeper/pull/2269#discussion_r2199066212
########## zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/auth/MockSslQuorumAuthServer.java: ########## @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.zookeeper.server.quorum.auth; + +import static org.junit.Assert.assertEquals; +import java.io.DataInputStream; +import java.io.IOException; +import java.net.Socket; +import java.security.cert.X509Certificate; +import org.apache.zookeeper.server.quorum.UnifiedServerSocket; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Test stub implementation of {@link QuorumAuthServer} for SSL quorum authentication. + * Used to verify provider wiring in {@code QuorumPeer}. + */ +public class MockSslQuorumAuthServer implements QuorumAuthServer { + + private static final Logger LOG = LoggerFactory.getLogger(MockSslQuorumAuthServer.class); + private static String subjectX509Principal; + private final boolean initialized; + + /** + * Constructs a new MockSslQuorumAuthServer and reads the expected X.509 principal + * from the system property. + */ + public MockSslQuorumAuthServer() { + this.initialized = true; + subjectX509Principal = System.getProperty("zookeeper.ssl.quorum.auth.subjectX509Principal"); Review Comment: Agreed – this follows the same pattern as `X509AuthenticationProvider`, which pulls all of its settings from static config at construction time. Custom `QuorumAuthServer`/`Learner` implementations can do the same: read whatever they need via the `QuorumX509Util` APIs. That keeps us consistent with the rest of ZooKeeper’s SSL hooks, so I think a no‐arg constructor is fine here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@zookeeper.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org