Cleanups for SslClientCertAuthenticator.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2021-06-09 15:13:31 +10:00
parent 3a8af443f5
commit e77ba1e2b2
3 changed files with 8 additions and 18 deletions

View File

@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory;
* <li>{@link org.eclipse.jetty.security.authentication.DigestAuthenticator}</li> * <li>{@link org.eclipse.jetty.security.authentication.DigestAuthenticator}</li>
* <li>{@link org.eclipse.jetty.security.authentication.FormAuthenticator}</li> * <li>{@link org.eclipse.jetty.security.authentication.FormAuthenticator}</li>
* <li>{@link org.eclipse.jetty.security.authentication.ClientCertAuthenticator}</li> * <li>{@link org.eclipse.jetty.security.authentication.ClientCertAuthenticator}</li>
* <li>{@link SslClientCertAuthenticator}</li> * <li>{@link org.eclipse.jetty.security.authentication.SslClientCertAuthenticator}</li>
* </ul> * </ul>
* All authenticators derived from {@link org.eclipse.jetty.security.authentication.LoginAuthenticator} are * All authenticators derived from {@link org.eclipse.jetty.security.authentication.LoginAuthenticator} are
* wrapped with a {@link org.eclipse.jetty.security.authentication.DeferredAuthentication} * wrapped with a {@link org.eclipse.jetty.security.authentication.DeferredAuthentication}

View File

@ -35,10 +35,10 @@ import org.eclipse.jetty.util.security.CertificateValidator;
import org.eclipse.jetty.util.security.Constraint; import org.eclipse.jetty.util.security.Constraint;
import org.eclipse.jetty.util.security.Password; import org.eclipse.jetty.util.security.Password;
@Deprecated
/** /**
* @deprecated Prefer using {@link SslClientCertAuthenticator} * @deprecated Prefer using {@link SslClientCertAuthenticator}
*/ */
@Deprecated
public class ClientCertAuthenticator extends LoginAuthenticator public class ClientCertAuthenticator extends LoginAuthenticator
{ {
/** /**

View File

@ -37,23 +37,14 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
* The client certificates available in the request will be verified against the configured {@link SslContextFactory} instance * The client certificates available in the request will be verified against the configured {@link SslContextFactory} instance
* </p> * </p>
*/ */
public class SslClientCertAuthenticator public class SslClientCertAuthenticator extends LoginAuthenticator
extends LoginAuthenticator
{ {
private final SslContextFactory sslContextFactory;
/**
* Set to true if SSL certificate validation is not required
* per default it's true as this is the goal of this implementation
*/
private boolean validateCerts = true; private boolean validateCerts = true;
private SslContextFactory sslContextFactory;
public SslClientCertAuthenticator(SslContextFactory sslContextFactory) public SslClientCertAuthenticator(SslContextFactory sslContextFactory)
{ {
super(); this.sslContextFactory = Objects.requireNonNull(sslContextFactory);
Objects.nonNull(sslContextFactory);
this.sslContextFactory = sslContextFactory;
} }
@Override @Override
@ -135,7 +126,7 @@ public class SslClientCertAuthenticator
} }
/** /**
* @return true if SSL certificate has to be validated * @return true if SSL certificate has to be validated.
*/ */
public boolean isValidateCerts() public boolean isValidateCerts()
{ {
@ -143,11 +134,10 @@ public class SslClientCertAuthenticator
} }
/** /**
* @param validateCerts true if SSL certificates have to be validated * @param validateCerts true if SSL certificates have to be validated.
*/ */
public void setValidateCerts(boolean validateCerts) public void setValidateCerts(boolean validateCerts)
{ {
validateCerts = validateCerts; this.validateCerts = validateCerts;
} }
} }