-
Notifications
You must be signed in to change notification settings - Fork 968
/
ssl_options.rb
58 lines (55 loc) · 2.04 KB
/
ssl_options.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# frozen_string_literal: true
module Faraday
# SSL-related options.
#
# @!attribute verify
# @return [Boolean] whether to verify SSL certificates or not
#
# @!attribute ca_file
# @return [String] CA file
#
# @!attribute ca_path
# @return [String] CA path
#
# @!attribute verify_mode
# @return [String] Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
#
# @!attribute cert_store
# @return [OpenSSL::X509::Store] certificate store
#
# @!attribute client_cert
# @return [String, OpenSSL::X509::Certificate] client certificate
#
# @!attribute client_key
# @return [String, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA] client key
#
# @!attribute certificate
# @return [OpenSSL::X509::Certificate] certificate (Excon only)
#
# @!attribute private_key
# @return [OpenSSL::PKey::RSA, OpenSSL::PKey::DSA] private key (Excon only)
#
# @!attribute verify_depth
# @return [Integer] maximum depth for the certificate chain verification
#
# @!attribute version
# @return [String, Symbol] SSL version (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html#method-i-ssl_version-3D)
#
# @!attribute min_version
# @return [String, Symbol] minimum SSL version (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html#method-i-min_version-3D)
#
# @!attribute max_version
# @return [String, Symbol] maximum SSL version (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html#method-i-max_version-3D)
class SSLOptions < Options.new(:verify, :ca_file, :ca_path, :verify_mode,
:cert_store, :client_cert, :client_key, :certificate, :private_key, :verify_depth,
:version, :min_version, :max_version)
# @return [Boolean] true if should verify
def verify?
verify != false
end
# @return [Boolean] true if should not verify
def disable?
!verify?
end
end
end