omniauth-salesforce 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile +12 -0
- data/Guardfile +10 -0
- data/README.md +5 -0
- data/Rakefile +12 -0
- data/lib/omniauth-salesforce.rb +2 -0
- data/lib/omniauth-salesforce/version.rb +5 -0
- data/lib/omniauth/strategies/salesforce.rb +45 -0
- data/omniauth-salesforce.gemspec +24 -0
- data/spec/omniauth/strategies/salesforce_spec.rb +7 -0
- data/spec/spec_helper.rb +16 -0
- metadata +125 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Salesforce < OmniAuth::Strategies::OAuth2
|
6
|
+
option :client_options, {
|
7
|
+
:site => 'https://login.salesforce.com',
|
8
|
+
:authorize_url => '/services/oauth2/authorize',
|
9
|
+
:token_url => '/services/oauth2/token'
|
10
|
+
}
|
11
|
+
def request_phase
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
uid { raw_info['id'] }
|
16
|
+
|
17
|
+
info do
|
18
|
+
{
|
19
|
+
'name' => raw_info['display_name'],
|
20
|
+
'email' => raw_info['email'],
|
21
|
+
'nickname' => raw_info['nick_name'],
|
22
|
+
'first_name' => raw_info['first_name'],
|
23
|
+
'last_name' => raw_info['last_name'],
|
24
|
+
'location' => '',
|
25
|
+
'description' => '',
|
26
|
+
'image' => raw_info['nick_name'],
|
27
|
+
'phone' => '',
|
28
|
+
'urls' => raw_info['urls'],
|
29
|
+
'organizationid' => raw_info['organization_id'],
|
30
|
+
'userid' => raw_info['user_id'],
|
31
|
+
'username' => raw_info['username'],
|
32
|
+
'organization_id' => raw_info['organization_id'],
|
33
|
+
'user_id' => raw_info['user_id'],
|
34
|
+
'user_name' => raw_info['username']
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def raw_info
|
39
|
+
access_token.options[:mode] = :query
|
40
|
+
access_token.options[:param_name] = :oauth_token
|
41
|
+
@raw_info ||= access_token.post(access_token['id']).parsed
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-salesforce/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Richard Vanhook"]
|
6
|
+
gem.email = ["rvanhook@salesforce.com"]
|
7
|
+
gem.description = %q{OmniAuth strategy for salesforce.com.}
|
8
|
+
gem.summary = %q{OmniAuth strategy for salesforce.com.}
|
9
|
+
gem.homepage = "https://github.com/richardvanhook/omniauth-salesforce"
|
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-salesforce"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = OmniAuth::Salesforce::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
19
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.0'
|
20
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
21
|
+
gem.add_development_dependency 'rack-test'
|
22
|
+
gem.add_development_dependency 'simplecov'
|
23
|
+
gem.add_development_dependency 'webmock'
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
require 'rspec'
|
6
|
+
require 'rack/test'
|
7
|
+
require 'webmock/rspec'
|
8
|
+
require 'omniauth'
|
9
|
+
require 'omniauth-salesforce'
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include WebMock::API
|
13
|
+
config.include Rack::Test::Methods
|
14
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
15
|
+
end
|
16
|
+
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-salesforce
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Richard Vanhook
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth
|
16
|
+
requirement: &2152205600 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2152205600
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: omniauth-oauth2
|
27
|
+
requirement: &2152205080 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2152205080
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &2152204500 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.7'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2152204500
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rack-test
|
49
|
+
requirement: &2152204100 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2152204100
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: simplecov
|
60
|
+
requirement: &2152203620 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2152203620
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: &2152203120 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *2152203120
|
80
|
+
description: OmniAuth strategy for salesforce.com.
|
81
|
+
email:
|
82
|
+
- rvanhook@salesforce.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- .rspec
|
89
|
+
- Gemfile
|
90
|
+
- Guardfile
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- lib/omniauth-salesforce.rb
|
94
|
+
- lib/omniauth-salesforce/version.rb
|
95
|
+
- lib/omniauth/strategies/salesforce.rb
|
96
|
+
- omniauth-salesforce.gemspec
|
97
|
+
- spec/omniauth/strategies/salesforce_spec.rb
|
98
|
+
- spec/spec_helper.rb
|
99
|
+
homepage: https://github.com/richardvanhook/omniauth-salesforce
|
100
|
+
licenses: []
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options: []
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 1.8.5
|
120
|
+
signing_key:
|
121
|
+
specification_version: 3
|
122
|
+
summary: OmniAuth strategy for salesforce.com.
|
123
|
+
test_files:
|
124
|
+
- spec/omniauth/strategies/salesforce_spec.rb
|
125
|
+
- spec/spec_helper.rb
|