Skip to content

Commit

Permalink
Fix authorization header of tokendata endpoint (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi authored Jul 12, 2024
1 parent fe335d3 commit 65448c9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
decidim-ub (0.1.0)
decidim-ub (0.1.1)
decidim-core (>= 0.28.0, < 0.29)

GEM
Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/ub/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Decidim
# This holds the decidim-meetings version.
module Ub
VERSION = "0.1.0"
VERSION = "0.1.1"
DECIDIM_VERSION = "~> 0.28.0"
COMPAT_DECIDIM_VERSION = [">= 0.28.0", "< 0.29"].freeze
end
Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/ub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def callback_url
def raw_info
@raw_info ||= begin
connection = Faraday.new(url: options.client_options[:site], ssl: { verify: true }) do |conn|
conn.headers["Authorization"] = "#{access_token.response.parsed.token_type} #{access_token.token}"
conn.headers["Authorization"] = access_token.options[:header_format].gsub("%s", access_token.token)
end
response = connection.get("/api/adas/oauth2/tokendata")
raise Error, "Unable to fetch the user information" unless response.success?
Expand Down
2 changes: 1 addition & 1 deletion spec/omni_auth/strategies/ub_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
let(:callback_path) { "/auth/ub/callback" }

let(:raw_info) { { employeenumber: [id], cn: [name], mail: [email], uidnet: [nickname], colect2: roles }.stringify_keys }
let(:access_token) { OpenStruct.new(token: "secret-token", response: OpenStruct.new(parsed: OpenStruct.new(token_type: "Bearer"))) }
let(:access_token) { OpenStruct.new(token: "secret-token", options: { header_format: "Bearer %s" }) }

before do
allow_any_instance_of(described_class).to receive(:full_host).and_return(full_host)
Expand Down

0 comments on commit 65448c9

Please sign in to comment.