graphql-auth 0.1.1 → 0.1.2
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/graphql-auth/jwt_manager.rb +8 -6
- data/lib/graphql-auth/reset_password.rb +0 -2
- data/lib/graphql-auth.rb +1 -0
- 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: 79461c41709c7d56994651702a94ee154dd0bc20
|
|
4
|
+
data.tar.gz: b6239eef62073916eda2bccbc61be0b9f6f283b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6a68be89825e75ac22efbfa606e2fd4bc1c23b1f786d70c4d1e5161917a1807ab963d33ed654315714ad6885ff433cdcceef898bd1bdda22aa6383bb0a9b334
|
|
7
|
+
data.tar.gz: 97c97beb3238267fdb598b5ef5ffc304b901626b0fd61a3f0f5e54a56c1198e96a6d2429b8441c94671b3f9d555757ba63a767a659a271df6e9c7890f2f6c3bb
|
|
@@ -6,15 +6,17 @@ module GraphQL
|
|
|
6
6
|
class JwtManager
|
|
7
7
|
ALGORITHM = 'HS256'
|
|
8
8
|
TYPE = 'Bearer'
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
class << self
|
|
11
|
-
def issue(payload)
|
|
12
|
-
|
|
11
|
+
def issue(payload, set_expiration = true)
|
|
12
|
+
payload.merge!(expiration) if set_expiration.present?
|
|
13
|
+
|
|
14
|
+
token = JWT.encode payload,
|
|
13
15
|
auth_secret,
|
|
14
16
|
ALGORITHM
|
|
15
17
|
set_type token
|
|
16
18
|
end
|
|
17
|
-
|
|
19
|
+
|
|
18
20
|
def decode(token)
|
|
19
21
|
token = extract_token token
|
|
20
22
|
decrypted_token = JWT.decode token,
|
|
@@ -25,7 +27,7 @@ module GraphQL
|
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
private
|
|
28
|
-
|
|
30
|
+
|
|
29
31
|
def auth_secret
|
|
30
32
|
GraphQL::Auth.configuration.jwt_secret_key
|
|
31
33
|
end
|
|
@@ -37,7 +39,7 @@ module GraphQL
|
|
|
37
39
|
def extract_token(token)
|
|
38
40
|
token.gsub "#{TYPE} ", ''
|
|
39
41
|
end
|
|
40
|
-
|
|
42
|
+
|
|
41
43
|
def expiration
|
|
42
44
|
exp = Time.now.to_i + GraphQL::Auth.configuration.token_lifespan
|
|
43
45
|
{ exp: exp }
|
data/lib/graphql-auth.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphql-auth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Guillaume Ferland
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-11-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|