strelka 0.0.1.pre.315 → 0.0.1.pre.320

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.
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,8 +1,59 @@
1
+ 2012-09-28 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * lib/strelka/cookie.rb:
4
+ Remove some chatty debugging from Strelka::Cookie
5
+ [d85c5f7728fe] [tip]
6
+
7
+ * Rakefile, manual/layouts/default.erb, manual/lib/api-filter.rb,
8
+ manual/lib/editorial-filter.rb, manual/lib/examples-filter.rb,
9
+ manual/lib/links-filter.rb, manual/resources/css/manual.css,
10
+ manual/resources/fonts/GraublauWeb.otf,
11
+ manual/resources/fonts/GraublauWebBold.otf,
12
+ manual/resources/fonts/Inconsolata.otf,
13
+ manual/resources/images/arrow_225_small.png,
14
+ manual/resources/images/arrow_315_small.png,
15
+ manual/resources/images/arrow_skip.png, manual/resources/images/cc-
16
+ by.png, manual/resources/images/dialog-error.png,
17
+ manual/resources/images/dialog-information.png,
18
+ manual/resources/images/dialog-warning.png, manual/resources/images
19
+ /emblem-important.png, manual/resources/images/help.png,
20
+ manual/resources/images/information.png,
21
+ manual/resources/images/magnifier.png,
22
+ manual/resources/images/magnifier_left.png,
23
+ manual/resources/images/page_white_code.png,
24
+ manual/resources/images/page_white_copy.png,
25
+ manual/resources/images/printer.png, manual/resources/images
26
+ /project-layout.png, manual/resources/images/question.png,
27
+ manual/resources/images/scripts_code.png, manual/resources/images
28
+ /strelka-dogs/doggie6.svg, manual/resources/images/strelka-
29
+ dogs/doggie7.svg, manual/resources/images/wrap.png,
30
+ manual/resources/images/wrapping.png,
31
+ manual/resources/js/jquery-1.4.4.min.js,
32
+ manual/resources/js/manual.js, manual/resources/js/sh.js,
33
+ manual/resources/swf/clipboard.swf, manual/src/index.page,
34
+ manual/src/starting.page:
35
+ Removing the manual, as everything is now in the API docs
36
+ [c1625574779f]
37
+
38
+ * lib/strelka/cookie.rb, spec/strelka/cookie_spec.rb:
39
+ Add a guard against nil options hash in Strelka::Cookie#initialize
40
+ [cfddc50a05c8]
41
+
42
+ 2012-09-27 Michael Granger <ged@FaerieMUD.org>
43
+
44
+ * lib/strelka/cookie.rb, spec/strelka/cookie_spec.rb:
45
+ Fix dotted domain and allow max_age and domain to be reset.
46
+ [34039ead3f43]
47
+
48
+ * lib/strelka/cookie.rb, spec/strelka/cookie_spec.rb:
49
+ Add Strelka::Cookie#options method.
50
+ [4278d5128b6a]
51
+
1
52
  2012-09-26 Michael Granger <ged@FaerieMUD.org>
2
53
 
3
54
  * Deploying.rdoc, Plugins.rdoc, README.rdoc, Rakefile:
4
55
  A few more fixups to documentation.
5
- [53fcc16af3a6] [tip]
56
+ [53fcc16af3a6]
6
57
 
7
58
  2012-09-26 Michael B. Hix <mhix@laika.com>
8
59
 
data/Rakefile CHANGED
@@ -35,7 +35,6 @@ hoespec = Hoe.spec 'strelka' do
35
35
  self.dependency 'uuidtools', '~> 2.1'
36
36
 
37
37
  self.dependency 'hoe-deveiate', '~> 0.1', :developer
38
- self.dependency 'hoe-manualgen', '~> 0.3', :developer
39
38
  self.dependency 'simplecov', '~> 0.6', :developer
40
39
 
41
40
  self.spec_extras[:licenses] = ["BSD"]
@@ -74,9 +74,18 @@ class Strelka::AuthProvider
74
74
  end
75
75
 
76
76
 
77
- ### If the +callback+ is set, call it with the specified +credentials+, and +request. Override this in
78
- ### your own AuthProvider to provide +additional_arguments+ to the +callback+, and/or to provide
79
- ### additional generic authorization.
77
+ ### Callback for auth success; the auth provider should use this to add cookies, headers, or
78
+ ### whatever to the request or response when the client becomes authenticated. This is a no-op
79
+ ### by default.
80
+ def auth_succeeded( request, credentials )
81
+ self.log.info "Authentication for %p succeeded." % [ credentials ]
82
+ # No-op by default
83
+ end
84
+
85
+
86
+ ### If the +callback+ is set, call it with the specified +credentials+, and +request. Override
87
+ ### this in your own AuthProvider to provide +additional_arguments+ to the +callback+, and/or
88
+ ### to provide additional generic authorization.
80
89
  def authorize( credentials, request, *additional_arguments, &callback )
