@@ -237,16 +237,16 @@ function testRequireAuthFail() {
237
237
$ this ->Controller ->Security ->startup ($ this ->Controller );
238
238
$ this ->assertTrue ($ this ->Controller ->failed );
239
239
240
- $ this ->Controller ->Session ->write ('_Token ' , array ('allowedControllers ' => array ()));
240
+ $ this ->Controller ->Session ->write ('_Token ' , serialize ( array ('allowedControllers ' => array () )));
241
241
$ this ->Controller ->data = array ('username ' => 'willy ' , 'password ' => 'somePass ' );
242
242
$ this ->Controller ->action = 'posted ' ;
243
243
$ this ->Controller ->Security ->requireAuth ('posted ' );
244
244
$ this ->Controller ->Security ->startup ($ this ->Controller );
245
245
$ this ->assertTrue ($ this ->Controller ->failed );
246
246
247
- $ this ->Controller ->Session ->write ('_Token ' , array (
247
+ $ this ->Controller ->Session ->write ('_Token ' , serialize ( array (
248
248
'allowedControllers ' => array ('SecurityTest ' ), 'allowedActions ' => array ('posted2 ' )
249
- ));
249
+ ))) ;
250
250
$ this ->Controller ->data = array ('username ' => 'willy ' , 'password ' => 'somePass ' );
251
251
$ this ->Controller ->action = 'posted ' ;
252
252
$ this ->Controller ->Security ->requireAuth ('posted ' );
@@ -1145,5 +1145,19 @@ function testSettingTokenForRequestAction() {
1145
1145
$ this ->Controller ->Security ->startup ($ this ->Controller );
1146
1146
$ this ->assertEqual ($ this ->Controller ->params ['_Token ' ]['key ' ], $ key );
1147
1147
}
1148
+
1149
+ /**
1150
+ * test that blackhole doesn't delete the _Token session key so repeat data submissions
1151
+ * stay blackholed.
1152
+ *
1153
+ * @link http://cakephp.lighthouseapp.com/projects/42648/tickets/214
1154
+ * @return void
1155
+ */
1156
+ function testBlackHoleNotDeletingSessionInformation () {
1157
+ $ this ->Controller ->Security ->startup ($ this ->Controller );
1158
+
1159
+ $ this ->Controller ->Security ->blackHole ($ this ->Controller , 'auth ' );
1160
+ $ this ->assertTrue ($ this ->Controller ->Security ->Session ->check ('_Token ' ), '_Token was deleted by blackHole %s ' );
1161
+ }
1148
1162
}
1149
1163
?>
0 commit comments