incline 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cfbf17b26c16120554b3867cb1ce1f33d3bc39d
4
- data.tar.gz: 8fdfd9a49f863281010e5c0a50e373a11a984b09
3
+ metadata.gz: 96abfaafca9bf6706a2f20c026892324ed54535e
4
+ data.tar.gz: 774487236771970729fe63b66f01051c0186635b
5
5
  SHA512:
6
- metadata.gz: 886b0af6a73cd3e11dd8485a36d73f353d512ed49ea1b38f89352e5ccf4f7ab15444c4d011eeae49b679c005e15f0e6844acb68ce1524e7b8704b8d68889eb4a
7
- data.tar.gz: 6239c29b73ef51dc972f489bd9d67c1e75211a3cdd09cb7776270d8f56fef89352e1aa7e4206762cea20e4fd658a1499cff216889db2aa9a392a7ad2835b7a0c
6
+ metadata.gz: c7c8dfba5bbbb8dd7098d1a0471b369990b50f955577c4240254d7fd7aa16c7353ef25352438e5a55bd321f415d5f20fce1dbab3decf2d69537c1d0cdc5c5637
7
+ data.tar.gz: ce534a4d60ebb59f9b7c00aecb9389a23bedfb6e0f9b82fec5610e25ef8eeee3fb2cd9e42928370bedab947a4a2395bdae95bd92a934ddce46189e2b3c955eed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- incline (0.2.7)
4
+ incline (0.2.8)
5
5
  ansi (~> 1.5.0)
6
6
  bcrypt
7
7
  bootstrap-sass
@@ -58,7 +58,7 @@ GEM
58
58
  tzinfo (~> 1.1)
59
59
  ansi (1.5.0)
60
60
  arel (6.0.4)
61
- autoprefixer-rails (7.1.2.6)
61
+ autoprefixer-rails (7.1.3)
62
62
  execjs
63
63
  bcrypt (3.1.11)
64
64
  bootstrap-sass (3.3.7)
@@ -44,8 +44,14 @@ module Incline
44
44
  ##
45
45
  # DELETE /incline/logout
46
46
  def destroy
47
- log_out if logged_in?
48
- redirect_to main_app.root_url
47
+ # Check to see if an external auth system should be used.
48
+ auth_url = ::Incline::UserManager.end_external_authentication(request)
49
+ if auth_url.blank?
50
+ log_out if logged_in?
51
+ redirect_to main_app.root_url
52
+ else
53
+ redirect_to auth_url
54
+ end
49
55
  end
50
56
 
51
57
  end
@@ -18,12 +18,19 @@ module Incline
18
18
  end
19
19
 
20
20
  ##
21
- # The begin_external_authentication method takes a request object to determine if it should process authentication or
22
- # return nil. If it decides to process authentication, it should return a URL to redirect to.
21
+ # The begin_external_authentication method takes a request object to determine if it should process a login
22
+ # or return nil. If it decides to process authentication, it should return a URL to redirect to.
23
23
  def begin_external_authentication(request)
24
24
  nil
25
25
  end
26
26
 
27
+ ##
28
+ # The end_external_authentication method takes a request object to determine if it should process a logout
29
+ # or return nil. If it decides to process authentication, it should return a URL to redirect to.
30
+ def end_external_authentication(request)
31
+ nil
32
+ end
33
+
27
34
  protected
28
35
 
29
36
  ##
@@ -109,8 +109,8 @@ module Incline
109
109
  end
110
110
 
111
111
  ##
112
- # The begin_external_authentication method takes a request object to determine if it should process authentication or
113
- # return nil. If it decides to process authentication, it should return a URL to redirect to.
112
+ # The begin_external_authentication method takes a request object to determine if it should process a login
113
+ # or return nil. If it decides to process authentication, it should return a URL to redirect to.
114
114
  def begin_external_authentication(request)
115
115
  # We don't have an email domain to work from.
116
116
  # Instead, we'll call each engine's authenticate_external method.
@@ -124,6 +124,22 @@ module Incline
124
124
  nil
125
125
  end
126
126
 
127
+ ##
128
+ # The end_external_authentication method takes a request object to determine if it should process a logout
129
+ # or return nil. If it decides to process authentication, it should return a URL to redirect to.
130
+ def end_external_authentication(request)
131
+ # We don't have an email domain to work from.
132
+ # Instead, we'll call each engine's authenticate_external method.
133
+ # If one of them returns a user, then we return that value and skip further processing.
134
+ auth_engines.each do |dom,engine|
135
+ unless engine.nil?
136
+ url = engine.end_external_authentication(request)
137
+ return url unless url.blank?
138
+ end
139
+ end
140
+ nil
141
+ end
142
+
127
143
  ##
128
144
  # Attempts to authenticate the user and returns the model on success.
129
145
  def self.authenticate(email, password, client_ip)
@@ -131,11 +147,16 @@ module Incline
131
147
  end
132
148
 
133
149
  ##
134
- # The begin_external_authentication method takes a request object to determine if it should process authentication or
135
- # return nil. If it decides to process authentication, it should return a URL to redirect to.
150
+ # Returns a URL if an external login is to be used, or nil to use local authentication.
136
151
  def self.begin_external_authentication(request)
137
152
  default.begin_external_authentication request
138
153
  end
154
+
155
+ ##
156
+ # Returns a URL if an external logout is to be used, or nil to use local authentication.
157
+ def self.end_external_authentication(request)
158
+ default.end_external_authentication request
159
+ end
139
160
 
140
161
  ##
141
162
  # Registers an authentication engine for one or more domains.
@@ -1,3 +1,3 @@
1
1
  module Incline
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: incline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beau Barker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2017-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -604,7 +604,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
604
604
  version: '0'
605
605
  requirements: []
606
606
  rubyforge_project:
607
- rubygems_version: 2.5.2
607
+ rubygems_version: 2.6.11
608
608
  signing_key:
609
609
  specification_version: 4
610
610
  summary: A gem designed to get off to an even quicker start with Rails.