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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddfcc06cecbd12767a22ba155a343720208b92be
4
- data.tar.gz: b7547f8051e0b489208035dc3be0da2146997c63
3
+ metadata.gz: ca264c63b14fa89691cfe5a8e11f23cde931c0a4
4
+ data.tar.gz: adf2273ad2d2d2b3af15fd3e2b68503daf9c7d4e
5
5
  SHA512:
6
- metadata.gz: b7eea18d381216b2cf8ef6d9586b1238157522e47ab10acc99912962a1882a0383e5b9e53e10897efe5c49de4e80f1f44fec222481c4e41a466290eb9a0502a3
7
- data.tar.gz: cd81879c9e537cb6ace8e97e716493e559bdf9b485591780a321039232ff7a8acf9ea5775529bcc9ab68370d3621fd4e4e375338127f24712286a1944ee9a0bc
6
+ metadata.gz: 8acdf1219c6775476415c42f5914e3afc16ab94ad28977c87183a736efafc689a13ec3156075a5a979b9eadbac25f9f4618bcc799a50c3bcf20a5fa458484775
7
+ data.tar.gz: 3a53191f69d16ff6442d88297630d320e5251b75cced5ff31d7f796cd92b4d059f92933a57ad24baef25a11cf6a2b11c4c0db5cb781eb9b1c3e20f232ee33b71
data/README.md CHANGED
@@ -1,24 +1,72 @@
1
1
  # OmniAuth YahooJp [![Gem Version](https://badge.fury.io/rb/omniauth-yahoojp.svg)](https://badge.fury.io/rb/omniauth-yahoojp)
2
2
 
3
- This is the official OmniAuth strategy for authenticating to Yahoo! JAPAN( [YConnect](http://developer.yahoo.co.jp/yconnect/) ).
4
- To use it, you'll need to sign up for a YConnect Application ID and Secret
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
- YConnect API v1 lets you set scopes to provide granular access to different types of data:
23
+ `OmniAuth::Strategies::YahooJp` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
10
24
 
11
- use OmniAuth::Builder do
12
- provider :yahoojp, ENV['YAHOOJP_KEY'], ENV['YAHOOJP_SECRET'],
13
- {
14
- scope: "openid profile email address"
15
- }
16
- end
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
 
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module YahooJp
3
- VERSION = "0.1.4"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -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/v1/authorization',
12
- :token_url => '/yconnect/v1/token',
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['user_id'] }
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
- :first_name => raw_info['given_name'],
29
- :last_name => raw_info['family_name'],
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/v1/attribute?schema=openid').parsed
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.1.4
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-05-10 00:00:00.000000000 Z
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth