GithubHelp home page GithubHelp logo

Aura.Session compatibility about aura.auth HOT 12 OPEN

auraphp avatar auraphp commented on July 23, 2024 6
Aura.Session compatibility

from aura.auth.

Comments (12)

cxj avatar cxj commented on July 23, 2024 3

Yes, if it breaks compatibility, it'd have bump to a new major version. I'm ok with that. ;-)

from aura.auth.

jakejohns avatar jakejohns commented on July 23, 2024 2

I think that would mean separate interface packages and therefore 3.x bump.

from aura.auth.

harikt avatar harikt commented on July 23, 2024

@cxj looking for this now ?

https://github.com/friendsofaura/FOA.Auth_Session_Bundle ( 3 years old, so not sure if all is working as expected. Have not tested those now )

There is already one ;-) .

from aura.auth.

cxj avatar cxj commented on July 23, 2024

I think if Aura.Auth just used a compatible API (PHP interface) to its included Session class, then users of it could optionally and easily plug in Aura.Session to get its greater functionality. That would allow Aura.Auth to remain a standalone and not be dependent on anything.

from aura.auth.

harikt avatar harikt commented on July 23, 2024

@cxj I do agree. See discussion on google group regarding the topic : https://groups.google.com/d/msg/auraphp/dVpSOV6RnM4/HWynJROLm-gJ .

from aura.auth.

cxj avatar cxj commented on July 23, 2024

It appears that Aura.Session's SegmentInterface and Aura.Auth's SegmentInterface are currently 100% compatible, with Aura.Auth's being a subset of the Aura. Session's.

Aura.Auth:

$ fgrep function SegmentInterface.php     
    public function get($key, $alt = null);
    public function set($key, $val);

Aura.Session:

$ fgrep function SegmentInterface.php
    public function get($key, $alt = null);
    public function set($key, $val);
    public function clear();
    public function setFlash($key, $val);
    public function getFlash($key, $alt = null);
    public function clearFlash();
    public function getFlashNext($key, $alt = null);
    public function setFlashNow($key, $val);
    public function clearFlashNow();
    public function keepFlash();

from aura.auth.

cxj avatar cxj commented on July 23, 2024

Aura.Session strangely does not have an interface definition for the Session class, while Aura.Auth does. However, the Aura\Session\Sesssion class appears to be compatible with Aura\Auth\Session\SessionInterface.

Aura\Auth:

$ fgrep function SessionInterface.php     
    public function start();
    public function resume();
    public function regenerateId();

Aura\Session:

$ fgrep 'public function' Session.php
    public function __construct(
    public function setDeleteCookie($delete_cookie)
    public function getSegment($name)
    public function isResumable()
    public function isStarted()
    public function start()   // match
    public function resume()  // match
    public function clear()
    public function commit()
    public function destroy()
    public function getCsrfToken()
    public function setCacheExpire($expire)
    public function getCacheExpire()
    public function setCacheLimiter($limiter)
    public function getCacheLimiter()
    public function setCookieParams(array $params)
    public function getCookieParams()
    public function getId()
    public function regenerateId()  // match
    public function setName($name)
    public function getName()
    public function setSavePath($path)
    public function getSavePath()

from aura.auth.

cxj avatar cxj commented on July 23, 2024

A problem might be the constructors for the Session class. Perhaps some clever use of a Dependency Injection Container might solve this, however.
Aura.Auth:

    public function __construct(array $cookie)

Aura.Session:

    public function __construct(
        SegmentFactory $segment_factory,
        CsrfTokenFactory $csrf_token_factory,
        Phpfunc $phpfunc,
        array $cookies = array(),
        $delete_cookie = null
    )

from aura.auth.

cxj avatar cxj commented on July 23, 2024

Another problem is that Auth\Auth\AuthFactory takes a Segment in its constructor, while Aura\Session\Session expects to generate its own Segments using a SegmentFactory:

    public function __construct(
        array $cookie,
        SessionInterface $session = null,
        SegmentInterface $segment = null
    )

from aura.auth.

harikt avatar harikt commented on July 23, 2024

Constructor is never a problem if the interfaces satisfies. We can create a separate interface package as https://github.com/auraphp/Aura.Filter_Interface . And this doesn't need all those methods, but very limited / commonly used. Rest of it can be in package level itself.

from aura.auth.

cxj avatar cxj commented on July 23, 2024

It does not appear that Aura\Filter makes use of Aura\Filter_Interface. For an interface package to be useful, don't we need to have implementations which actually conform to it by using the PHP implements keyword?

If I understand correctly, to do what you are suggesting, there needs to be a new auraphp package named Aura.Session_Interface, correct? If so, can you create that? I do not have commit access to the auraphp project.

Or perhaps there should be just one auraphp Interfaces repository, where interfaces for all of the subprojects are defined. For example:
auraphp/Interfaces contains:

  • Aura\Interfaces\Filter_Interface
  • Aura\Interfaces\FailureCollectionInterface
  • Aura\Interfaces\Payload_Interface
  • Aura\Interfaces\Session_Interface
  • Aura\Interfaces\Segment_Interface

Then Aura\Auth\Session could implement Aura\Interfaces\Session_Interface, etc.

from aura.auth.

harikt avatar harikt commented on July 23, 2024

May be we need to ping @pmjones regarding the thoughts expressed here. So he can create the repository. I don't have access for it.

from aura.auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.