File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -105,13 +105,20 @@ public function testRefreshToken()
105
105
$ this ->assertTrue (csrfp_wrapper::checkHeader ($ _SESSION [csrfprotector::$ config ['CSRFP_TOKEN ' ]][1 ]));
106
106
}
107
107
108
+ /**
109
+ * test secure flag is set in the token cookie when requested
110
+ */
108
111
public function testSecureCookie ()
109
112
{
110
113
$ _SERVER ['REQUEST_METHOD ' ] = 'POST ' ;
111
114
$ _SESSION [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = array ('123abcd ' );
112
115
116
+ csrfprotector::$ config ['secureCookie ' ] = false ;
117
+ csrfprotector::refreshToken ();
118
+ $ this ->assertNotRegExp ('/; secure/ ' , csrfp_wrapper::getHeaderValue ('Set-Cookie ' ));
119
+
113
120
csrfprotector::$ config ['secureCookie ' ] = true ;
114
- csrfprotector::refreshToken (); //will create new session and cookies
121
+ csrfprotector::refreshToken ();
115
122
$ this ->assertRegExp ('/; secure/ ' , csrfp_wrapper::getHeaderValue ('Set-Cookie ' ));
116
123
}
117
124
You can’t perform that action at this time.
0 commit comments