omniauth-leancloud 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2f8e4fec337d6fb417939366736ab04cf361c5bc
4
+ data.tar.gz: eb07294cb1b41190123c64912e751f895631d56a
5
+ SHA512:
6
+ metadata.gz: fa795010bfa31c0371c03db8a083d9f78e2d870eda4733201ac95f71445cec493c3955b01c9acda14811d236b2cb8cc38daf5c27c19cec3ee36ffed587809d52
7
+ data.tar.gz: 7581b1b9148c5e90a84e0b7b96f02d6c7ccd017fbd1b6238fb7301168391e1e6905d107cacd2aa89ec3ee3aac58dd4a12f9692687d1f9cee23ed4b4aef665a51
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
@@ -0,0 +1,2 @@
1
+ require "omniauth-leancloud/version"
2
+ require 'omniauth/strategies/leancloud'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module LeanCloud
3
+ VERSION = "0.1"
4
+ end
5
+ end
@@ -0,0 +1,53 @@
1
+ require "omniauth-oauth2"
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class LeanCloud < OmniAuth::Strategies::OAuth2
6
+ option :client_options, {
7
+ :site => "https://leancloud.cn",
8
+ :authorize_url => "/1.1/authorize",
9
+ :token_url => "/1.1/token"
10
+ }
11
+
12
+ # option :token_params, {
13
+ # :parse => :json
14
+ # }
15
+
16
+ uid do
17
+ raw_info['id']
18
+ end
19
+
20
+ info do
21
+ {
22
+ :name => raw_info['username'],
23
+ :email => raw_info['email']
24
+ }
25
+ end
26
+
27
+ extra do
28
+ {
29
+ :raw_info => raw_info
30
+ }
31
+ end
32
+
33
+ def authorize_params
34
+ super.tap do |params|
35
+ %w[scope client_options].each do |v|
36
+ if request.params[v]
37
+ params[v.to_sym] = request.params[v]
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ def raw_info
44
+ access_token.options[:mode] = :query
45
+ # access_token.options[:param_name] = 'access_token'
46
+ # @uid ||= access_token.get('clients/self').parsed["uid"]
47
+ @raw_info ||= access_token.get("/clients/self").parsed
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ OmniAuth.config.add_camelization "leancloud", "LeanCloud"
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-leancloud/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = "paomian"
6
+ gem.email = "xpaomian@gmail.com"
7
+ gem.description = %q{OmniAuth Oauth2 strategy for leancloud.cn.}
8
+ gem.summary = %q{OmniAuth Oauth2 strategy for leancloud.cn.}
9
+ gem.homepage = "https://github.com/paomian/omniauth-leancloud"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "omniauth-leancloud"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = OmniAuth::LeanCloud::VERSION
17
+
18
+ gem.add_dependency 'omniauth', '~> 1.0'
19
+ gem.add_dependency 'omniauth-oauth2', '~> 1.0'
20
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-leancloud
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - paomian
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-20 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.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ description: OmniAuth Oauth2 strategy for leancloud.cn.
42
+ email: xpaomian@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - Gemfile
48
+ - lib/omniauth-leancloud.rb
49
+ - lib/omniauth-leancloud/version.rb
50
+ - lib/omniauth/strategies/leancloud.rb
51
+ - omniauth-leancloud-auth2.gemspec
52
+ homepage: https://github.com/paomian/omniauth-leancloud
53
+ licenses: []
54
+ metadata: {}
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 2.0.14
72
+ signing_key:
73
+ specification_version: 4
74
+ summary: OmniAuth Oauth2 strategy for leancloud.cn.
75
+ test_files: []