registrar-rails 0.1.0.alpha → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/registrar_controller.rb +7 -0
- data/config/routes.rb +2 -6
- data/lib/registrar/rails/controller_extensions.rb +9 -15
- data/lib/registrar/rails/engine.rb +4 -0
- data/lib/registrar/rails/version.rb +1 -1
- data/test/dummy/log/test.log +36 -0
- metadata +5 -5
- data/app/controllers/authentication_controller.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63b952e593becaf35f3cdf23aca956d29bb6f38f
|
4
|
+
data.tar.gz: b95dbd8baac6bb446e962bbd964f2890f999a962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71e9b85cd98b542caacdd1aeb54c023bdb446c43b4f75c6b46ebeb87017ba7712c6234725bb14135bc5a3088a4bce96b437173adab592e6bb417f5079a0f8000
|
7
|
+
data.tar.gz: 6e62c6519aa9fb15529ce0fcf78f6a333dbe70a376b24791a27999b6873fefc9be263839d268565a5f894a4f39750545595e459c36d189d58673a2f1cff04310
|
data/config/routes.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
# Auth through OmniAuth strategy
|
6
|
-
post 'auth/:strategy/callback' => 'authentication#authenticate'
|
7
|
-
get 'auth/:strategy/callback' => 'authentication#authenticate'
|
2
|
+
# Delegate all OmniAuth callbacks to Registrar
|
3
|
+
match 'auth/:strategy/callback' => 'registrar#callback', :via => [:get, :post]
|
8
4
|
end
|
@@ -8,7 +8,7 @@ module Registrar
|
|
8
8
|
klass.class_eval do
|
9
9
|
helper_method :current_profile
|
10
10
|
helper_method :current_profile?
|
11
|
-
helper_method :
|
11
|
+
helper_method :sign_out_current_profile
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -22,19 +22,9 @@ module Registrar
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def logout
|
26
|
-
session[CURRENT_PROFILE_UID] = nil
|
27
|
-
end
|
28
|
-
|
29
25
|
def current_profile
|
30
26
|
return @current_profile if @current_profile
|
31
|
-
|
32
|
-
if current_profile_uid_from_session
|
33
|
-
@current_profile = Registrar::Middleware::config.handler.call(
|
34
|
-
build_current_profile
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
27
|
+
@current_profile = handle(profile) if current_profile_uid_from_session
|
38
28
|
@current_profile
|
39
29
|
end
|
40
30
|
|
@@ -42,8 +32,8 @@ module Registrar
|
|
42
32
|
!!current_profile
|
43
33
|
end
|
44
34
|
|
45
|
-
def
|
46
|
-
|
35
|
+
def sign_out_current_profile
|
36
|
+
session[CURRENT_PROFILE_UID] = nil
|
47
37
|
end
|
48
38
|
|
49
39
|
private
|
@@ -56,7 +46,11 @@ module Registrar
|
|
56
46
|
session[CURRENT_PROFILE_UID]
|
57
47
|
end
|
58
48
|
|
59
|
-
def
|
49
|
+
def handle(profile)
|
50
|
+
Registrar::Middleware::config.handler.call(profile)
|
51
|
+
end
|
52
|
+
|
53
|
+
def profile
|
60
54
|
{
|
61
55
|
"provider" => {
|
62
56
|
"name" => "session",
|
@@ -17,6 +17,10 @@ module Registrar
|
|
17
17
|
block = lambda do |config|
|
18
18
|
configuration.call config
|
19
19
|
config.middleware(::Rails.application.config.middleware)
|
20
|
+
|
21
|
+
OmniAuth.config.on_failure = Proc.new { |env|
|
22
|
+
# noop - lat the application handle the error
|
23
|
+
}
|
20
24
|
end
|
21
25
|
|
22
26
|
@@configuration = lambda do
|
data/test/dummy/log/test.log
CHANGED
@@ -896,3 +896,39 @@ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliab
|
|
896
896
|
Started GET "/" for 127.0.0.1 at 2015-06-02 17:24:43 +0200
|
897
897
|
Processing by SomeController#index as HTML
|
898
898
|
Completed 200 OK in 14ms (Views: 0.2ms)
|
899
|
+
----------------------------------------------------------------------------------
|
900
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
901
|
+
----------------------------------------------------------------------------------
|
902
|
+
Started GET "/" for 127.0.0.1 at 2015-12-02 11:00:51 +0100
|
903
|
+
Processing by SomeController#index as HTML
|
904
|
+
Completed 200 OK in 16ms (Views: 0.2ms)
|
905
|
+
----------------------------------------------------------------------------------
|
906
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
907
|
+
----------------------------------------------------------------------------------
|
908
|
+
Started GET "/" for 127.0.0.1 at 2015-12-02 11:03:25 +0100
|
909
|
+
Processing by SomeController#index as HTML
|
910
|
+
Completed 200 OK in 14ms (Views: 0.1ms)
|
911
|
+
----------------------------------------------------------------------------------
|
912
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
913
|
+
----------------------------------------------------------------------------------
|
914
|
+
Started GET "/" for 127.0.0.1 at 2015-12-02 11:06:23 +0100
|
915
|
+
Processing by SomeController#index as HTML
|
916
|
+
Completed 200 OK in 14ms (Views: 0.1ms)
|
917
|
+
----------------------------------------------------------------------------------
|
918
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
919
|
+
----------------------------------------------------------------------------------
|
920
|
+
Started GET "/" for 127.0.0.1 at 2015-12-02 11:34:25 +0100
|
921
|
+
Processing by SomeController#index as HTML
|
922
|
+
Completed 200 OK in 14ms (Views: 0.1ms)
|
923
|
+
----------------------------------------------------------------------------------
|
924
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
925
|
+
----------------------------------------------------------------------------------
|
926
|
+
Started GET "/" for 127.0.0.1 at 2015-12-02 12:37:02 +0100
|
927
|
+
Processing by SomeController#index as HTML
|
928
|
+
Completed 200 OK in 14ms (Views: 0.2ms)
|
929
|
+
----------------------------------------------------------------------------------
|
930
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
931
|
+
----------------------------------------------------------------------------------
|
932
|
+
Started GET "/" for 127.0.0.1 at 2015-12-02 14:18:24 +0100
|
933
|
+
Processing by SomeController#index as HTML
|
934
|
+
Completed 200 OK in 14ms (Views: 0.2ms)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: registrar-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Owiesniak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -46,7 +46,7 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- Rakefile
|
49
|
-
- app/controllers/
|
49
|
+
- app/controllers/registrar_controller.rb
|
50
50
|
- config/initializers/registrar.rb
|
51
51
|
- config/routes.rb
|
52
52
|
- lib/registrar-rails.rb
|
@@ -95,9 +95,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
|
-
- - "
|
98
|
+
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
100
|
+
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
103
|
rubygems_version: 2.2.2
|