Skip to content

Commit 53a3a3b

Browse files
authored
Bump omniauth and hashie versions (#18)
* Bump omniauth and hashie versions * Add test to check AuthHash doesn't cause conflicts in the future * Bump version of GitHub actions used in CI * Add explanation why upgrade Hashie
1 parent d3bedab commit 53a3a3b

File tree

8 files changed

+87
-11
lines changed

8 files changed

+87
-11
lines changed

.github/workflows/linters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v2.0.0
19+
- uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 1
2222

@@ -25,7 +25,7 @@ jobs:
2525
ruby-version: ${{ env.RUBY_VERSION }}
2626

2727
- name: Recover Ruby dependency cache
28-
uses: actions/cache@v2
28+
uses: actions/cache@v4
2929
with:
3030
path: ./vendor/bundle
3131
key: ${{ runner.OS }}-rubydeps-${{ hashFiles('Gemfile.lock') }}

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v2.0.0
19+
- uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 1
2222

@@ -25,7 +25,7 @@ jobs:
2525
ruby-version: ${{ env.RUBY_VERSION }}
2626

2727
- name: Recover Ruby dependency cache
28-
uses: actions/cache@v1
28+
uses: actions/cache@v4
2929
with:
3030
path: ./vendor/bundle
3131
key: ${{ runner.OS }}-rubydeps-${{ hashFiles('Gemfile.lock') }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## next version:
44

5+
## Version 0.6.0 (MINOR)
6+
- Bump omniauth dependency to v2.1 series.
7+
- Force Hashie >= 5.0.0.
8+
59
## Version 0.5.0 (MINOR)
610
- Send the client_id and the client_secret during the AuthToken retrieval.
711

Gemfile.lock

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
PATH
22
remote: .
33
specs:
4-
omniauth-idcat_mobil (0.5.0)
5-
omniauth (~> 2.0.4)
4+
omniauth-idcat_mobil (0.6.0)
5+
hashie (>= 5.0.0)
6+
omniauth (~> 2.1.2)
67
omniauth-oauth2 (>= 1.7.2, < 2.0)
78

89
GEM
@@ -17,6 +18,7 @@ GEM
1718
faraday-net_http (2.0.3)
1819
hashie (5.0.0)
1920
jwt (2.3.0)
21+
logger (1.7.0)
2022
multi_json (1.15.0)
2123
multi_xml (0.6.0)
2224
oauth2 (1.4.9)
@@ -25,9 +27,10 @@ GEM
2527
multi_json (~> 1.3)
2628
multi_xml (~> 0.5)
2729
rack (>= 1.2, < 3)
28-
omniauth (2.0.4)
30+
omniauth (2.1.4)
2931
hashie (>= 3.4.6)
30-
rack (>= 1.6.2, < 3)
32+
logger
33+
rack (>= 2.2.3)
3134
rack-protection
3235
omniauth-oauth2 (1.7.2)
3336
oauth2 (~> 1.4)

lib/omniauth/idcat_mobil/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module Omniauth
44
module IdCatMobil
5-
VERSION = "0.5.0"
5+
VERSION = "0.6.0"
66
end
77
end

lib/omniauth/strategies/idcat_mobil.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def callback_url
123123
# --------------------------------------------------
124124

125125
def idcat_log(msg)
126-
idcat_logger.debug(msg)
126+
idcat_logger.info("[idcat_mobil] #{msg}")
127127
end
128128

129129
def idcat_logger

omniauth-idcat_mobil.gemspec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ Gem::Specification.new do |spec|
2424
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2525
spec.require_paths = ["lib"]
2626

27-
spec.add_dependency "omniauth", "~> 2.0.4"
27+
# Hashie >= 5.0.0 is required for compatibility with newer ActiveSupport versions.
28+
# Older versions of Hashie have conflicts with ActiveSupport's Hash extensions.
29+
spec.add_dependency "hashie", ">=5.0.0"
30+
spec.add_dependency "omniauth", "~> 2.1.2"
2831
spec.add_dependency "omniauth-oauth2", ">= 1.7.2", "< 2.0"
2932
spec.add_development_dependency "bundler", "~> 2.2", ">= 2.2.10"
3033
spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"

spec/omni_auth/auth_hash_spec.rb

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# frozen_string_literal: true
2+
3+
require "spec_helper"
4+
5+
describe OmniAuth::AuthHash do
6+
let(:auth_hash) do
7+
OmniAuth::AuthHash.new(
8+
provider: "idcat_mobil",
9+
uid: "123456789",
10+
info: {
11+
email: "email@example.net",
12+
name: "Oriol",
13+
surname1: "Junquerol",
14+
surname2: "Balaguer"
15+
},
16+
credentials: {
17+
token: "fake_token",
18+
expires: false
19+
},
20+
extra: {
21+
identifier_type: "1",
22+
method: "idcatmobil",
23+
status: "ok"
24+
}
25+
)
26+
end
27+
28+
describe "indifferent access" do
29+
it "is accessible with string keys at root level" do
30+
expect(auth_hash["provider"]).to eq("idcat_mobil")
31+
expect(auth_hash["uid"]).to eq("123456789")
32+
expect(auth_hash["info"]).to be_a(Hash)
33+
expect(auth_hash["credentials"]).to be_a(Hash)
34+
expect(auth_hash["extra"]).to be_a(Hash)
35+
end
36+
37+
it "is accessible with symbol keys at root level" do
38+
expect(auth_hash[:provider]).to eq("idcat_mobil")
39+
expect(auth_hash[:uid]).to eq("123456789")
40+
expect(auth_hash[:info]).to be_a(Hash)
41+
expect(auth_hash[:credentials]).to be_a(Hash)
42+
expect(auth_hash[:extra]).to be_a(Hash)
43+
end
44+
45+
it "is accessible with string keys in nested hashes" do
46+
expect(auth_hash["info"]["email"]).to eq("email@example.net")
47+
expect(auth_hash["info"]["name"]).to eq("Oriol")
48+
expect(auth_hash["credentials"]["token"]).to eq("fake_token")
49+
expect(auth_hash["extra"]["method"]).to eq("idcatmobil")
50+
end
51+
52+
it "is accessible with symbol keys in nested hashes" do
53+
expect(auth_hash[:info][:email]).to eq("email@example.net")
54+
expect(auth_hash[:info][:name]).to eq("Oriol")
55+
expect(auth_hash[:credentials][:token]).to eq("fake_token")
56+
expect(auth_hash[:extra][:method]).to eq("idcatmobil")
57+
end
58+
59+
it "supports mixed string and symbol access" do
60+
expect(auth_hash["info"][:email]).to eq("email@example.net")
61+
expect(auth_hash[:info]["name"]).to eq("Oriol")
62+
expect(auth_hash["credentials"][:token]).to eq("fake_token")
63+
expect(auth_hash[:extra]["method"]).to eq("idcatmobil")
64+
end
65+
end
66+
end

0 commit comments

Comments
 (0)