Class AbstractVOMSProtocol
- java.lang.Object
-
- org.italiangrid.voms.request.impl.AbstractVOMSProtocol
-
- All Implemented Interfaces:
VOMSProtocol
- Direct Known Subclasses:
LegacyProtocol
,RESTProtocol
public abstract class AbstractVOMSProtocol extends java.lang.Object implements VOMSProtocol
Abstract base class providing a skeletal implementation of the VOMS client-server protocol. This class handles SSL authentication, connection timeouts, and hostname verification.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
connectTimeout
TCP connection timeout in milliseconds.static int
DEFAULT_CONNECT_TIMEOUT
The default value for the socket connection timeout (in milliseconds).static int
DEFAULT_READ_TIMEOUT
The default value for the socket read timeout (in milliseconds).static boolean
DEFAULT_SKIP_HOSTNAME_CHECKS
The default policy for skipping hostname verification.protected VOMSProtocolListener
listener
Listener for protocol events.protected int
readTimeout
Socket read timeout in milliseconds.protected boolean
skipHostnameChecks
Flag indicating whether hostname verification is disabled.protected eu.emi.security.authn.x509.X509CertChainValidatorExt
validator
Validator used for SSL authentication.static java.lang.String[]
VOMS_LEGACY_ENABLED_PROTOCOLS
Enabled TLS protocols for VOMS legacy connections.
-
Constructor Summary
Constructors Constructor Description AbstractVOMSProtocol(eu.emi.security.authn.x509.X509CertChainValidatorExt validator)
Constructor initializing the protocol with a certificate validator.AbstractVOMSProtocol(eu.emi.security.authn.x509.X509CertChainValidatorExt validator, VOMSProtocolListener listener, int connectTimeout, int readTimeout)
Constructor initializing the protocol with a validator, listener, and timeout settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getConnectTimeout()
Retrieves the connection timeout value.int
getReadTimeout()
Retrieves the read timeout value.protected javax.net.ssl.SSLSocketFactory
getSSLSocketFactory(eu.emi.security.authn.x509.X509Credential credential)
Creates an SSL socket factory using the provided credential and validator.boolean
isSkipHostnameChecks()
Checks whether hostname verification is disabled.void
setConnectTimeout(int connectTimeout)
Sets the connection timeout for the underlying socket.void
setReadTimeout(int readTimeout)
Sets the read timeout for the underlying socket.void
setSkipHostnameChecks(boolean skipHostnameChecks)
Configures whether SSL hostname verification should be skipped.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.italiangrid.voms.request.VOMSProtocol
doRequest
-
-
-
-
Field Detail
-
VOMS_LEGACY_ENABLED_PROTOCOLS
public static final java.lang.String[] VOMS_LEGACY_ENABLED_PROTOCOLS
Enabled TLS protocols for VOMS legacy connections.
-
DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_CONNECT_TIMEOUT
The default value for the socket connection timeout (in milliseconds).- See Also:
- Constant Field Values
-
DEFAULT_READ_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT
The default value for the socket read timeout (in milliseconds).- See Also:
- Constant Field Values
-
DEFAULT_SKIP_HOSTNAME_CHECKS
public static final boolean DEFAULT_SKIP_HOSTNAME_CHECKS
The default policy for skipping hostname verification.- See Also:
- Constant Field Values
-
listener
protected VOMSProtocolListener listener
Listener for protocol events.
-
validator
protected eu.emi.security.authn.x509.X509CertChainValidatorExt validator
Validator used for SSL authentication.
-
connectTimeout
protected int connectTimeout
TCP connection timeout in milliseconds.
-
readTimeout
protected int readTimeout
Socket read timeout in milliseconds.
-
skipHostnameChecks
protected boolean skipHostnameChecks
Flag indicating whether hostname verification is disabled.
-
-
Constructor Detail
-
AbstractVOMSProtocol
public AbstractVOMSProtocol(eu.emi.security.authn.x509.X509CertChainValidatorExt validator)
Constructor initializing the protocol with a certificate validator.- Parameters:
validator
- the certificate validator for SSL authentication
-
AbstractVOMSProtocol
public AbstractVOMSProtocol(eu.emi.security.authn.x509.X509CertChainValidatorExt validator, VOMSProtocolListener listener, int connectTimeout, int readTimeout)
Constructor initializing the protocol with a validator, listener, and timeout settings.- Parameters:
validator
- the certificate validator for SSL authenticationlistener
- the listener for protocol eventsconnectTimeout
- the socket connection timeout in millisecondsreadTimeout
- the socket read timeout in milliseconds
-
-
Method Detail
-
getSSLSocketFactory
protected javax.net.ssl.SSLSocketFactory getSSLSocketFactory(eu.emi.security.authn.x509.X509Credential credential)
Creates an SSL socket factory using the provided credential and validator.- Parameters:
credential
- the client credential for SSL authentication- Returns:
- an SSL socket factory configured with the given credential and validator
-
getConnectTimeout
public int getConnectTimeout()
Retrieves the connection timeout value.- Returns:
- the connection timeout in milliseconds
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout)
Sets the connection timeout for the underlying socket.- Parameters:
connectTimeout
- the connection timeout in milliseconds
-
getReadTimeout
public int getReadTimeout()
Retrieves the read timeout value.- Returns:
- the read timeout in milliseconds
-
setReadTimeout
public void setReadTimeout(int readTimeout)
Sets the read timeout for the underlying socket.- Parameters:
readTimeout
- the read timeout in milliseconds
-
isSkipHostnameChecks
public boolean isSkipHostnameChecks()
Checks whether hostname verification is disabled.- Returns:
true
if hostname checks are skipped,false
otherwise
-
setSkipHostnameChecks
public void setSkipHostnameChecks(boolean skipHostnameChecks)
Configures whether SSL hostname verification should be skipped.- Parameters:
skipHostnameChecks
-true
to disable hostname verification,false
to enable it
-
-