azure_jwt_auth 0.1.1 → 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/lib/azure_jwt_auth/jwt_manager.rb +13 -10
- data/lib/azure_jwt_auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 669372be8a4bd023f45dd4a365a67ad05617d6cc6f9a04602c991acd50ef00dc
|
|
4
|
+
data.tar.gz: b4c7376361a1bd94e70df695ea1495af847c927761c3b58fd44dc0970681f655
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d05c977588d65da4411c95eb166c7789d5f1c9a39aaf8d949977d204b493fcf529daf8f896001d4fc4adffc25535985eb5688b37bf708973febc63033a2b6640
|
|
7
|
+
data.tar.gz: 1a82da154c632e9919dbadf9e5bf48a080f7ac3739e3f71f1e508dc547ed753c5ca499fdef8c5ed2c09ed94e4c218bb57f39bc5edba94df13c7f77f0d77ef6cc
|
|
@@ -22,16 +22,20 @@ module AzureJwtAuth
|
|
|
22
22
|
raise ProviderNotFound unless (@provider = self.class.find_provider(provider_id))
|
|
23
23
|
|
|
24
24
|
@jwt = request.env['HTTP_AUTHORIZATION'].split.last # remove Bearer
|
|
25
|
-
@jwt_info = decode
|
|
25
|
+
@jwt_info = JWT.decode(@jwt, nil, false)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def payload
|
|
29
29
|
@jwt_info ? @jwt_info.first : nil
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
def header
|
|
33
|
+
@jwt_info ? @jwt_info.last : nil
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Validates issuer
|
|
37
|
+
def iss_valid?
|
|
38
|
+
payload['iss'] == @provider.config['issuer']
|
|
35
39
|
end
|
|
36
40
|
|
|
37
41
|
# Check custom validations defined into provider
|
|
@@ -43,17 +47,16 @@ module AzureJwtAuth
|
|
|
43
47
|
true
|
|
44
48
|
end
|
|
45
49
|
|
|
46
|
-
# Validates
|
|
47
|
-
def
|
|
48
|
-
payload
|
|
50
|
+
# Validates the payload hash for expiration and meta claims
|
|
51
|
+
def valid?
|
|
52
|
+
payload && iss_valid? && custom_valid? && rsa_decode
|
|
49
53
|
end
|
|
50
54
|
|
|
51
55
|
private
|
|
52
56
|
|
|
53
57
|
# Decodes the JWT with the signed secret
|
|
54
|
-
def
|
|
55
|
-
|
|
56
|
-
kid = dirty_token.last['kid']
|
|
58
|
+
def rsa_decode
|
|
59
|
+
kid = header['kid']
|
|
57
60
|
try = false
|
|
58
61
|
|
|
59
62
|
begin
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: azure_jwt_auth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- rjurado
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-04-
|
|
11
|
+
date: 2018-04-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bcrypt
|