Package com.guinetik.rr
Class RocketRestSecureConfig
- java.lang.Object
-
- com.guinetik.rr.RocketRestConfig
-
- com.guinetik.rr.RocketRestSecureConfig
-
- All Implemented Interfaces:
RocketSSL.SSLConfig
public class RocketRestSecureConfig extends RocketRestConfig implements RocketSSL.SSLConfig
Extended configuration forRocketRestclients requiring custom SSL/TLS certificates.This class extends
RocketRestConfigto provide support for custom SSL certificates, enabling secure connections to APIs that use self-signed certificates, custom certificate authorities, or require mutual TLS (mTLS) authentication.When to Use
- Connecting to APIs with self-signed SSL certificates
- Corporate environments with internal certificate authorities
- Mutual TLS (mTLS) authentication requirements
- Development/staging environments with non-production certificates
Basic Usage
RocketRestSecureConfig config = RocketRestSecureConfig .secureBuilder("https://secure-api.internal.corp") .withCustomCertificate("/path/to/keystore.p12", "keystorePassword") .authStrategy(AuthStrategyFactory.createBearerToken("api-token")) .build(); RocketRest client = new RocketRest(config); SecureData data = client.get("/secure/data", SecureData.class);With OAuth2 and Custom Certificate
RocketRestSecureConfig config = RocketRestSecureConfig .secureBuilder("https://api.internal.corp") .withCustomCertificate("client-cert.p12", "certPassword") .authStrategy(AuthStrategyFactory.createOAuth2ClientCredentials( "client-id", "client-secret", "https://auth.internal.corp/oauth/token" )) .tokenUrl("https://auth.internal.corp/oauth/token") .defaultOptions(opts -> { opts.set(RocketRestOptions.RETRY_ENABLED, true); opts.set(RocketRestOptions.MAX_RETRIES, 3); }) .build(); RocketRest client = new RocketRest(config);- Since:
- 1.0.0
- Author:
- guinetik <guinetik@gmail.com>
- See Also:
RocketRestConfig,RocketSSL,RocketRest
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRocketRestSecureConfig.SecureBuilderBuilder for creating RocketRestSecureConfig instances.-
Nested classes/interfaces inherited from class com.guinetik.rr.RocketRestConfig
RocketRestConfig.Builder
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRocketRestSecureConfig(RocketRestSecureConfig.SecureBuilder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCustomCertificateFilename()Gets the custom certificate filename.StringgetCustomCertificatePassword()Gets the custom certificate password.booleanisCustomCertificateEnabled()Checks if a custom SSL certificate is enabled.static RocketRestSecureConfig.SecureBuildersecureBuilder(String serviceUrl)Creates a new secure builder for RocketRestConfig.-
Methods inherited from class com.guinetik.rr.RocketRestConfig
builder, getAuthStrategy, getDefaultOptions, getServiceUrl, getTokenUrl, setServiceUrl
-
-
-
-
Constructor Detail
-
RocketRestSecureConfig
protected RocketRestSecureConfig(RocketRestSecureConfig.SecureBuilder builder)
-
-
Method Detail
-
isCustomCertificateEnabled
public boolean isCustomCertificateEnabled()
Checks if a custom SSL certificate is enabled.- Specified by:
isCustomCertificateEnabledin interfaceRocketSSL.SSLConfig- Returns:
- true if a custom certificate is enabled
-
getCustomCertificateFilename
public String getCustomCertificateFilename()
Gets the custom certificate filename.- Specified by:
getCustomCertificateFilenamein interfaceRocketSSL.SSLConfig- Returns:
- the custom certificate filename
-
getCustomCertificatePassword
public String getCustomCertificatePassword()
Gets the custom certificate password.- Specified by:
getCustomCertificatePasswordin interfaceRocketSSL.SSLConfig- Returns:
- the custom certificate password
-
secureBuilder
public static RocketRestSecureConfig.SecureBuilder secureBuilder(String serviceUrl)
Creates a new secure builder for RocketRestConfig.- Parameters:
serviceUrl- the base URL for the API service- Returns:
- a new secure builder instance
-
-