Skip to content

Commit

Permalink
Rename package to mfatypes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joerger committed Oct 30, 2024
1 parent c1d7864 commit 377c90d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib/auth/mfa/mfa.go → lib/auth/mfatypes/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package mfa
package mfatypes

import mfav1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/mfa/v1"

Expand Down
4 changes: 2 additions & 2 deletions lib/auth/sso_mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/gravitational/teleport/api/constants"
mfav1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/mfa/v1"
"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/lib/auth/mfa"
"github.com/gravitational/teleport/lib/auth/mfatypes"
"github.com/gravitational/teleport/lib/authz"
"github.com/gravitational/teleport/lib/defaults"
"github.com/gravitational/teleport/lib/services"
Expand Down Expand Up @@ -142,7 +142,7 @@ func (a *Server) upsertSSOMFASession(ctx context.Context, user string, sessionID
RequestID: sessionID,
ConnectorID: connectorID,
ConnectorType: connectorType,
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: ext.Scope,
AllowReuse: ext.AllowReuse,
},
Expand Down
24 changes: 12 additions & 12 deletions lib/auth/sso_mfa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
mfav1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/mfa/v1"
"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/lib/auth/authclient"
"github.com/gravitational/teleport/lib/auth/mfa"
"github.com/gravitational/teleport/lib/auth/mfatypes"
"github.com/gravitational/teleport/lib/authz"
"github.com/gravitational/teleport/lib/defaults"
"github.com/gravitational/teleport/lib/services"
Expand Down Expand Up @@ -276,7 +276,7 @@ func TestSSOMFAChallenge_Creation(t *testing.T) {
Username: samlUser.GetName(),
ConnectorID: samlConnector.GetName(),
ConnectorType: samlConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
},
}, sd)
Expand Down Expand Up @@ -315,7 +315,7 @@ func TestSSOMFAChallenge_Creation(t *testing.T) {
Username: oidcUser.GetName(),
ConnectorID: oidcConnector.GetName(),
ConnectorType: oidcConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
},
}, sd)
Expand Down Expand Up @@ -481,7 +481,7 @@ func TestSSOMFAChallenge_Validation(t *testing.T) {
Username: "wrong-user",
ConnectorID: samlConnector.GetName(),
ConnectorType: samlConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
},
Token: "token",
Expand All @@ -505,7 +505,7 @@ func TestSSOMFAChallenge_Validation(t *testing.T) {
Username: samlUser.GetName(),
ConnectorID: samlConnector.GetName(),
ConnectorType: samlConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
},
Token: "token",
Expand All @@ -529,7 +529,7 @@ func TestSSOMFAChallenge_Validation(t *testing.T) {
Username: samlUser.GetName(),
ConnectorID: samlConnector.GetName(),
ConnectorType: samlConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
},
},
Expand All @@ -552,7 +552,7 @@ func TestSSOMFAChallenge_Validation(t *testing.T) {
Username: samlUser.GetName(),
ConnectorID: samlConnector.GetName(),
ConnectorType: samlConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
},
Token: "token",
Expand All @@ -576,7 +576,7 @@ func TestSSOMFAChallenge_Validation(t *testing.T) {
Username: samlUser.GetName(),
ConnectorID: samlConnector.GetName(),
ConnectorType: samlConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
AllowReuse: mfav1.ChallengeAllowReuse_CHALLENGE_ALLOW_REUSE_YES,
},
Expand All @@ -602,7 +602,7 @@ func TestSSOMFAChallenge_Validation(t *testing.T) {
Username: noMFASAMLUser.GetName(),
ConnectorID: noMFASAMLConnector.GetName(),
ConnectorType: noMFASAMLConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
},
Token: "token",
Expand All @@ -626,7 +626,7 @@ func TestSSOMFAChallenge_Validation(t *testing.T) {
Username: standardUser.GetName(),
ConnectorID: samlConnector.GetName(),
ConnectorType: samlConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
},
Token: "token",
Expand All @@ -650,7 +650,7 @@ func TestSSOMFAChallenge_Validation(t *testing.T) {
Username: samlUser.GetName(),
ConnectorID: samlConnector.GetName(),
ConnectorType: samlConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
AllowReuse: mfav1.ChallengeAllowReuse_CHALLENGE_ALLOW_REUSE_NO,
},
Expand Down Expand Up @@ -680,7 +680,7 @@ func TestSSOMFAChallenge_Validation(t *testing.T) {
Username: samlUser.GetName(),
ConnectorID: samlConnector.GetName(),
ConnectorType: samlConnector.GetKind(),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_LOGIN,
AllowReuse: mfav1.ChallengeAllowReuse_CHALLENGE_ALLOW_REUSE_YES,
},
Expand Down
4 changes: 2 additions & 2 deletions lib/auth/webauthn/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

mfav1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/mfa/v1"
"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/lib/auth/mfa"
"github.com/gravitational/teleport/lib/auth/mfatypes"
wantypes "github.com/gravitational/teleport/lib/auth/webauthntypes"
)

Expand Down Expand Up @@ -191,7 +191,7 @@ func (f *loginFlow) begin(ctx context.Context, user string, challengeExtensions
if err != nil {
return nil, trace.Wrap(err)
}
sd.ChallengeExtensions = &mfa.ChallengeExtensions{
sd.ChallengeExtensions = &mfatypes.ChallengeExtensions{
Scope: challengeExtensions.Scope,
AllowReuse: challengeExtensions.AllowReuse,
UserVerificationRequirement: challengeExtensions.UserVerificationRequirement,
Expand Down
4 changes: 2 additions & 2 deletions lib/auth/webauthn/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (

mfav1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/mfa/v1"
"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/lib/auth/mfa"
"github.com/gravitational/teleport/lib/auth/mfatypes"
"github.com/gravitational/teleport/lib/auth/mocku2f"
wanlib "github.com/gravitational/teleport/lib/auth/webauthn"
wantypes "github.com/gravitational/teleport/lib/auth/webauthntypes"
Expand Down Expand Up @@ -442,7 +442,7 @@ func TestPasswordlessFlow_BeginAndFinish(t *testing.T) {
AllowCredentials: [][]uint8{}, // aka unset
ResidentKey: false, // irrelevant for login
UserVerification: string(protocol.VerificationRequired),
ChallengeExtensions: &mfa.ChallengeExtensions{
ChallengeExtensions: &mfatypes.ChallengeExtensions{
Scope: mfav1.ChallengeScope_CHALLENGE_SCOPE_PASSWORDLESS_LOGIN,
AllowReuse: mfav1.ChallengeAllowReuse_CHALLENGE_ALLOW_REUSE_NO,
},
Expand Down
4 changes: 2 additions & 2 deletions lib/auth/webauthntypes/webauthn.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/go-webauthn/webauthn/webauthn"
"github.com/gravitational/trace"

"github.com/gravitational/teleport/lib/auth/mfa"
"github.com/gravitational/teleport/lib/auth/mfatypes"
)

// CredentialAssertion is the payload sent to authenticators to initiate login.
Expand Down Expand Up @@ -405,7 +405,7 @@ type SessionData struct {
// An empty value is treated equivalently to "discouraged".
UserVerification string `json:"userVerification,omitempty"`
// ChallengeExtensions are Teleport extensions that apply to this webauthn session.
ChallengeExtensions *mfa.ChallengeExtensions `json:"challenge_extensions,omitempty"`
ChallengeExtensions *mfatypes.ChallengeExtensions `json:"challenge_extensions,omitempty"`
}

// SessionDataFromProtocol converts a [webauthn.SessionData] struct to an
Expand Down
4 changes: 2 additions & 2 deletions lib/services/sso_mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package services

import "github.com/gravitational/teleport/lib/auth/mfa"
import "github.com/gravitational/teleport/lib/auth/mfatypes"

// SSOMFASessionData SSO MFA Session data.
type SSOMFASessionData struct {
Expand All @@ -34,5 +34,5 @@ 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 *mfa.ChallengeExtensions `json:"challenge_extensions"`
ChallengeExtensions *mfatypes.ChallengeExtensions `json:"challenge_extensions"`
}

0 comments on commit 377c90d

Please sign in to comment.