cerner-oauth1a 2.5.1 → 2.5.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: 5080f2da839650783e60c1aeece1b66e1d941e42cb261ca8f1537b01bcdf1631
4
- data.tar.gz: fac69cde7fdc2008b57edc4ad56f5c8e5acb95953e4b18978ed4c353987ddf2f
3
+ metadata.gz: ca8300adcad968664fcc86fc549aea148270447a03b551a3a4ab3205768bc39b
4
+ data.tar.gz: 83979ce58e001e22b1c1f88f5f7f32f7c743955d1f6f01772e4ff59073b2ba54
5
5
  SHA512:
6
- metadata.gz: 2f8b24beb10edfc647de6db18cb8dfd59b2c1e85864be8c4b68c9084353805772cc2b51aaec3f9f7c3639ee1d55a14d58a903094c9ace8b6de332a2526b1f812
7
- data.tar.gz: d909b24d22d1f8c3459d496ab4129bebd15eaf171c4a3fe36459764d40cf8e59e48c4aaf4111a32e5bca427d2a8d381d22caad9c65d0bf90d0cebc7d25aef3be
6
+ metadata.gz: f80154214e20e2bad8ecea32520af361b51e700740bb51cff3688bec67363cd1187bf08a089a4fbccb32be241d0677f924d87471076c67e40fb3cace036e22e3
7
+ data.tar.gz: 492f0ba94453e2c13e276a7074467df0764153d45c0424286835191d2fb2c214c802569ac35436b17bc8dcdcca9dc9588008e33866e28e217cb0689971a23b0b
@@ -1,3 +1,7 @@
1
+ # v2.5.2
2
+ Adjust `Cerner::OAuth1a::Protocol.parse_www_authenticate_header` to handle parameters
3
+ that are either tokens or quoted strings.
4
+
1
5
  # v2.5.1
2
6
  Address `instance variable @cache_instance not initialized` warning
3
7
 
@@ -49,6 +49,10 @@ module Cerner
49
49
  # Cerner::OAuth1a::Protocol.parse_www_authenticate_header(header)
50
50
  # # => {:realm=>"https://test.host", :oauth_problem=>"token_expired"}
51
51
  #
52
+ # header = 'OAuth realm="https://test.host", oauth_problem=token_expired'
53
+ # Cerner::OAuth1a::Protocol.parse_www_authenticate_header(header)
54
+ # # => {:realm=>"https://test.host", :oauth_problem=>"token_expired"}
55
+ #
52
56
  # Returns a Hash with symbolized keys of all of the parameters.
53
57
  def self.parse_authorization_header(value)
54
58
  params = {}
@@ -57,10 +61,18 @@ module Cerner
57
61
  value = value.strip
58
62
  return params unless value.size > 6 && value[0..5].casecmp?('OAuth ')
59
63
 
60
- value.scan(/([^,\s=]*)=\"([^\"]*)\"/).each do |pair|
61
- k = URI.decode_www_form_component(pair[0])
62
- v = URI.decode_www_form_component(pair[1])
63
- params[k.to_sym] = v
64
+ # trim off 'OAuth ' prefix
65
+ value = value[6..-1]
66
+
67
+ # split value on comma separators
68
+ value.split(/,\s*/).each do |kv_part|
69
+ # split each part on '=' separator
70
+ key, value = kv_part.split('=')
71
+ key = URI.decode_www_form_component(key)
72
+ # trim off surrounding double quotes, if they exist
73
+ value = value[1..-2] if value.start_with?('"') && value.end_with?('"')
74
+ value = URI.decode_www_form_component(value)
75
+ params[key.to_sym] = value
64
76
  end
65
77
 
66
78
  params
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cerner
4
4
  module OAuth1a
5
- VERSION = '2.5.1'
5
+ VERSION = '2.5.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cerner-oauth1a
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Beyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-19 00:00:00.000000000 Z
11
+ date: 2020-05-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  A minimal dependency library for interacting with a Cerner OAuth 1.0a Access