Skip to content

Commit

Permalink
Merge branch 'master' of github.com:intridea/omniauth into 1.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bleigh committed May 25, 2011
2 parents a378b07 + 21e6ef8 commit ec0b4db
Show file tree
Hide file tree
Showing 47 changed files with 685 additions and 126 deletions.
1 change: 0 additions & 1 deletion .travis.yml
@@ -1,7 +1,6 @@
script: "bundle exec rake test"
rvm:
- 1.8.7
- 1.9.1
- 1.9.2
- jruby
- rbx
Expand Down
4 changes: 0 additions & 4 deletions Gemfile
Expand Up @@ -4,10 +4,6 @@ platforms :jruby do
gem 'jruby-openssl', '~> 0.7'
end

group :development do
gem 'yard', :git => 'https://github.com/lsegal/yard.git'
end

gemspec :path => 'oa-basic'
gemspec :path => 'oa-core'
gemspec :path => 'oa-enterprise'
Expand Down
59 changes: 36 additions & 23 deletions README.md
@@ -1,26 +1,36 @@
# OmniAuth: Standardized Multi-Provider Authentication

OmniAuth is a new Rack-based authentication system for multi-provider external authentcation. OmniAuth is built from the ground up on the philosophy that **authentication is not the same as identity**, and is based on two observations:

1. The traditional 'sign up using a login and password' model is becoming the exception, not the rule. Modern web applications offer external authentication via OpenID, Facebook, and/or OAuth.
2. The interconnectable web is no longer a dream, it is a necessity. It is not unreasonable to expect that one application may need to be able to connect to one, three, or twelve other services. Modern authentication systems should allow a user's identity to be associated with many authentications.

## Installation

OmniAuth: Standardized Multi-Provider Authentication
====================================================
OmniAuth is a new Rack-based authentication system for multi-provider external
authentcation. OmniAuth is built from the ground up on the philosophy that
**authentication is not the same as identity**, and is based on two
observations:

1. The traditional 'sign up using a login and password' model is becoming the
exception, not the rule. Modern web applications offer external
authentication via OpenID, Facebook, and/or OAuth.
2. The interconnectable web is no longer a dream, it is a necessity. It is not
unreasonable to expect that one application may need to be able to connect
to one, three, or twelve other services. Modern authentication systems
should allow a user's identity to be associated with many authentications.

Installation
------------
To install OmniAuth, simply install the gem:

gem install omniauth

