omniauth-weixin-oauth2 0.0.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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +12 -0
- data/lib/omniauth-weixin-oauth2.rb +2 -0
- data/lib/omniauth-weixin-oauth2/version.rb +5 -0
- data/lib/omniauth-weixin.rb +2 -0
- data/lib/omniauth/strategies/weixin.rb +48 -0
- data/omniauth-weixin-oauth2.gemspec +22 -0
- metadata +79 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 00b77502ebc6828ef30bf8e729ecffd3082fab80
|
|
4
|
+
data.tar.gz: 408b0ee29d81f3d32f824e0d45574df0bc835b84
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2b75eae98301f6457e7cea098460f365bf17cad63546fb0079e10b9ea807665a8f85c383ca3ed9d0ca12ac612f0d276d28fed36eb16ff9cdd1faa57931687430
|
|
7
|
+
data.tar.gz: 441de73f13fdb20c15b13181c50056ceeb875c85d3d0edf702ebcc0b3a34417b753dfd63ecff078e1094eed479bef56aeaefedb826744e8f8028a163b05bf75d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require 'omniauth-oauth2'
|
|
2
|
+
|
|
3
|
+
module OmniAuth
|
|
4
|
+
module Strategies
|
|
5
|
+
class Weixin < OmniAuth::Strategies::OAuth2
|
|
6
|
+
|
|
7
|
+
DEFAULT_SCOPE = 'snsapi_base,snsapi_userinfo'
|
|
8
|
+
|
|
9
|
+
option :name, 'weixin'
|
|
10
|
+
|
|
11
|
+
option :client_options, {
|
|
12
|
+
:site => 'https://api.weixin.qq.com',
|
|
13
|
+
:authorize_url => 'https://open.weixin.qq.com/connect/qrconnect',
|
|
14
|
+
:token_url => '/sns/oauth2/access_token'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
uid { raw_info['openid'] }
|
|
18
|
+
|
|
19
|
+
info do
|
|
20
|
+
{
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
extra {}
|
|
25
|
+
|
|
26
|
+
def raw_info
|
|
27
|
+
@raw_info ||= nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def authorize_params
|
|
31
|
+
super.tap do |params|
|
|
32
|
+
params[:appid] = options.client_id
|
|
33
|
+
params[:scope] ||= request.params['scope'] || DEFAULT_SCOPE
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def token_params
|
|
38
|
+
super.tap do |params|
|
|
39
|
+
params[:parse] = :json
|
|
40
|
+
params[:appid] = options.client_id
|
|
41
|
+
params[:secret] = options.client_secret
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
OmniAuth.config.add_camelization 'weixin', 'Weixin'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require File.expand_path('../lib/omniauth-weixin-oauth2/version', __FILE__)
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |gem|
|
|
6
|
+
gem.authors = ['Liluo']
|
|
7
|
+
gem.email = ['i@liluo.org']
|
|
8
|
+
gem.summary = %q{OmniAuth OAuth2 strategy for Wexin.}
|
|
9
|
+
gem.description = %q{OmniAuth OAuth2 strategy for Wexin.}
|
|
10
|
+
gem.homepage = 'https://github.com/liluo/omniauth-weixin-oauth2'
|
|
11
|
+
gem.license = 'MIT'
|
|
12
|
+
|
|
13
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
|
15
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
16
|
+
gem.name = 'omniauth-weixin-oauth2'
|
|
17
|
+
gem.require_paths = ['lib']
|
|
18
|
+
gem.version = OmniAuth::Weixin::VERSION
|
|
19
|
+
|
|
20
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
|
21
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.1'
|
|
22
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: omniauth-weixin-oauth2
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Liluo
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-06-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: omniauth
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: omniauth-oauth2
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ~>
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.1'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ~>
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.1'
|
|
41
|
+
description: OmniAuth OAuth2 strategy for Wexin.
|
|
42
|
+
email:
|
|
43
|
+
- i@liluo.org
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- .gitignore
|
|
49
|
+
- Gemfile
|
|
50
|
+
- lib/omniauth-weixin-oauth2.rb
|
|
51
|
+
- lib/omniauth-weixin-oauth2/version.rb
|
|
52
|
+
- lib/omniauth-weixin.rb
|
|
53
|
+
- lib/omniauth/strategies/weixin.rb
|
|
54
|
+
- omniauth-weixin-oauth2.gemspec
|
|
55
|
+
homepage: https://github.com/liluo/omniauth-weixin-oauth2
|
|
56
|
+
licenses:
|
|
57
|
+
- MIT
|
|
58
|
+
metadata: {}
|
|
59
|
+
post_install_message:
|
|
60
|
+
rdoc_options: []
|
|
61
|
+
require_paths:
|
|
62
|
+
- lib
|
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - '>='
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - '>='
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '0'
|
|
73
|
+
requirements: []
|
|
74
|
+
rubyforge_project:
|
|
75
|
+
rubygems_version: 2.2.2
|
|
76
|
+
signing_key:
|
|
77
|
+
specification_version: 4
|
|
78
|
+
summary: OmniAuth OAuth2 strategy for Wexin.
|
|
79
|
+
test_files: []
|