81
90
  return true unless callback
82
91
  return true if callback.call( credentials, request, *additional_arguments )
@@ -105,7 +105,7 @@ class Strelka::AuthProvider::Basic < Strelka::AuthProvider
105
105
  self.check_password( username, password )
106
106
 
107
107
  # Success!
108
- self.log.info "Authentication for %p succeeded." % [ username ]
108
+ self.auth_succeeded( request, username )
109
109
  return username
110
110
  end
111
111
 
@@ -113,7 +113,9 @@ class Strelka::Cookie
113
113
  ### \httponly::
114
114
  ### HttpOnly flag.
115
115
  def initialize( name, value, options={} )
116
+ options ||= {}
116
117
  self.log.debug "New cookie: %p = %p (%p)" % [ name, value, options ]
118
+
117
119
  @name = name
118
120
  @value = value
119
121
 
@@ -125,6 +127,7 @@ class Strelka::Cookie
125
127
  @expires = nil
126
128
  @version = 0
127
129
 
130
+ self.log.debug " setting options: %p" % [ options ]
128
131
  options.each do |meth, val|
129
132
  self.__send__( "#{meth}=", val )
130
133
  end
@@ -233,14 +236,24 @@ class Strelka::Cookie
233
236
  # discard the cookie. A value of zero means the cookie should be
234
237
  # discarded immediately.
235
238
  def max_age=( delta_seconds )
236
- @max_age = Integer( delta_seconds )
239
+ if delta_seconds.nil?
240
+ @max_age = nil
241
+ else
242
+ @max_age = Integer( delta_seconds )
243
+ end
237
244
  end
238
245
 
239
246
 
240
- ### Set the domain for which the cookie is valid.
247
+ ### Set the domain for which the cookie is valid. Leading '.' characters
248
+ ### will be stripped.
241
249
  def domain=( newdomain )
242
- newdomain = ".#{newdomain}" unless newdomain[0] == ?.
243
- @domain = newdomain.dup
250
+ if newdomain.nil?
251
+ @domain = nil
252
+ else
253
+ newdomain = newdomain.dup
254
+ newdomain.slice!( 0 ) while newdomain.start_with?( '.' )
255
+ @domain = newdomain
256
+ end
244
257
  end
245
258
 
246
259
 
@@ -59,6 +59,11 @@ describe Strelka::AuthProvider do
59
59
  @provider.authenticate( req ).should == 'anonymous'
60
60
  end
61
61
 
62
+ it "has a callback for adding authentication information to the request" do
63
+ req = @request_factory.get( '/admin/console' )
64
+ @provider.auth_succeeded( req, 'anonymous' ) # No-op by default
65
+ end
66
+
62
67
  end
63
68
 
64
69
 
@@ -61,6 +61,10 @@ describe Strelka::Cookie do
61
61
  result.should == {}
62
62
  end
63
63
 
64
+ it "guards against a nil options hash" do
65
+ Strelka::Cookie.new( :name, 'value', nil ).should be_a( Strelka::Cookie )
66
+ end
67
+
64
68
 
65
69
  context "instance" do
66
70
 
@@ -78,13 +82,19 @@ describe Strelka::Cookie do
78
82
  end
79
83
 
80
84
  it "stringifies with a domain if one is set" do
85
+ @cookie.domain = 'example.com'
86
+ @cookie.to_s.should =~ /; Domain=example.com/
87
+ end
88
+
89
+ it "stringifies with the leading '.' in the domain" do
81
90
  @cookie.domain = '.example.com'
82
- @cookie.to_s.should =~ /; Domain=.example.com/
91
+ @cookie.to_s.should =~ /; Domain=example.com/
83
92
  end
84
93
 
85
- it "stringifies with a dot prepended to the domain if the set doesn't have one" do
94
+ it "doesn't stringify with a domain if it is reset" do
86
95
  @cookie.domain = 'example.com'
87
- @cookie.to_s.should =~ /; Domain=.example.com/i
96
+ @cookie.domain = nil
97
+ @cookie.to_s.should_not =~ /; Domain=/
88
98
  end
89
99
 
90
100
  it "raises an exception if the cookie value would be invalid when serialized" do
@@ -145,7 +155,7 @@ describe Strelka::Cookie do
145
155
  @cookie.secure = true
146
156
 
147
157
  @cookie.options.should == {
148
- domain: '.example.com',
158
+ domain: 'example.com',
149
159
  path: nil,
150
160
  secure: true,
151
161
  httponly: false,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strelka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.pre.315
4
+ version: 0.0.1.pre.320
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,7 +36,7 @@ cert_chain:
36
36
  YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
37
37
  Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
38
38
  cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2012-09-27 00:00:00.000000000 Z
39
+ date: 2012-09-28 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: configurability
metadata.gz.sig CHANGED
Binary file