michael-o commented on code in PR #615:
URL: 
https://github.com/apache/httpcomponents-client/pull/615#discussion_r1932087039


##########
httpclient5/src/main/java/org/apache/hc/client5/http/auth/MutualKerberosConfig.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.client5.http.auth;
+
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+
+/**
+ * Immutable class encapsulating Kerberos configuration options for 
MutualSpnegoScheme.
+ *
+ * Unlike the deprecated {@link KerberosConfig}, this class uses explicit 
defaults, and
+ * primitive booleans.
+ *
+ * @since 5.5
+ *
+ */
+@Contract(threading = ThreadingBehavior.IMMUTABLE)
+public class MutualKerberosConfig implements Cloneable {
+
+
+    public static final MutualKerberosConfig DEFAULT = new Builder().build();
+
+    private final boolean stripPort;
+    private final boolean useCanonicalHostname;
+    private final boolean requestMutualAuth;
+    private final boolean requestDelegCreds;
+
+    /**
+     * Intended for CDI compatibility
+    */
+    protected MutualKerberosConfig() {
+        this(true, true, true, false);

Review Comment:
   Does this imply a DNS call? If yes, this should be disabled by default. 
Consider that you have a VHost and you cannot expect PTR records to match.



##########
httpclient5/src/main/java/org/apache/hc/client5/http/auth/MutualKerberosConfig.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.client5.http.auth;
+
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+
+/**
+ * Immutable class encapsulating Kerberos configuration options for 
MutualSpnegoScheme.
+ *
+ * Unlike the deprecated {@link KerberosConfig}, this class uses explicit 
defaults, and
+ * primitive booleans.
+ *
+ * @since 5.5
+ *
+ */
+@Contract(threading = ThreadingBehavior.IMMUTABLE)
+public class MutualKerberosConfig implements Cloneable {
+
+
+    public static final MutualKerberosConfig DEFAULT = new Builder().build();
+
+    private final boolean stripPort;
+    private final boolean useCanonicalHostname;
+    private final boolean requestMutualAuth;
+    private final boolean requestDelegCreds;
+
+    /**
+     * Intended for CDI compatibility
+    */
+    protected MutualKerberosConfig() {
+        this(true, true, true, false);
+    }
+
+    MutualKerberosConfig(
+            final boolean stripPort,
+            final boolean useCanonicalHostname,
+            final boolean requestMutualAuth,
+            final boolean requestDelegCreds) {
+        super();
+        this.stripPort = stripPort;
+        this.useCanonicalHostname = useCanonicalHostname;
+        this.requestMutualAuth = requestMutualAuth;
+        this.requestDelegCreds = requestDelegCreds;
+    }
+
+    public boolean isStripPort() {
+        return stripPort;
+    }
+
+    public boolean isUseCanonicalHostname() {
+        return useCanonicalHostname;
+    }
+
+    public boolean isRequestDelegCreds() {
+        return requestDelegCreds;
+    }
+
+    public boolean isRequestMutualAuth() {
+        return requestMutualAuth;
+    }
+
+    @Override
+    protected MutualKerberosConfig clone() throws CloneNotSupportedException {
+        return (MutualKerberosConfig) super.clone();
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("[");
+        builder.append("stripPort=").append(stripPort);
+        builder.append(", useCanonicalHostname=").append(useCanonicalHostname);
+        builder.append(", requestDelegCreds=").append(requestDelegCreds);
+        builder.append(", requestMutualAuth=").append(requestMutualAuth);
+        builder.append("]");
+        return builder.toString();
+    }
+
+    public static MutualKerberosConfig.Builder custom() {
+        return new Builder();
+    }
+
+    public static MutualKerberosConfig.Builder copy(final MutualKerberosConfig 
config) {
+        return new Builder()
+                .setStripPort(config.isStripPort())
+                .setUseCanonicalHostname(config.isUseCanonicalHostname())
+                .setRequestDelegCreds(config.isRequestDelegCreds())
+                .setRequestMutualAuth(config.isRequestMutualAuth());
+    }
+
+    public static class Builder {
+
+        private boolean stripPort = true;
+        private boolean useCanonicalHostname = true ;

Review Comment:
   space



##########
httpclient5/src/main/java/org/apache/hc/client5/http/auth/MutualKerberosConfig.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.client5.http.auth;
+
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+
+/**
+ * Immutable class encapsulating Kerberos configuration options for 
MutualSpnegoScheme.
+ *
+ * Unlike the deprecated {@link KerberosConfig}, this class uses explicit 
defaults, and
+ * primitive booleans.
+ *
+ * @since 5.5
+ *
+ */
+@Contract(threading = ThreadingBehavior.IMMUTABLE)
+public class MutualKerberosConfig implements Cloneable {
+
+
+    public static final MutualKerberosConfig DEFAULT = new Builder().build();
+
+    private final boolean stripPort;

Review Comment:
   Since this is new, I would negate this logic: `addPort`



-- 
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: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to