Skip to content

Commit 8a8d0ac

Browse files
committed
chore: fmt java
Signed-off-by: Mark Phelps <[email protected]>
1 parent 3f7438d commit 8a8d0ac

File tree

1 file changed

+107
-116
lines changed

1 file changed

+107
-116
lines changed

flipt-client-java/src/main/java/io/flipt/client/models/TlsConfig.java

Lines changed: 107 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -2,145 +2,136 @@
22

33
import com.fasterxml.jackson.annotation.JsonInclude;
44
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import java.util.Optional;
56
import lombok.Builder;
67
import lombok.Value;
78

8-
import java.util.Optional;
9-
109
/**
1110
* TLS configuration for connecting to Flipt servers with custom certificates.
12-
*
11+
*
1312
* <p>This class provides comprehensive TLS configuration options including:
13+
*
1414
* <ul>
15-
* <li>Custom CA certificates for self-signed or private CAs</li>
16-
* <li>Client certificates for mutual TLS authentication</li>
17-
* <li>Certificate data as strings or file paths</li>
18-
* <li>Insecure mode for development (skip certificate verification)</li>
15+
* <li>Custom CA certificates for self-signed or private CAs
16+
* <li>Client certificates for mutual TLS authentication
17+
* <li>Certificate data as strings or file paths
18+
* <li>Insecure mode for development (skip certificate verification)
1919
* </ul>
20-
*
20+
*
2121
* <p>Certificate data fields take precedence over file path fields when both are provided.
2222
*/
2323
@Value
2424
@Builder
2525
@JsonInclude(JsonInclude.Include.NON_EMPTY)
2626
public class TlsConfig {
2727

28-
/**
29-
* Path to custom CA certificate file in PEM format.
30-
* Used to verify server certificates signed by custom or self-signed CAs.
31-
*/
32-
@JsonProperty("ca_cert_file")
33-
Optional<String> caCertFile;
28+
/**
29+
* Path to custom CA certificate file in PEM format. Used to verify server certificates signed by
30+
* custom or self-signed CAs.
31+
*/
32+
@JsonProperty("ca_cert_file")
33+
Optional<String> caCertFile;
3434

35-
/**
36-
* Raw CA certificate content in PEM format.
37-
* Used to verify server certificates signed by custom or self-signed CAs.
38-
* Takes precedence over caCertFile when both are provided.
39-
*/
40-
@JsonProperty("ca_cert_data")
41-
Optional<String> caCertData;
35+
/**
36+
* Raw CA certificate content in PEM format. Used to verify server certificates signed by custom
37+
* or self-signed CAs. Takes precedence over caCertFile when both are provided.
38+
*/
39+
@JsonProperty("ca_cert_data")
40+
Optional<String> caCertData;
4241

43-
/**
44-
* Skip certificate verification entirely.
45-
* <strong>WARNING:</strong> This should only be used in development environments.
46-
* Setting this to true makes connections vulnerable to man-in-the-middle attacks.
47-
*/
48-
@JsonProperty("insecure_skip_verify")
49-
Optional<Boolean> insecureSkipVerify;
42+
/**
43+
* Skip certificate verification entirely. <strong>WARNING:</strong> This should only be used in
44+
* development environments. Setting this to true makes connections vulnerable to
45+
* man-in-the-middle attacks.
46+
*/
47+
@JsonProperty("insecure_skip_verify")
48+
Optional<Boolean> insecureSkipVerify;
5049

51-
/**
52-
* Path to client certificate file in PEM format.
53-
* Used for mutual TLS authentication where the server requires client certificates.
54-
*/
55-
@JsonProperty("client_cert_file")
56-
Optional<String> clientCertFile;
50+
/**
51+
* Path to client certificate file in PEM format. Used for mutual TLS authentication where the
52+
* server requires client certificates.
53+
*/
54+
@JsonProperty("client_cert_file")
55+
Optional<String> clientCertFile;
5756

58-
/**
59-
* Path to client private key file in PEM format.
60-
* Used for mutual TLS authentication where the server requires client certificates.
61-
* Must correspond to the clientCertFile.
62-
*/
63-
@JsonProperty("client_key_file")
64-
Optional<String> clientKeyFile;
57+
/**
58+
* Path to client private key file in PEM format. Used for mutual TLS authentication where the
59+
* server requires client certificates. Must correspond to the clientCertFile.
60+
*/
61+
@JsonProperty("client_key_file")
62+
Optional<String> clientKeyFile;
6563

66-
/**
67-
* Raw client certificate content in PEM format.
68-
* Used for mutual TLS authentication where the server requires client certificates.
69-
* Takes precedence over clientCertFile when both are provided.
70-
*/
71-
@JsonProperty("client_cert_data")
72-
Optional<String> clientCertData;
64+
/**
65+
* Raw client certificate content in PEM format. Used for mutual TLS authentication where the
66+
* server requires client certificates. Takes precedence over clientCertFile when both are
67+
* provided.
68+
*/
69+
@JsonProperty("client_cert_data")
70+
Optional<String> clientCertData;
7371

74-
/**
75-
* Raw client private key content in PEM format.
76-
* Used for mutual TLS authentication where the server requires client certificates.
77-
* Must correspond to the clientCertData.
78-
* Takes precedence over clientKeyFile when both are provided.
79-
*/
80-
@JsonProperty("client_key_data")
81-
Optional<String> clientKeyData;
72+
/**
73+
* Raw client private key content in PEM format. Used for mutual TLS authentication where the
74+
* server requires client certificates. Must correspond to the clientCertData. Takes precedence
75+
* over clientKeyFile when both are provided.
76+
*/
77+
@JsonProperty("client_key_data")
78+
Optional<String> clientKeyData;
8279

83-
/**
84-
* Creates a TlsConfig for development with insecure certificate verification disabled.
85-
* <strong>WARNING:</strong> Only use this in development environments.
86-
*
87-
* @return TlsConfig with insecure skip verify enabled
88-
*/
89-
public static TlsConfig insecure() {
90-
return TlsConfig.builder()
91-
.insecureSkipVerify(Optional.of(true))
92-
.build();
93-
}
80+
/**
81+
* Creates a TlsConfig for development with insecure certificate verification disabled.
82+
* <strong>WARNING:</strong> Only use this in development environments.
83+
*
84+
* @return TlsConfig with insecure skip verify enabled
85+
*/
86+
public static TlsConfig insecure() {
87+
return TlsConfig.builder().insecureSkipVerify(Optional.of(true)).build();
88+
}
9489

95-
/**
96-
* Creates a TlsConfig with a custom CA certificate from a file.
97-
*
98-
* @param caCertFile path to the CA certificate file in PEM format
99-
* @return TlsConfig with custom CA certificate
100-
*/
101-
public static TlsConfig withCaCertFile(String caCertFile) {
102-
return TlsConfig.builder()
103-
.caCertFile(Optional.of(caCertFile))
104-
.build();
105-
}
90+
/**
91+
* Creates a TlsConfig with a custom CA certificate from a file.
92+
*
93+
* @param caCertFile path to the CA certificate file in PEM format
94+
* @return TlsConfig with custom CA certificate
95+
*/
96+
public static TlsConfig withCaCertFile(String caCertFile) {
97+
return TlsConfig.builder().caCertFile(Optional.of(caCertFile)).build();
98+
}
10699

107-
/**
108-
* Creates a TlsConfig with a custom CA certificate from string data.
109-
*
110-
* @param caCertData CA certificate content in PEM format
111-
* @return TlsConfig with custom CA certificate
112-
*/
113-
public static TlsConfig withCaCertData(String caCertData) {
114-
return TlsConfig.builder()
115-
.caCertData(Optional.of(caCertData))
116-
.build();
117-
}
100+
/**
101+
* Creates a TlsConfig with a custom CA certificate from string data.
102+
*
103+
* @param caCertData CA certificate content in PEM format
104+
* @return TlsConfig with custom CA certificate
105+
*/
106+
public static TlsConfig withCaCertData(String caCertData) {
107+
return TlsConfig.builder().caCertData(Optional.of(caCertData)).build();
108+
}
118109

119-
/**
120-
* Creates a TlsConfig for mutual TLS with client certificate and key files.
121-
*
122-
* @param clientCertFile path to client certificate file in PEM format
123-
* @param clientKeyFile path to client private key file in PEM format
124-
* @return TlsConfig with mutual TLS configuration
125-
*/
126-
public static TlsConfig withMutualTls(String clientCertFile, String clientKeyFile) {
127-
return TlsConfig.builder()
128-
.clientCertFile(Optional.of(clientCertFile))
129-
.clientKeyFile(Optional.of(clientKeyFile))
130-
.build();
131-
}
110+
/**
111+
* Creates a TlsConfig for mutual TLS with client certificate and key files.
112+
*
113+
* @param clientCertFile path to client certificate file in PEM format
114+
* @param clientKeyFile path to client private key file in PEM format
115+
* @return TlsConfig with mutual TLS configuration
116+
*/
117+
public static TlsConfig withMutualTls(String clientCertFile, String clientKeyFile) {
118+
return TlsConfig.builder()
119+
.clientCertFile(Optional.of(clientCertFile))
120+
.clientKeyFile(Optional.of(clientKeyFile))
121+
.build();
122+
}
132123

133-
/**
134-
* Creates a TlsConfig for mutual TLS with client certificate and key data.
135-
*
136-
* @param clientCertData client certificate content in PEM format
137-
* @param clientKeyData client private key content in PEM format
138-
* @return TlsConfig with mutual TLS configuration
139-
*/
140-
public static TlsConfig withMutualTlsData(String clientCertData, String clientKeyData) {
141-
return TlsConfig.builder()
142-
.clientCertData(Optional.of(clientCertData))
143-
.clientKeyData(Optional.of(clientKeyData))
144-
.build();
145-
}
146-
}
124+
/**
125+
* Creates a TlsConfig for mutual TLS with client certificate and key data.
126+
*
127+
* @param clientCertData client certificate content in PEM format
128+
* @param clientKeyData client private key content in PEM format
129+
* @return TlsConfig with mutual TLS configuration
130+
*/
131+
public static TlsConfig withMutualTlsData(String clientCertData, String clientKeyData) {
132+
return TlsConfig.builder()
133+
.clientCertData(Optional.of(clientCertData))
134+
.clientKeyData(Optional.of(clientKeyData))
135+
.build();
136+
}
137+
}

0 commit comments

Comments
 (0)