warden-jwt_auth 0.1.2 → 0.1.3
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/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/warden/jwt_auth/interfaces.rb +3 -3
- data/lib/warden/jwt_auth/payload_user_helper.rb +1 -1
- data/lib/warden/jwt_auth/version.rb +1 -1
- 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: b8ed9c8f6cace7db893ccf8e11bd7833cf5262a2
|
4
|
+
data.tar.gz: 738ae98ee84748294cb7bb63ac484a89e4edaac8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bf76be42a53095676c37beb08a73a060cddfe088fb5f71bc7485291485c20f6c04d156a9a60d6acaaffde833e2c87726a24216ebc4e50d269b577b231bf6241
|
7
|
+
data.tar.gz: ded8bc87a384b3ace04c38506c1ec71cc79a8b816c353f13ff4d904e90183b80a59c87c9aec85bbda2b08baf0c33ffda4f8d150e6d1f437d76f37e5a82cc8e81
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## [0.1.3] - 2017-04-15
|
8
|
+
### Fixed
|
9
|
+
- Coerce `sub` to string to conform with JWT specification
|
10
|
+
|
7
11
|
## [0.1.2] - 2017-04-13
|
8
12
|
### Fixed
|
9
13
|
- Ignore expired tokens on revocation instead of fail
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ module UserRepository
|
|
77
77
|
end
|
78
78
|
```
|
79
79
|
|
80
|
-
User records must implement a `jwt_subject` method returning what should be encoded in the `sub` claim on dispatch time.
|
80
|
+
User records must implement a `jwt_subject` method returning what should be encoded in the `sub` claim on dispatch time. Be aware that what is returned must be coercible to string in order to conform with [RFC7519 standard for `sub` claim](https://tools.ietf.org/html/rfc7519#section-4.1.2).
|
81
81
|
|
82
82
|
```ruby
|
83
83
|
User = Struct.new(:id, :name)
|
@@ -9,7 +9,7 @@ module Warden
|
|
9
9
|
class UserRepository
|
10
10
|
# Finds and returns an [User]
|
11
11
|
#
|
12
|
-
# @param _sub [
|
12
|
+
# @param _sub [String] JWT sub claim
|
13
13
|
# @return [User]
|
14
14
|
def find_for_jwt_authentication(_sub)
|
15
15
|
raise NotImplementedError
|
@@ -18,9 +18,9 @@ module Warden
|
|
18
18
|
|
19
19
|
# An user
|
20
20
|
class User
|
21
|
-
# What will be encoded as `sub` claim
|
21
|
+
# What will be encoded as `sub` claim. It must respond to `#to_s`.
|
22
22
|
#
|
23
|
-
# @return [
|
23
|
+
# @return [#to_s] `sub` claim
|
24
24
|
def jwt_subject
|
25
25
|
raise NotImplementedError
|
26
26
|
end
|
@@ -30,7 +30,7 @@ module Warden
|
|
30
30
|
# :reek:ManualDispatch
|
31
31
|
def self.payload_for_user(user, scope)
|
32
32
|
sub = user.jwt_subject
|
33
|
-
payload = { 'sub' => sub, 'scp' => scope.to_s }
|
33
|
+
payload = { 'sub' => String(sub), 'scp' => scope.to_s }
|
34
34
|
return payload unless user.respond_to?(:jwt_payload)
|
35
35
|
user.jwt_payload.merge(payload)
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warden-jwt_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Busqué
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|