Skip to content

Commit

Permalink
Use json compatible struct for SSOMFASessionData.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joerger committed Oct 29, 2024
1 parent 820dc4e commit 4ac8be5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 8 additions & 5 deletions lib/auth/sso_mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,14 @@ func (a *Server) verifySSOMFASession(ctx context.Context, username, sessionID, t
// sessionID, connector details, and challenge extensions.
func (a *Server) upsertSSOMFASession(ctx context.Context, user string, sessionID string, connectorID string, connectorType string, ext *mfav1.ChallengeExtensions) error {
err := a.UpsertSSOMFASessionData(ctx, &services.SSOMFASessionData{
Username: user,
RequestID: sessionID,
ConnectorID: connectorID,
ConnectorType: connectorType,
ChallengeExtensions: ext,
Username: user,
RequestID: sessionID,
ConnectorID: connectorID,
ConnectorType: connectorType,
ChallengeExtensions: &services.ChallengeExtensions{
Scope: ext.Scope,
AllowReuse: ext.AllowReuse,
},
})
return trace.Wrap(err)
}
Expand Down
8 changes: 7 additions & 1 deletion lib/services/sso_mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,11 @@ type SSOMFASessionData struct {
// ConnectorType is SSO type of the corresponding Auth connector (SAML, OIDC).
ConnectorType string `json:"connector_type,omitempty"`
// ChallengeExtensions are Teleport extensions that apply to this SSO MFA session.
ChallengeExtensions *mfav1.ChallengeExtensions `json:"challenge_extensions,omitempty"`
ChallengeExtensions *ChallengeExtensions `json:"challenge_extensions"`
}

// ChallengeExtensions is a json struct for [mfav1.ChallengeExtensions].
type ChallengeExtensions struct {
Scope mfav1.ChallengeScope `json:"scope,omitempty"`
AllowReuse mfav1.ChallengeAllowReuse `json:"allow_reuse,omitempty"`
}

0 comments on commit 4ac8be5

Please sign in to comment.