mumukit-login 7.2.0 → 7.4.3

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
  SHA256:
3
- metadata.gz: 854e6578d8f00a338d8a83eb3be76e3bdc8640e89e64a77aad1952af176f2678
4
- data.tar.gz: 80f4f529115acada7bb63ab400262ec65bb5a704f1d4d926d80002f261beda83
3
+ metadata.gz: fd902bc892d6881295171b8ddd9502f0ec70da727ade976edb0d399556196f54
4
+ data.tar.gz: 0e82d8fb0dce8e82ed39ddc2793722446a3f2e10c39f6e021bb55a3cd5004470
5
5
  SHA512:
6
- metadata.gz: e6e14eda5004dc72b190246d65f578ef13af64acfa4a84800c4e2f90358d5345dfb786378361f3d542d98a6cb9fb2764f001793cb1ba21e0ce00aea5b78e4594
7
- data.tar.gz: eaa995969c522a907507239a7436dfdd6adadbc81ed8fef07d9200b8ca76c2c45736eccc0137c94666cb32234fe437d33a8949b63d80cdd02f350c2bb20f3314
6
+ metadata.gz: b281525c1d8d326de527da48a88440dd3427c43440b8a8306a22cb9701d741a464e610520143999a87193d928bdf41ba826b384e07e8223da590fc35f6618f57
7
+ data.tar.gz: dd697f2ec90429d7d589d8d5585bdfbd7d2ac46789ec387c961fc381b231fea667c7036fb63eadd8b6e1bbf70f3603dbf0ed860b6c265f12fae3a35b8ca5c3f5
@@ -19,6 +19,7 @@ module Mumukit::Login::LoginControllerHelpers
19
19
 
20
20
  def logout_current_user!
21
21
  destroy_current_user_session!
22
+ login_provider.destroy_session! mumukit_controller
22
23
  origin_redirector.redirect_after_logout!
23
24
  end
24
25
 
@@ -111,3 +111,5 @@ class Mumukit::Login::Mucookie
111
111
  end
112
112
  end
113
113
  end
114
+
115
+ require_relative 'mucookie/store'
@@ -0,0 +1,14 @@
1
+ require 'action_dispatch'
2
+
3
+ class Mumukit::Login::Mucookie::Store < ActionDispatch::Session::CookieStore
4
+ def set_cookie(request, session_id, cookie)
5
+ cookie.merge! same_site: :none if on_embeddable_organization?(request)
6
+ super
7
+ end
8
+
9
+ private
10
+
11
+ def on_embeddable_organization?(request)
12
+ Mumukit::Platform::Organization.find_by_name!(request.cookies['mucookie_login_organization']).embeddable? rescue false
13
+ end
14
+ end
@@ -1,15 +1,25 @@
1
1
  module Mumukit::Login::Profile
2
2
  def self.from_omniauth(omniauth)
3
- struct provider: omniauth.provider,
4
- first_name: omniauth.info.first_name,
5
- last_name: omniauth.info.last_name,
6
- social_id: omniauth.uid,
7
- email: omniauth.info.email,
8
- uid: generate_uid(omniauth),
9
- image_url: omniauth.info.image
3
+ struct profile_hash(omniauth)
4
+ end
5
+
6
+ def self.profile_hash(omniauth)
7
+ {
8
+ provider: omniauth.provider,
9
+ first_name: omniauth.info.first_name,
10
+ last_name: omniauth.info.last_name,
11
+ social_id: omniauth.uid,
12
+ email: omniauth.info.email,
13
+ uid: generate_uid(omniauth),
14
+ image_url: image_url(omniauth.info.image)
15
+ }.compact
16
+ end
17
+
18
+ def self.image_url(url)
19
+ url if url.try { size <= 255 }
10
20
  end
11
21
 
12
22
  def self.generate_uid(omniauth)
13
- omniauth.info.email || omniauth.uid
23
+ Mumukit::Login::Provider.parse_login_provider(omniauth.provider).uid_for_profile(omniauth)
14
24
  end
15
25
  end
@@ -46,7 +46,7 @@ module Mumukit::Login::Provider
46
46
  end
47
47
 
48
48
  def self.parse_login_provider(login_provider)
49
- if enabled_providers.include? login_provider
49
+ if enabled_providers.include?(login_provider.to_s)
50
50
  "Mumukit::Login::Provider::#{login_provider.capitalize}".constantize.new
51
51
  else
52
52
  raise "Unknown login_provider `#{login_provider}`"
@@ -45,6 +45,9 @@ class Mumukit::Login::Provider::Base
45
45
  nil
46
46
  end
47
47
 
48
+ def destroy_session!(_controller)
49
+ end
50
+
48
51
  def setup_proc
49
52
  proc do |env|
50
53
  options = env['omniauth.strategy'].options
@@ -75,6 +78,13 @@ class Mumukit::Login::Provider::Base
75
78
  {}
76
79
  end
77
80
 
81
+ def finalize_user_creation!(_user)
82
+ end
83
+
84
+ def uid_for_profile(omniauth)
85
+ omniauth.info.email || omniauth.uid
86
+ end
87
+
78
88
  private
79
89
 
80
90
  def setup_phase_login_settings(env)
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Login
3
- VERSION = '7.2.0'
3
+ VERSION = '7.4.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-login
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.0
4
+ version: 7.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-11 00:00:00.000000000 Z
11
+ date: 2020-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '12.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '12.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3'
47
+ version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3'
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: codeclimate-test-reporter
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
236
  version: '5.0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: actionpack
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: '5.1'
244
+ type: :runtime
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: '5.1'
237
251
  description:
238
252
  email:
239
253
  - franco@mumuki.org
@@ -257,6 +271,7 @@ files:
257
271
  - lib/mumukit/login/helpers/login_settings_helpers.rb
258
272
  - lib/mumukit/login/helpers/organization_helpers.rb
259
273
  - lib/mumukit/login/mucookie.rb
274
+ - lib/mumukit/login/mucookie/store.rb
260
275
  - lib/mumukit/login/origin_redirector.rb
261
276
  - lib/mumukit/login/profile.rb
262
277
  - lib/mumukit/login/provider.rb
@@ -290,8 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
305
  - !ruby/object:Gem::Version
291
306
  version: '0'
292
307
  requirements: []
293
- rubyforge_project:
294
- rubygems_version: 2.7.7
308
+ rubygems_version: 3.0.8
295
309
  signing_key:
296
310
  specification_version: 4
297
311
  summary: Library for login mumuki requests