oauth2_hmac_header 0.1.0 → 0.1.1

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: 0c0980088ef79e386fc8ecdbdc025a3f42ae7565
4
- data.tar.gz: 4713caca9228e9f7e3ae6426fcb79fd9a6399ad2
3
+ metadata.gz: b07dad0f735f59e4542b2c6aafdcb82d07b52141
4
+ data.tar.gz: be97df9ad861301a8e3ce3fcc0fdfe34d1676858
5
5
  SHA512:
6
- metadata.gz: 4686124cb405572f62bd19c65915f0ff7a6aad12aaac044fee56db4c5cb221177edfe890abe345d8f2ecfced517a43575bc759d9ed5fd0b2bb0902e20c9b00e9
7
- data.tar.gz: 78c97dc71f17ced4d07da355b1bfd9070a45f1dd0e5821a22584abbf068fecab86f9a8992e296cd85f888198778f5e78d15bd37da7940a0a77563d45651602d7
6
+ metadata.gz: 2aea597596390db5a2f128493eea7c9530a0a1ca3d5f72c17b1a39bd7b2e86bae3c2c37a404942085cf0a8551242f2921057731327531aab24bfa737fbc922aa
7
+ data.tar.gz: e3b2db311f619c8aff77e4a12ce638e6eb144ce9df12ebab57b3b0a415c57baa96aa3cb09ce0dc21993be9f61c4e9e49e846eeac3ba161931e00efed8db7c718
data/README.md CHANGED
@@ -26,13 +26,15 @@ Or install it yourself as:
26
26
  ```ruby
27
27
 
28
28
  @client_id = 'client1'
29
- @algorithm = 'hmac-sha-256''hmac-sha-256' # 'hmac-sha-1' or 'hmac-sha-256'
29
+ @algorithm = 'hmac-sha-256' # 'hmac-sha-1' or 'hmac-sha-256'
30
30
  @key = 'demo_key' # key for client1
31
31
  @method = 'post' # get, post, put, head, patch, etc...
32
32
  @uri = '/request?b5=%3D%253D&a3=a&c%40=&a2=r%20b&c2&a3=2+q' # path for req
33
33
  @host = 'example.com' # hostname for the request
34
34
  @port = 443 # port number for the request
35
35
  @ext = 'a,b,c' # optional str, can be nil
36
+
37
+ # generate header
36
38
  @header = Oauth2HmacHeader::AuthorizationHeader.generate_with_new_signature(
37
39
  @client_id, @algorithm, @key, @method, @uri, @host, @port, @ext
38
40
  )
@@ -52,9 +54,13 @@ Or install it yourself as:
52
54
  @host = 'example.com' # hostname for the request
53
55
  @port = 443 # port number for the request
54
56
  @ext = 'a,b,c' # optional str, can be nil
57
+
58
+ # generate HMAC signature and vars
55
59
  @ts, @nonce, @ext, @mac = Oauth2HmacSign::Signature.generate(
56
60
  @algorithm, @key, @method, @uri, @host, @port, @ext
57
61
  )
62
+
63
+ # generate header
58
64
  @header = Oauth2HmacHeader::AuthorizationHeader.generate(
59
65
  @client_id, @ts, @nonce, @ext, @mac
60
66
  )
@@ -115,8 +115,7 @@ module Oauth2HmacHeader
115
115
  def validate_presence_of_keys_and_values(hash, keys)
116
116
  keys.each do |key|
117
117
  raise(KeyError, "#{key} is a MUST field for Oauth V2 HMAC Authorization header.") unless hash.has_key?(key)
118
- next if !hash[key].nil? && !hash[key].empty?
119
- raise(StandardError, "#{key} is a MUST field for Oauth V2 HMAC Authorization header and can not be blank!") unless hash.has_key?(key)
118
+ raise(StandardError, "#{key} is a MUST field for Oauth V2 HMAC Authorization header and can not be blank!") if hash[key].nil? || hash[key].empty?
120
119
  end
121
120
  end
122
121
  end
@@ -1,3 +1,3 @@
1
1
  module Oauth2HmacHeader
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth2_hmac_header
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mustafa TURAN
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-02 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2_hmac_sign
@@ -84,6 +84,7 @@ files:
84
84
  - lib/oauth2_hmac_header.rb
85
85
  - lib/oauth2_hmac_header/authorization_header.rb
86
86
  - lib/oauth2_hmac_header/version.rb
87
+ - oauth2_hmac_header-0.1.0.gem
87
88
  - oauth2_hmac_header.gemspec
88
89
  homepage: https://github.com/mustafaturan/oauth2_hmac_header
89
90
  licenses: []