mumukit-auth 3.7.0 → 4.0.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/auth/permissions_persistence/daybreak.rb +1 -0
- data/lib/mumukit/auth/token.rb +15 -14
- data/lib/mumukit/auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff4b114d44e8e0f561db33664147f3284c7a174c
|
4
|
+
data.tar.gz: 1e3eafff3f4e11a8282daf91c88e33a7ae66688f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebdd2c656a4d7d7854909bc34cc6042846a64fbf7394062c3c54b6d9f6342707435844cf945089a2475849353e671449761821f244de8a80e577b19ed92230d1
|
7
|
+
data.tar.gz: 063b4d5d45e68f002efd0fe2eaae4c6d753c61268c35332ea845eba0d439230668d1e8f44c33be75186a4d713e0838f445d328b70a1e1b782d8ec7d0b47e19f8
|
data/lib/mumukit/auth/token.rb
CHANGED
@@ -24,34 +24,34 @@ module Mumukit::Auth
|
|
24
24
|
permissions.protect! scope, resource_slug
|
25
25
|
end
|
26
26
|
|
27
|
-
def verify_client!
|
28
|
-
raise Mumukit::Auth::InvalidTokenError.new('aud mismatch') if Mumukit::Auth.config.
|
27
|
+
def verify_client!(client = :auth0)
|
28
|
+
raise Mumukit::Auth::InvalidTokenError.new('aud mismatch') if Mumukit::Auth.config.client_ids[client] != jwt['aud']
|
29
29
|
end
|
30
30
|
|
31
|
-
def encode
|
32
|
-
JWT.encode(jwt, self.class.decoded_secret)
|
31
|
+
def encode(client = :auth0)
|
32
|
+
JWT.encode(jwt, self.class.decoded_secret(client))
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.from_rack_env(env)
|
36
36
|
new(env.dig('omniauth.auth', 'extra', 'raw_info') || {})
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.encode_dummy_auth_header(uid, metadata)
|
40
|
-
'dummy token ' + encode(uid, metadata)
|
39
|
+
def self.encode_dummy_auth_header(uid, metadata, client = :auth0)
|
40
|
+
'dummy token ' + encode(uid, metadata, client)
|
41
41
|
end
|
42
42
|
|
43
|
-
def self.encode(uid, metadata)
|
44
|
-
new(aud: Mumukit::Auth.config.
|
43
|
+
def self.encode(uid, metadata, client = :auth0)
|
44
|
+
new(aud: Mumukit::Auth.config.client_ids[client], metadata: metadata, uid: uid).encode client
|
45
45
|
end
|
46
46
|
|
47
|
-
def self.decode(encoded)
|
48
|
-
Token.new JWT.decode(encoded, decoded_secret)[0]
|
47
|
+
def self.decode(encoded, client = :auth0)
|
48
|
+
Token.new JWT.decode(encoded, decoded_secret(client))[0]
|
49
49
|
rescue JWT::DecodeError => e
|
50
50
|
raise Mumukit::Auth::InvalidTokenError.new(e)
|
51
51
|
end
|
52
52
|
|
53
|
-
def self.decode_header(header)
|
54
|
-
decode extract_from_header
|
53
|
+
def self.decode_header(header, client = :auth0)
|
54
|
+
decode extract_from_header(header), client
|
55
55
|
end
|
56
56
|
|
57
57
|
def self.extract_from_header(header)
|
@@ -59,8 +59,9 @@ module Mumukit::Auth
|
|
59
59
|
header.split(' ').last
|
60
60
|
end
|
61
61
|
|
62
|
-
def self.decoded_secret
|
63
|
-
|
62
|
+
def self.decoded_secret(client = :auth0)
|
63
|
+
client_secret = Mumukit::Auth.config.client_secrets[client]
|
64
|
+
JWT.base64url_decode(client_secret)
|
64
65
|
end
|
65
66
|
end
|
66
67
|
end
|
data/lib/mumukit/auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.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: 2017-01-
|
11
|
+
date: 2017-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|