card-mod-api_key 0.11.7 → 0.13.2

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: 177cebf58d053976a834c8b2a101446d362a64a0726763b572f91f76f8a5058b
4
- data.tar.gz: 9e2edc76711515b90d3e113e3f2c81ea1cf12b7af04546113202bc15a6c9fb6c
3
+ metadata.gz: 3b08ecec477698c6c6f48fb42f9e13ac35bfe373427bfff3892d0414b9dc44b5
4
+ data.tar.gz: 1c15dd649ef0ac6ed9c61dfcaef356ec4ce02bf275ec8ac79b48ba4451311eb0
5
5
  SHA512:
6
- metadata.gz: a139f55be0197d88dff841b55e91089a4d2e3afaad59e03a62050a3cabbde4daff963831b36c82cb7ce2ceaf47c4c0a93431f90c66ba18e4038d9cd963c2d21c
7
- data.tar.gz: 171536527a9a7c9a5c217783e49c231f1b9b36254a399026033123a7a65dda0d5cf9fa8a2d6d5d4747fd12886e68ac5dcacfa0ee6bfb15344367a186fd8a3511
6
+ metadata.gz: 42ce8c60e4d1bea0c60b3df24577357c56e73cde7585cb6f9905239fd518e4bfb747d1abd4f69b65b92bb0802603a25546ae8435aeee37986eed3b1f1fb086f6
7
+ data.tar.gz: 311cd016a62676eaaa8f6865abc4a3e7f40531388b064b345fc31b841ce234f53265a3ba2ec24356de49fa83862412c86295408f0df83730af1ef4ac417ebbb8
@@ -1,3 +1,5 @@
1
1
  # Adds {Card::Auth::ApiKey} methods to Card::Auth class
2
2
 
3
3
  Card::Auth.extend Card::Auth::ApiKey
4
+
5
+ CardController.include CardController::ApiKey
@@ -4,11 +4,11 @@ class Card
4
4
  module Auth
5
5
  # methods for setting current account
6
6
  module ApiKey
7
- def signin_with opts={}
8
- if opts[:token]
9
- signin_with_token opts[:token]
10
- elsif opts[:api_key]
11
- signin_with_api_key opts[:api_key]
7
+ def signin_with token: nil, api_key: nil
8
+ if token
9
+ signin_with_token token
10
+ elsif api_key
11
+ signin_with_api_key api_key
12
12
  else
13
13
  signin_with_session
14
14
  end
@@ -0,0 +1,12 @@
1
+ class CardController
2
+ # add support for passing api key through header using X-API-Key
3
+ module ApiKey
4
+ def authenticators
5
+ super.merge api_key: api_key_from_header || params[:api_key]
6
+ end
7
+
8
+ def api_key_from_header
9
+ request.headers["X-API-Key"]
10
+ end
11
+ end
12
+ end
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.11.7
4
+ version: 0.13.2
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-01 00:00:00.000000000 Z
13
+ date: 2021-08-06 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.101.7
21
+ version: 1.103.2
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.101.7
28
+ version: 1.103.2
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.11.7
35
+ version: 0.13.2
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.11.7
42
+ version: 0.13.2
43
43
  description: ''
44
44
  email:
45
45
  - info@decko.org
@@ -48,8 +48,10 @@ extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
50
  - README.md
51
- - config/initializers/api_key.rb
51
+ - init/late/api_key.rb
52
52
  - lib/card/auth/api_key.rb
53
+ - lib/card_controller/api_key.rb
54
+ - locales/en.yml
53
55
  - set/right/account.rb
54
56
  - set/right/api_key.rb
55
57
  - set/right/api_key/core.haml