Class: SSLCheck::Validator
- Inherits:
-
Object
- Object
- SSLCheck::Validator
show all
- Defined in:
- lib/sslcheck/validator.rb
Defined Under Namespace
Classes: CABundleMissingError, CommonNameMissingError, PeerCertificateMissingError
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Validator.
Instance Method Details
#errors ⇒ Object
41
42
43
|
# File 'lib/sslcheck/validator.rb', line 41
def errors
@errors.compact
end
|
#valid? ⇒ Boolean
37
38
39
|
# File 'lib/sslcheck/validator.rb', line 37
def valid?
@validated && errors.empty?
end
|
#validate(common_name = nil, peer_cert = nil, ca_bundle = [], validators = []) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/sslcheck/validator.rb', line 25
def validate(common_name=nil, peer_cert=nil, ca_bundle=[], validators=[])
raise CommonNameMissingError if common_name.nil? || common_name.empty?
raise PeerCertificateMissingError if peer_cert.nil?
raise CABundleMissingError if ca_bundle.nil? || ca_bundle.empty?
@common_name = common_name
@peer_cert = peer_cert
@ca_bundle = ca_bundle
run_validations(validators)
end
|
#warnings ⇒ Object
45
46
47
|
# File 'lib/sslcheck/validator.rb', line 45
def warnings
[]
end
|