omniauth-yahoojp 0.1.4 → 0.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/README.md +59 -11
- data/lib/omniauth-yahoojp/version.rb +1 -1
- data/lib/omniauth/strategies/yahoojp.rb +19 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca264c63b14fa89691cfe5a8e11f23cde931c0a4
|
4
|
+
data.tar.gz: adf2273ad2d2d2b3af15fd3e2b68503daf9c7d4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8acdf1219c6775476415c42f5914e3afc16ab94ad28977c87183a736efafc689a13ec3156075a5a979b9eadbac25f9f4618bcc799a50c3bcf20a5fa458484775
|
7
|
+
data.tar.gz: 3a53191f69d16ff6442d88297630d320e5251b75cced5ff31d7f796cd92b4d059f92933a57ad24baef25a11cf6a2b11c4c0db5cb781eb9b1c3e20f232ee33b71
|
data/README.md
CHANGED
@@ -1,24 +1,72 @@
|
|
1
1
|
# OmniAuth YahooJp [](https://badge.fury.io/rb/omniauth-yahoojp)
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
**These notes are based on master, please see tags for README pertaining to specific releases.**
|
4
|
+
|
5
|
+
This is the official OmniAuth strategy for authenticating to Yahoo! JAPAN( [YConnect](http://developer.yahoo.co.jp/yconnect/v2/) ).
|
6
|
+
To use it, you'll need to sign up for a YConnect Client ID and Secret
|
5
7
|
on the [Yahoo! JAPAN Developer Network](https://e.developer.yahoo.co.jp/dashboard/).
|
6
8
|
|
9
|
+
Supports OAuth 2.0 Authorization Code flows. Read the Yahoo!JAPAN docs for more details: https://developer.yahoo.co.jp/yconnect/v2/
|
10
|
+
|
11
|
+
## Installing
|
12
|
+
|
13
|
+
Add to your `Gemfile`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'omniauth-yahoojp'
|
17
|
+
```
|
18
|
+
|
19
|
+
Then `bundle install`.
|
20
|
+
|
7
21
|
## Basic Usage
|
8
22
|
|
9
|
-
|
23
|
+
`OmniAuth::Strategies::YahooJp` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
|
10
24
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
25
|
+
YConnect API v2 lets you set scopes to provide granular access to different types of data:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
29
|
+
provider :yahoojp, ENV['YAHOOJP_KEY'], ENV['YAHOOJP_SECRET'],
|
30
|
+
{
|
31
|
+
scope: "openid profile email address"
|
32
|
+
}
|
33
|
+
end
|
34
|
+
```
|
17
35
|
|
18
36
|
## Advanced Parameters
|
19
37
|
|
20
|
-
You can also set :display, :prompt, :bail parameter to specify behavior of sign-in and permission page.
|
21
|
-
More info on [YConnect](http://developer.yahoo.co.jp/yconnect/).
|
38
|
+
You can also set :display, :prompt, :scope, :bail parameter to specify behavior of sign-in and permission page.
|
39
|
+
More info on [YConnect](http://developer.yahoo.co.jp/yconnect/v2/).
|
40
|
+
|
41
|
+
For example, to request `openid`, `profile`, and `email` permissions and display the authentication page in a popup window:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
45
|
+
provider :yahoojp, ENV['YAHOOJP_KEY'], ENV['YAHOOJP_SECRET'],
|
46
|
+
{
|
47
|
+
scope: "openid profile email",
|
48
|
+
display: "popup"
|
49
|
+
}
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
### API Version
|
54
|
+
|
55
|
+
OmniAuth YahooJp uses versioned API endpoints by default (current v2). You can configure a different version via `client_options` hash passed to `provider`, specifically you should change the version in the `site` and `authorize_url` parameters. For example, to change to v1:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
59
|
+
provider :yahoojp, ENV['YAHOOJP_KEY'], ENV['YAHOOJP_SECRET'],
|
60
|
+
{
|
61
|
+
scope: "openid profile email address",
|
62
|
+
client_options: {
|
63
|
+
site: 'https://auth.login.yahoo.co.jp',
|
64
|
+
authorize_url: '/yconnect/v1/authorization',
|
65
|
+
token_url: '/yconnect/v1/token'
|
66
|
+
}
|
67
|
+
}
|
68
|
+
end
|
69
|
+
```
|
22
70
|
|
23
71
|
## License
|
24
72
|
|
@@ -8,8 +8,8 @@ module OmniAuth
|
|
8
8
|
option :name, 'yahoojp'
|
9
9
|
option :client_options, {
|
10
10
|
:site => 'https://auth.login.yahoo.co.jp',
|
11
|
-
:authorize_url => '/yconnect/
|
12
|
-
:token_url => '/yconnect/
|
11
|
+
:authorize_url => '/yconnect/v2/authorization',
|
12
|
+
:token_url => '/yconnect/v2/token',
|
13
13
|
:auth_scheme => :basic_auth
|
14
14
|
}
|
15
15
|
|
@@ -19,17 +19,27 @@ module OmniAuth
|
|
19
19
|
super
|
20
20
|
end
|
21
21
|
|
22
|
-
uid { raw_info['
|
22
|
+
uid { raw_info['sub'] }
|
23
23
|
|
24
24
|
info do
|
25
25
|
prune!({
|
26
|
+
:sub => raw_info['sub'],
|
26
27
|
:name => raw_info['name'],
|
28
|
+
:given_name => raw_info['given_name'],
|
29
|
+
:given_name_ja_kana_jp => raw_info['given_name#ja-Kana-JP'],
|
30
|
+
:given_name_ja_hani_jp => raw_info['given_name#ja-Hani-JP'],
|
31
|
+
:family_name => raw_info['family_name'],
|
32
|
+
:family_name_ja_kana_jp => raw_info['family_name#ja-Kana-JP'],
|
33
|
+
:family_name_ja_hani_jp => raw_info['family_name#ja-Hani-JP'],
|
34
|
+
:gender => raw_info['gender'],
|
35
|
+
:zoneinfo => raw_info['zoneinfo'],
|
36
|
+
:locale => raw_info['locale'],
|
37
|
+
:birthdate => raw_info['birthdate'],
|
38
|
+
:nickname => raw_info['nickname'],
|
39
|
+
:picture => raw_info['picture'],
|
27
40
|
:email => raw_info['email'],
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:urls => {
|
31
|
-
'YahooJp' => raw_info['link'],
|
32
|
-
},
|
41
|
+
:email_verified => raw_info['email_verified'],
|
42
|
+
:address => raw_info['address'],
|
33
43
|
})
|
34
44
|
end
|
35
45
|
|
@@ -41,7 +51,7 @@ module OmniAuth
|
|
41
51
|
|
42
52
|
def raw_info
|
43
53
|
access_token.options[:mode] = :header
|
44
|
-
@raw_info ||= access_token.get('https://userinfo.yahooapis.jp/yconnect/
|
54
|
+
@raw_info ||= access_token.get('https://userinfo.yahooapis.jp/yconnect/v2/attribute').parsed
|
45
55
|
end
|
46
56
|
|
47
57
|
def prune!(hash)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-yahoojp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mikanmarusan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|