Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9b5ed6d
Showing
12 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
*.gem | ||
*.rbc | ||
.bundle | ||
.config | ||
.yardoc | ||
Gemfile.lock | ||
InstalledFiles | ||
_yardoc | ||
coverage | ||
doc/ | ||
lib/bundler/man | ||
/pkg | ||
rdoc | ||
spec/reports | ||
test/tmp | ||
test/version_tmp | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--colour |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
source 'http://rubygems.org' | ||
|
||
# Specify your gem's dependencies in omniauth-salesforce.gemspec | ||
gemspec | ||
|
||
group :development, :test do | ||
gem 'guard' | ||
gem 'guard-rspec' | ||
gem 'guard-bundler' | ||
gem 'rb-fsevent' | ||
gem 'growl' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
guard 'rspec', :version => 2 do | ||
watch(%r{^spec/.+_spec\.rb$}) | ||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | ||
watch('spec/spec_helper.rb') { "spec" } | ||
end | ||
|
||
guard 'bundler' do | ||
watch('Gemfile') | ||
watch('omniauth-salesforce.gemspec') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Basic Usage | ||
|
||
use OmniAuth::Builder do | ||
provider :salesforce, ENV['SALESFORCE_KEY'], ENV['SALESFORCE_SECRET'] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env rake | ||
require "bundler/gem_tasks" | ||
require 'rspec/core/rake_task' | ||
|
||
desc 'Default: run specs.' | ||
task :default => :spec | ||
|
||
desc "Run specs" | ||
RSpec::Core::RakeTask.new | ||
|
||
desc 'Run specs' | ||
task :default => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require "omniauth-salesforce/version" | ||
require 'omniauth/strategies/salesforce' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module OmniAuth | ||
module Salesforce | ||
VERSION = "1.0.0" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require 'omniauth-oauth2' | ||
|
||
module OmniAuth | ||
module Strategies | ||
class Salesforce < OmniAuth::Strategies::OAuth2 | ||
option :client_options, { | ||
:site => 'https://login.salesforce.com', | ||
:authorize_url => '/services/oauth2/authorize', | ||
:token_url => '/services/oauth2/token' | ||
} | ||
def request_phase | ||
super | ||
end | ||
|
||
uid { raw_info['id'] } | ||
|
||
info do | ||
{ | ||
'name' => raw_info['display_name'], | ||
'email' => raw_info['email'], | ||
'nickname' => raw_info['nick_name'], | ||
'first_name' => raw_info['first_name'], | ||
'last_name' => raw_info['last_name'], | ||
'location' => '', | ||
'description' => '', | ||
'image' => raw_info['nick_name'], | ||
'phone' => '', | ||
'urls' => raw_info['urls'], | ||
'organizationid' => raw_info['organization_id'], | ||
'userid' => raw_info['user_id'], | ||
'username' => raw_info['username'], | ||
'organization_id' => raw_info['organization_id'], | ||
'user_id' => raw_info['user_id'], | ||
'user_name' => raw_info['username'] | ||
} | ||
end | ||
|
||
def raw_info | ||
access_token.options[:mode] = :query | ||
access_token.options[:param_name] = :oauth_token | ||
@raw_info ||= access_token.post(access_token['id']).parsed | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- encoding: utf-8 -*- | ||
require File.expand_path('../lib/omniauth-salesforce/version', __FILE__) | ||
|
||
Gem::Specification.new do |gem| | ||
gem.authors = ["Richard Vanhook"] | ||
gem.email = ["rvanhook@salesforce.com"] | ||
gem.description = %q{OmniAuth strategy for salesforce.com.} | ||
gem.summary = %q{OmniAuth strategy for salesforce.com.} | ||
gem.homepage = "https://github.com/richardvanhook/omniauth-salesforce" | ||
|
||
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
gem.files = `git ls-files`.split("\n") | ||
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
gem.name = "omniauth-salesforce" | ||
gem.require_paths = ["lib"] | ||
gem.version = OmniAuth::Salesforce::VERSION | ||
|
||
gem.add_dependency 'omniauth', '~> 1.0' | ||
gem.add_dependency 'omniauth-oauth2', '~> 1.0' | ||
gem.add_development_dependency 'rspec', '~> 2.7' | ||
gem.add_development_dependency 'rack-test' | ||
gem.add_development_dependency 'simplecov' | ||
gem.add_development_dependency 'webmock' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'spec_helper' | ||
|
||
describe OmniAuth::Strategies::Salesforce do | ||
it 'should do some testing' do | ||
pending | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$:.unshift File.expand_path('..', __FILE__) | ||
$:.unshift File.expand_path('../../lib', __FILE__) | ||
require 'simplecov' | ||
SimpleCov.start | ||
require 'rspec' | ||
require 'rack/test' | ||
require 'webmock/rspec' | ||
require 'omniauth' | ||
require 'omniauth-salesforce' | ||
|
||
RSpec.configure do |config| | ||
config.include WebMock::API | ||
config.include Rack::Test::Methods | ||
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy | ||
end | ||
|