tinytokenauth-rails 0.1.5 → 0.1.6
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/Gemfile.lock +1 -1
- data/lib/tinytokenauth/json_web_token.rb +22 -0
- data/lib/tinytokenauth/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a51cd8dbe7faddbd28aa43eab713a841bb3ea8b629d4753c949e522e09627048
|
4
|
+
data.tar.gz: 35168279b0cb122da90c5a56502adb804e15f3f05b5bfe96a2a238dd7179ca53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08f62d165b73b1b0e0e9517643b143e708e40600dfdf7bdbbbb1fe4cb6daa02d53c808bac82c5feaef1d3d8a71831ffbbac55f9c08ef0ba80f9e6a6161ae29b2'
|
7
|
+
data.tar.gz: 5cb15b86e8d527860b646155a49f7dc318346f6d96a3a91876c53e6fdf5b9d18b8275661e96aceef537cc01943b868e6837089f325351efd4446fa760cd8212a
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'jwt'
|
2
|
+
|
3
|
+
module Tinytokenauth
|
4
|
+
class JsonWebToken
|
5
|
+
# def self.encode(payload, exp = 24.hours.from_now, secret = Rails.application.credentials.secret_key_base)
|
6
|
+
def self.encode(payload, options = {})
|
7
|
+
exp = options[:exp]
|
8
|
+
secret = options[:secret]
|
9
|
+
puts exp
|
10
|
+
puts exp.to_i
|
11
|
+
puts payload
|
12
|
+
payload[:exp] = exp.to_i
|
13
|
+
JWT.encode(payload, secret)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.decode(token, options = {})
|
17
|
+
secret = options[:secret]
|
18
|
+
decoded = JWT.decode(token, secret)[0]
|
19
|
+
HashWithIndifferentAccess.new decoded
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinytokenauth-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kim Laplume
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/tinytokenauth.rb
|
57
57
|
- lib/tinytokenauth/authorizable.rb
|
58
58
|
- lib/tinytokenauth/configuration.rb
|
59
|
+
- lib/tinytokenauth/json_web_token.rb
|
59
60
|
- lib/tinytokenauth/railtie.rb
|
60
61
|
- lib/tinytokenauth/version.rb
|
61
62
|
- lib/tinytokenauth/view_helpers.rb
|