multiauth 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/views/multiauth/sessions/new.html.erb +1 -0
- data/lib/multiauth/rails.rb +22 -13
- data/multiauth.gemspec +2 -2
- metadata +3 -3
- data/app/views/multiauth/sessions/new.html.haml +0 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= multiauth_box %>
|
data/lib/multiauth/rails.rb
CHANGED
@@ -6,27 +6,36 @@ module Multiauth
|
|
6
6
|
paths.app.views = File.expand_path("../../../app/views", __FILE__)
|
7
7
|
paths.config.routes = File.expand_path("../routes.rb", __FILE__)
|
8
8
|
|
9
|
+
|
9
10
|
initializer "multiauth" do |app|
|
11
|
+
|
10
12
|
config_file = Rails.root+"config/auth_providers.yml"
|
11
|
-
providers = YAML::load(ERB.new(File.read(config_file)).result)
|
12
|
-
if providers[Rails.env].nil?
|
13
|
-
raise ArgumentError, "cannot find section for #{Rails.env} environment in #{config_file}"
|
14
|
-
end
|
15
13
|
|
16
|
-
|
14
|
+
if File.exist?(config_file)
|
15
|
+
providers = YAML::load(ERB.new(File.read(config_file)).result)
|
16
|
+
if providers.blank?
|
17
|
+
raise ArgumentError, "#{config_file} is invalid"
|
18
|
+
elsif providers[Rails.env].nil?
|
19
|
+
raise ArgumentError, "cannot find section for #{Rails.env} environment in #{config_file}"
|
20
|
+
end
|
21
|
+
|
22
|
+
Multiauth.providers = providers[Rails.env]
|
17
23
|
|
18
|
-
|
19
|
-
|
24
|
+
require 'omniauth/openid'
|
25
|
+
require 'openid/store/filesystem'
|
20
26
|
|
21
|
-
|
27
|
+
app.config.middleware.use OmniAuth::Strategies::OpenID, OpenID::Store::Filesystem.new('/tmp') # FIXME: mm store
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
|
29
|
+
app.config.middleware.use OmniAuth::Builder do
|
30
|
+
Multiauth.providers.each do |provider, config|
|
31
|
+
next if config["token"].blank?
|
26
32
|
|
27
|
-
|
28
|
-
|
33
|
+
puts ">> Setting up #{provider} provider"
|
34
|
+
provider provider.downcase.to_sym, config["id"], config["token"]
|
35
|
+
end
|
29
36
|
end
|
37
|
+
else
|
38
|
+
$stderr.puts "Config file doesn't exist: #{config_file}"
|
30
39
|
end
|
31
40
|
end
|
32
41
|
|
data/multiauth.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{multiauth}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David A. Cuadrado"]
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
"VERSION",
|
28
28
|
"app/controllers/multiauth/sessions_controller.rb",
|
29
29
|
"app/views/multiauth/_box.html.erb",
|
30
|
-
"app/views/multiauth/sessions/new.html.
|
30
|
+
"app/views/multiauth/sessions/new.html.erb",
|
31
31
|
"lib/generators/multiauth/multiauth_generator.rb",
|
32
32
|
"lib/generators/templates/README",
|
33
33
|
"lib/generators/templates/auth_providers.yml",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- David A. Cuadrado
|
@@ -82,7 +82,7 @@ files:
|
|
82
82
|
- VERSION
|
83
83
|
- app/controllers/multiauth/sessions_controller.rb
|
84
84
|
- app/views/multiauth/_box.html.erb
|
85
|
-
- app/views/multiauth/sessions/new.html.
|
85
|
+
- app/views/multiauth/sessions/new.html.erb
|
86
86
|
- lib/generators/multiauth/multiauth_generator.rb
|
87
87
|
- lib/generators/templates/README
|
88
88
|
- lib/generators/templates/auth_providers.yml
|
@@ -1 +0,0 @@
|
|
1
|
-
= multiauth_box
|