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.
- data/lib/casclient/client.rb +13 -3
- data/lib/casclient/version.rb +1 -1
- metadata +1 -1
data/lib/casclient/client.rb
CHANGED
@@ -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
|
|
data/lib/casclient/version.rb
CHANGED