Skip to content

Commit

Permalink
Fix connecting to leaf app directly with MFA.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joerger committed Jan 29, 2025
1 parent e2d0ae8 commit 2e285ab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/web/mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ func (h *Handler) createAuthenticateChallengeHandle(w http.ResponseWriter, r *ht
return nil, trace.Wrap(err)
}

// If this is an app session request and we're missing the ClusterID argument, we can
// get the target cluster ID from the app resolved by the request. This is useful when
// connecting directly to a leaf cluster app through the root cluster rather than through
// the launcher.
appReq := mfaRequiredCheckProto.GetApp()
if appReq != nil && req.IsMFARequiredRequest.ClusterID == "" {
req.IsMFARequiredRequest.ClusterID = appReq.GetClusterName()
}

// If the MFA requirement check is being performed for a leaf host, we must check directly
// with the leaf cluster before the authentication challenge request through root.
if req.IsMFARequiredRequest.ClusterID != "" && req.IsMFARequiredRequest.ClusterID != c.cfg.RootClusterName {
Expand Down

0 comments on commit 2e285ab

Please sign in to comment.