oauth2c 0.2.1 → 0.3.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
  SHA1:
3
- metadata.gz: 8d3c710b44e81dbe2f8da14f941559d0ed6548ec
4
- data.tar.gz: 36e6ecd60a44687c386963c81aeadb96cff338c0
3
+ metadata.gz: 3b831e9e1d917a696b1f892f3c7e881503979afd
4
+ data.tar.gz: bc48bc62ab519732031d3ac775d0e0f1a7215996
5
5
  SHA512:
6
- metadata.gz: 4427858645aade6e8f8fc9cfb337105172f494ffee7fa4d45172e0b3a2f0f03aae52c35293398e31f3987ad763cda61f0f075ae6abbb995a5c16e23b18cedd00
7
- data.tar.gz: ffebe8c6e1df8befe9a9eba20a77f20a966f561f48d886fa835d45551c64d038c3a3767fee4d14e2fa47406c5717d60d62a6593f5aa331c1260d117cd5866cd6
6
+ metadata.gz: fcd8388c125ad0eaf0564d891c74d10cd6cf3c07ea044a495ea3dce92aaaec81150c2924e16f806e1ea4af16495bbc38ed65d5de7215ad5025325926fcdd2b4a
7
+ data.tar.gz: e3530f38f0b63c50dbf56b0a2f028eb69536e05b7682f73d3c9debfac149982ea6ca34ff6f5e71be3bd88275f1d8fc2d1db2ec7cafddecabeb61c5cbfc56a4a8
data/lib/oauth2c/agent.rb CHANGED
@@ -22,17 +22,21 @@ module OAuth2c
22
22
 
23
23
  ConfigError = Class.new(StandardError)
24
24
 
25
- def initialize(authz_url: nil, token_url:, client_id:, client_secret: nil, redirect_uri: nil)
25
+ def initialize(authz_url: nil, token_url:, client_id:, client_secret: nil,
26
+ redirect_uri: nil, client_credentials_on_body: false)
26
27
  @authz_url = authz_url && authz_url.chomp("/")
27
28
  @token_url = token_url && token_url.chomp("/")
28
29
  @client_id = client_id
29
30
  @client_secret = client_secret
30
31
  @redirect_uri = redirect_uri
32
+ @client_credentials_on_body = client_credentials_on_body
31
33
 
32
34
  @http_client = HTTP.nodelay
33
- .basic_auth(user: @client_id, pass: @client_secret)
34
35
  .accept("application/json")
35
36
  .headers("Content-Type": "application/x-www-form-urlencoded; encoding=UTF-8")
37
+ unless @client_credentials_on_body
38
+ @http_client = @http_client.basic_auth(user: @client_id, pass: @client_secret)
39
+ end
36
40
  end
37
41
 
38
42
  def authz_url(response_type:, state:, scope: [], **params)
@@ -64,6 +68,12 @@ module OAuth2c
64
68
  scope: normalize_scope(scope),
65
69
  **params,
66
70
  }
71
+ if @client_credentials_on_body
72
+ params.merge!(
73
+ client_id: @client_id,
74
+ client_secret: @client_secret
75
+ )
76
+ end
67
77
 
68
78
  if include_redirect_uri
69
79
  params[:redirect_uri] = @redirect_uri
@@ -25,13 +25,16 @@ module OAuth2c
25
25
  :default_scope,
26
26
  )
27
27
 
28
- def initialize(authz_url: nil, token_url:, client_id:, client_secret: nil, redirect_uri: nil, default_scope: [])
29
- @authz_url = authz_url
30
- @token_url = token_url
31
- @client_id = client_id
32
- @client_secret = client_secret
33
- @redirect_uri = redirect_uri
34
- @default_scope = default_scope
28
+ def initialize(authz_url: nil, token_url:, client_id:, client_secret: nil,
29
+ redirect_uri: nil, default_scope: [],
30
+ client_credentials_on_body: false)
31
+ @authz_url = authz_url
32
+ @token_url = token_url
33
+ @client_id = client_id
34
+ @client_secret = client_secret
35
+ @redirect_uri = redirect_uri
36
+ @default_scope = default_scope
37
+ @client_credentials_on_body = client_credentials_on_body
35
38
 
36
39
  define_grant_methods!
37
40
  end
@@ -55,6 +58,7 @@ module OAuth2c
55
58
  client_id: @client_id,
56
59
  client_secret: @client_secret,
57
60
  redirect_uri: @redirect_uri,
61
+ client_credentials_on_body: @client_credentials_on_body,
58
62
  )
59
63
  end
60
64
  end
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module OAuth2c
16
- VERSION = "0.2.1"
16
+ VERSION = "0.3.0"
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth2c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Kochenburger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  requirements: []
199
199
  rubyforge_project:
200
- rubygems_version: 2.6.8
200
+ rubygems_version: 2.6.13
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: OAuth2c is a extensible OAuth2 client implementation