Skip to content
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

changed access token handling #56

Merged
merged 1 commit into from
May 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions libraries/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ class ComplianceProfile < Chef::Resource # rubocop:disable Metrics/ClassLength
path = tar_path

# retrieve access token if a refresh token is set
token = retrieve_access_token if refresh_token
access_token = token
access_token = retrieve_access_token unless refresh_token.nil?

if token # go direct
if access_token # go direct
reqpath ="owners/#{o}/compliance/#{p}/tar"
url = construct_url(server, reqpath)

Expand Down
5 changes: 3 additions & 2 deletions libraries/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ class ComplianceReport < Chef::Resource
o = return_or_guess_owner

# retrieve access token if a refresh token is set
token = retrieve_access_token if refresh_token
access_token = token
access_token = retrieve_access_token unless refresh_token.nil?

if token # go direct
if access_token # go direct
url = construct_url(server, ::File.join('/owners', o, 'inspec'))
req = Net::HTTP::Post.new(url, { 'Authorization' => "Bearer #{token}" })
req.body = blob.to_json
Expand Down