rack-simple_auth 0.0.5 → 0.0.6

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: 679543cc4da776a8986f3d8477153db2daa11c3f
4
- data.tar.gz: befc0a5d1bae82ae0b1bf169af01270124a63b0c
3
+ metadata.gz: 9821660c1ff4703956f11cd39f67f3a09f98a9ad
4
+ data.tar.gz: 6cab22a6d00d70e62411e28ec042def714c347d3
5
5
  SHA512:
6
- metadata.gz: 02c9398175da001fbb27384be1c6c2d39b2b385e45751924cb5edf567b903e6c55f6bccce0edbeb57e700d6b74209185d451659a734246f9ef9df8e92a59c887
7
- data.tar.gz: f32117cd429abfe524be90fd69a4627d765427fc6f2d5fe5e2d7dc89130be0ba6a327d29f1216adb0f22222e5bf931bd498c0ad879b583cd82c39afd7fd4adff
6
+ metadata.gz: 84068e6c7c66de24a364c6cc607c01ec65ec7d9ade78c8a7d3ab6a720b324084b73a3c0aa472afb7706b4ae510e82f5e8b63c160df94d4bfe1fb526e19eac491
7
+ data.tar.gz: 4fed2416ba52add9e396e692a12c327d78f238d97fbf9829b496d8ff330e2b55313d3ea78780227b053626a6b1b4ce9f8c85ce371d6d891d8819d64d115152b6
@@ -32,6 +32,8 @@ module Rack
32
32
  # @param [Rack::Request] request [current Request]
33
33
  # @return [boolean] ValidationStatus [If authorized returns true, else false]
34
34
  def valid?(request)
35
+ @hash_array = build_allowed_messages(request)
36
+
35
37
  if request.env['HTTP_AUTHORIZATION'].nil?
36
38
  log(request)
37
39
 
@@ -42,8 +44,6 @@ module Rack
42
44
  message_hash = auth_array[0]
43
45
  signature = auth_array[1]
44
46
 
45
- @hash_array = build_allowed_messages(request)
46
-
47
47
  if signature == @signature && @hash_array.include?(message_hash)
48
48
  true
49
49
  else
@@ -106,10 +106,12 @@ module Rack
106
106
 
107
107
  log = "#{Time.new} - #{method} #{path} - 400 Unauthorized - HTTP_AUTHORIZATION: #{request.env['HTTP_AUTHORIZATION']}\n"
108
108
  log << "Auth Message Config: #{@config[request.request_method]}\n"
109
- log << "Allowed Encrypted Messages:\n"
110
109
 
111
- @hash_array.each do |hash|
112
- log << "#{hash}\n"
110
+ if @hash_array
111
+ log << "Allowed Encrypted Messages:\n"
112
+ @hash_array.each do |hash|
113
+ log << "#{hash}\n"
114
+ end
113
115
  end
114
116
 
115
117
  log << "Auth Signature: #{@signature}"
@@ -2,6 +2,6 @@ module Rack
2
2
  # Module which Contains different Authorization / Authentication Classes (HMAC, ..)
3
3
  module SimpleAuth
4
4
  # Current Gem Version
5
- VERSION = '0.0.5'
5
+ VERSION = '0.0.6'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-simple_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benny1992