lib/redfish_client/connector.rb in redfish_client-0.5.4 vs lib/redfish_client/connector.rb in redfish_client-0.6.0
- old
+ new
@@ -45,20 +45,22 @@
# 3. `clear` - Clear the complete cache.
# 4. `delete(key)` - Invalidate cache entry associated with `key`.
#
# @param url [String] base url of the Redfish service
# @param verify [Boolean] verify SSL certificate of the service
+ # @param use_session [Boolean] Use a session for authentication
# @param cache [Object] cache backend
- def initialize(url, verify: true, cache: nil)
+ def initialize(url, verify: true, cache: nil, use_session: true)
@url = url
@headers = DEFAULT_HEADERS.dup
middlewares = Excon.defaults[:middlewares] +
[Excon::Middleware::RedirectFollower]
@connection = Excon.new(@url,
ssl_verify_peer: verify,
middlewares: middlewares)
@cache = cache || NilHash.new
+ @use_session = use_session
end
# Add HTTP headers to the requests made by the connector.
#
# @param headers [Hash<String, String>] headers to be added
@@ -155,10 +157,10 @@
# @param session_path [String, nil] API session path
def set_auth_info(username, password, auth_test_path, session_path = nil)
@username = username
@password = password
@auth_test_path = auth_test_path
- @session_path = session_path
+ @session_path = @use_session ? session_path : nil
end
# Authenticate against the service.
#
# Calling this method will try to authenticate against API using