exvo-auth 0.9.0 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +2 -17
- data/VERSION +1 -1
- data/exvo-auth.gemspec +3 -2
- data/lib/exvo-auth.rb +3 -2
- data/lib/exvo_auth/middleware.rb +15 -0
- metadata +5 -4
data/README
CHANGED
@@ -10,19 +10,13 @@ OAuth2
|
|
10
10
|
1. Install exvo-auth gem or add it to your Gemfile.
|
11
11
|
|
12
12
|
|
13
|
-
2. Configure middleware
|
13
|
+
2. Configure middleware.
|
14
14
|
|
15
|
-
There are two middlewares. Usually you will need the "interactive" one:
|
16
|
-
|
17
|
-
ExvoAuth::Strategies::Interactive
|
18
|
-
ExvoAuth::Strategies::NonInteractive
|
19
|
-
|
20
|
-
Both middlewares need client_id and client_secret configured.
|
21
15
|
In Rails, the relevant lines could look like this:
|
22
16
|
|
23
17
|
ExvoAuth::Config.client_id = "foo"
|
24
18
|
ExvoAuth::Config.client_secret = "bar"
|
25
|
-
config.middleware.use ExvoAuth::
|
19
|
+
config.middleware.use ExvoAuth::Middleware
|
26
20
|
|
27
21
|
|
28
22
|
3. Add routes.
|
@@ -39,14 +33,6 @@ You can have separate callbacks for interactive and non-interactive
|
|
39
33
|
callback routes but you can also route both callbacks to the same controller method
|
40
34
|
like shown above.
|
41
35
|
|
42
|
-
You also need a root_url route defined in routes (Rails) or this little hack (Merb):
|
43
|
-
|
44
|
-
Merb::Controller.class_eval do
|
45
|
-
def root_url
|
46
|
-
absolute_url("/foo") # probably a "/"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
36
|
4. Include controller helpers into your application controller.
|
51
37
|
|
52
38
|
include ExvoAuth::Controllers::Rails (or Merb)
|
@@ -92,7 +78,6 @@ You have a handy methods available in controllers (and views in Rails): sign_in_
|
|
92
78
|
Inter-Application Communication
|
93
79
|
===============================
|
94
80
|
|
95
|
-
|
96
81
|
# Consumer side
|
97
82
|
|
98
83
|
consumer = ExvoAuth::Autonomous::Consumer.new(
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.2
|
data/exvo-auth.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{exvo-auth}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jacek Becela"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-03}
|
13
13
|
s.description = %q{Sign in with Exvo account}
|
14
14
|
s.email = %q{jacek.becela@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/exvo_auth/controllers/merb.rb",
|
36
36
|
"lib/exvo_auth/controllers/rails.rb",
|
37
37
|
"lib/exvo_auth/dejavu.rb",
|
38
|
+
"lib/exvo_auth/middleware.rb",
|
38
39
|
"lib/exvo_auth/oauth2.rb",
|
39
40
|
"lib/exvo_auth/strategies/base.rb",
|
40
41
|
"lib/exvo_auth/strategies/interactive.rb",
|
data/lib/exvo-auth.rb
CHANGED
@@ -6,8 +6,9 @@ require 'uri'
|
|
6
6
|
require 'base64'
|
7
7
|
|
8
8
|
module ExvoAuth
|
9
|
-
autoload :
|
10
|
-
autoload :
|
9
|
+
autoload :Middleware, 'exvo_auth/middleware'
|
10
|
+
autoload :Config, 'exvo_auth/config'
|
11
|
+
autoload :Dejavu, 'exvo_auth/dejavu'
|
11
12
|
|
12
13
|
module Strategies
|
13
14
|
autoload :Base, 'exvo_auth/strategies/base'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ExvoAuth::Middleware
|
2
|
+
def initialize(app)
|
3
|
+
@app = middlewares.inject(app){ |a, m| a = m.new(a) }
|
4
|
+
end
|
5
|
+
|
6
|
+
def call(env)
|
7
|
+
@app.call(env)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def middlewares
|
13
|
+
[ExvoAuth::Strategies::Interactive, ExvoAuth::Strategies::NonInteractive, ExvoAuth::Dejavu]
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exvo-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 2
|
10
|
+
version: 0.9.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jacek Becela
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-03 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- lib/exvo_auth/controllers/merb.rb
|
111
111
|
- lib/exvo_auth/controllers/rails.rb
|
112
112
|
- lib/exvo_auth/dejavu.rb
|
113
|
+
- lib/exvo_auth/middleware.rb
|
113
114
|
- lib/exvo_auth/oauth2.rb
|
114
115
|
- lib/exvo_auth/strategies/base.rb
|
115
116
|
- lib/exvo_auth/strategies/interactive.rb
|