## Continuous Integration
Continuous Integration
----------------------
[![Build Status](http://travis-ci.org/intridea/omniauth.png)](http://travis-ci.org/intridea/omniauth)

## Providers

Providers
---------
OmniAuth currently supports the following external providers:

* via OAuth (OAuth 1.0, OAuth 2, and xAuth)
* 37signals ID (credit: [mbleigh](https://github.com/mbleigh))
* Bit.ly (credit: [philnash](https://github.com/philnash))
* Blogger (credit: [dsueiro-backing](https://github.com/dsueiro-backing))
* DailyMile (credit: [cdmwebs](https://github.com/cdmwebs))
* Doit.im (credit: [chouti](https://github.com/chouti))
* Dopplr (credit: [flextrip](https://github.com/flextrip))
Expand All @@ -30,6 +40,7 @@ OmniAuth currently supports the following external providers:
* Foursquare (credit: [mbleigh](https://github.com/mbleigh))
* GitHub (credit: [mbleigh](https://github.com/mbleigh))
* GoodReads (credit: [cristoffer](https://github.com/christoffer))
* Google Health (credit: [jaigouk](https://github.com/jaigouk))
* Gowalla (credit: [kvnsmth](https://github.com/kvnsmth))
* Hyves (credit: [mrdg](https://github.com/mrdg))
* Identi.ca (credit: [dcu](https://github.com/dcu))
Expand All @@ -41,13 +52,15 @@ OmniAuth currently supports the following external providers:
* Miso (credit: [rickenharp](https://github.com/rickenharp))
* Mixi (credit: [kiyoshi](https://github.com/kiyoshi))
* Netflix (credit: [caged](https://github.com/caged))
* Plurk (credit: [albb0920](http://github.com/albb0920))
* Qzone (credit: [quake](https://github.com/quake))
* Rdio (via [brandonweiss](https://github.com/brandonweiss))
* Renren (credit: [quake](https://github.com/quake))
* Salesforce (via [CloudSpokes](http://www.cloudspokes.com))
* SmugMug (credit: [pchilton](https://github.com/pchilton))
* SoundCloud (credit: [leemartin](https://github.com/leemartin))
* T163 (credit: [quake](https://github.com/quake))
* Taobao (credit: [l4u](https://github.com/l4u))
* TeamBox (credit [jrom](https://github.com/jrom))
* Tqq (credit: [quake](https://github.com/quake))
* TradeMe (credit: [pchilton](https://github.com/pchilton))
Expand All @@ -67,19 +80,19 @@ OmniAuth currently supports the following external providers:
* OpenID (credit: [mbleigh](https://github.com/mbleigh))
* Yupoo (credit: [chouti](https://github.com/chouti))

## Compatibility

Compatibility
-------------
OmniAuth is tested against the following Ruby versions:

* 1.8.7
* 1.9.1
* 1.9.2
* jRuby (note, the Evernote strategy is not available for jRuby)
* JRuby (note, the Evernote strategy is not available for JRuby)
* Rubinius
* REE

## Usage

Usage
-----
OmniAuth is a collection of Rack middleware. To use a single strategy, you simply need to add the middleware:

require 'oa-oauth'
Expand All @@ -105,8 +118,8 @@ The hash in question will look something like this:

The `user_info` hash will automatically be populated with as much information about the user as OmniAuth was able to pull from the given API or authentication provider.

## Resources

Resources
---------
The best place to find more information is the [OmniAuth Wiki](https://github.com/intridea/omniauth/wiki). Some specific information you might be interested in:

* [CI Build Status](http://travis-ci.org/#!/intridea/omniauth)
Expand All @@ -115,11 +128,11 @@ The best place to find more information is the [OmniAuth Wiki](https://github.co
* [Report Issues](https://github.com/intridea/omniauth/issues)
* [Mailing List](http://groups.google.com/group/omniauth)

## OmniAuth Core

OmniAuth Core
-------------
* **Michael Bleigh** ([mbleigh](https://github.com/mbleigh))
* **Erik Michaels-Ober** ([sferik](https://github.com/sferik))

## License

License
-------
OmniAuth is licensed under the MIT License.
2 changes: 1 addition & 1 deletion lib/omniauth/version.rb
Expand Up @@ -7,7 +7,7 @@ module Version
MINOR = 2
end
unless defined?(::OmniAuth::Version::PATCH)
PATCH = 5
PATCH = 6
end
unless defined?(::OmniAuth::Version::PRE)
PRE = nil
Expand Down
4 changes: 0 additions & 4 deletions oa-basic/Gemfile
Expand Up @@ -4,8 +4,4 @@ platforms :jruby do
gem 'jruby-openssl', '~> 0.7'
end

group :development do
gem 'yard', :git => 'https://github.com/lsegal/yard.git'
end

gemspec
2 changes: 1 addition & 1 deletion oa-basic/lib/omniauth/version.rb
Expand Up @@ -7,7 +7,7 @@ module Version
MINOR = 2
end
unless defined?(::OmniAuth::Version::PATCH)
PATCH = 5
PATCH = 6
end
unless defined?(::OmniAuth::Version::PRE)
PRE = nil
Expand Down
2 changes: 1 addition & 1 deletion oa-basic/oa-basic.gemspec
Expand Up @@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake', '~> 0.8'
gem.add_development_dependency 'rspec', '~> 2.5'
gem.add_development_dependency 'webmock', '~> 1.6'
# gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-basic'
gem.version = OmniAuth::Version::STRING
Expand Down
4 changes: 0 additions & 4 deletions oa-core/Gemfile
@@ -1,7 +1,3 @@
source 'http://rubygems.org'

group :development do
gem 'yard', :git => 'https://github.com/lsegal/yard.git'
end

gemspec
11 changes: 7 additions & 4 deletions oa-core/lib/omniauth/strategy.rb
Expand Up @@ -3,7 +3,7 @@
module OmniAuth
class NoSessionError < StandardError; end
# The Strategy is the base unit of OmniAuth's ability to
# wrangle multiple providers. Each strategy provided by
# wrangle multiple providers. Each strategy provided by
# OmniAuth includes this mixin to gain the default functionality
# necessary to be compatible with the OmniAuth library.
module Strategy
Expand Down Expand Up @@ -41,9 +41,9 @@ def call!(env)
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
@app.call(env)
end

# Performs the steps necessary to run the request phase of a strategy.
def request_call
setup_phase
Expand Down Expand Up @@ -85,7 +85,7 @@ def on_path?(path)
end

def mock_call!(env)
return mock_request_call if on_request_path?
return mock_request_call if on_request_path?
return mock_callback_call if on_callback_path?
call_app!
end
Expand Down Expand Up @@ -130,6 +130,8 @@ def request_phase

def callback_phase
@env['omniauth.auth'] = auth_hash
@env['omniauth.params'] = session['query_params'] || {}
session['query_params'] = nil if session['query_params']
call_app!
end

Expand Down Expand Up @@ -159,6 +161,7 @@ def query_string

def call_through_to_app
status, headers, body = *call_app!
session['query_params'] = Rack::Request.new(env).params
@response = Rack::Response.new(body, status, headers)

status == 404 ? nil : @response.finish
Expand Down
2 changes: 1 addition & 1 deletion oa-core/lib/omniauth/version.rb
Expand Up @@ -7,7 +7,7 @@ module Version
MINOR = 2
end
unless defined?(::OmniAuth::Version::PATCH)
PATCH = 5
PATCH = 6
end
unless defined?(::OmniAuth::Version::PRE)
PRE = nil
Expand Down
2 changes: 1 addition & 1 deletion oa-core/oa-core.gemspec
Expand Up @@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rack-test', '~> 0.5'
gem.add_development_dependency 'rake', '~> 0.8'
gem.add_development_dependency 'rspec', '~> 2.5'
# gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-core'
gem.version = OmniAuth::Version::STRING
Expand Down
4 changes: 0 additions & 4 deletions oa-enterprise/Gemfile
Expand Up @@ -4,8 +4,4 @@ platforms :jruby do
gem 'jruby-openssl', '~> 0.7'
end

group :development do
gem 'yard', :git => 'https://github.com/lsegal/yard.git'
end

gemspec
Expand Up @@ -39,14 +39,14 @@ def user_info
def parse_user_info(node)
return nil if node.nil?
hash = {}
node.children.each do |e|
node.children.each do |e|
unless e.kind_of?(Nokogiri::XML::Text) ||
e.name == 'cas:proxies' ||
e.name == 'proxies'
# There are no child elements
if e.element_children.count == 0
hash[e.name.sub(/^cas:/, '')] = e.content
elsif e.element_children.count
elsif e.element_children.count
hash[e.name.sub(/^cas:/, '')] = [] if hash[e.name.sub(/^cas:/, '')].nil?
hash[e.name.sub(/^cas:/, '')].push parse_user_info e
end
Expand Down
2 changes: 1 addition & 1 deletion oa-enterprise/lib/omniauth/version.rb
Expand Up @@ -7,7 +7,7 @@ module Version
MINOR = 2
end
unless defined?(::OmniAuth::Version::PATCH)
PATCH = 5
PATCH = 6
end
unless defined?(::OmniAuth::Version::PRE)
PRE = nil
Expand Down
2 changes: 1 addition & 1 deletion oa-enterprise/oa-enterprise.gemspec
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake', '~> 0.8'
gem.add_development_dependency 'rspec', '~> 2.5'
gem.add_development_dependency 'webmock', '~> 1.6'
# gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-enterprise'
gem.version = OmniAuth::Version::STRING
Expand Down
41 changes: 41 additions & 0 deletions oa-enterprise/spec/omniauth/strategies/ldap_spec.rb
@@ -0,0 +1,41 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'cgi'

describe OmniAuth::Strategies::LDAP, :type => :strategy do

include OmniAuth::Test::StrategyTestCase

def strategy
@ldap_server ||= 'ldap.example.org'
[OmniAuth::Strategies::LDAP, {
:host => @ldap_server,
:port => 636,
:method => :ssl,
:uid => 'jeremyf',
:base => 'o="University of OmniAuth", st=Sublime, c=RubyNation',
}]
end

describe 'GET /auth/ldap' do
before do
get '/auth/ldap'
end

# TODO: Add checks that page has authentication form; I attempted
# to use `should have_tag` but that was not working.
it 'should get authentication page' do
last_response.status.should == 200
end
end

describe 'POST /auth/ldap' do
before do
post '/auth/ldap', {:username => 'jeremy', :password => 'valid_password' }
end

it 'should redirect us to /auth/ldap/callback' do
last_response.should be_redirect
last_response.location.should == '/auth/ldap/callback'
end
end
end
4 changes: 0 additions & 4 deletions oa-more/Gemfile
Expand Up @@ -4,8 +4,4 @@ platforms :jruby do
gem 'jruby-openssl', '~> 0.7'
end

group :development do
gem 'yard', :git => 'https://github.com/lsegal/yard.git'
end

gemspec
1 change: 1 addition & 0 deletions oa-more/lib/omniauth/more.rb
Expand Up @@ -6,5 +6,6 @@ module Strategies
autoload :Flickr, 'omniauth/strategies/flickr'
autoload :Yupoo, 'omniauth/strategies/yupoo'
autoload :Ign, 'omniauth/strategies/ign'
autoload :Draugiem, 'omniauth/strategies/draugiem'
end
end

0 comments on commit ec0b4db

Please sign in to comment.