omniauth-idcat_mobil 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## next version:
4
4
 
5
+ ## Version 0.3.0 (MINOR)
6
+ - CI: Intoduce continous integration via GitHub Actions.
7
+ - CI: Apply `rubocop` recommendations.
8
+
5
9
  ## Version 0.2.4 (PATCH)
6
10
  - FIX: do not delete the session state before checking it.
7
11
  - DOC: Change CHANGELOG format, prefix with change type.
data/Gemfile CHANGED
@@ -1,12 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  # Specify your gem's dependencies in omniauth-idcat_mobil.gemspec
6
8
  gemspec
7
9
 
10
+ group :development, :test do
11
+ gem "rubocop"
12
+ gem "rubocop-rspec"
13
+ end
14
+
8
15
  group :test do
9
16
  gem "rack", ">= 2.1.4"
10
17
  gem "rack-test"
11
18
  gem "rspec", "~> 3.0"
12
- end
19
+ end
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rake/testtask"
3
5
 
@@ -7,4 +9,4 @@ Rake::TestTask.new(:test) do |t|
7
9
  t.test_files = FileList["test/**/*_test.rb"]
8
10
  end
9
11
 
10
- task :default => :test
12
+ task default: :test
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Omniauth
2
4
  module IdCatMobil
3
- VERSION = "0.2.4"
5
+ VERSION = "0.3.0"
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "omniauth/idcat_mobil/version"
2
4
  require "omniauth/strategies/idcat_mobil"
3
5
 
@@ -18,7 +18,7 @@ module OmniAuth
18
18
  option :name, :idcat_mobil
19
19
  option :auth_token_params, {
20
20
  mode: :query, # put the param in the query of the requested url
21
- param_name: 'AccessToken'
21
+ param_name: "AccessToken"
22
22
  }
23
23
 
24
24
  option :user_info_path, "/serveis-rest/getUserInfo"
@@ -38,7 +38,7 @@ module OmniAuth
38
38
  surname1: raw_info["surname1"],
39
39
  surname2: raw_info["surname2"],
40
40
  surnames: raw_info["surnames"],
41
- country_code: raw_info["countryCode"],
41
+ country_code: raw_info["countryCode"]
42
42
  }
43
43
  end
44
44
 
@@ -59,7 +59,7 @@ module OmniAuth
59
59
  scope: :autenticacio_usuari,
60
60
  response_type: :code,
61
61
  approval_prompt: :auto,
62
- access_type: :online,
62
+ access_type: :online
63
63
  }
64
64
  options.client_options[:token_url] = URI.join(options.site, "/o/oauth2/token").to_s
65
65
  options.client_options[:auth_token_params] = {
@@ -74,7 +74,7 @@ module OmniAuth
74
74
  #
75
75
  # It is implemented in the OAuth2 superclass, and does the follwing:
76
76
  # redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(options.authorize_params))
77
- #
77
+ #
78
78
  # We're overriding solely to log.
79
79
  def request_phase
80
80
  idcat_log("In `request_phase`, with params: redirect_uri=>#{callback_url}, options=>#{options.authorize_params}")
@@ -99,7 +99,7 @@ module OmniAuth
99
99
  else
100
100
  idcat_log("Performing getUserInfo...")
101
101
  response= access_token.get(options.user_info_path)
102
- result= %i(status headers body).collect {|m| response.send(m)}
102
+ result= [:status, :headers, :body].collect { |m| response.send(m) }
103
103
  idcat_log("getUserInfo response status/headers/body: #{result}")
104
104
  @raw_info= response.parsed
105
105
  # Logout to avoid problems with IdCat mòbil's cookie session when trying to login again.
@@ -117,6 +117,7 @@ module OmniAuth
117
117
 
118
118
  # --------------------------------------------------
119
119
  private
120
+
120
121
  # --------------------------------------------------
121
122
 
122
123
  def idcat_log(msg)
@@ -124,8 +125,8 @@ module OmniAuth
124
125
  end
125
126
 
126
127
  def idcat_logger
127
- @idcat_logger||= defined?(Rails.logger) ? Rails.logger : Logger.new(STDOUT, progname: 'idcat_mobil')
128
+ @idcat_logger||= defined?(Rails.logger) ? Rails.logger : Logger.new($stdout, progname: "idcat_mobil")
128
129
  end
129
130
  end
130
131
  end
131
- end
132
+ end
@@ -1,30 +1,32 @@
1
+ # frozen_string_literal: true
1
2
 
2
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require "omniauth/idcat_mobil/version"
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "omniauth-idcat_mobil"
8
- spec.version = Omniauth::IdCatMobil::VERSION
9
- spec.authors = ["Oliver Valls"]
10
- spec.email = ["oliver.vh@coditramuntana.com"]
8
+ spec.name = "omniauth-idcat_mobil"
9
+ spec.version = Omniauth::IdCatMobil::VERSION
10
+ spec.authors = ["Oliver Valls"]
11
+ spec.email = ["oliver.vh@coditramuntana.com"]
11
12
 
12
- spec.summary = %q{User registration and login through IdCat mòbil.}
13
- spec.description = %q{Authentication method that uses OAuth 2.0 protocol.}
14
- spec.homepage = "https://github.com/gencat/omniauth-idcat_mobil"
15
- spec.license = "MIT"
13
+ spec.summary = "User registration and login through IdCat mòbil."
14
+ spec.description = "Authentication method that uses OAuth 2.0 protocol."
15
+ spec.homepage = "https://github.com/gencat/omniauth-idcat_mobil"
16
+ spec.license = "MIT"
16
17
 
17
18
  # Specify which files should be added to the gem when it is released.
18
19
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
21
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
22
  end
22
- spec.bindir = "exe"
23
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
25
  spec.require_paths = ["lib"]
25
26
 
26
27
  spec.add_dependency "omniauth", "~> 1.5"
27
28
  spec.add_dependency "omniauth-oauth2", ">= 1.4.0", "< 2.0"
28
29
  spec.add_development_dependency "bundler", "~> 2.2", ">= 2.2.10"
29
30
  spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
31
+ spec.metadata["rubygems_mfa_required"] = "true"
30
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-idcat_mobil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Valls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-31 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -91,7 +91,12 @@ executables: []
91
91
  extensions: []
92
92
  extra_rdoc_files: []
93
93
  files:
94
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
95
+ - ".github/pull_request_template.md"
96
+ - ".github/workflows/linters.yml"
97
+ - ".github/workflows/test.yml"
94
98
  - ".gitignore"
99
+ - ".rubocop.yml"
95
100
  - ".ruby-version"
96
101
  - CHANGELOG.md
97
102
  - CODE_OF_CONDUCT.md
@@ -111,7 +116,8 @@ files:
111
116
  homepage: https://github.com/gencat/omniauth-idcat_mobil
112
117
  licenses:
113
118
  - MIT
114
- metadata: {}
119
+ metadata:
120
+ rubygems_mfa_required: 'true'
115
121
  post_install_message:
116
122
  rdoc_options: []
117
123
  require_paths: