17
17
use CodeIgniter \HTTP \IncomingRequest ;
18
18
use CodeIgniter \HTTP \RedirectResponse ;
19
19
use CodeIgniter \HTTP \RequestInterface ;
20
- use CodeIgniter \HTTP \Response ;
21
20
use CodeIgniter \HTTP \ResponseInterface ;
22
21
23
22
/**
29
28
class ChainAuth implements FilterInterface
30
29
{
31
30
/**
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.
40
33
*
41
34
* @param array|null $arguments
42
35
*
@@ -53,10 +46,18 @@ public function before(RequestInterface $request, $arguments = null)
53
46
$ chain = config ('Auth ' )->authenticationChain ;
54
47
55
48
foreach ($ chain as $ alias ) {
56
- if (auth ($ alias )->loggedIn ()) {
49
+ $ auth = auth ($ alias );
50
+
51
+ if ($ auth ->loggedIn ()) {
57
52
// Make sure Auth uses this Authenticator
58
53
auth ()->setAuthenticator ($ alias );
59
54
55
+ $ authenticator = $ auth ->getAuthenticator ();
56
+
57
+ if (setting ('Auth.recordActiveDate ' )) {
58
+ $ authenticator ->recordActiveDate ();
59
+ }
60
+
60
61
return ;
61
62
}
62
63
}
0 commit comments