Skip to content

Commit

Permalink
LTI-280: remove duplicate call to broker (#254)
Browse files Browse the repository at this point in the history
Co-authored-by: Jesus Federico <[email protected]>
  • Loading branch information
Mariam05 and jfederico authored Dec 19, 2023
1 parent 08a214e commit 0a26c28
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/bbb/credentials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
module Bbb
class Credentials
include OmniauthHelper
include BrokerHelper

attr_writer :cache, :cache_enabled, :multitenant_api_endpoint, :multitenant_api_secret # Rails.cache store is assumed. # Enabled by default.

Expand Down Expand Up @@ -67,7 +68,7 @@ def formatted_tenant_info(tenant)
end

# Get tenant info from broker
tenant_info = fetch_tenant_info(tenant)
tenant_info = tenant_settings(tenant: tenant)

# Get tenant credentials from TENANT_CREDENTIALS environment variable
tenant_credentials = JSON.parse(Rails.configuration.tenant_credentials)[tenant]
Expand Down Expand Up @@ -110,15 +111,6 @@ def formatted_tenant_info(tenant)
end
end

def fetch_tenant_info(tenant)
bbbltibroker_url = omniauth_bbbltibroker_url("/api/v1/tenants/#{tenant}")
get_response = RestClient.get(bbbltibroker_url, 'Authorization' => "Bearer #{omniauth_client_token(omniauth_bbbltibroker_url)}")
JSON.parse(get_response)
rescue StandardError
Rails.logger.error('Could not fetch tenant credentials from broker')
nil
end

def http_request(uri)
# Make the request.
http = Net::HTTP.new(uri.host, uri.port)
Expand Down

0 comments on commit 0a26c28

Please sign in to comment.