appoxy_rails 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rails/api_controller.rb +10 -4
  2. metadata +13 -13
@@ -42,10 +42,10 @@ module Appoxy
42
42
  signature = ""
43
43
  case sigv
44
44
  when "0.1"
45
- puts "outdated version of client"
45
+ # puts "outdated version of client"
46
46
  signature = "#{controller_name}/#{action_name}"
47
47
  when "0.2"
48
- puts "new version of client"
48
+ # puts "new version of client"
49
49
  operation = request.env["PATH_INFO"].gsub(/\/rails\//, "") # here we're getting original request url'
50
50
  params_for_signature = params2||request.query_parameters
51
51
  params_for_signature = params_for_signature.delete_if { |key, value| ["access_key", "sigv", "sig", "timestamp"].include? key }
@@ -58,8 +58,14 @@ module Appoxy
58
58
  raise Appoxy::Api::ApiError, "No sig" if sig.nil?
59
59
  gmtime = Time.now.gmtime
60
60
  # timestamp2 = Appoxy::Api::Signatures.generate_timestamp(gmtime)
61
- raise Appoxy::Api::ApiError, "Request timed out!" unless (gmtime - Time.parse(timestamp)) < 60 # deny all requests older than 60 seconds
62
- sig2 = Appoxy::Api::Signatures.generate_signature(signature, timestamp, secret_key_for_signature(access_key))
61
+ if timestamp.is_?(String)
62
+ timestamp_str = timestamp
63
+ timestamp = Time.parse(timestamp)
64
+ else
65
+ timestamp_str = Appoxy::Api::Signatures.generate_timestamp(timestamp)
66
+ end
67
+ raise Appoxy::Api::ApiError, "Request timed out!" unless (gmtime - timestamp) < 60 # deny all requests older than 60 seconds
68
+ sig2 = Appoxy::Api::Signatures.generate_signature(signature, timestamp_str, secret_key_for_signature(access_key))
63
69
  raise Appoxy::Api::ApiError, "Invalid signature!" unless sig == sig2
64
70
 
65
71
  puts 'Signature OK'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appoxy_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
17
- requirement: &26331156 !ruby/object:Gem::Requirement
17
+ requirement: &25853592 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *26331156
25
+ version_requirements: *25853592
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: oauth
28
- requirement: &26330856 !ruby/object:Gem::Requirement
28
+ requirement: &25853244 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *26330856
36
+ version_requirements: *25853244
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: ruby-openid
39
- requirement: &26330520 !ruby/object:Gem::Requirement
39
+ requirement: &25852884 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *26330520
47
+ version_requirements: *25852884
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: appoxy_api
50
- requirement: &26330220 !ruby/object:Gem::Requirement
50
+ requirement: &25852560 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *26330220
58
+ version_requirements: *25852560
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: mini_fb
61
- requirement: &26329932 !ruby/object:Gem::Requirement
61
+ requirement: &25852224 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *26329932
69
+ version_requirements: *25852224
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: simple_record
72
- requirement: &26329644 !ruby/object:Gem::Requirement
72
+ requirement: &25851936 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *26329644
80
+ version_requirements: *25851936
81
81
  description: Appoxy API Helper gem description...
82
82
  email: travis@appoxy.com
83
83
  executables: []