-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2402 from department-of-veterans-affairs/bastosmi…
…chael/okta_breaker_service Creating Okta Breaker Pattern
- Loading branch information
Showing
9 changed files
with
75 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'common/client/configuration/rest' | ||
|
||
module Okta | ||
class Configuration < Common::Client::Configuration::REST | ||
def base_path | ||
Settings.oidc.base_api_url || '' | ||
end | ||
|
||
def connection | ||
@conn ||= Faraday.new(base_path) do |faraday| | ||
faraday.use :breakers | ||
faraday.response :json | ||
faraday.adapter Faraday.default_adapter | ||
end | ||
end | ||
|
||
def service_name | ||
'OKTA' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'common/client/base' | ||
|
||
module Okta | ||
class Service < Common::Client::Base | ||
include Common::Client::Monitoring | ||
|
||
STATSD_KEY_PREFIX = 'api.okta' | ||
|
||
configuration Okta::Configuration | ||
|
||
def get_url_with_token(url) | ||
connection.get do |req| | ||
req.url url | ||
req.headers['Content-Type'] = 'application/json' | ||
req.headers['Accept'] = 'application/json' | ||
req.headers['Authorization'] = "SSWS #{Settings.oidc.base_api_token}" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
describe Okta::Configuration do | ||
describe '#service_name' do | ||
it 'has the expected service name' do | ||
expect(described_class.instance.service_name).to eq('OKTA') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters