Skip to content

Commit

Permalink
Merge pull request #198 from eclipse-thingweb/trusted-roots
Browse files Browse the repository at this point in the history
Reactivate `withTrustedRoots` by default in HTTP binding
  • Loading branch information
JKRhb authored Nov 4, 2024
2 parents a3156ac + e7dc1fe commit 3f40b8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/src/binding_http/http_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ final class HttpClient extends ProtocolClient
IOClient(io.HttpClient(context: _createContext(httpClientConfig)));

static SecurityContext _createContext(HttpClientConfig? httpClientConfig) {
final context = SecurityContext();
final context = SecurityContext(
withTrustedRoots: httpClientConfig?.withTrustedRoots ?? true,
);

final trustedCertificates = httpClientConfig?.trustedCertificates ?? [];

Expand Down
5 changes: 5 additions & 0 deletions lib/src/binding_http/http_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ class HttpConfig {
class HttpClientConfig {
/// Creates a new [HttpClientConfig] object.
const HttpClientConfig({
this.withTrustedRoots = true,
this.trustedCertificates,
});

/// Indicates whether the security contexts created from this config will
/// incorporate trusted root certificates from the underlying platform.
final bool withTrustedRoots;

/// List of trusted certificates that will be added to the security contexts
/// of newly created HTTP clients.
///
Expand Down

0 comments on commit 3f40b8a

Please sign in to comment.