diff --git a/config/settings.yml b/config/settings.yml index ae6ac19c385..f90840cc4c4 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -174,6 +174,7 @@ form_10_10cg: token_url: ~ client_id: ~ client_secret: ~ + auth_token_path: ~ poa: s3: aws_access_key_id: my-aws-key-id diff --git a/lib/carma/client/mule_soft_auth_token_client.rb b/lib/carma/client/mule_soft_auth_token_client.rb index d881dc98a33..8314925ba9f 100644 --- a/lib/carma/client/mule_soft_auth_token_client.rb +++ b/lib/carma/client/mule_soft_auth_token_client.rb @@ -8,7 +8,6 @@ class MuleSoftAuthTokenClient < Common::Client::Base include Common::Client::Concerns::Monitoring STATSD_KEY_PREFIX = 'api.carma.mulesoft.auth' - AUTH_TOKEN_PATH = 'oauth2/ause1x1h6Zit9ziQL0j6/v1/token' GRANT_TYPE = 'client_credentials' SCOPE = 'DTCWriteResource' @@ -19,7 +18,7 @@ class GetAuthTokenError < StandardError; end def new_bearer_token with_monitoring do response = perform(:post, - AUTH_TOKEN_PATH, + auth_token_path, params, token_headers, { timeout: config.timeout }) @@ -55,6 +54,10 @@ def client_id def client_secret config.settings.client_secret end + + def auth_token_path + config.settings.auth_token_path + end end end end diff --git a/spec/lib/carma/client/mule_soft_auth_token_client_spec.rb b/spec/lib/carma/client/mule_soft_auth_token_client_spec.rb index 92038409cf7..a183eeffcff 100644 --- a/spec/lib/carma/client/mule_soft_auth_token_client_spec.rb +++ b/spec/lib/carma/client/mule_soft_auth_token_client_spec.rb @@ -13,6 +13,7 @@ token_url: 'my/token/url', client_id: 'id', client_secret: 'secret', + auth_token_path: 'auth/token/path', timeout: ) end @@ -57,7 +58,7 @@ expect(client).to receive(:perform) .with( :post, - CARMA::Client::MuleSoftAuthTokenClient::AUTH_TOKEN_PATH, + config.settings.auth_token_path, token_params, token_headers, options ) .and_return(mock_token_response) @@ -71,7 +72,7 @@ it 'raises error' do expect(client).to receive(:perform) - .with(:post, CARMA::Client::MuleSoftAuthTokenClient::AUTH_TOKEN_PATH, token_params, token_headers, options) + .with(:post, config.settings.auth_token_path, token_params, token_headers, options) .and_return(mock_error_token_response) expect do