diesel-api-dsl 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09fb6c7bd081ec67cae4e38437da922ffb6c1ce5
4
- data.tar.gz: 9b64c5eaa0fb570a5f59432c2d17fe30f190a8c4
3
+ metadata.gz: 1d4d0c9b3ef66d9ba223bc4f9844a5ca7785c087
4
+ data.tar.gz: bdce05f100ab2fa3207150fa5fcd867052aa180f
5
5
  SHA512:
6
- metadata.gz: 392364cc807390808496a22150749768b1f25c21d7cf885169a76f5cfafced3e71e1081f527410050c1213cf7de831751422a85033318a56b32ceb95c2b13335
7
- data.tar.gz: b63314de68a6f27f6abba06b919ae739a931f7544832ca69e5e2279ed553cc12b9d1a2181065266ca52d72c0eb1e7ce5be8ec736886f2ca9d8def19e7d25d574
6
+ metadata.gz: 747c888131145da4de241043438788ccdd6b9657da281efe64a83f4b781bf2705e65a31cfd848f3c7a2e8d420e3f597fa7d8f831c76faa6027a083e2bbf99dbb
7
+ data.tar.gz: ff267d0ab287faf7e07a1806955996453e58a9aa7ae40c1991769734b993b767ca1a2c692263031d64ebd8c27013d8d68f3cb287bb60e41295af967752868776
@@ -91,7 +91,9 @@ module Diesel
91
91
  when 'oauth2'
92
92
  require 'diesel/middleware/auth/oauth2'
93
93
  use Diesel::Middleware::Auth::OAuth2,
94
- id: Diesel::Utils::Inflections.underscore(name).to_sym
94
+ id: Diesel::Utils::Inflections.underscore(name).to_sym,
95
+ in: security_def.in,
96
+ name: security_def.name
95
97
  else
96
98
  raise APIError, "Unsupported security definition: #{security_def.type}"
97
99
  end
@@ -9,12 +9,19 @@ module Diesel
9
9
  def initialize(app, options)
10
10
  @app = app
11
11
  @id = options[:id]
12
+ @in = options[:in]
13
+ @name = options[:name]
12
14
  end
13
15
 
14
16
  def call(env)
15
17
  context = env[:context]
16
18
  auth_options = context.options[@id]
17
- env[:request_headers][AUTHORIZATION_HEADER] = AUTHORIZATION_HEADER_FORMAT % auth_options[:token]
19
+ token = auth_options[:token]
20
+ if @in == :query
21
+ env[:params][@name] = token
22
+ else
23
+ env[:request_headers][AUTHORIZATION_HEADER] = AUTHORIZATION_HEADER_FORMAT % token
24
+ end
18
25
  @app.call(env)
19
26
  end
20
27
 
@@ -1,3 +1,3 @@
1
1
  module Diesel
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diesel-api-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Calvin Yu