omniauth-line-v2_1 0.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb969635fc2b09065bebf5373d123f43986a6730036a34329a2d53e6a64cae6e
4
- data.tar.gz: b78c3a7a5d50a89d6ed15c533467d40c3588be0cf4c05799e957a36994b85ac4
3
+ metadata.gz: 32152b111920b320e068b3038339245e0a7f8b7bf3b42481b07f33276a770afb
4
+ data.tar.gz: 9424e8c32ba957214cb9583ab3c094544d0cc0500a26b4b425330775e840401c
5
5
  SHA512:
6
- metadata.gz: beb775ade24ca083c3732d52a9b3428731d929ce6726170d23813f85f264e841059ed9db1a81de6a0fb963224c5015a4c7595b761bba8d5f427a150f6ace83df
7
- data.tar.gz: e6d6e1548574c50864d9b49fc445222dda932c94933c9aa96f15803c7d067ce7e1ba7075daf12578c7bc84efb8b2cb5f150590ff730f31987317130d59727567
6
+ metadata.gz: 96b6264a13cbd4e4a9645dcd57ca1e9a0403d04989654b65beab55568f72ac17e2ecfc1631895622b56b311c2c46d1e420728789a3781d06526e8355bb1d7629
7
+ data.tar.gz: f9cbd122a9ca71a835f0c4bb3c48e157a75c7164e283efbac7df689a02d9473b94b554a2c8065e3da3e6b3f04308424a7daedca65efd93c96113d8871a461264
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.0] - 2025-08-02
4
+
5
+ - Refactor: Refactor `OmniAuth::Strategies::LineV21#authorize_params`
6
+ - Test: Update test
7
+
8
+ ## [1.0.0] - 2025-08-01
9
+
10
+ - New: Generate nonce parameter automatically for security
11
+ - New: Call fail! when ID token verification response contains error
12
+
3
13
  ## [0.0.0] - 2025-07-26
4
14
 
5
15
  - Initial release
data/README.md CHANGED
@@ -108,8 +108,7 @@ After successful authentication, the auth hash will be available in `request.env
108
108
  raw_info: {
109
109
  sub: 'U4af4980629...',
110
110
  name: 'Taro Line',
111
- picture: 'https://profile.line-scdn.net/...',
112
- email: 'taro.line@example.com'
111
+ picture: 'https://profile.line-scdn.net/...'
113
112
  },
114
113
  id_token: 'eyJhbGciOiJIUzI1NiJ9...',
115
114
  id_info: {
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module LineV21
5
- VERSION = '0.0.0'
5
+ VERSION = '1.1.0'
6
6
  end
7
7
  end
@@ -56,15 +56,16 @@ module OmniAuth
56
56
  options[:redirect_uri] || (full_host + callback_path)
57
57
  end
58
58
 
59
- def authorize_params
59
+ def authorize_params # rubocop:disable Metrics/AbcSize
60
60
  super.tap do |params|
61
- %w[scope state nonce prompt bot_prompt].each do |v|
62
- params[v.to_sym] = request.params[v] if request.params[v]
61
+ options[:authorize_options].each do |key|
62
+ params[key] = request.params[key.to_s] unless empty?(request.params[key.to_s])
63
63
  end
64
64
  params[:scope] ||= DEFAULT_SCOPE
65
+ params[:nonce] ||= SecureRandom.hex(24)
65
66
  params[:response_type] = 'code'
66
- session['omniauth.state'] = params[:state] if params[:state]
67
- session['omniauth.nonce'] = params[:nonce] if params[:nonce]
67
+ session['omniauth.state'] = params[:state] unless empty?(params[:state])
68
+ session['omniauth.nonce'] = params[:nonce] unless empty?(params[:nonce])
68
69
  end
69
70
  end
70
71
 
@@ -73,10 +74,14 @@ module OmniAuth
73
74
  def prune!(hash)
74
75
  hash.delete_if do |_, value|
75
76
  prune!(value) if value.is_a?(Hash)
76
- value.nil? || (value.respond_to?(:empty?) && value.empty?)
77
+ empty?(value)
77
78
  end
78
79
  end
79
80
 
81
+ def empty?(value)
82
+ value.nil? || (value.respond_to?(:empty?) && value.empty?)
83
+ end
84
+
80
85
  def id_token_info
81
86
  return @id_token_info if defined?(@id_token_info)
82
87
 
@@ -93,9 +98,9 @@ module OmniAuth
93
98
  id_token: id_token,
94
99
  client_id: options.client_id
95
100
  }
96
- params[:nonce] = session['omniauth.nonce'] if session['omniauth.nonce']
101
+ params[:nonce] = session.delete('omniauth.nonce') if session['omniauth.nonce']
97
102
 
98
- client.request(
103
+ response = client.request(
99
104
  :post,
100
105
  ID_TOKEN_VERIFY_URL,
101
106
  headers: {
@@ -103,9 +108,12 @@ module OmniAuth
103
108
  },
104
109
  body: URI.encode_www_form(params)
105
110
  ).parsed
111
+
112
+ fail!(:id_token_verification_failed, CallbackError.new(:id_token_verification_failed, response['error_description'])) if response['error']
113
+
114
+ response
106
115
  rescue StandardError => e
107
- log :error, "ID token verification failed: #{e.message}"
108
- nil
116
+ fail!(:id_token_verification_failed, e)
109
117
  end
110
118
  end
111
119
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-line-v2_1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro
@@ -52,15 +52,15 @@ files:
52
52
  - lib/omniauth-line-v2_1.rb
53
53
  - lib/omniauth/line_v2_1/version.rb
54
54
  - lib/omniauth/strategies/line_v2_1.rb
55
- homepage: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v0.0.0
55
+ homepage: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v1.1.0
56
56
  licenses:
57
57
  - MIT
58
58
  metadata:
59
- homepage_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v0.0.0
60
- source_code_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v0.0.0
61
- changelog_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/blob/v0.0.0/CHANGELOG.md
59
+ homepage_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v1.1.0
60
+ source_code_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v1.1.0
61
+ changelog_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/blob/v1.1.0/CHANGELOG.md
62
62
  bug_tracker_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/issues
63
- documentation_uri: https://rubydoc.info/gems/omniauth-line-v2_1/0.0.0
63
+ documentation_uri: https://rubydoc.info/gems/omniauth-line-v2_1/1.1.0
64
64
  funding_uri: https://patreon.com/CadenzaTech
65
65
  rubygems_mfa_required: 'true'
66
66
  rdoc_options: []