doorkeeper-jwt 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/doorkeeper-jwt.rb +4 -4
- data/lib/doorkeeper-jwt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57e587b52e8f80e7fdc6f5d713195d51e0fae835
|
4
|
+
data.tar.gz: d6c01c311c104f827855f3e137a87b930ad935da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d08963c4cfad7776688c1bd972e2b07fa16f20646ef38277b9fab95a39aa54bc2c7655d05bcd8d40f46ed0453237ec8b2e4eb1637f7911e9edaed7b84d7422
|
7
|
+
data.tar.gz: 37a3e4f8b16cdd78ddfc466f3115b54818f857fbe8d5ee34136945f118a036ee8cb0ddeb4b5a92351f3fb844f38084e40d9cd4d44e33f9a3cb7e6bff03a84a1c
|
data/README.md
CHANGED
@@ -38,13 +38,13 @@ Doorkeeper::JWT.configure do
|
|
38
38
|
# about the user.
|
39
39
|
# Defaults to a randomly generated token in a hash
|
40
40
|
# { token: "RANDOM-TOKEN" }
|
41
|
-
|
41
|
+
token_payload do |opts|
|
42
|
+
user = User.find(opts[:resource_owner_id])
|
43
|
+
|
42
44
|
{
|
43
45
|
user: {
|
44
|
-
id:
|
45
|
-
|
46
|
-
last_name: "Doe",
|
47
|
-
email: "jdoe@example.com"
|
46
|
+
id: user.id,
|
47
|
+
email: user.email
|
48
48
|
}
|
49
49
|
}
|
50
50
|
end
|
data/lib/doorkeeper-jwt.rb
CHANGED
@@ -4,9 +4,9 @@ require 'jwt'
|
|
4
4
|
|
5
5
|
module Doorkeeper
|
6
6
|
module JWT
|
7
|
-
def self.generate(
|
7
|
+
def self.generate(opts = {})
|
8
8
|
::JWT.encode(
|
9
|
-
token_payload(
|
9
|
+
token_payload(opts),
|
10
10
|
secret_key,
|
11
11
|
encryption_method
|
12
12
|
)
|
@@ -14,8 +14,8 @@ module Doorkeeper
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def self.token_payload(
|
18
|
-
Doorkeeper::JWT.configuration.token_payload.call
|
17
|
+
def self.token_payload(opts = {})
|
18
|
+
Doorkeeper::JWT.configuration.token_payload.call opts
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.secret_key
|