oa-core 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omniauth/core.rb +2 -4
- data/lib/omniauth/strategy.rb +5 -1
- metadata +7 -8
- data/lib/omniauth/strategies/password.rb +0 -43
data/lib/omniauth/core.rb
CHANGED
@@ -2,15 +2,13 @@ require 'rack'
|
|
2
2
|
require 'singleton'
|
3
3
|
|
4
4
|
module OmniAuth
|
5
|
+
module Strategies; end
|
6
|
+
|
5
7
|
autoload :Builder, 'omniauth/builder'
|
6
8
|
autoload :Strategy, 'omniauth/strategy'
|
7
9
|
autoload :Test, 'omniauth/test'
|
8
10
|
autoload :Form, 'omniauth/form'
|
9
11
|
|
10
|
-
module Strategies
|
11
|
-
autoload :Password, 'omniauth/strategies/password'
|
12
|
-
end
|
13
|
-
|
14
12
|
def self.strategies
|
15
13
|
@@strategies ||= []
|
16
14
|
end
|
data/lib/omniauth/strategy.rb
CHANGED
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.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Michael Bleigh
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-16 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -80,13 +80,13 @@ dependencies:
|
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: *id006
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
|
-
name:
|
83
|
+
name: json_pure
|
84
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.5.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: *id007
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- lib/omniauth/builder.rb
|
115
115
|
- lib/omniauth/core.rb
|
116
116
|
- lib/omniauth/form.rb
|
117
|
-
- lib/omniauth/strategies/password.rb
|
118
117
|
- lib/omniauth/strategy.rb
|
119
118
|
- lib/omniauth/test/phony_session.rb
|
120
119
|
- lib/omniauth/test/strategy_macros.rb
|
@@ -135,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
134
|
requirements:
|
136
135
|
- - ">="
|
137
136
|
- !ruby/object:Gem::Version
|
138
|
-
hash:
|
137
|
+
hash: 4207635899688391122
|
139
138
|
segments:
|
140
139
|
- 0
|
141
140
|
version: "0"
|
@@ -144,14 +143,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
143
|
requirements:
|
145
144
|
- - ">="
|
146
145
|
- !ruby/object:Gem::Version
|
147
|
-
hash:
|
146
|
+
hash: 4207635899688391122
|
148
147
|
segments:
|
149
148
|
- 0
|
150
149
|
version: "0"
|
151
150
|
requirements: []
|
152
151
|
|
153
152
|
rubyforge_project:
|
154
|
-
rubygems_version: 1.
|
153
|
+
rubygems_version: 1.6.2
|
155
154
|
signing_key:
|
156
155
|
specification_version: 3
|
157
156
|
summary: HTTP Basic strategies for OmniAuth.
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'digest/sha1'
|
2
|
-
require 'omniauth/core'
|
3
|
-
|
4
|
-
module OmniAuth
|
5
|
-
module Strategies
|
6
|
-
class Password
|
7
|
-
include OmniAuth::Strategy
|
8
|
-
|
9
|
-
def initialize(app, secret = 'changethisappsecret', options = {}, &block)
|
10
|
-
@secret = secret
|
11
|
-
super(app, :password, options, &block)
|
12
|
-
end
|
13
|
-
|
14
|
-
attr_reader :secret
|
15
|
-
|
16
|
-
def request_phase
|
17
|
-
return fail!(:missing_information) unless request[:identifier] && request[:password]
|
18
|
-
return fail!(:password_mismatch) if request[:password_confirmation] && request[:password_confirmation] != '' && request[:password] != request[:password_confirmation]
|
19
|
-
env['REQUEST_METHOD'] = 'GET'
|
20
|
-
env['PATH_INFO'] = request.path + '/callback'
|
21
|
-
env['omniauth.auth'] = auth_hash(encrypt(request[:identifier], request[:password]))
|
22
|
-
call_app!
|
23
|
-
end
|
24
|
-
|
25
|
-
def auth_hash(crypted_password)
|
26
|
-
OmniAuth::Utils.deep_merge(super(), {
|
27
|
-
'uid' => crypted_password,
|
28
|
-
'user_info' => {
|
29
|
-
@options[:identifier_key] => request[:identifier]
|
30
|
-
}
|
31
|
-
})
|
32
|
-
end
|
33
|
-
|
34
|
-
def callback_phase
|
35
|
-
call_app!
|
36
|
-
end
|
37
|
-
|
38
|
-
def encrypt(identifier, password)
|
39
|
-
Digest::SHA1.hexdigest([identifier, password, secret].join('::'))
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|