omniauth-line-v2_1 1.0.0 → 1.2.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +1 -6
- data/lib/omniauth/line_v2_1/version.rb +1 -1
- data/lib/omniauth/strategies/line_v2_1.rb +17 -21
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 48b7eabf165102c77a028447af025a49a0d96fef443212573ca39e1f5607cfe3
|
|
4
|
+
data.tar.gz: 3e660975cc14731e0063e5efb9b326bead51bb60ffc92fd66738f0b7cf02ee5e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 15acff7703daf08e09128e2116f631376f7b50f067cbc1a56df6d882a7e98140dafdde1023338558917bb21bc1f3f9a3ab447ea91c426ebec79d94c256e45cc9
|
|
7
|
+
data.tar.gz: c20139b4ac5542d34f70656e86917e0b4e62947033f4eab5fe65d1eb38e9e84e448c9f0f86258e54246041b17d94313b0d2612e75f2c0e5acb02241edf42511d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0] - 2025-11-03
|
|
4
|
+
|
|
5
|
+
- Refactor: Remove redundant user info endpoint call
|
|
6
|
+
- Test: Update test
|
|
7
|
+
- Other: Update README.md
|
|
8
|
+
|
|
9
|
+
## [1.1.0] - 2025-08-02
|
|
10
|
+
|
|
11
|
+
- Refactor: Refactor `OmniAuth::Strategies::LineV21#authorize_params`
|
|
12
|
+
- Test: Update test
|
|
13
|
+
|
|
3
14
|
## [1.0.0] - 2025-08-01
|
|
4
15
|
|
|
5
16
|
- New: Generate nonce parameter automatically for security
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/cadenza-tech/omniauth-line-v2_1/blob/main/LICENSE.txt) [](https://github.com/cadenza-tech/omniauth-line-v2_1/blob/main/CHANGELOG.md) [](https://github.com/cadenza-tech/omniauth-line-v2_1/actions?query=workflow%3Arelease) [](https://github.com/cadenza-tech/omniauth-line-v2_1/actions?query=workflow%3Atest) [](https://github.com/cadenza-tech/omniauth-line-v2_1/actions?query=workflow%3Alint)
|
|
4
4
|
|
|
5
|
-
LINE
|
|
5
|
+
LINE strategy for OmniAuth.
|
|
6
6
|
|
|
7
7
|
- [Installation](#installation)
|
|
8
8
|
- [Usage](#usage)
|
|
@@ -105,11 +105,6 @@ After successful authentication, the auth hash will be available in `request.env
|
|
|
105
105
|
refresh_token: 'Aa1FdeggRhTnPNNpxr8p'
|
|
106
106
|
},
|
|
107
107
|
extra: {
|
|
108
|
-
raw_info: {
|
|
109
|
-
sub: 'U4af4980629...',
|
|
110
|
-
name: 'Taro Line',
|
|
111
|
-
picture: 'https://profile.line-scdn.net/...'
|
|
112
|
-
},
|
|
113
108
|
id_token: 'eyJhbGciOiJIUzI1NiJ9...',
|
|
114
109
|
id_info: {
|
|
115
110
|
iss: 'https://access.line.me',
|
|
@@ -1,40 +1,36 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'omniauth-oauth2'
|
|
4
|
+
require 'uri'
|
|
4
5
|
|
|
5
6
|
module OmniAuth
|
|
6
7
|
module Strategies
|
|
7
8
|
class LineV21 < OmniAuth::Strategies::OAuth2
|
|
8
9
|
DEFAULT_SCOPE = 'profile openid email'
|
|
9
|
-
USER_INFO_URL = 'https://api.line.me/oauth2/v2.1/userinfo'
|
|
10
10
|
ID_TOKEN_VERIFY_URL = 'https://api.line.me/oauth2/v2.1/verify'
|
|
11
11
|
|
|
12
12
|
option :name, 'line_v2_1'
|
|
13
|
-
|
|
14
13
|
option :client_options, {
|
|
15
14
|
site: 'https://access.line.me',
|
|
16
15
|
authorize_url: '/oauth2/v2.1/authorize',
|
|
17
16
|
token_url: 'https://api.line.me/oauth2/v2.1/token'
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
option :authorize_options, [:scope, :state, :nonce, :prompt, :bot_prompt]
|
|
21
|
-
|
|
22
19
|
option :scope, DEFAULT_SCOPE
|
|
23
20
|
|
|
24
|
-
uid {
|
|
21
|
+
uid { id_token_info[:decoded]['sub'] }
|
|
25
22
|
|
|
26
23
|
info do
|
|
27
24
|
prune!({
|
|
28
|
-
name:
|
|
29
|
-
nickname:
|
|
30
|
-
image:
|
|
25
|
+
name: id_token_info[:decoded]['name'],
|
|
26
|
+
nickname: id_token_info[:decoded]['sub'],
|
|
27
|
+
image: id_token_info[:decoded]['picture'],
|
|
31
28
|
email: id_token_info[:decoded]['email']
|
|
32
29
|
})
|
|
33
30
|
end
|
|
34
31
|
|
|
35
32
|
extra do
|
|
36
33
|
hash = {}
|
|
37
|
-
hash[:raw_info] = raw_info unless skip_info?
|
|
38
34
|
hash[:id_token] = id_token_info[:raw] if id_token_info[:raw]
|
|
39
35
|
hash[:id_info] = id_token_info[:decoded] if id_token_info[:decoded]
|
|
40
36
|
prune!(hash)
|
|
@@ -48,24 +44,20 @@ module OmniAuth
|
|
|
48
44
|
hash
|
|
49
45
|
end
|
|
50
46
|
|
|
51
|
-
def raw_info
|
|
52
|
-
@raw_info ||= access_token.get(USER_INFO_URL, headers: { 'Authorization' => "Bearer #{access_token.token}" }).parsed
|
|
53
|
-
end
|
|
54
|
-
|
|
55
47
|
def callback_url
|
|
56
48
|
options[:redirect_uri] || (full_host + callback_path)
|
|
57
49
|
end
|
|
58
50
|
|
|
59
|
-
def authorize_params
|
|
51
|
+
def authorize_params # rubocop:disable Metrics/AbcSize
|
|
60
52
|
super.tap do |params|
|
|
61
|
-
|
|
62
|
-
params[
|
|
53
|
+
options[:authorize_options].each do |key|
|
|
54
|
+
params[key] = request.params[key.to_s] unless empty?(request.params[key.to_s])
|
|
63
55
|
end
|
|
64
56
|
params[:scope] ||= DEFAULT_SCOPE
|
|
65
57
|
params[:nonce] ||= SecureRandom.hex(24)
|
|
66
58
|
params[:response_type] = 'code'
|
|
67
|
-
session['omniauth.state'] = params[:state]
|
|
68
|
-
session['omniauth.nonce'] = params[:nonce]
|
|
59
|
+
session['omniauth.state'] = params[:state] unless empty?(params[:state])
|
|
60
|
+
session['omniauth.nonce'] = params[:nonce] unless empty?(params[:nonce])
|
|
69
61
|
end
|
|
70
62
|
end
|
|
71
63
|
|
|
@@ -74,10 +66,14 @@ module OmniAuth
|
|
|
74
66
|
def prune!(hash)
|
|
75
67
|
hash.delete_if do |_, value|
|
|
76
68
|
prune!(value) if value.is_a?(Hash)
|
|
77
|
-
|
|
69
|
+
empty?(value)
|
|
78
70
|
end
|
|
79
71
|
end
|
|
80
72
|
|
|
73
|
+
def empty?(value)
|
|
74
|
+
value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
|
75
|
+
end
|
|
76
|
+
|
|
81
77
|
def id_token_info
|
|
82
78
|
return @id_token_info if defined?(@id_token_info)
|
|
83
79
|
|
|
@@ -85,11 +81,11 @@ module OmniAuth
|
|
|
85
81
|
return @id_token_info unless access_token.params['id_token']
|
|
86
82
|
|
|
87
83
|
@id_token_info[:raw] = access_token.params['id_token']
|
|
88
|
-
@id_token_info[:decoded] =
|
|
84
|
+
@id_token_info[:decoded] = verify_and_decode_id_token(access_token.params['id_token'])
|
|
89
85
|
@id_token_info
|
|
90
86
|
end
|
|
91
87
|
|
|
92
|
-
def
|
|
88
|
+
def verify_and_decode_id_token(id_token)
|
|
93
89
|
params = {
|
|
94
90
|
id_token: id_token,
|
|
95
91
|
client_id: options.client_id
|
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: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masahiro
|
|
@@ -37,7 +37,7 @@ dependencies:
|
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '1.8'
|
|
40
|
-
description: LINE
|
|
40
|
+
description: LINE strategy for OmniAuth
|
|
41
41
|
email:
|
|
42
42
|
- watanabe@cadenza-tech.com
|
|
43
43
|
executables: []
|
|
@@ -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/v1.
|
|
55
|
+
homepage: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v1.2.0
|
|
56
56
|
licenses:
|
|
57
57
|
- MIT
|
|
58
58
|
metadata:
|
|
59
|
-
homepage_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v1.
|
|
60
|
-
source_code_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v1.
|
|
61
|
-
changelog_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/blob/v1.
|
|
59
|
+
homepage_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v1.2.0
|
|
60
|
+
source_code_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/tree/v1.2.0
|
|
61
|
+
changelog_uri: https://github.com/cadenza-tech/omniauth-line-v2_1/blob/v1.2.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/1.
|
|
63
|
+
documentation_uri: https://rubydoc.info/gems/omniauth-line-v2_1/1.2.0
|
|
64
64
|
funding_uri: https://patreon.com/CadenzaTech
|
|
65
65
|
rubygems_mfa_required: 'true'
|
|
66
66
|
rdoc_options: []
|
|
@@ -79,5 +79,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
79
79
|
requirements: []
|
|
80
80
|
rubygems_version: 3.6.9
|
|
81
81
|
specification_version: 4
|
|
82
|
-
summary: LINE
|
|
82
|
+
summary: LINE strategy for OmniAuth
|
|
83
83
|
test_files: []
|