artemis-api_auth 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +230 -0
- data/.rubocop_todo.yml +48 -0
- data/.travis.yml +14 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +68 -0
- data/Rakefile +11 -0
- data/artemis-api_auth.gemspec +35 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/artemis/adapters/net_http_hmac_adapter.rb +45 -0
- data/lib/artemis/api_auth.rb +1 -0
- data/lib/artemis/api_auth/version.rb +5 -0
- metadata +186 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 251b9fd8afef48a76067b72e91b28fc7f883c0980d0d9fccbc8d318a3526e1b9
|
4
|
+
data.tar.gz: d94e64aa94427ced062f2f9f4ace9b1c5a99959bd4080f883bd0a958276dfb51
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a13498d96c834c6e7fe835e593ac07d052479fbcfb77e74f6a7a35a504d9a5d4a8fa90122bbc248409da2d32bdc463231f88e615c485bb5eba16f64ff383f09b
|
7
|
+
data.tar.gz: f1dc59710b594c79d896d5cc1471496f4dd22622264a7252760ab0132570abdf71f1931a1f5f8c507f46218587e164b6af7bd7fa80e79f112d6a85ed5f072dac
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,230 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
require: rubocop-rspec
|
3
|
+
|
4
|
+
# RSpec is a big DSL so ignore this in specs
|
5
|
+
Metrics/BlockLength:
|
6
|
+
Exclude:
|
7
|
+
- 'spec/**/*.rb'
|
8
|
+
|
9
|
+
# -----------------------------------------------------------------------------
|
10
|
+
# Style / Layout
|
11
|
+
# -----------------------------------------------------------------------------
|
12
|
+
|
13
|
+
# All our files should be UTF-8
|
14
|
+
Style/Encoding:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
# Don't require the frozen string comment, later versions of ruby will do this by default
|
18
|
+
Style/FrozenStringLiteralComment:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
# Go for consitent instead of all the other wierd setups
|
22
|
+
Layout/IndentHash:
|
23
|
+
EnforcedStyle: consistent
|
24
|
+
|
25
|
+
Layout/IndentArray:
|
26
|
+
EnforcedStyle: consistent
|
27
|
+
|
28
|
+
# Spacing it out is more work then just letting it be, so lets let it be
|
29
|
+
Layout/AlignArray:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
# We always want key style
|
33
|
+
Layout/AlignHash:
|
34
|
+
EnforcedColonStyle: key
|
35
|
+
EnforcedHashRocketStyle: key
|
36
|
+
EnforcedLastArgumentHashStyle: always_ignore
|
37
|
+
|
38
|
+
# We want to go for consitency and nothing fancy really, the style is quite simple
|
39
|
+
# just indent with 2 tabs always. This means we have to disable all the rubocops
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# method(has: 'value',
|
43
|
+
# key: 'value',
|
44
|
+
# )
|
45
|
+
#
|
46
|
+
Layout/AlignParameters:
|
47
|
+
EnforcedStyle: with_fixed_indentation
|
48
|
+
|
49
|
+
Layout/MultilineMethodCallIndentation:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Layout/MultilineMethodCallBraceLayout:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Layout/MultilineHashBraceLayout:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Layout/MultilineArrayBraceLayout:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
Layout/MultilineOperationIndentation:
|
62
|
+
Enabled: true
|
63
|
+
EnforcedStyle: indented
|
64
|
+
|
65
|
+
Layout/EmptyLineAfterGuardClause:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
Layout/RescueEnsureAlignment:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
####
|
72
|
+
|
73
|
+
# Enforces if / else / end to always use 2 identations, even when assigned
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
# variable = if cookies
|
77
|
+
# 'eat'
|
78
|
+
# else
|
79
|
+
# 'cry'
|
80
|
+
# end
|
81
|
+
#
|
82
|
+
Layout/CaseIndentation:
|
83
|
+
Enabled: true
|
84
|
+
EnforcedStyle: end
|
85
|
+
|
86
|
+
Layout/EndAlignment:
|
87
|
+
Enabled: true
|
88
|
+
EnforcedStyleAlignWith: variable
|
89
|
+
|
90
|
+
# Only require braces when there might be possible confusion on what is a hsahs and what not
|
91
|
+
Style/BracesAroundHashParameters:
|
92
|
+
Enabled: true
|
93
|
+
EnforcedStyle: context_dependent
|
94
|
+
|
95
|
+
# We prefere alias_method
|
96
|
+
# ref: http://blog.bigbinary.com/2012/01/08/alias-vs-alias-method.html
|
97
|
+
Style/Alias:
|
98
|
+
Enabled: true
|
99
|
+
EnforcedStyle: prefer_alias_method
|
100
|
+
|
101
|
+
# Prefere do..end when you have more then 2 lines in a block
|
102
|
+
Style/BlockDelimiters:
|
103
|
+
Enabled: true
|
104
|
+
EnforcedStyle: line_count_based
|
105
|
+
|
106
|
+
# With rails being very picky on eager loading we disable this,
|
107
|
+
# I also see no benefit and it really depends on the readability of the code
|
108
|
+
Style/ClassAndModuleChildren:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
# Don't bitch about documentation
|
112
|
+
Style/Documentation:
|
113
|
+
Enabled: false
|
114
|
+
|
115
|
+
# I do see it an anti pattern but ruby just misses a boolean class imoh
|
116
|
+
Style/DoubleNegation:
|
117
|
+
Enabled: false
|
118
|
+
|
119
|
+
# extend self != module_function, extend self has its useful cases
|
120
|
+
Style/ModuleFunction:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
# `inject` and `reduce` can make more sense and are more readable, shorter
|
124
|
+
# to type, for this reason I don't like to enforce this at all.
|
125
|
+
Style/EachWithObject:
|
126
|
+
Enabled: false
|
127
|
+
|
128
|
+
# When you have an empty method we don't want it to become a oneliner with a ;
|
129
|
+
# That looks ugly and just reminds me of PHP days I don't want to go to
|
130
|
+
Style/EmptyMethod:
|
131
|
+
Enabled: true
|
132
|
+
EnforcedStyle: expanded
|
133
|
+
|
134
|
+
# Don't care about how we formated strings
|
135
|
+
Style/FormatString:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
# We hate hash rockets, shoot to the moon
|
139
|
+
Style/HashSyntax:
|
140
|
+
Enabled: true
|
141
|
+
EnforcedStyle: ruby19
|
142
|
+
|
143
|
+
# Sometimes it is more readble and easier to understand, enforcing is a step to far
|
144
|
+
Style/GuardClause:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
# We like the short lambda syntax
|
148
|
+
Style/Lambda:
|
149
|
+
Enabled: true
|
150
|
+
EnforcedStyle: literal
|
151
|
+
|
152
|
+
# I don't see an issue with having a multiline and if statement at the end
|
153
|
+
Style/MultilineIfModifier:
|
154
|
+
Enabled: false
|
155
|
+
|
156
|
+
# We prefere next instead of an if inside loops, exclude the 2 workers since they
|
157
|
+
# rely on checking busy workers in sidekiq
|
158
|
+
Style/Next:
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
# Those predicates are confusing, it takes longer to read a word then to pattern match
|
162
|
+
Style/NumericPredicate:
|
163
|
+
Enabled: true
|
164
|
+
EnforcedStyle: comparison
|
165
|
+
|
166
|
+
Style/ZeroLengthPredicate:
|
167
|
+
Enabled: false
|
168
|
+
|
169
|
+
Naming/PredicateName:
|
170
|
+
Enabled: false
|
171
|
+
|
172
|
+
# We don't care about regex printing
|
173
|
+
Style/RegexpLiteral:
|
174
|
+
Enabled: false
|
175
|
+
|
176
|
+
# Do not care about single or double quotes, thats just annoying
|
177
|
+
Style/StringLiterals:
|
178
|
+
Enabled: false
|
179
|
+
|
180
|
+
# No preference, can be handy or not but certainly dont nag about it
|
181
|
+
Style/TrailingCommaInArguments:
|
182
|
+
Enabled: false
|
183
|
+
|
184
|
+
Style/TrailingCommaInArrayLiteral:
|
185
|
+
Enabled: false
|
186
|
+
|
187
|
+
Style/TrailingCommaInHashLiteral:
|
188
|
+
Enabled: false
|
189
|
+
|
190
|
+
# Don't care how we use variable names with numbers
|
191
|
+
Naming/VariableNumber:
|
192
|
+
Enabled: false
|
193
|
+
|
194
|
+
# Allow f as a name since its just a lot for forms
|
195
|
+
Naming/UncommunicativeMethodParamName:
|
196
|
+
AllowedNames:
|
197
|
+
- _
|
198
|
+
|
199
|
+
# Enforce different brackets when we allow interpolating
|
200
|
+
Style/PercentLiteralDelimiters:
|
201
|
+
PreferredDelimiters:
|
202
|
+
default: ()
|
203
|
+
'%i': '()'
|
204
|
+
'%I': '[]'
|
205
|
+
'%r': '{}'
|
206
|
+
'%w': '()'
|
207
|
+
'%W': '[]'
|
208
|
+
|
209
|
+
# Enfirce a symbol array if you have more then 5 items in it
|
210
|
+
Style/SymbolArray:
|
211
|
+
Enabled: true
|
212
|
+
MinSize: 5
|
213
|
+
|
214
|
+
Style/WordArray:
|
215
|
+
Enabled: true
|
216
|
+
MinSize: 5
|
217
|
+
|
218
|
+
# Do not place comments on the same line as certain keywords. (eg def / end)
|
219
|
+
Style/CommentedKeyword:
|
220
|
+
Enabled: false
|
221
|
+
|
222
|
+
Layout/EmptyLinesAroundArguments:
|
223
|
+
Enabled: false
|
224
|
+
|
225
|
+
# Not using rails or fixtures so this can be ignored
|
226
|
+
RSpec/BeforeAfterAll:
|
227
|
+
Enabled: false
|
228
|
+
|
229
|
+
RSpec/MessageSpies:
|
230
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2019-02-26 12:04:46 +0100 using RuboCop version 0.65.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
Lint/HandleExceptions:
|
11
|
+
Exclude:
|
12
|
+
- 'spec/artemis/adapters/net_http_hmac_adapter_spec.rb'
|
13
|
+
|
14
|
+
# Offense count: 1
|
15
|
+
Metrics/AbcSize:
|
16
|
+
Max: 33
|
17
|
+
|
18
|
+
# Offense count: 1
|
19
|
+
Metrics/CyclomaticComplexity:
|
20
|
+
Max: 7
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
24
|
+
Metrics/MethodLength:
|
25
|
+
Max: 20
|
26
|
+
|
27
|
+
# Offense count: 1
|
28
|
+
# Configuration parameters: Max.
|
29
|
+
RSpec/ExampleLength:
|
30
|
+
Exclude:
|
31
|
+
- 'spec/artemis/adapters/net_http_hmac_adapter_spec.rb'
|
32
|
+
|
33
|
+
# Offense count: 1
|
34
|
+
# Configuration parameters: AssignmentOnly.
|
35
|
+
RSpec/InstanceVariable:
|
36
|
+
Exclude:
|
37
|
+
- 'spec/artemis/adapters/net_http_hmac_adapter_spec.rb'
|
38
|
+
|
39
|
+
# Offense count: 1
|
40
|
+
# Configuration parameters: AggregateFailuresByDefault.
|
41
|
+
RSpec/MultipleExpectations:
|
42
|
+
Max: 6
|
43
|
+
|
44
|
+
# Offense count: 17
|
45
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
46
|
+
# URISchemes: http, https
|
47
|
+
Metrics/LineLength:
|
48
|
+
Max: 123
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Jan Stevens
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Artemis ApiAuth
|
2
|
+
[![Build Status](https://travis-ci.org/JanStevens/artemis-api-auth.svg?branch=master)](https://travis-ci.org/JanStevens/artemis-api-auth)
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/github/JanStevens/artemis-api-auth/badge.svg?branch=master)](https://coveralls.io/github/JanStevens/artemis-api-auth?branch=master)
|
4
|
+
|
5
|
+
This gem provides a new Adapter for the [Artemis](https://github.com/yuki24/artemis) GraphQL ruby client to support HMAC Authentication
|
6
|
+
using [ApiAuth](https://github.com/mgomes/api_auth)
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'artemis-api_auth'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install artemis-api-auth-adapter
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
After following the installation instruction of Artemis, update your `config/graphql.yml` to use the new `net_http_hmac` adapter
|
27
|
+
|
28
|
+
```yaml
|
29
|
+
default: &default
|
30
|
+
# The underlying client library that actually makes an HTTP request.
|
31
|
+
# Available adapters are :net_http, :net_http_persistent, :curb, and :test.
|
32
|
+
#
|
33
|
+
# It is set to :net_http by default.
|
34
|
+
adapter: :net_http_hmac
|
35
|
+
```
|
36
|
+
|
37
|
+
You can configure ApiAuth by setting the `default_context` in your Artemis client
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
class Artsy < Artemis::Client
|
41
|
+
# Set the default context for HMAC authentication from the secrets
|
42
|
+
# This will be used in our Net HTTP HMAC adapter
|
43
|
+
# @see {Artemis::Adapters::NetHttpHmacAdapter}
|
44
|
+
self.default_context = {
|
45
|
+
api_auth: {
|
46
|
+
access_id: '1',
|
47
|
+
secret_key: 'very-secret-hmac-api-key',
|
48
|
+
# optional
|
49
|
+
digest: 'sha256', # default since more secure
|
50
|
+
override_http_method: 'POST' # default: nil
|
51
|
+
}
|
52
|
+
}
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
## Development
|
57
|
+
|
58
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
59
|
+
|
60
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/JanStevens/artemis-api-auth
|
65
|
+
|
66
|
+
## License
|
67
|
+
|
68
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'artemis/api_auth/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'artemis-api_auth'
|
7
|
+
spec.version = Artemis::ApiAuth::VERSION
|
8
|
+
spec.authors = ['Jan Stevens']
|
9
|
+
spec.email = ['jan@playpass.be']
|
10
|
+
|
11
|
+
spec.summary = 'Net::HTTP adapter that adds Api Auth authentication for Artemis GraphQL Client'
|
12
|
+
spec.description = 'Net::HTTP adapter that adds Api Auth authentication for Artemis GraphQL Client'
|
13
|
+
spec.homepage = 'https://github.com/JanStevens/artemis-api-auth'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_dependency 'api-auth', '< 3'
|
26
|
+
spec.add_dependency 'artemis', '< 1'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
29
|
+
spec.add_development_dependency 'coveralls'
|
30
|
+
spec.add_development_dependency 'rack'
|
31
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
|
+
spec.add_development_dependency 'rubocop'
|
34
|
+
spec.add_development_dependency 'rubocop-rspec'
|
35
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'artemis/api/auth/adapter'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
module Artemis
|
2
|
+
module Adapters
|
3
|
+
# We overwrite execute so we can sign the request with HMAC
|
4
|
+
class NetHttpHmacAdapter < Artemis::Adapters::NetHttpAdapter
|
5
|
+
# Makes an HTTP request for GraphQL query.
|
6
|
+
def execute(document:, operation_name: nil, variables: {}, context: {})
|
7
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
8
|
+
request.basic_auth(uri.user, uri.password) if uri.user || uri.password
|
9
|
+
|
10
|
+
request['Accept'] = 'application/json'
|
11
|
+
request['Content-Type'] = 'application/json'
|
12
|
+
headers(context).each { |name, value| request[name] = value }
|
13
|
+
|
14
|
+
body = {}
|
15
|
+
body['query'] = document.to_query_string
|
16
|
+
body['variables'] = variables if variables.any?
|
17
|
+
body['operationName'] = operation_name if operation_name
|
18
|
+
request.body = JSON.generate(body)
|
19
|
+
|
20
|
+
# Only changes are in here
|
21
|
+
signed_request = api_auth_sign_request!(request, context.fetch(:api_auth))
|
22
|
+
response = connection.request(signed_request)
|
23
|
+
|
24
|
+
case response.code.to_i
|
25
|
+
when 200, 400
|
26
|
+
JSON.parse(response.body)
|
27
|
+
when 500..599
|
28
|
+
raise Artemis::GraphQLServerError, "Received server error status #{response.code}: #{response.body}"
|
29
|
+
else
|
30
|
+
{ 'errors' => [{ 'message' => "#{response.code} #{response.message}" }] }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def api_auth_sign_request!(request, api_auth)
|
37
|
+
override_http_method = api_auth.fetch(:override_http_method, nil)
|
38
|
+
digest = api_auth.fetch(:digest, 'sha256')
|
39
|
+
::ApiAuth.sign!(request,
|
40
|
+
api_auth.fetch(:access_id), api_auth.fetch(:secret_key),
|
41
|
+
override_http_method: override_http_method, digest: digest)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'artemis/adapters/net_http_hmac_adapter'
|
metadata
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: artemis-api_auth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jan Stevens
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: api-auth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "<"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "<"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: artemis
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "<"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.17'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.17'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '12.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '12.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Net::HTTP adapter that adds Api Auth authentication for Artemis GraphQL
|
140
|
+
Client
|
141
|
+
email:
|
142
|
+
- jan@playpass.be
|
143
|
+
executables: []
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".rspec"
|
149
|
+
- ".rubocop.yml"
|
150
|
+
- ".rubocop_todo.yml"
|
151
|
+
- ".travis.yml"
|
152
|
+
- Gemfile
|
153
|
+
- LICENSE.txt
|
154
|
+
- README.md
|
155
|
+
- Rakefile
|
156
|
+
- artemis-api_auth.gemspec
|
157
|
+
- bin/console
|
158
|
+
- bin/setup
|
159
|
+
- lib/artemis/adapters/net_http_hmac_adapter.rb
|
160
|
+
- lib/artemis/api_auth.rb
|
161
|
+
- lib/artemis/api_auth/version.rb
|
162
|
+
homepage: https://github.com/JanStevens/artemis-api-auth
|
163
|
+
licenses:
|
164
|
+
- MIT
|
165
|
+
metadata: {}
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options: []
|
168
|
+
require_paths:
|
169
|
+
- lib
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
requirements: []
|
181
|
+
rubyforge_project:
|
182
|
+
rubygems_version: 2.7.6
|
183
|
+
signing_key:
|
184
|
+
specification_version: 4
|
185
|
+
summary: Net::HTTP adapter that adds Api Auth authentication for Artemis GraphQL Client
|
186
|
+
test_files: []
|