oa-core 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/lib/omniauth/form.rb +5 -3
- data/lib/omniauth/strategy.rb +5 -5
- data/lib/omniauth/version.rb +1 -1
- data/oa-core.gemspec +1 -1
- data/spec/omniauth/strategy_spec.rb +5 -0
- metadata +5 -5
data/Gemfile
ADDED
data/lib/omniauth/form.rb
CHANGED
@@ -90,13 +90,14 @@ module OmniAuth
|
|
90
90
|
|
91
91
|
def initialize(options = {})
|
92
92
|
options[:title] ||= "Authentication Info Required"
|
93
|
+
options[:header_info] ||= ""
|
93
94
|
self.options = options
|
94
95
|
|
95
96
|
@html = ""
|
96
|
-
header(options[:title])
|
97
|
+
header(options[:title],options[:header_info])
|
97
98
|
end
|
98
99
|
|
99
|
-
def self.build(title=nil
|
100
|
+
def self.build(title=nil,&block)
|
100
101
|
form = OmniAuth::Form.new(title)
|
101
102
|
form.instance_eval(&block)
|
102
103
|
end
|
@@ -138,13 +139,14 @@ module OmniAuth
|
|
138
139
|
self
|
139
140
|
end
|
140
141
|
|
141
|
-
def header(title)
|
142
|
+
def header(title,header_info)
|
142
143
|
@html << <<-HTML
|
143
144
|
<!DOCTYPE html>
|
144
145
|
<html>
|
145
146
|
<head>
|
146
147
|
<title>#{title}</title>
|
147
148
|
#{css}
|
149
|
+
#{header_info}
|
148
150
|
</head>
|
149
151
|
<body>
|
150
152
|
<h1>#{title}</h1>
|
data/lib/omniauth/strategy.rb
CHANGED
@@ -3,7 +3,7 @@ require 'omniauth/core'
|
|
3
3
|
module OmniAuth
|
4
4
|
class NoSessionError < StandardError; end
|
5
5
|
# The Strategy is the base unit of OmniAuth's ability to
|
6
|
-
# wrangle multiple providers. Each strategy provided by
|
6
|
+
# wrangle multiple providers. Each strategy provided by
|
7
7
|
# OmniAuth includes this mixin to gain the default functionality
|
8
8
|
# necessary to be compatible with the OmniAuth library.
|
9
9
|
module Strategy
|
@@ -41,9 +41,9 @@ module OmniAuth
|
|
41
41
|
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
|
42
42
|
return callback_call if on_callback_path?
|
43
43
|
return other_phase if respond_to?(:other_phase)
|
44
|
-
@app.call(env)
|
44
|
+
@app.call(env)
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
# Performs the steps necessary to run the request phase of a strategy.
|
48
48
|
def request_call
|
49
49
|
setup_phase
|
@@ -81,7 +81,7 @@ module OmniAuth
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def mock_call!(env)
|
84
|
-
return mock_request_call if on_request_path?
|
84
|
+
return mock_request_call if on_request_path?
|
85
85
|
return mock_callback_call if on_callback_path?
|
86
86
|
call_app!
|
87
87
|
end
|
@@ -95,7 +95,7 @@ module OmniAuth
|
|
95
95
|
elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)
|
96
96
|
@env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
|
97
97
|
end
|
98
|
-
redirect(callback_path)
|
98
|
+
redirect(script_name + callback_path)
|
99
99
|
end
|
100
100
|
|
101
101
|
def mock_callback_call
|
data/lib/omniauth/version.rb
CHANGED
data/oa-core.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.add_development_dependency 'rack-test', '~> 0.5'
|
8
8
|
gem.add_development_dependency 'rake', '~> 0.8'
|
9
9
|
gem.add_development_dependency 'rspec', '~> 2.5'
|
10
|
-
gem.add_development_dependency 'yard', '~> 0.
|
10
|
+
gem.add_development_dependency 'yard', '~> 0.7'
|
11
11
|
gem.add_development_dependency 'ZenTest', '~> 4.5'
|
12
12
|
gem.name = 'oa-core'
|
13
13
|
gem.version = OmniAuth::Version::STRING
|
@@ -258,6 +258,11 @@ describe OmniAuth::Strategy do
|
|
258
258
|
strategy.call(make_env('/AUTH/Test'))[0].should == 302
|
259
259
|
end
|
260
260
|
|
261
|
+
it 'should respect SCRIPT_NAME (a.k.a. BaseURI)' do
|
262
|
+
response = strategy.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri'))
|
263
|
+
response[1]['Location'].should == '/sub_uri/auth/test/callback'
|
264
|
+
end
|
265
|
+
|
261
266
|
it 'should be case insensitive on callback path' do
|
262
267
|
strategy.call(make_env('/AUTH/TeSt/CaLlBAck')).should == strategy.call(make_env('/auth/test/callback'))
|
263
268
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: oa-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Michael Bleigh
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-05-20 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: maruku
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - ~>
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: "0.
|
79
|
+
version: "0.7"
|
80
80
|
type: :development
|
81
81
|
version_requirements: *id006
|
82
82
|
- !ruby/object:Gem::Dependency
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- .gemtest
|
105
105
|
- .rspec
|
106
106
|
- .yardopts
|
107
|
+
- Gemfile
|
107
108
|
- LICENSE
|
108
109
|
- Rakefile
|
109
110
|
- autotest/discover.rb
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
146
|
requirements: []
|
146
147
|
|
147
148
|
rubyforge_project:
|
148
|
-
rubygems_version: 1.
|
149
|
+
rubygems_version: 1.8.2
|
149
150
|
signing_key:
|
150
151
|
specification_version: 3
|
151
152
|
summary: Core strategies for OmniAuth.
|
@@ -154,4 +155,3 @@ test_files:
|
|
154
155
|
- spec/omniauth/core_spec.rb
|
155
156
|
- spec/omniauth/strategy_spec.rb
|
156
157
|
- spec/spec_helper.rb
|
157
|
-
has_rdoc:
|