1717use CodeIgniter \HTTP \IncomingRequest ;
1818use CodeIgniter \HTTP \RedirectResponse ;
1919use CodeIgniter \HTTP \RequestInterface ;
20- use CodeIgniter \HTTP \Response ;
2120use CodeIgniter \HTTP \ResponseInterface ;
2221
2322/**
2928class ChainAuth implements FilterInterface
3029{
3130 /**
32- * Do whatever processing this filter needs to do.
33- * By default it should not return anything during
34- * normal execution. However, when an abnormal state
35- * is found, it should return an instance of
36- * CodeIgniter\HTTP\Response. If it does, script
37- * execution will end and that Response will be
38- * sent back to the client, allowing for error pages,
39- * redirects, etc.
31+ * Checks authenticators in sequence to see if the user is logged in through
32+ * either of authenticators.
4033 *
4134 * @param array|null $arguments
4235 *
@@ -53,10 +46,18 @@ public function before(RequestInterface $request, $arguments = null)
5346 $ chain = config ('Auth ' )->authenticationChain ;
5447
5548 foreach ($ chain as $ alias ) {
56- if (auth ($ alias )->loggedIn ()) {
49+ $ auth = auth ($ alias );
50+
51+ if ($ auth ->loggedIn ()) {
5752 // Make sure Auth uses this Authenticator
5853 auth ()->setAuthenticator ($ alias );
5954
55+ $ authenticator = $ auth ->getAuthenticator ();
56+
57+ if (setting ('Auth.recordActiveDate ' )) {
58+ $ authenticator ->recordActiveDate ();
59+ }
60+
6061 return ;
6162 }
6263 }
0 commit comments