challah-jwt 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/challah/jwt/tokenizer.rb +5 -1
- data/lib/challah/jwt/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24a7006305ca4a2c167a60fe9cff8b48c4e355fc
|
4
|
+
data.tar.gz: 0013cd81f2cc458f3d79c84fa7e1afb962c26728
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e14e19ba9ac251374dbc2e8fba9d47eee81c62f7372bff91c5bdf6a58b4cbaa733669a4a2cdc7648f29ab70e4732378d46b88b8dbd07e679c4f9b9b25d9dbb8c
|
7
|
+
data.tar.gz: 5b3926ca3ac358743da052888d14bed18ab9a0883f0123017c7d47dbc678103c85e7f4d607bb7ea6ff9395797bf1ce1b8a44494fd26cd01f908aeddaa3165e07
|
@@ -10,7 +10,7 @@ module Challah
|
|
10
10
|
payload = ::JWT.decode(token, Challah::Jwt.secret_key)
|
11
11
|
id = payload.dig(0, jwt_root, "id")
|
12
12
|
|
13
|
-
if Challah::Jwt.configuration.use_api_key
|
13
|
+
if Challah::Jwt.configuration.use_api_key && column_names.include?("api_key")
|
14
14
|
api_key = payload.dig(0, jwt_root, "api_key")
|
15
15
|
find_by(id: id, api_key: api_key)
|
16
16
|
else
|
@@ -20,6 +20,10 @@ module Challah
|
|
20
20
|
nil
|
21
21
|
end
|
22
22
|
|
23
|
+
def find_by_jwt!(token)
|
24
|
+
find_by_jwt(token) or raise ActiveRecord::RecordNotFound.new("Couldn't find #{self.name} with [jwt=#{token.to_s.truncate(25)}]")
|
25
|
+
end
|
26
|
+
|
23
27
|
def jwt_root
|
24
28
|
model_name.singular
|
25
29
|
end
|
data/lib/challah/jwt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: challah-jwt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phillip Ridlen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: challah
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.6.8
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Use JSON Web Tokens (JWT) to authenticate with Challah
|