This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cookie path handling via Aura\Session to enable multiple instan…
…ces on the same server with login, fixes #173. By default session cookies used the "/" path. With multiple instances on the same server this meant that a session was valid for all instances on this server. The new session handling uses the instance path, e.g. .../bbs, to qualify a session cookie for only this instance.
- Loading branch information
Showing
32 changed files
with
354 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: rv | ||
* Date: 01.10.15 | ||
* Time: 09:31 | ||
*/ | ||
|
||
namespace BicBucStriim; | ||
|
||
|
||
use Aura\Auth\Session\SegmentInterface; | ||
use Aura\Session\Segment as AuraSessionSegment; | ||
|
||
/** | ||
* | ||
* Segment that integrates Aura Auth and Session.. | ||
* | ||
*/ | ||
class Segment extends AuraSessionSegment implements SegmentInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: rv | ||
* Date: 01.10.15 | ||
* Time: 09:39 | ||
*/ | ||
|
||
namespace BicBucStriim; | ||
|
||
/** | ||
* | ||
* A factory to create session segment objects. | ||
* | ||
*/ | ||
class SegmentFactory extends \Aura\Session\SegmentFactory | ||
{ | ||
/** | ||
* | ||
* Creates a session segment object. | ||
* | ||
* @param Session $session | ||
* @param string $name | ||
* | ||
* @return Segment | ||
*/ | ||
public function newInstance(Session $session, $name) | ||
{ | ||
return new Segment($session, $name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace BicBucStriim; | ||
|
||
use Aura\Auth\Session\SessionInterface; | ||
use Aura\Session\Session as AuraSession; | ||
|
||
/** | ||
* | ||
* Session that integrates Aura Auth and Session. | ||
* | ||
*/ | ||
class Session extends AuraSession implements SessionInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: rv | ||
* Date: 01.10.15 | ||
* Time: 09:37 | ||
*/ | ||
|
||
namespace BicBucStriim; | ||
|
||
use Aura\Session\Randval; | ||
use Aura\Session\CsrfTokenFactory; | ||
use Aura\Session\Phpfunc; | ||
|
||
/** | ||
* | ||
* A factory to create a Session manager. | ||
* | ||
*/ | ||
class SessionFactory extends \Aura\Session\SessionFactory | ||
{ | ||
/** | ||
* | ||
* Creates a new Session manager. | ||
* | ||
* @param array $cookies An array of cookie values, typically $_COOKIE. | ||
* | ||
* @param callable|null $delete_cookie Optional: An alternative callable | ||
* to invoke when deleting the session cookie. Defaults to `null`. | ||
* | ||
* @return Session New Session manager instance | ||
*/ | ||
public function newInstance(array $cookies, $delete_cookie = null) | ||
{ | ||
$phpfunc = new Phpfunc; | ||
return new Session( | ||
new SegmentFactory, | ||
new CsrfTokenFactory(new Randval($phpfunc)), | ||
$phpfunc, | ||
$cookies, | ||
$delete_cookie | ||
); | ||
} | ||
} |
Oops, something went wrong.