Skip to content

Commit

Permalink
Merge pull request #549 from OpenC3/fix_httpclient_ssl
Browse files Browse the repository at this point in the history
Fix HTTPClient SSL and realm reference
  • Loading branch information
ryanmelt authored Mar 16, 2023
2 parents a6378cb + e6325a1 commit 5fde3c4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion openc3/lib/openc3/core_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
# All changes Copyright 2022, OpenC3, Inc.
# All Rights Reserved
#
# This file may also be used under the terms of a commercial license
# This file may also be used under the terms of a commercial license
# if purchased from OpenC3, Inc.

require 'openc3/core_ext/array'
require 'openc3/core_ext/binding'
require 'openc3/core_ext/class'
require 'openc3/core_ext/httpclient'
require 'openc3/core_ext/openc3_io'
require 'openc3/core_ext/exception'
require 'openc3/core_ext/file'
Expand Down
11 changes: 11 additions & 0 deletions openc3/lib/openc3/core_ext/httpclient.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'httpclient'

class HTTPClient
alias original_initialize initialize

def initialize(*args, &block)
original_initialize(*args, &block)
# Force use of the default system CA certs (instead of the 6 year old bundled ones)
@session_manager&.ssl_config&.set_default_paths
end
end
3 changes: 2 additions & 1 deletion openc3/lib/openc3/utilities/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ def _refresh_token(current_time)

# Make the post request to keycloak
def _make_request(headers, data)
uri = URI("#{@url}/realms/openc3/protocol/openid-connect/token")
realm = ENV['OPENC3_KEYCLOAK_REALM'] || 'openc3'
uri = URI("#{@url}/realms/#{realm}/protocol/openid-connect/token")
@log[0] = "request uri: #{uri.to_s} header: #{headers.to_s} body: #{data.to_s}"
STDOUT.puts @log[0] if JsonDRb.debug?
saved_verbose = $VERBOSE; $VERBOSE = nil
Expand Down

0 comments on commit 5fde3c4

Please sign in to comment.