omniauth 1.0.0.beta1 → 1.0.0.pr1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of omniauth might be problematic. Click here for more details.

data/README.md CHANGED
@@ -18,13 +18,7 @@ one or more strategies. These strategies are generally released
18
18
  individually as RubyGems, and you can see a [community maintained list](https://github.com/intridea/omniauth/wiki/List-of-Strategies)
19
19
  on the wiki for this project.
20
20
 
21
- One strategy, called `Developer`, is included with OmniAuth and provides
22
- a completely unsecure, non-production-usable strategy that directly
23
- prompts a user for authentication information and then passes it
24
- straight through. You can use it as a placeholder when you start
25
- development and easily swap in other strategies later.
26
-
27
- ## Getting Started
21
+ ## Adding OmniAuth to Your Application
28
22
 
29
23
  Each OmniAuth strategy is a Rack Middleware. That means that you can use
30
24
  it the same way that you use any other Rack middleware. For example, to
@@ -85,7 +79,7 @@ something like this:
85
79
 
86
80
  class SessionsController < ApplicationController
87
81
  def create
88
- @user = User.find_or_create_from_auth_hash(auth_hash)
82
+ @user = ̈User.find_or_create_from_auth_hash(auth_hash)
89
83
  self.current_user = @user
90
84
  redirect_to '/'
91
85
  end
data/lib/omniauth.rb CHANGED
@@ -2,9 +2,7 @@ require 'rack'
2
2
  require 'singleton'
3
3
 
4
4
  module OmniAuth
5
- module Strategies
6
- autoload :Developer, 'omniauth/strategies/developer'
7
- end
5
+ module Strategies; end
8
6
 
9
7
  autoload :Builder, 'omniauth/builder'
10
8
  autoload :Strategy, 'omniauth/strategy'
@@ -6,8 +6,6 @@ module OmniAuth
6
6
  # is able to provide into the InfoHash (stored as the `'info'`
7
7
  # key).
8
8
  class AuthHash < Hashie::Mash
9
- def self.subkey_class; Hashie::Mash end
10
-
11
9
  # Tells you if this is considered to be a valid
12
10
  # OmniAuth AuthHash. The requirements for that
13
11
  # are that it has a provider name, a uid, and a
@@ -25,8 +23,6 @@ module OmniAuth
25
23
  end
26
24
 
27
25
  class InfoHash < Hashie::Mash
28
- def self.subkey_class; Hashie::Mash end
29
-
30
26
  def name
31
27
  return self[:name] if self[:name]
32
28
  return "#{first_name} #{last_name}".strip if first_name? || last_name?
@@ -1,3 +1,3 @@
1
1
  module OmniAuth
2
- VERSION = "1.0.0.beta1"
2
+ VERSION = "1.0.0.pr1"
3
3
  end
data/omniauth.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.email = ['michael@intridea.com', 'sferik@gmail.com']
9
9
 
10
10
  gem.add_runtime_dependency 'rack'
11
- gem.add_runtime_dependency 'hashie', '~> 1.2'
11
+ gem.add_runtime_dependency 'hashie'
12
12
 
13
13
  gem.add_development_dependency 'maruku', '~> 0.6'
14
14
  gem.add_development_dependency 'simplecov', '~> 0.4'
@@ -91,11 +91,6 @@ describe OmniAuth::AuthHash do
91
91
  subject.info = {:first_name => 'Bob', :last_name => 'Examplar'}
92
92
  hash['info']['name'].should == 'Bob Examplar'
93
93
  end
94
-
95
- it 'should not pollute the URL hash with "name" etc' do
96
- subject.info = {'urls' => {'Homepage' => "http://homepage.com"}}
97
- subject.to_hash['info']['urls'].should == {'Homepage' => "http://homepage.com"}
98
- end
99
94
  end
100
95
 
101
96
  describe OmniAuth::AuthHash::InfoHash do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta1
4
+ version: 1.0.0.pr1
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-19 00:00:00.000000000Z
13
+ date: 2011-10-13 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
17
- requirement: &70214948162300 !ruby/object:Gem::Requirement
17
+ requirement: &70237240831600 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,21 +22,21 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70214948162300
25
+ version_requirements: *70237240831600
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: hashie
28
- requirement: &70214948161800 !ruby/object:Gem::Requirement
28
+ requirement: &70237240831180 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
- - - ~>
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
- version: '1.2'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70214948161800
36
+ version_requirements: *70237240831180
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: maruku
39
- requirement: &70214948161300 !ruby/object:Gem::Requirement
39
+ requirement: &70237240860880 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0.6'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70214948161300
47
+ version_requirements: *70237240860880
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: simplecov
50
- requirement: &70214948160840 !ruby/object:Gem::Requirement
50
+ requirement: &70237240860380 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0.4'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70214948160840
58
+ version_requirements: *70237240860380
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rack-test
61
- requirement: &70214948160380 !ruby/object:Gem::Requirement
61
+ requirement: &70237240859920 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0.5'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70214948160380
69
+ version_requirements: *70237240859920
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rake
72
- requirement: &70214948159920 !ruby/object:Gem::Requirement
72
+ requirement: &70237240859460 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0.8'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70214948159920
80
+ version_requirements: *70237240859460
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rdiscount
83
- requirement: &70214948159460 !ruby/object:Gem::Requirement
83
+ requirement: &70237240859000 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '1.6'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *70214948159460
91
+ version_requirements: *70237240859000
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: rspec
94
- requirement: &70214948159000 !ruby/object:Gem::Requirement
94
+ requirement: &70237240858540 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '2.5'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *70214948159000
102
+ version_requirements: *70237240858540
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: yard
105
- requirement: &70214948158540 !ruby/object:Gem::Requirement
105
+ requirement: &70237240858080 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ~>
@@ -110,7 +110,7 @@ dependencies:
110
110
  version: '0.7'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *70214948158540
113
+ version_requirements: *70237240858080
114
114
  description: A generalized Rack framework for multiple-provider authentication.
115
115
  email:
116
116
  - michael@intridea.com
@@ -133,7 +133,6 @@ files:
133
133
  - lib/omniauth/auth_hash.rb
134
134
  - lib/omniauth/builder.rb
135
135
  - lib/omniauth/form.rb
136
- - lib/omniauth/strategies/developer.rb
137
136
  - lib/omniauth/strategy.rb
138
137
  - lib/omniauth/test.rb
139
138
  - lib/omniauth/test/phony_session.rb
@@ -143,7 +142,6 @@ files:
143
142
  - omniauth.gemspec
144
143
  - spec/omniauth/auth_hash_spec.rb
145
144
  - spec/omniauth/builder_spec.rb
146
- - spec/omniauth/strategies/developer_spec.rb
147
145
  - spec/omniauth/strategy_spec.rb
148
146
  - spec/omniauth_spec.rb
149
147
  - spec/spec_helper.rb
@@ -174,7 +172,6 @@ summary: A generalized Rack framework for multiple-provider authentication.
174
172
  test_files:
175
173
  - spec/omniauth/auth_hash_spec.rb
176
174
  - spec/omniauth/builder_spec.rb
177
- - spec/omniauth/strategies/developer_spec.rb
178
175
  - spec/omniauth/strategy_spec.rb
179
176
  - spec/omniauth_spec.rb
180
177
  - spec/spec_helper.rb
@@ -1,60 +0,0 @@
1
- require 'omniauth'
2
-
3
- module OmniAuth
4
- module Strategies
5
- # The Developer strategy is a very simple strategy that can be used as a
6
- # placeholder in your application until a different authentication strategy
7
- # is swapped in. It has zero security and should *never* be used in a
8
- # production setting.
9
- #
10
- # ## Usage
11
- #
12
- # To use the Developer strategy, all you need to do is put it in like any
13
- # other strategy:
14
- #
15
- # @example Basic Usage
16
- #
17
- # use OmniAuth::Builder do
18
- # provider :developer
19
- # end
20
- #
21
- # @example Custom Fields
22
- #
23
- # use OmniAuth::Builder do
24
- # provider :developer,
25
- # :fields => [:first_name, :last_name],
26
- # :uid_field => :last_name
27
- # end
28
- #
29
- # This will create a strategy that, when the user visits `/auth/developer`
30
- # they will be presented a form that prompts for (by default) their name
31
- # and email address. The auth hash will be populated with these fields and
32
- # the `uid` will simply be set to the provided email.
33
- class Developer
34
- include OmniAuth::Strategy
35
-
36
- option :fields, [:name, :email]
37
- option :uid_field, :email
38
-
39
- def request_phase
40
- form = OmniAuth::Form.new(:title => "User Info", :url => callback_path)
41
- options.fields.each do |field|
42
- form.text_field field.to_s.capitalize.gsub("_", " "), field.to_s
43
- end
44
- form.button "Sign In"
45
- form.to_response
46
- end
47
-
48
- uid do
49
- request.params[options.uid_field.to_s]
50
- end
51
-
52
- info do
53
- options.fields.inject({}) do |hash, field|
54
- hash[field] = request.params[field.to_s]
55
- hash
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe OmniAuth::Strategies::Developer do
4
- let(:app){ Rack::Builder.new do |b|
5
- b.use Rack::Session::Cookie
6
- b.use OmniAuth::Strategies::Developer
7
- b.run lambda{|env| [200, {}, ['Not Found']]}
8
- end.to_app }
9
-
10
- context 'request phase' do
11
- before(:each){ get '/auth/developer' }
12
-
13
- it 'should display a form' do
14
- last_response.status.should == 200
15
- last_response.body.should be_include("<form")
16
- end
17
-
18
- it 'should have the callback as the action for the form' do
19
- last_response.body.should be_include("action='/auth/developer/callback'")
20
- end
21
-
22
- it 'should have a text field for each of the fields' do
23
- last_response.body.scan('<input').size.should == 2
24
- end
25
- end
26
-
27
- context 'callback phase' do
28
- let(:auth_hash){ last_request.env['omniauth.auth'] }
29
-
30
- context 'with default options' do
31
- before do
32
- post '/auth/developer/callback', :name => 'Example User', :email => 'user@example.com'
33
- end
34
-
35
- it 'should set the name in the auth hash' do
36
- auth_hash.info.name.should == 'Example User'
37
- end
38
-
39
- it 'should set the email in the auth hash' do
40
- auth_hash.info.email.should == 'user@example.com'
41
- end
42
-
43
- it 'should set the uid to the email' do
44
- auth_hash.uid.should == 'user@example.com'
45
- end
46
- end
47
-
48
- context 'with custom options' do
49
- let(:app){ Rack::Builder.new do |b|
50
- b.use Rack::Session::Cookie
51
- b.use OmniAuth::Strategies::Developer, :fields => [:first_name, :last_name], :uid_field => :last_name
52
- b.run lambda{|env| [200, {}, ['Not Found']]}
53
- end.to_app }
54
-
55
- before do
56
- @options = {:uid_field => :last_name, :fields => [:first_name, :last_name]}
57
- post '/auth/developer/callback', :first_name => 'Example', :last_name => 'User'
58
- end
59
-
60
- it 'should set info fields properly' do
61
- auth_hash.info.name.should == 'Example User'
62
- end
63
-
64
- it 'should set the uid properly' do
65
- auth_hash.uid.should == 'User'
66
- end
67
- end
68
- end
69
- end