-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changes as requested. #3
base: master
Are you sure you want to change the base?
Changes from all commits
907b275
d73ab6c
c654cc2
38a5bb6
717448f
6718cf9
918f9c4
cbbe843
6e17880
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,15 @@ def initialize(uid, config_uri, validations={}) | |
@config_uri = config_uri | ||
@validations = validations | ||
|
||
http = Net::HTTP.new(URI(config_uri).host, URI(config_uri).port) | ||
|
||
begin | ||
@config = JSON.parse(Net::HTTP.get(URI(config_uri))) | ||
uri = URI.parse(config_uri) | ||
http = Net::HTTP.new(uri.host, uri.port) | ||
http.use_ssl = true | ||
request = Net::HTTP::Get.new(uri.request_uri) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that you can pass |
||
response = http.request(request) | ||
@config = JSON.parse(response.body) | ||
rescue JSON::ParserError | ||
raise InvalidProviderConfig, "config_uri response is not valid for provider: #{uid}" | ||
end | ||
|
@@ -22,7 +29,11 @@ def initialize(uid, config_uri, validations={}) | |
|
||
def load_keys | ||
uri = URI(@config['jwks_uri']) | ||
keys = JSON.parse(Net::HTTP.get(uri))['keys'] | ||
http = Net::HTTP.new(uri.host, uri.port) | ||
http.use_ssl = true | ||
request = Net::HTTP::Get.new(uri.request_uri) | ||
response = http.request(request) | ||
keys = JSON.parse(response.body)['keys'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code is duplicated. I think that it's better to create a private function like this:
|
||
|
||
@keys = {} | ||
keys.each do |key| | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore this line please. We always put empty line before and after a block.