mumukit-login 7.0.0 → 7.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/login/helpers/login_controller_helpers.rb +2 -1
- data/lib/mumukit/login/mucookie.rb +36 -9
- data/lib/mumukit/login/mucookie/store.rb +14 -0
- data/lib/mumukit/login/profile.rb +14 -8
- data/lib/mumukit/login/provider/base.rb +7 -1
- data/lib/mumukit/login/version.rb +1 -1
- metadata +26 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be2628bd7ab69e312b2259b3c26d75b37bde248e7d3105760605b366d5b27564
|
4
|
+
data.tar.gz: b4efe8b1d0cb3fc93dfe9b77bfa12efebf1966e31f24f14f51dfeb86160d2732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f296c251632dbb75996eed92312b26433eaab8bfafcf30da0990fb64d4e610b263b4fd11efac5dd6e9f66e9022a5c86bd84d524e41ac08b0d0a81aeb8cab3548
|
7
|
+
data.tar.gz: d242c667ab85d70254514ea418322544580a229c9e3f1587122d9fae8a1dcf7213565a7166bfb616a18fbebdd89f8c969496293150724e070da0e0dbe5551a45
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Mumukit::Login::LoginControllerHelpers
|
2
2
|
|
3
3
|
def login_current_user!
|
4
|
-
mumukit_controller.
|
4
|
+
mumukit_controller.mucookie.write!(:login_organization, organization_name)
|
5
5
|
origin_redirector.save_after_login_location!
|
6
6
|
if current_user?
|
7
7
|
origin_redirector.redirect_after_login!
|
@@ -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
|
|
@@ -6,10 +6,10 @@ class Mumukit::Login::Mucookie
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def write!(key, value, options={})
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
do_write! cookie_name(key),
|
10
|
+
spec.merge(
|
11
|
+
value: value.to_s,
|
12
|
+
httponly: !!options[:httponly])
|
13
13
|
end
|
14
14
|
|
15
15
|
def encrypt_and_write!(key, value, options={})
|
@@ -21,7 +21,7 @@ class Mumukit::Login::Mucookie
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def read(key)
|
24
|
-
|
24
|
+
do_read!(cookie_name(key))
|
25
25
|
end
|
26
26
|
|
27
27
|
def decrypt_and_read(key)
|
@@ -33,17 +33,43 @@ class Mumukit::Login::Mucookie
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def delete!(key)
|
36
|
-
|
36
|
+
do_delete! cookie_name(key), Mumukit::Login.config.mucookie_domain
|
37
37
|
end
|
38
38
|
|
39
39
|
def spec
|
40
|
-
{
|
40
|
+
{
|
41
|
+
path: '/',
|
41
42
|
expires: Mumukit::Login.config.mucookie_duration.days.since,
|
42
|
-
domain: Mumukit::Login.config.mucookie_domain
|
43
|
+
domain: Mumukit::Login.config.mucookie_domain
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.cookie_same_site
|
48
|
+
if %w(RACK_ENV RAILS_ENV).any? { |it| ENV[it] == 'production' }
|
49
|
+
:none
|
50
|
+
else
|
51
|
+
:lax
|
52
|
+
end
|
43
53
|
end
|
44
54
|
|
45
55
|
private
|
46
56
|
|
57
|
+
# Support for legacy browsers
|
58
|
+
# Duplicate write / read / delete cookies without samesite for old browsers that do not allow for SameSite=None attribute
|
59
|
+
def do_write!(cookie_name, spec)
|
60
|
+
@controller.write_cookie! cookie_name, spec.merge(same_site: self.class.cookie_same_site)
|
61
|
+
@controller.write_cookie! "#{cookie_name}_legacy", spec
|
62
|
+
end
|
63
|
+
|
64
|
+
def do_delete!(cookie_name, domain)
|
65
|
+
@controller.delete_cookie! cookie_name, domain
|
66
|
+
@controller.delete_cookie! "#{cookie_name}_legacy", domain
|
67
|
+
end
|
68
|
+
|
69
|
+
def do_read!(cookie_name)
|
70
|
+
@controller.read_cookie(cookie_name) || @controller.read_cookie("#{cookie_name}_legacy")
|
71
|
+
end
|
72
|
+
|
47
73
|
def cookie_name(key)
|
48
74
|
"mucookie_#{key}"
|
49
75
|
end
|
@@ -84,5 +110,6 @@ class Mumukit::Login::Mucookie
|
|
84
110
|
value.try { |it| encryptor.decrypt_and_verify it }
|
85
111
|
end
|
86
112
|
end
|
87
|
-
|
88
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,21 @@
|
|
1
1
|
module Mumukit::Login::Profile
|
2
2
|
def self.from_omniauth(omniauth)
|
3
|
-
struct
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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: omniauth.info.image
|
15
|
+
}.compact
|
10
16
|
end
|
11
17
|
|
12
18
|
def self.generate_uid(omniauth)
|
13
|
-
omniauth.
|
19
|
+
omniauth.uid || omniauth.info.email
|
14
20
|
end
|
15
21
|
end
|
@@ -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,9 @@ class Mumukit::Login::Provider::Base
|
|
75
78
|
{}
|
76
79
|
end
|
77
80
|
|
81
|
+
def finalize_user_creation!(_user)
|
82
|
+
end
|
83
|
+
|
78
84
|
private
|
79
85
|
|
80
86
|
def setup_phase_login_settings(env)
|
@@ -82,7 +88,7 @@ class Mumukit::Login::Provider::Base
|
|
82
88
|
end
|
83
89
|
|
84
90
|
def setup_phase_login_organization_name(env)
|
85
|
-
Rack::Request.new(env).cookies['
|
91
|
+
Rack::Request.new(env).cookies['mucookie_login_organization']
|
86
92
|
end
|
87
93
|
|
88
94
|
def organization_login_settings_for(name)
|
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.
|
4
|
+
version: 7.4.0
|
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:
|
11
|
+
date: 2020-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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: '
|
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
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1
|
89
|
+
version: '2.1'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1
|
96
|
+
version: '2.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: jwt
|
99
99
|
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,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
305
|
- !ruby/object:Gem::Version
|
291
306
|
version: '0'
|
292
307
|
requirements: []
|
293
|
-
rubygems_version: 3.0.
|
308
|
+
rubygems_version: 3.0.8
|
294
309
|
signing_key:
|
295
310
|
specification_version: 4
|
296
311
|
summary: Library for login mumuki requests
|