omniauth-raven 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Raven
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -3,28 +3,6 @@ require 'omniauth'
3
3
  module OmniAuth
4
4
  module Strategies
5
5
 
6
- # Two new methods are added to the Standard CGI class.
7
- class CGI
8
- # Perhaps not a great place for this, but rfc3339 is an internet standard ....
9
- # Takes a string with a time encoded according to rfc3339 and returns a Time object.
10
- def timeforRFC3339( rfc3339 )
11
- year = rfc3339[ 0..3 ].to_i
12
- month = rfc3339[ 4..5 ].to_i
13
- day = rfc3339[ 6..7 ].to_i
14
- hour = rfc3339[ 9..10 ].to_i
15
- minute = rfc3339[ 11..12 ].to_i
16
- second = rfc3339[ 13..14 ].to_i
17
- return Time.gm( year, month, day, hour, minute, second)
18
- end
19
-
20
- def escape(string)
21
- string.gsub(/([^ a-zA-Z0-9_.-]+)/) do
22
- '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
23
- end.tr(' ', '+')
24
- end
25
- end
26
-
27
-
28
6
  class Raven
29
7
  include OmniAuth::Strategy
30
8
 
@@ -49,14 +27,14 @@ module OmniAuth
49
27
  params = session['request_id'] = rand( 999999 ).to_s
50
28
 
51
29
  auth_url = options[:raven_opt][:url] <<
52
- "?ver=" << CGI.escape(options[:raven_opt][:version]) <<
53
- ";url=" << CGI.escape(callback_path) <<
54
- ";desc=" << CGI.escape(options[:raven_opt][:desc]) <<
55
- ";msg=" << CGI.escape(options[:raven_opt][:msg]) <<
56
- ";iact=" << CGI.escape(options[:raven_opt][:iact]) <<
57
- ";aauth=" << CGI.escape(options[:raven_opt][:aauth]) <<
58
- ";params=" << CGI.escape(params) <<
59
- ";fail=" << CGI.escape(options[:raven_opt][:fail])
30
+ "?ver=" << uriescape(options[:raven_opt][:version]) <<
31
+ ";url=" << uriescape(callback_path) <<
32
+ ";desc=" << uriescape(options[:raven_opt][:desc]) <<
33
+ ";msg=" << uriescape(options[:raven_opt][:msg]) <<
34
+ ";iact=" << uriescape(options[:raven_opt][:iact]) <<
35
+ ";aauth=" << uriescape(options[:raven_opt][:aauth]) <<
36
+ ";params=" << uriescape(params) <<
37
+ ";fail=" << uriescape(options[:raven_opt][:fail])
60
38
 
61
39
  return redirect auth_url
62
40
  end
@@ -82,6 +60,24 @@ module OmniAuth
82
60
  options[:fields][:name] = @name
83
61
  options[:fields][:email] = @email
84
62
  }
63
+
64
+ private
65
+
66
+ def timeforRFC3339( rfc3339 )
67
+ year = rfc3339[ 0..3 ].to_i
68
+ month = rfc3339[ 4..5 ].to_i
69
+ day = rfc3339[ 6..7 ].to_i
70
+ hour = rfc3339[ 9..10 ].to_i
71
+ minute = rfc3339[ 11..12 ].to_i
72
+ second = rfc3339[ 13..14 ].to_i
73
+ return Time.gm( year, month, day, hour, minute, second)
74
+ end
75
+
76
+ def uriescape(string)
77
+ string.gsub(/([^ a-zA-Z0-9_.-]+)/) do
78
+ '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
79
+ end.tr(' ', '+')
80
+ end
85
81
  end
86
82
  end
87
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-raven
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: