foobara-auth 0.0.10 → 0.0.11
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/src/authenticate_with_api_key.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39a1c84b35482f06f620033be6d576030c4de3b6d440ecc8d4ecaba90c2cf126
|
4
|
+
data.tar.gz: daa37fb14dfcd8be6fc50e9f356f0209fb8a78ee73e741157507f4c700f464af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b90d812a7a6f459a097ebd8602848ab81bab0dfc16f1dbaaa009c3be71aefa5f6c078f167b648333092ae8072f2d8545dd44937d40e12f81f70438a65df36da
|
7
|
+
data.tar.gz: 2e7ad097761cd1831bc58762e78e523bd8d50507758f922d34fb4ed2a0b8474fb3d4f77c4bd8993a8c7db6b05d0bc8e6b4f4fef9435fb25fb2a1ed84c6b8d649
|
data/CHANGELOG.md
CHANGED
@@ -4,10 +4,15 @@ module Foobara
|
|
4
4
|
module Auth
|
5
5
|
class AuthenticateWithApiKey < Foobara::Command
|
6
6
|
class InvalidApiKeyError < Foobara::RuntimeError
|
7
|
-
context
|
7
|
+
context({})
|
8
8
|
message "Invalid api key"
|
9
9
|
end
|
10
10
|
|
11
|
+
class ApiKeyDoesNotExistError < Foobara::RuntimeError
|
12
|
+
context({})
|
13
|
+
message "No such key"
|
14
|
+
end
|
15
|
+
|
11
16
|
depends_on VerifyToken
|
12
17
|
depends_on_entities Types::Token
|
13
18
|
|
@@ -37,13 +42,15 @@ module Foobara
|
|
37
42
|
|
38
43
|
def load_api_key_record
|
39
44
|
self.api_key_record = Types::Token.load(api_key_id)
|
45
|
+
rescue Foobara::Entity::NotFoundError
|
46
|
+
add_runtime_error(ApiKeyDoesNotExistError)
|
40
47
|
end
|
41
48
|
|
42
49
|
def verify_api_key
|
43
50
|
valid = run_subcommand!(VerifyToken, token_string: api_key)
|
44
51
|
|
45
52
|
unless valid[:verified]
|
46
|
-
add_runtime_error(InvalidApiKeyError
|
53
|
+
add_runtime_error(InvalidApiKeyError)
|
47
54
|
end
|
48
55
|
end
|
49
56
|
|