oauth2_dingtalk 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/Gemfile +2 -2
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/example/Gemfile +2 -2
- data/example/config.ru +3 -3
- data/lib/oauth2_dingtalk/version.rb +1 -1
- data/lib/oauth2_dingtalk.rb +2 -2
- data/lib/omniauth/strategies/dingding.rb +17 -17
- data/oauth2_dingtalk.gemspec +14 -10
- metadata +22 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3d012bf98b1dc7ca8cbbf7c43f1869415754d1a
|
4
|
+
data.tar.gz: 1fb0e703a6a8187d52c3d246f8a80041ed5c909e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aeaf74e1bb4c37b155d9c8444a2eb9f57d4ba13076c2e1648fdf2b38b4d770cccc1c1645cd60d6d3d9930b5cb9f3246ebe547f786653170036061968d09379b
|
7
|
+
data.tar.gz: dec0b555d7877dd764ca489b97d6a90487a65db673ba6e3a3a4fd022ca506195d30733f0bdb31f06a7927615c945165fa53b45529d2d9d31d3579fc5b26b8910
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in oauth2_dingtalk.gemspec
|
6
6
|
gemspec
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'oauth2_dingtalk'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "oauth2_dingtalk"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
data/example/Gemfile
CHANGED
data/example/config.ru
CHANGED
@@ -2,8 +2,8 @@ require 'bundler'
|
|
2
2
|
require 'sinatra'
|
3
3
|
require 'oauth2_dingtalk'
|
4
4
|
|
5
|
-
ENV['APPID'] =
|
6
|
-
ENV['APPSECRET'] =
|
5
|
+
ENV['APPID'] = 'APPID'
|
6
|
+
ENV['APPSECRET'] = 'APPSECRET'
|
7
7
|
|
8
8
|
class App < Sinatra::Base
|
9
9
|
get '/' do
|
@@ -21,7 +21,7 @@ class App < Sinatra::Base
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
use Rack::Session::Cookie, :
|
24
|
+
use Rack::Session::Cookie, secret: 'change_me'
|
25
25
|
|
26
26
|
use OmniAuth::Builder do
|
27
27
|
# note that the scope is different from the default
|
data/lib/oauth2_dingtalk.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
-
require
|
1
|
+
require 'omniauth-oauth2'
|
2
2
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
5
|
class Dingding < OmniAuth::Strategies::OAuth2
|
6
|
-
option :name,
|
6
|
+
option :name, 'dingding'
|
7
7
|
|
8
|
-
option :client_options,
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
8
|
+
option :client_options,
|
9
|
+
site: 'https://oapi.dingtalk.com',
|
10
|
+
authorize_url: '/connect/qrconnect',
|
11
|
+
token_url: '/sns/gettoken',
|
12
|
+
persistent_url: '/sns/get_persistent_code',
|
13
|
+
token_method: :get
|
15
14
|
|
16
|
-
option :authorize_params,
|
15
|
+
option :authorize_params, scope: 'snsapi_login'
|
17
16
|
|
18
17
|
uid do
|
19
18
|
raw_info['openid']
|
@@ -31,15 +30,16 @@ module OmniAuth
|
|
31
30
|
|
32
31
|
def request_phase
|
33
32
|
params = client.auth_code.authorize_params.merge(redirect_uri: callback_url).merge(authorize_params)
|
34
|
-
params[
|
33
|
+
params['appid'] = params.delete('client_id')
|
35
34
|
redirect client.authorize_url(params)
|
36
35
|
end
|
37
36
|
|
38
37
|
def raw_info
|
39
|
-
@raw_info ||=
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
@raw_info ||=
|
39
|
+
access_token.post(options.client_options[:persistent_url] + "?access_token=#{access_token.token}") do |req|
|
40
|
+
req.headers['Content-Type'] = 'application/json'
|
41
|
+
req.body = "{\"tmp_auth_code\":\"#{request.params['code']}\"}"
|
42
|
+
end.parsed
|
43
43
|
end
|
44
44
|
|
45
45
|
protected
|
@@ -48,9 +48,9 @@ module OmniAuth
|
|
48
48
|
params = {
|
49
49
|
'appid' => client.id,
|
50
50
|
'appsecret' => client.secret
|
51
|
-
|
51
|
+
}
|
52
52
|
client.get_token(params)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
-
end
|
56
|
+
end
|
data/oauth2_dingtalk.gemspec
CHANGED
@@ -1,26 +1,30 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path(
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require 'oauth2_dingtalk/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'oauth2_dingtalk'
|
8
8
|
spec.version = Oauth2Dingtalk::VERSION
|
9
9
|
spec.authors = %w[liukun]
|
10
10
|
spec.email = %w[fee1mix@163.com]
|
11
|
+
spec.homepage = 'https://github.com/liukun-lk/oauth2_dingtalk'
|
12
|
+
spec.license = 'MIT'
|
11
13
|
|
12
|
-
spec.summary = 'Omniauth strategy for
|
13
|
-
spec.description = '
|
14
|
+
spec.summary = 'Omniauth strategy for DingTalk(alibaba)'
|
15
|
+
spec.description = 'Omniauth strategy for DingTalk(alibaba)'
|
14
16
|
|
15
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
18
|
f.match(%r{^(test|spec|features)/})
|
17
19
|
end
|
18
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = [
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
|
+
spec.add_development_dependency 'rubocop', '~> 0.52'
|
20
27
|
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.15"
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
24
28
|
spec.add_dependency 'omniauth', '~> 1.0'
|
25
29
|
spec.add_dependency 'omniauth-oauth2', '~> 1.0'
|
26
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth2_dingtalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- liukun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.52'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.52'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: omniauth
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,8 +94,7 @@ dependencies:
|
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '1.0'
|
83
|
-
description:
|
84
|
-
within dingding(alibaba) client.
|
97
|
+
description: Omniauth strategy for DingTalk(alibaba)
|
85
98
|
email:
|
86
99
|
- fee1mix@163.com
|
87
100
|
executables: []
|
@@ -90,6 +103,7 @@ extra_rdoc_files: []
|
|
90
103
|
files:
|
91
104
|
- ".gitignore"
|
92
105
|
- ".rspec"
|
106
|
+
- ".rubocop.yml"
|
93
107
|
- ".travis.yml"
|
94
108
|
- Gemfile
|
95
109
|
- LICENSE
|
@@ -103,8 +117,9 @@ files:
|
|
103
117
|
- lib/oauth2_dingtalk/version.rb
|
104
118
|
- lib/omniauth/strategies/dingding.rb
|
105
119
|
- oauth2_dingtalk.gemspec
|
106
|
-
homepage:
|
107
|
-
licenses:
|
120
|
+
homepage: https://github.com/liukun-lk/oauth2_dingtalk
|
121
|
+
licenses:
|
122
|
+
- MIT
|
108
123
|
metadata: {}
|
109
124
|
post_install_message:
|
110
125
|
rdoc_options: []
|
@@ -125,5 +140,5 @@ rubyforge_project:
|
|
125
140
|
rubygems_version: 2.6.13
|
126
141
|
signing_key:
|
127
142
|
specification_version: 4
|
128
|
-
summary: Omniauth strategy for
|
143
|
+
summary: Omniauth strategy for DingTalk(alibaba)
|
129
144
|
test_files: []
|