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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1791769530ac6ad399efbb8a26146c17e2348ec9
4
- data.tar.gz: 473b621043f01eddae55661dafce3b46b5c8e379
3
+ metadata.gz: 57e587b52e8f80e7fdc6f5d713195d51e0fae835
4
+ data.tar.gz: d6c01c311c104f827855f3e137a87b930ad935da
5
5
  SHA512:
6
- metadata.gz: 7ee55933a1bc248459885ef1fece175aa70feda72ac7d29027ac580db8be4f882b1a114e63de7a724c3b42b91e0ee84db52362b5cd219da0a5afaaa1780f6cd2
7
- data.tar.gz: e0517f1209e9ee6a9b8a5b4c73ed5daf3542369367d21fcd70e0ccaaaac86515909d48b02a3c5ec9f077d5f0f8f4956ee505e8e7c4a0933baaf4fae00cb169c4
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
- payload do
41
+ token_payload do |opts|
42
+ user = User.find(opts[:resource_owner_id])
43
+
42
44
  {
43
45
  user: {
44
- id: 123,
45
- first_name: "Jane",
46
- last_name: "Doe",
47
- email: "jdoe@example.com"
46
+ id: user.id,
47
+ email: user.email
48
48
  }
49
49
  }
50
50
  end
@@ -4,9 +4,9 @@ require 'jwt'
4
4
 
5
5
  module Doorkeeper
6
6
  module JWT
7
- def self.generate(resource_owner_id)
7
+ def self.generate(opts = {})
8
8
  ::JWT.encode(
9
- token_payload(resource_owner_id),
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(resource_owner_id)
18
- Doorkeeper::JWT.configuration.token_payload.call resource_owner_id
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
@@ -1,5 +1,5 @@
1
1
  module Doorkeeper
2
2
  module JWT
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Warren