omniauth-weibo-oauth2 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module WeiboOauth2
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -42,14 +42,25 @@ module OmniAuth
42
42
  @uid ||= access_token.get('/2/account/get_uid.json').parsed["uid"]
43
43
  @raw_info ||= access_token.get("/2/users/show.json", :params => {:uid => @uid}).parsed
44
44
  end
45
-
46
- alias :old_request_phase :request_phase
47
- def request_phase
48
- display = session['omniauth.params']['display']
49
- if display
50
- options[:authorize_params].merge!(:display => display)
45
+
46
+ ##
47
+ # You can pass +display+, +with_offical_account+ or +state+ params to the auth request, if
48
+ # you need to set them dynamically. You can also set these options
49
+ # in the OmniAuth config :authorize_params option.
50
+ #
51
+ # /auth/weibo?display=mobile&with_offical_account=1
52
+ #
53
+ def authorize_params
54
+ super.tap do |params|
55
+ %w[display with_offical_account state forcelogin].each do |v|
56
+ if request.params[v]
57
+ params[v.to_sym] = request.params[v]
58
+
59
+ # to support omniauth-oauth2's auto csrf protection
60
+ session['omniauth.state'] = params[:state] if v == 'state'
61
+ end
62
+ end
51
63
  end
52
- old_request_phase
53
64
  end
54
65
 
55
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-weibo-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-03 00:00:00.000000000 Z
12
+ date: 2013-05-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
16
- requirement: &70239456025480 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70239456025480
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: omniauth-oauth2
27
- requirement: &70239456024980 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '1.0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70239456024980
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.0'
36
46
  description: OmniAuth Oauth2 strategy for weibo.com.
37
47
  email: beenhero@gmail.com
38
48
  executables: []
@@ -66,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
76
  version: '0'
67
77
  requirements: []
68
78
  rubyforge_project:
69
- rubygems_version: 1.8.17
79
+ rubygems_version: 1.8.25
70
80
  signing_key:
71
81
  specification_version: 3
72
82
  summary: OmniAuth Oauth2 strategy for weibo.com.