card-mod-api_key 0.13.1 → 0.14.0

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
  SHA256:
3
- metadata.gz: a0e3b0ab4b54b222a7dc8622dd8ad53913c38628b7380a80c3ae9c4df619d893
4
- data.tar.gz: af7b2172397d7b3b9587af970476f83436c5b5e49b091eac3c70d119a4be8fb7
3
+ metadata.gz: c1abd11fd1b99f97a018512a3a59b1cfa4a593af932df5026142391700a20865
4
+ data.tar.gz: 2388f868561c815f6624d683c7eaeca6de337083acae67051f1044d4df25a64e
5
5
  SHA512:
6
- metadata.gz: 9e610c8a2fc29a2fb4c0abf5116bcb84179bb66ae7165deb89ca169d8b384692b8ca2b846970a83390e02f25db965a8c1d53e709da72b70cfe6fa886a8682d56
7
- data.tar.gz: 8028eca001724402fd1db6ba2936e5ec75d0f01c5650d002dc0d6d7088838e3b477b2c29c893e6065baa52b033b989fbea1964d2cb0e418de57daffab7f9c4a0
6
+ metadata.gz: e3eae28345918820f87ca236f74f7ec0cab18cd33613f4290c9afbdabc260112722cd1beead45a13d27d5ef47b7eadc4e4d0d05c9428816a7a169a545384b542
7
+ data.tar.gz: 74fdc5961f04b96e25dd27fbe645117fbd0abd0848c16660c80fd50011494e6b07e3ecd651dd07a81e00fd38d20b105d76e8908474f9c7db214dcb70676e5687
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  <!--
2
- # @title README - mod: API key
2
+ # @title README - mod: api key
3
3
  -->
4
-
5
- # API key Mod
4
+ # API Key mod
6
5
  Enable Decko users to perform authorized web requests associated with their account
7
6
  without a session.
8
7
 
@@ -0,0 +1,5 @@
1
+ # Adds {Card::Auth::ApiKey} methods to Card::Auth class
2
+
3
+ Card::Auth.extend Card::Auth::ApiKey
4
+
5
+ CardController.include CardController::ApiKey
@@ -30,6 +30,10 @@ class Card
30
30
  def find_account_by_api_key api_key
31
31
  find_account_by :api_key, api_key.strip
32
32
  end
33
+
34
+ def api_act?
35
+ Env.controller&.try(:authenticators)&.values&.compact.present?
36
+ end
33
37
  end
34
38
  end
35
39
  end
@@ -2,6 +2,8 @@ class CardController
2
2
  # add support for passing api key through header using X-API-Key
3
3
  module ApiKey
4
4
  def authenticators
5
+ return {} unless request
6
+
5
7
  super.merge api_key: api_key_from_header || params[:api_key]
6
8
  end
7
9
 
data/locales/de.yml ADDED
@@ -0,0 +1,11 @@
1
+ de:
2
+ api_key_not_found: keineb API-Schlüssel gefunden
3
+ api_key_incorrect: API-Schlüssel stimmt nicht überein
4
+ api_key_invalid: "Ungültiger API-Schlüssel; darf nur 20+ alphanumerische Zeichen enthalten"
5
+ api_key_label: "API-Schlüssel"
6
+ api_key_generate: "API-Schlüssel erzeugen"
7
+ api_key_regenerate: "API-Schlüssel neu erzeugen"
8
+ api_key_generating: "API-Schlüssel wird erzeugt"
9
+ api_key_taken: "API-Schlüssel vergeben"
10
+ api_key_get_jwt_token: "ein JWT-Token abrufen"
11
+ api_key_no_key: "Kein Schlüssel."
data/locales/en.yml ADDED
@@ -0,0 +1,11 @@
1
+ en:
2
+ api_key_not_found: no API key found
3
+ api_key_incorrect: API key mismatch
4
+ api_key_invalid: "Invalid API Key; must contain 20+ alphanumeric characters only"
5
+ api_key_label: "API Key"
6
+ api_key_generate: "Generate API Key"
7
+ api_key_regenerate: "Regenerate API Key"
8
+ api_key_generating: "Generating API Key"
9
+ api_key_taken: "API Key taken"
10
+ api_key_get_jwt_token: "get a JWT token"
11
+ api_key_no_key: "No key."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-api_key
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-08-06 00:00:00.000000000 Z
13
+ date: 2021-12-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.103.1
21
+ version: 1.104.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.103.1
28
+ version: 1.104.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: card-mod-account
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.13.1
35
+ version: 0.14.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.13.1
42
+ version: 0.14.0
43
43
  description: ''
44
44
  email:
45
45
  - info@decko.org
@@ -48,8 +48,11 @@ extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
50
  - README.md
51
+ - init/late/api_key.rb
51
52
  - lib/card/auth/api_key.rb
52
53
  - lib/card_controller/api_key.rb
54
+ - locales/de.yml
55
+ - locales/en.yml
53
56
  - set/right/account.rb
54
57
  - set/right/api_key.rb
55
58
  - set/right/api_key/core.haml
@@ -78,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
81
  - !ruby/object:Gem::Version
79
82
  version: '0'
80
83
  requirements: []
81
- rubygems_version: 3.1.6
84
+ rubygems_version: 3.2.15
82
85
  signing_key:
83
86
  specification_version: 4
84
87
  summary: API Keys and JWT Tokens for Decko