Class: Temporalio::Connection::TlsOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/temporalio/connection/tls_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_root_ca_cert: nil, client_cert: nil, client_private_key: nil, server_name_override: nil) ⇒ TlsOptions

Returns a new instance of TlsOptions.

Parameters:

  • server_root_ca_cert (String?) (defaults to: nil)

    Root CA certificate used by the server.

  • client_cert (String?) (defaults to: nil)

    Client certificate used to authenticate with the server.

  • client_private_key (String?) (defaults to: nil)

    Client private key used to authenticate with the server.

  • server_name_override (String?) (defaults to: nil)

    Overrides the target name used for validation of the server SSL certificate.

Raises:

  • (ArgumentError)

    if ‘client_cert` and `client_private_key` are not both set or both unset



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/temporalio/connection/tls_options.rb', line 34

def initialize(
  server_root_ca_cert: nil,
  client_cert: nil,
  client_private_key: nil,
  server_name_override: nil
)
  if (client_cert && !client_private_key) || (!client_cert && client_private_key)
    raise ArgumentError, 'client_cert and client_private_key must be either both set or both unset'
  end

  @server_root_ca_cert = server_root_ca_cert
  @client_cert = client_cert
  @client_private_key = client_private_key
  @server_name_override = server_name_override
end

Instance Attribute Details

#client_certObject (readonly)

Client certificate used to authenticate with the server. If set, a corresponding ‘client_private_key` must be provided.



14
15
16
# File 'lib/temporalio/connection/tls_options.rb', line 14

def client_cert
  @client_cert
end

#client_private_keyObject (readonly)

Client private key used to authenticate with the server. Required if ‘client_cert` is set.



17
18
19
# File 'lib/temporalio/connection/tls_options.rb', line 17

def client_private_key
  @client_private_key
end

#server_name_overrideObject (readonly)

Overrides the target name used for validation of the server SSL certificate. If not specified, the server certificate will be checked against the host part of the connection target address. This should be used for testing only.

Leave unset for Temporal Cloud.



26
27
28
# File 'lib/temporalio/connection/tls_options.rb', line 26

def server_name_override
  @server_name_override
end

#server_root_ca_certObject (readonly)

Root CA certificate used by the server. If not set, the server’s certificate will be validated against the operating system’s root certificates.

Leave unset for Temporal Cloud.



8
9
10
# File 'lib/temporalio/connection/tls_options.rb', line 8

def server_root_ca_cert
  @server_root_ca_cert
end