Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind SessionState handler interface in container #147

Conversation

nstapelbroek
Copy link
Contributor

Heya,

These are the functional changes extracted from #143

Changes

Instead of binding the SessionStateHandler in the container we are now binding the StateHandler interface. This allows for an easier replacement in case someone wants to.

References

#143

Testing

[x] This change has been tested on the latest version Laravel

Checklist

[x] I have read the Auth0 general contribution guidelines

[x] I have read the Auth0 Code of Conduct

@nstapelbroek nstapelbroek requested a review from a team October 10, 2019 19:33
@joshcanhelp joshcanhelp requested review from joshcanhelp and removed request for a team October 10, 2019 19:49
@joshcanhelp joshcanhelp changed the base branch from master to 7.0.0-dev October 14, 2019 23:16
Copy link
Contributor

@joshcanhelp joshcanhelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again!

src/Auth0/Login/Auth0Service.php Outdated Show resolved Hide resolved
Comment on lines 39 to 42
array $auth0Config = null,
StoreInterface $sessionStorage = null,
SessionStateHandler $sessionStateHandler = null
StateHandler $stateHandler = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were going to remove the default checking here, correct? Would it be common for a developer to call this directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand your question correctly it's about removing the = null from the arguments?

I'd love to make these argument required in the future and remove the fallback behaviour in the constructor. Maybe this is something we can do in the 7.0.0-dev branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aah, I see you changed the base branch. Should I get rid of the fallback logic in the constructor? 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think so. As long as the default package initialization is set to always pass, I would say it's best to force these dependencies as well. I don't imagine this would be called directly that often outside of register()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, that makes sense. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Binding the interface allows for an easier replacement with a different
implmentation lateron.
@nstapelbroek nstapelbroek force-pushed the use-statehandler-interface-in-container branch from 5ebbcf1 to aad8af6 Compare October 15, 2019 14:54
@nstapelbroek nstapelbroek changed the title Bind SessionState handler interface in contianer Bind SessionState handler interface in container Oct 15, 2019
Dropped BC constructor logic to stimulate moving all constructor and configuration logic to a
centralized place e.g. a service provider.
@joshcanhelp joshcanhelp self-requested a review October 15, 2019 16:29
@joshcanhelp
Copy link
Contributor

❯ snyk test

Testing /Users/josh-cunningham/Sites/laravel/auth0-login-dev/vendor/auth0/login...

Organization:      auth0-sdks
Package manager:   composer
Target file:       composer.lock
Open source:       no
Project path:      /Users/josh-cunningham/Sites/laravel/auth0-login-dev/vendor/auth0/login
Licenses:          enabled

✓ Tested 19 dependencies for known issues, no vulnerable paths found.

@joshcanhelp joshcanhelp added this to the 7.0.0 milestone Oct 16, 2019
@joshcanhelp joshcanhelp merged commit 5b2a011 into auth0:7.0.0-dev Oct 16, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants