gnodet-bot commented on code in PR #31039: URL: https://github.com/apache/camel/pull/31039#discussion_r4722543999
########## components/camel-milo/src/main/java/org/apache/camel/component/milo/server/internal/CertificateValidatorCertificateManager.java: ########## @@ -0,0 +1,156 @@ +/* + * 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.camel.component.milo.server.internal; + +import java.security.KeyPair; +import java.security.cert.X509Certificate; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +import org.eclipse.milo.opcua.stack.core.security.CertificateFactory; +import org.eclipse.milo.opcua.stack.core.security.CertificateGroup; +import org.eclipse.milo.opcua.stack.core.security.CertificateManager; +import org.eclipse.milo.opcua.stack.core.security.CertificateQuarantine; +import org.eclipse.milo.opcua.stack.core.security.CertificateValidator; +import org.eclipse.milo.opcua.stack.core.security.TrustListManager; +import org.eclipse.milo.opcua.stack.core.types.builtin.ByteString; +import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; + +/** + * A {@link CertificateManager} that delegates to another certificate manager, but whose certificate groups validate the + * certificates of the clients with the given {@link CertificateValidator}. + * <p> + * With Eclipse Milo 1.x, the server validates the certificate of a client with the validator of the certificate group + * of the server certificate, see {@link CertificateGroup#getCertificateValidator()}. + */ +public final class CertificateValidatorCertificateManager implements CertificateManager { + + private final CertificateManager delegate; Review Comment: 💡 **Nit:** The class Javadoc could note that the three default methods of `CertificateManager` (`getDefaultApplicationGroup`, `getDefaultUserTokenGroup`, `getDefaultHttpsGroup`) are intentionally not overridden — they delegate to `getCertificateGroup(NodeId)`, which IS overridden here and applies the validator wrapping. Without this note a future reader might wonder if the decorator is incomplete. ```suggestion * A {@link CertificateManager} that delegates to another certificate manager, but whose certificate groups validate the * certificates of the clients with the given {@link CertificateValidator}. * <p> * With Eclipse Milo 1.x, the server validates the certificate of a client with the validator of the certificate group * of the server certificate, see {@link CertificateGroup#getCertificateValidator()}. * <p> * The default methods {@code getDefaultApplicationGroup}, {@code getDefaultUserTokenGroup}, and * {@code getDefaultHttpsGroup} are not overridden: they delegate to {@link #getCertificateGroup(NodeId)}, * which applies the validator wrapping. */ -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
