lastobelus-rubycas-client 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,7 @@
1
1
  module CASClient
2
2
  # The client brokers all HTTP transactions with the CAS server.
3
3
  class Client
4
- attr_reader :cas_base_url
5
- attr_reader :log, :username_session_key, :extra_attributes_session_key, :service_url
4
+ attr_reader :cas_base_url, :log, :username_session_key, :extra_attributes_session_key, :service_url, :verify_ssl_certificate
6
5
  attr_writer :login_url, :validate_url, :proxy_url, :logout_url, :service_url
7
6
  attr_accessor :proxy_callback_url, :proxy_retrieval_url
8
7
 
@@ -23,7 +22,7 @@ module CASClient
23
22
  @proxy_callback_url = conf[:proxy_callback_url]
24
23
  @proxy_retrieval_url = conf[:proxy_retrieval_url]
25
24
  @load_ticket_url = conf[:load_ticket_url]
26
-
25
+ @verify_ssl_certificate = conf[:verify_ssl_certificate].nil? ? true : conf[:verify_ssl_certificate]
27
26
  @username_session_key = conf[:username_session_key] || :cas_user
28
27
  @extra_attributes_session_key = conf[:extra_attributes_session_key] || :cas_extra_attributes
29
28
 
@@ -122,6 +121,17 @@ module CASClient
122
121
  def http_connection(uri)
123
122
  https = Net::HTTP.new(uri.host, uri.port)
124
123
  https.use_ssl = (uri.scheme == 'https')
124
+ https.enable_post_connection_check = true
125
+ store = OpenSSL::X509::Store.new
126
+ store.set_default_paths
127
+ https.cert_store = store
128
+ if verify_ssl_certificate
129
+ log.debug "casclient will verify_ssl_certificate"
130
+ https.verify_mode = OpenSSL::SSL::VERIFY_PEER
131
+ else
132
+ log.debug "casclient will NOT verify_ssl_certificate"
133
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
134
+ end
125
135
  https
126
136
  end
127
137
 
@@ -2,7 +2,7 @@ module CASClient #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 0
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lastobelus-rubycas-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zukowski