-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: SSO MFA - WebUI backend implementation #47832
Changes from all commits
c27849f
1072419
511d6cb
13d0cca
384667e
4427375
fbe8f47
890c01e
182a6c7
66bfc8e
4e23a94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -111,6 +111,14 @@ type MFAChallengeResponse struct { | |||||
TOTPCode string `json:"totp_code,omitempty"` | ||||||
// WebauthnResponse is a response from a webauthn device. | ||||||
WebauthnResponse *wantypes.CredentialAssertionResponse `json:"webauthn_response,omitempty"` | ||||||
// SSOResponse is a response from an SSO MFA flow. | ||||||
SSOResponse *SSOResponse `json:"sso_response"` | ||||||
} | ||||||
|
||||||
// SSOResponse is a json compatible [proto.SSOResponse]. | ||||||
type SSOResponse struct { | ||||||
RequestID string `json:"requestId,omitempty"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like the surrounding existing structs are using snake case
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentional, the frontend uses camel case, but we've been inconsistent with it on the backend. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See a bit lower: type AuthenticateWebUserRequest struct {
// User is a teleport username.
User string `json:"user"`
// WebauthnAssertionResponse is a signed WebAuthn credential assertion.
WebauthnAssertionResponse *wantypes.CredentialAssertionResponse `json:"webauthnAssertionResponse,omitempty"`
} |
||||||
Token string `json:"token,omitempty"` | ||||||
} | ||||||
|
||||||
// GetOptionalMFAResponseProtoReq converts response to a type proto.MFAAuthenticateResponse, | ||||||
|
@@ -457,6 +465,37 @@ type MFAAuthenticateChallenge struct { | |||||
WebauthnChallenge *wantypes.CredentialAssertion `json:"webauthn_challenge"` | ||||||
// TOTPChallenge specifies whether TOTP is supported for this user. | ||||||
TOTPChallenge bool `json:"totp_challenge"` | ||||||
// SSOChallenge is an SSO MFA challenge. | ||||||
SSOChallenge *SSOChallenge `json:"sso_challenge"` | ||||||
} | ||||||
|
||||||
// SSOChallenge is a json compatible [proto.SSOChallenge]. | ||||||
type SSOChallenge struct { | ||||||
RequestID string `json:"requestId,omitempty"` | ||||||
RedirectURL string `json:"redirectUrl,omitempty"` | ||||||
Device *SSOMFADevice `json:"device"` | ||||||
// ChannelID is used by the front end to differentiate multiple ongoing SSO | ||||||
// MFA requests so they don't interfere with each other. | ||||||
ChannelID string `json:"channelId"` | ||||||
} | ||||||
|
||||||
// SSOMFADevice is a json compatible [proto.SSOMFADevice]. | ||||||
type SSOMFADevice struct { | ||||||
ConnectorID string `json:"connectorId,omitempty"` | ||||||
ConnectorType string `json:"connectorType,omitempty"` | ||||||
DisplayName string `json:"displayName,omitempty"` | ||||||
} | ||||||
Joerger marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
func SSOChallengeFromProto(ssoChal *proto.SSOChallenge) *SSOChallenge { | ||||||
return &SSOChallenge{ | ||||||
RequestID: ssoChal.RequestId, | ||||||
RedirectURL: ssoChal.RedirectUrl, | ||||||
Device: &SSOMFADevice{ | ||||||
ConnectorID: ssoChal.Device.ConnectorId, | ||||||
ConnectorType: ssoChal.Device.ConnectorType, | ||||||
DisplayName: ssoChal.Device.DisplayName, | ||||||
}, | ||||||
} | ||||||
} | ||||||
|
||||||
// MFARegisterChallenge is an MFA register challenge sent on new MFA register. | ||||||
|
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.
What kind of backwards compatibility do we have if an old proxy doesn't know about this route? Will a 404 kill the entire login flow?
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.
Yeah if the user starts SSO MFA on an up-to-date proxy, then goes through the flow and gets routed to an out-of-date proxy, it will fail. This doesn't break the existing login flow or anything, so this is in line with the compatibly capabilities of new features.