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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c00a42fb9bb9c5ecff9713c7b827daa8cd661c38
4
- data.tar.gz: b44356d7e17ec7e28558049d323fd758c06a4d53
3
+ metadata.gz: e3d012bf98b1dc7ca8cbbf7c43f1869415754d1a
4
+ data.tar.gz: 1fb0e703a6a8187d52c3d246f8a80041ed5c909e
5
5
  SHA512:
6
- metadata.gz: dfee89dedf85a8d8036f252c11e18c6accdbef58702aacfcaeefee1d0cf6c376554ae55a826a0018e8217b5f45328626f94eab5ee59cd84117b4f4344df0dba9
7
- data.tar.gz: 5c365212a5815b076f45ffeed9e58f9fb18d406eedf6d58fa194f98b36d64468a21b1a3f45569a2b4126982770b01a7041663f6a91721197bbf918207ccfe150
6
+ metadata.gz: 5aeaf74e1bb4c37b155d9c8444a2eb9f57d4ba13076c2e1648fdf2b38b4d770cccc1c1645cd60d6d3d9930b5cb9f3246ebe547f786653170036061968d09379b
7
+ data.tar.gz: dec0b555d7877dd764ca489b97d6a90487a65db673ba6e3a3a4fd022ca506195d30733f0bdb31f06a7927615c945165fa53b45529d2d9d31d3579fc5b26b8910
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ Metrics/LineLength:
2
+ Max: 120
3
+ Documentation:
4
+ Enabled: false
5
+ Metrics/BlockLength:
6
+ Enabled: false
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
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
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "oauth2_dingtalk"
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 "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
data/example/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
- gem 'sinatra'
4
3
  gem 'multi_json'
5
4
  gem 'oauth2_dingtalk'
5
+ gem 'sinatra'
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'] = "APPID"
6
- ENV['APPSECRET'] = "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, :secret => "change_me"
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
@@ -1,3 +1,3 @@
1
1
  module Oauth2Dingtalk
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'.freeze
3
3
  end
@@ -1,5 +1,5 @@
1
- require_relative "oauth2_dingtalk/version"
2
- require_relative "omniauth/strategies/dingding"
1
+ require_relative 'oauth2_dingtalk/version'
2
+ require_relative 'omniauth/strategies/dingding'
3
3
 
4
4
  module Oauth2Dingtalk
5
5
  # Your code goes here...
@@ -1,19 +1,18 @@
1
- require "omniauth-oauth2"
1
+ require 'omniauth-oauth2'
2
2
 
3
3
  module OmniAuth
4
4
  module Strategies
5
5
  class Dingding < OmniAuth::Strategies::OAuth2
6
- option :name, "dingding"
6
+ option :name, 'dingding'
7
7
 
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
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, { scope: 'snsapi_login' }
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["appid"] = params.delete("client_id")
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 ||= 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
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
@@ -1,26 +1,30 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
1
+
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "oauth2_dingtalk/version"
4
+ require 'oauth2_dingtalk/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "oauth2_dingtalk"
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 Dingding(alibaba)'
13
- spec.description = 'Using OAuth2 to authenticate dingding user when web resources being viewed within dingding(alibaba) client.'
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 = ["lib"]
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.0
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-12 00:00:00.000000000 Z
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: Using OAuth2 to authenticate dingding user when web resources being viewed
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 Dingding(alibaba)
143
+ summary: Omniauth strategy for DingTalk(alibaba)
129
144
  test_files: []