-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
14 changed files
with
261 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,12 @@ | ||
source 'http://rubygems.org' | ||
|
||
# Specify your gem's dependencies in omniauth-clients.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-clients.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,9 @@ | ||
# OmniAuth AdobeId | ||
|
||
This is the OmniAuth strategies for all clients authenticating for phonegapbuild. | ||
|
||
## Basic Usage | ||
|
||
use OmniAuth::Builder do | ||
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_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,4 @@ | ||
require 'omniauth/strategies/adobeid' | ||
require 'omniauth/strategies/github' | ||
require 'omniauth/strategies/bitbucket' | ||
require 'omniauth/strategies/gitlab' |
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 Clients | ||
VERSION = "0.9" | ||
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,37 @@ | ||
require 'omniauth-oauth2' | ||
|
||
module OmniAuth | ||
module Strategies | ||
class AdobeId < OmniAuth::Strategies::OAuth2 | ||
option :client_options, { | ||
:site => 'https://ims-na1.adobelogin.com/ims/profile/v1', | ||
:authorize_url => 'https://ims-na1.adobelogin.com/ims/authorize/v1', | ||
:token_url => 'https://ims-na1.adobelogin.com/ims/token/v1' | ||
} | ||
option :provider_ignores_state, true | ||
|
||
def request_phase | ||
options[:authorize_params].merge!(:locale => I18n.locale) | ||
super | ||
end | ||
|
||
uid { raw_info['userId'] } | ||
|
||
info do | ||
{ | ||
'nickname' => raw_info['email'], | ||
'email' => raw_info['email'], | ||
'name' => raw_info['name'], | ||
'service_accounts' => raw_info['serviceAccounts'], | ||
'country_code' => raw_info['countryCode'] | ||
} | ||
end | ||
|
||
def raw_info | ||
@raw_info ||= access_token.get('').parsed | ||
end | ||
end | ||
end | ||
end | ||
|
||
OmniAuth.config.add_camelization 'adobeid', 'AdobeId' |
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,36 @@ | ||
require 'omniauth-oauth2' | ||
|
||
module OmniAuth | ||
module Strategies | ||
class BitBucket < OmniAuth::Strategies::OAuth2 | ||
option :client_options, { | ||
:site => 'https://bitbucket.org', | ||
:authorize_url => '/site/oauth2/authorize', | ||
:token_url => '/site/oauth2/access_token' | ||
} | ||
|
||
uid { raw_info['uuid'] } | ||
|
||
def callback_url | ||
nil | ||
end | ||
|
||
info do | ||
{ | ||
'nickname' => raw_info['username'], | ||
'name' => raw_info['display_name'] | ||
} | ||
end | ||
|
||
def raw_info | ||
access_token.options[:mode] = :query | ||
if @raw_info.nil? | ||
@raw_info = (access_token.get('/api/2.0/user').parsed) | ||
end | ||
return @raw_info | ||
end | ||
end | ||
end | ||
end | ||
|
||
OmniAuth.config.add_camelization 'bitbucket', 'BitBucket' |
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,38 @@ | ||
require 'omniauth-oauth2' | ||
|
||
module OmniAuth | ||
module Strategies | ||
class GitHub < OmniAuth::Strategies::OAuth2 | ||
option :client_options, { | ||
:site => 'https://api.github.com', | ||
:authorize_url => 'https://github.com/login/oauth/authorize', | ||
:token_url => 'https://github.com/login/oauth/access_token' | ||
} | ||
|
||
def request_phase | ||
super | ||
end | ||
|
||
uid { raw_info['id'] } | ||
|
||
info do | ||
{ | ||
'nickname' => raw_info['login'], | ||
'email' => raw_info['email'], | ||
'name' => raw_info['name'] | ||
} | ||
end | ||
|
||
def raw_info | ||
access_token.options[:mode] = :query | ||
if @raw_info.nil? | ||
@raw_info = access_token.get('/user').parsed | ||
@raw_info['email'] = access_token.get('/user/emails').parsed | ||
end | ||
return @raw_info | ||
end | ||
end | ||
end | ||
end | ||
|
||
OmniAuth.config.add_camelization 'github', 'GitHub' |
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,42 @@ | ||
require 'omniauth-oauth2' | ||
|
||
module OmniAuth | ||
module Strategies | ||
class GitLab < OmniAuth::Strategies::OAuth2 | ||
option :client_options, { | ||
:site => 'https://gitlab.com', | ||
:authorize_url => '/oauth/authorize', | ||
:token_url => '/oauth/token' | ||
} | ||
|
||
option :redirect_url | ||
|
||
uid { raw_info['id'].to_s } | ||
|
||
def callback_url | ||
nil | ||
end | ||
|
||
info do | ||
{ | ||
'nickname' => raw_info['username'], | ||
'name' => raw_info['display_name'], | ||
'email' => raw_info['email'] | ||
} | ||
end | ||
|
||
def raw_info | ||
@raw_info ||= access_token.get('/api/v3/user').parsed | ||
end | ||
|
||
private | ||
|
||
def callback_url | ||
options.redirect_url || (full_host + script_name + callback_path) | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
OmniAuth.config.add_camelization 'gitlab', 'GitLab' |
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-clients/version', __FILE__) | ||
|
||
Gem::Specification.new do |gem| | ||
gem.authors = ["Brett Rudd"] | ||
gem.email = ["rudd@adobe.com"] | ||
gem.description = %q{OmniAuth clients for PhoneGapBuild.} | ||
gem.summary = %q{OmniAuth clients for PhoneGapBuild.} | ||
gem.homepage = "https://github.com/nitobi/omniauth-clients" | ||
|
||
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-clients" | ||
gem.require_paths = ["lib"] | ||
gem.version = OmniAuth::Clients::VERSION | ||
|
||
gem.add_dependency 'omniauth' | ||
gem.add_dependency 'omniauth-oauth2' | ||
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::AdobeId 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,9 @@ | ||
require 'spec_helper' | ||
|
||
describe OmniAuth::Strategies::GitHub 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-clients' | ||
|
||
RSpec.configure do |config| | ||
config.include WebMock::API | ||
config.include Rack::Test::Methods | ||
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy | ||
end | ||
|