Go to the documentation of this file.
54 parent::__construct();
56 if ( isset( $params[
'sessionCookieName'] ) ) {
57 if ( !is_string( $params[
'sessionCookieName'] ) ) {
58 throw new \InvalidArgumentException(
'sessionCookieName must be a string' );
60 $this->sessionCookieName = $params[
'sessionCookieName'];
62 if ( isset( $params[
'sessionCookieOptions'] ) ) {
63 if ( !is_array( $params[
'sessionCookieOptions'] ) ) {
64 throw new \InvalidArgumentException(
'sessionCookieOptions must be an array' );
66 $this->sessionCookieOptions = $params[
'sessionCookieOptions'];
82 if ( $this->sessionCookieName ===
null ) {
83 throw new \BadMethodCallException(
84 __METHOD__ .
' may not be called when $this->sessionCookieName === null'
88 $prefix = $this->sessionCookieOptions[
'prefix'] ?? $this->config->get(
'CookiePrefix' );
89 $id = $request->
getCookie( $this->sessionCookieName, $prefix );
94 return $this->sessionCookieName !==
null;
102 if ( $this->sessionCookieName ===
null ) {
109 $this->logger->debug( __METHOD__ .
': Headers already sent' );
115 $response->setCookie(
'forceHTTPS',
'true',
null,
116 [
'prefix' =>
'',
'secure' =>
false ] + $options );
117 $options[
'secure'] =
true;
120 $response->setCookie( $this->sessionCookieName, $session->
getId(),
null, $options );
124 if ( $this->sessionCookieName ===
null ) {
131 $this->logger->debug( __METHOD__ .
': Headers already sent' );
135 $response->clearCookie( $this->sessionCookieName, $this->sessionCookieOptions );
139 if ( $this->sessionCookieName ===
null ) {
143 $prefix = $this->sessionCookieOptions[
'prefix'] ?? $this->config->get(
'CookiePrefix' );
148 return wfMessage(
'sessionprovider-nocookies' );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
response()
Return a handle to WebResponse style object, for setting cookies, headers and other stuff,...
getCookie( $key, $prefix=null, $default=null)
Get a cookie from the $_COOKIE jar.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...