-
Notifications
You must be signed in to change notification settings - Fork 24
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
API Moving verification logic to a trait for easier re-usability #102
API Moving verification logic to a trait for easier re-usability #102
Conversation
af517de
to
beb2451
Compare
- Moves configuration for the required number of verified methods to the EnforcementManager - `StoreInterface` now requires a member. A store cannot be created without one - Parts of the code have been updated to handle the new `?StoreInterface` return type of `getStore` - Updated API responses to return `403` instead of redirects when session timeouts occur - Added a `LoginHandler` trait that provides methods for handling requests and responses to and from the MFA React app - `SessionStore` implements `Serializable` so it can be added to the session directly - Moved tracking of completed "verified methods" to `StoreInterface`. - Moved loading of existing `StoreInterface`s to the interface
beb2451
to
0b2a6c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems great :)
@@ -666,7 +570,7 @@ protected function doPerformLogin(HTTPRequest $request, Member $member) | |||
// These next two lines are pulled from "parent::doLogin()" | |||
$this->performLogin($member, $data, $request); | |||
// Allow operations on the member after successful login | |||
$this->extend('onLoginSuccess', $member); | |||
parent::extend('afterLogin', $member); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For public visibility, here's a summary of what we discussed internally with this change:
- We can't delegate to the parent method on success, because the member data is gone at this point. We overload it instead.
- The
afterLogin
hook comes from the parent class, and I removed it thinking we didn't need it in NEW Add extension points for audit logging in method registration, login and skip points #103. - The
onLoginSuccess
hook is something we added and don't actually need. - We're asking the parent to express the extension hook, because people may have listeners attached to the parent class rather than this child.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it, some minor suggestions
StoreInterface
now requires a member. A store cannot be created without one?StoreInterface
return type ofgetStore
403
instead of redirects when session timeouts occurLoginHandler
trait that provides methods for handling requests and responses to and from the MFA React appSessionStore
implementsSerializable
so it can be added to the session directlyStoreInterface
.StoreInterface
s to the interface