Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1

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

- name: Recover Ruby dependency cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ./vendor/bundle
key: ${{ runner.OS }}-rubydeps-${{ hashFiles('Gemfile.lock') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1

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

- name: Recover Ruby dependency cache
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ./vendor/bundle
key: ${{ runner.OS }}-rubydeps-${{ hashFiles('Gemfile.lock') }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## next version:

## Version 0.6.0 (MINOR)
- Bump omniauth dependency to v2.1 series.
- Force Hashie >= 5.0.0.

## Version 0.5.0 (MINOR)
- Send the client_id and the client_secret during the AuthToken retrieval.

Expand Down
11 changes: 7 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
PATH
remote: .
specs:
omniauth-idcat_mobil (0.5.0)
omniauth (~> 2.0.4)
omniauth-idcat_mobil (0.6.0)
hashie (>= 5.0.0)
omniauth (~> 2.1.2)
omniauth-oauth2 (>= 1.7.2, < 2.0)

GEM
Expand All @@ -17,6 +18,7 @@ GEM
faraday-net_http (2.0.3)
hashie (5.0.0)
jwt (2.3.0)
logger (1.7.0)
multi_json (1.15.0)
multi_xml (0.6.0)
oauth2 (1.4.9)
Expand All @@ -25,9 +27,10 @@ GEM
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (2.0.4)
omniauth (2.1.4)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
logger
rack (>= 2.2.3)
rack-protection
omniauth-oauth2 (1.7.2)
oauth2 (~> 1.4)
Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/idcat_mobil/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Omniauth
module IdCatMobil
VERSION = "0.5.0"
VERSION = "0.6.0"
end
end
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/idcat_mobil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def callback_url
# --------------------------------------------------

def idcat_log(msg)
idcat_logger.debug(msg)
idcat_logger.info("[idcat_mobil] #{msg}")
end

def idcat_logger
Expand Down
5 changes: 4 additions & 1 deletion omniauth-idcat_mobil.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "omniauth", "~> 2.0.4"
# Hashie >= 5.0.0 is required for compatibility with newer ActiveSupport versions.
# Older versions of Hashie have conflicts with ActiveSupport's Hash extensions.
spec.add_dependency "hashie", ">=5.0.0"
spec.add_dependency "omniauth", "~> 2.1.2"
spec.add_dependency "omniauth-oauth2", ">= 1.7.2", "< 2.0"
spec.add_development_dependency "bundler", "~> 2.2", ">= 2.2.10"
spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
Expand Down
66 changes: 66 additions & 0 deletions spec/omni_auth/auth_hash_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# frozen_string_literal: true

require "spec_helper"

describe OmniAuth::AuthHash do
let(:auth_hash) do
OmniAuth::AuthHash.new(
provider: "idcat_mobil",
uid: "123456789",
info: {
email: "email@example.net",
name: "Oriol",
surname1: "Junquerol",
surname2: "Balaguer"
},
credentials: {
token: "fake_token",
expires: false
},
extra: {
identifier_type: "1",
method: "idcatmobil",
status: "ok"
}
)
end

describe "indifferent access" do
it "is accessible with string keys at root level" do
expect(auth_hash["provider"]).to eq("idcat_mobil")
expect(auth_hash["uid"]).to eq("123456789")
expect(auth_hash["info"]).to be_a(Hash)
expect(auth_hash["credentials"]).to be_a(Hash)
expect(auth_hash["extra"]).to be_a(Hash)
end

it "is accessible with symbol keys at root level" do
expect(auth_hash[:provider]).to eq("idcat_mobil")
expect(auth_hash[:uid]).to eq("123456789")
expect(auth_hash[:info]).to be_a(Hash)
expect(auth_hash[:credentials]).to be_a(Hash)
expect(auth_hash[:extra]).to be_a(Hash)
end

it "is accessible with string keys in nested hashes" do
expect(auth_hash["info"]["email"]).to eq("email@example.net")
expect(auth_hash["info"]["name"]).to eq("Oriol")
expect(auth_hash["credentials"]["token"]).to eq("fake_token")
expect(auth_hash["extra"]["method"]).to eq("idcatmobil")
end

it "is accessible with symbol keys in nested hashes" do
expect(auth_hash[:info][:email]).to eq("email@example.net")
expect(auth_hash[:info][:name]).to eq("Oriol")
expect(auth_hash[:credentials][:token]).to eq("fake_token")
expect(auth_hash[:extra][:method]).to eq("idcatmobil")
end

it "supports mixed string and symbol access" do
expect(auth_hash["info"][:email]).to eq("email@example.net")
expect(auth_hash[:info]["name"]).to eq("Oriol")
expect(auth_hash["credentials"][:token]).to eq("fake_token")
expect(auth_hash[:extra]["method"]).to eq("idcatmobil")
end
end
end