88 */
99namespace OC \Authentication \Login ;
1010
11+ /**
12+ * Orchestrates the WebAuthn (passkeys/security keys) login command chain in a
13+ * security-sensitive order for interactive authentication.
14+ *
15+ * Mirrors the main login-chain {@see Chain} with adaptations to the
16+ * WebAuthn-specific authentication flow (i.e., no pre-login hook or Flow v2
17+ * ephemeral-session step).
18+ */
1119class WebAuthnChain {
1220 public function __construct (
1321 private UserDisabledCheckCommand $ userDisabledCheckCommand ,
@@ -23,17 +31,28 @@ public function __construct(
2331 ) {
2432 }
2533
34+ /**
35+ * Runs the WebAuthn login pipeline for one login attempt.
36+ */
2637 public function process (LoginData $ loginData ): LoginResult {
38+ // Phase 1: pre-auth eligibility checks
2739 $ chain = $ this ->userDisabledCheckCommand ;
2840 $ chain
41+ // Phase 2: primary authentication and login-state transition
2942 ->setNext ($ this ->webAuthnLoginCommand )
3043 ->setNext ($ this ->loggedInCheckCommand )
3144 ->setNext ($ this ->completeLoginCommand )
45+
46+ // Phase 3: session strategy and token materialization
3247 ->setNext ($ this ->createSessionTokenCommand )
48+
49+ // Phase 4: post-auth maintenance and context updates
3350 ->setNext ($ this ->clearLostPasswordTokensCommand )
3451 ->setNext ($ this ->updateLastPasswordConfirmCommand )
3552 ->setNext ($ this ->setUserTimezoneCommand )
36- ->setNext ($ this ->twoFactorCommand )
53+
54+ // Phase 5: assurance/finalization gates
55+ ->setNext ($ this ->twoFactorCommand ) // before remembered-login finalization
3756 ->setNext ($ this ->finishRememberedLoginCommand );
3857
3958 return $ chain ->process ($ loginData );
0 commit comments