Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
add e2e tests
Thiago Araujo da Silva516ac2825bbf
diff --git a/tests/clients/api/api.gen.go b/tests/clients/api/api.gen.goindex 02c63c5868..4fa550f0c6 100644--- a/tests/clients/api/api.gen.go+++ b/tests/clients/api/api.gen.go@@ -43317,6 +43317,24 @@ func (e UpdateOrganizationJSONBodySelectedMfaMethod) Valid() bool {}}+// Defines values for UpdateOrganizationJSONBodySsoMfaTrust.+const (+ None UpdateOrganizationJSONBodySsoMfaTrust = "none"+ Signal UpdateOrganizationJSONBodySsoMfaTrust = "signal"+)++// Valid indicates whether the value is a known member of the UpdateOrganizationJSONBodySsoMfaTrust enum.+func (e UpdateOrganizationJSONBodySsoMfaTrust) Valid() bool {+ switch e {+ case None:+ return true+ case Signal:+ return true+ default:+ return false+ }+}+// Defines values for UpdateOrganization400JSONResponseBodyStatusCode.const (UpdateOrganization400JSONResponseBodyStatusCodeN400 UpdateOrganization400JSONResponseBodyStatusCode = 400@@ -112278,6 +112296,7 @@ type UpdateOrganizationJSONBody struct {SelectedMfaMethod *UpdateOrganizationJSONBodySelectedMfaMethod `json:"selectedMfaMethod,omitempty"`ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`Slug *string `json:"slug,omitempty"`+ SsoMfaTrust *UpdateOrganizationJSONBodySsoMfaTrust `json:"ssoMfaTrust,omitempty"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`}@@ -112322,6 +112341,9 @@ type UpdateOrganizationJSONBody_SecretShareBrandConfig_SecondaryColor struct {// UpdateOrganizationJSONBodySelectedMfaMethod defines parameters for UpdateOrganization.type UpdateOrganizationJSONBodySelectedMfaMethod string+// UpdateOrganizationJSONBodySsoMfaTrust defines parameters for UpdateOrganization.+type UpdateOrganizationJSONBodySsoMfaTrust string+// UpdateOrganization400JSONResponseBodyStatusCode defines parameters for UpdateOrganization.type UpdateOrganization400JSONResponseBodyStatusCode float32@@ -121141,6 +121163,12 @@ type UpdateSamlConfigJSONBody struct {// Issuer The SAML provider issuer URL or entity ID.Issuer *string `json:"issuer,omitempty"`+ // MfaAuthnContexts Additional AuthnContextClassRef values, besides the built-in two-factor classes, that prove the identity provider completed MFA.+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`++ // MfaSignalAttribute The SAML attribute that lists the authentication methods the user completed, such as an Okta attribute with value session.amr. Set to null to use the provider's default: http://schemas.microsoft.com/claims/authnmethodsreferences for Azure / Entra ID, amr for every other provider.+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+// OrganizationId The ID of the organization to update the SAML config for.OrganizationId string `json:"organizationId"`}@@ -121186,6 +121214,12 @@ type CreateSamlConfigJSONBody struct {// Issuer The SAML provider issuer URL or entity ID.Issuer string `json:"issuer"`+ // MfaAuthnContexts Additional AuthnContextClassRef values, besides the built-in two-factor classes, that prove the identity provider completed MFA.+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`++ // MfaSignalAttribute The SAML attribute that lists the authentication methods the user completed, such as an Okta attribute with value session.amr. Set to null to use the provider's default: http://schemas.microsoft.com/claims/authnmethodsreferences for Azure / Entra ID, amr for every other provider.+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+// OrganizationId The ID of the organization to create the SAML config for.OrganizationId string `json:"organizationId"`}@@ -121297,6 +121331,12 @@ type UpdateOidcConfigJSONBody struct {// ManageGroupMemberships Whether to manage group memberships for the OIDC configuration. If enabled, users will automatically be assigned groups when they sign in, based on which groups they are a member of in the OIDC provider.ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ // MfaAmrValues Additional MFA claim values, besides 'mfa', that prove the identity provider completed MFA.+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`++ // MfaClaimName The ID token claim that lists the authentication methods the user completed. Defaults to amr.+ MfaClaimName *string `json:"mfaClaimName,omitempty"`+// OrganizationId The ID of the organization to update the OIDC config for.OrganizationId string `json:"organizationId"`@@ -121366,6 +121406,12 @@ type CreateOidcConfigJSONBody struct {// ManageGroupMemberships Whether to manage group memberships for the OIDC configuration. If enabled, users will automatically be assigned groups when they sign in, based on which groups they are a member of in the OIDC provider.ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ // MfaAmrValues Additional MFA claim values, besides 'mfa', that prove the identity provider completed MFA.+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`++ // MfaClaimName The ID token claim that lists the authentication methods the user completed. Defaults to amr.+ MfaClaimName *string `json:"mfaClaimName,omitempty"`+// OrganizationId The ID of the organization to create the OIDC config for.OrganizationId string `json:"organizationId"`@@ -219554,6 +219600,7 @@ type ListAdminOrganizationsResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organizations"`@@ -219662,6 +219709,7 @@ func (r ListAdminOrganizationsResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organizations"`@@ -219802,6 +219850,7 @@ type CreateAdminOrganizationResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -219890,6 +219939,7 @@ func (r CreateAdminOrganizationResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -220029,6 +220079,7 @@ type DeleteAdminOrganizationResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -220117,6 +220168,7 @@ func (r DeleteAdminOrganizationResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -220801,6 +220853,7 @@ type AdminSignUpResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -220902,6 +220955,7 @@ func (r AdminSignUpResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -264232,6 +264286,7 @@ type ListOrganizationsResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserJoinedAt time.Time `json:"userJoinedAt"`UserRole string `json:"userRole"`@@ -264318,6 +264373,7 @@ func (r ListOrganizationsResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserJoinedAt time.Time `json:"userJoinedAt"`UserRole string `json:"userRole"`@@ -264819,6 +264875,7 @@ type ListAccessibleOrganizationsWithSubOrgsResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`SubOrganizations []struct {Id openapi_types.UUID `json:"id"`Name string `json:"name"`@@ -264910,6 +264967,7 @@ func (r ListAccessibleOrganizationsWithSubOrgsResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`SubOrganizations []struct {Id openapi_types.UUID `json:"id"`Name string `json:"name"`@@ -269706,6 +269764,7 @@ type GetOrganizationByIdResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -269791,6 +269850,7 @@ func (r GetOrganizationByIdResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -269926,6 +269986,7 @@ type UpdateOrganizationResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -270010,6 +270071,7 @@ func (r UpdateOrganizationResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -310893,16 +310955,18 @@ type GetSamlConfigResponse struct {HTTPResponse *http.Response// JSON200 the response for an HTTP 200 `application/json` responseJSON200 *struct {- AuthProvider string `json:"authProvider"`- Cert string `json:"cert"`- EnableGroupSync *bool `json:"enableGroupSync,omitempty"`- EntryPoint string `json:"entryPoint"`- Id string `json:"id"`- IsActive bool `json:"isActive"`- Issuer string `json:"issuer"`- LastUsed *time.Time `json:"lastUsed,omitempty"`- OrgId string `json:"orgId"`- Organization string `json:"organization"`+ AuthProvider string `json:"authProvider"`+ Cert string `json:"cert"`+ EnableGroupSync *bool `json:"enableGroupSync,omitempty"`+ EntryPoint string `json:"entryPoint"`+ Id string `json:"id"`+ IsActive bool `json:"isActive"`+ Issuer string `json:"issuer"`+ LastUsed *time.Time `json:"lastUsed,omitempty"`+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+ OrgId string `json:"orgId"`+ Organization string `json:"organization"`}// JSON400 the response for an HTTP 400 `application/json` responseJSON400 *struct {@@ -310952,16 +311016,18 @@ type GetSamlConfigResponse struct {// GetJSON200 returns the response for an HTTP 200 `application/json` responsefunc (r GetSamlConfigResponse) GetJSON200() *struct {- AuthProvider string `json:"authProvider"`- Cert string `json:"cert"`- EnableGroupSync *bool `json:"enableGroupSync,omitempty"`- EntryPoint string `json:"entryPoint"`- Id string `json:"id"`- IsActive bool `json:"isActive"`- Issuer string `json:"issuer"`- LastUsed *time.Time `json:"lastUsed,omitempty"`- OrgId string `json:"orgId"`- Organization string `json:"organization"`+ AuthProvider string `json:"authProvider"`+ Cert string `json:"cert"`+ EnableGroupSync *bool `json:"enableGroupSync,omitempty"`+ EntryPoint string `json:"entryPoint"`+ Id string `json:"id"`+ IsActive bool `json:"isActive"`+ Issuer string `json:"issuer"`+ LastUsed *time.Time `json:"lastUsed,omitempty"`+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+ OrgId string `json:"orgId"`+ Organization string `json:"organization"`} {return r.JSON200}@@ -311062,13 +311128,15 @@ type UpdateSamlConfigResponse struct {HTTPResponse *http.Response// JSON200 the response for an HTTP 200 `application/json` responseJSON200 *struct {- AuthProvider string `json:"authProvider"`- CreatedAt time.Time `json:"createdAt"`- Id openapi_types.UUID `json:"id"`- IsActive bool `json:"isActive"`- LastUsed *time.Time `json:"lastUsed,omitempty"`- OrgId openapi_types.UUID `json:"orgId"`- UpdatedAt time.Time `json:"updatedAt"`+ AuthProvider string `json:"authProvider"`+ CreatedAt time.Time `json:"createdAt"`+ Id openapi_types.UUID `json:"id"`+ IsActive bool `json:"isActive"`+ LastUsed *time.Time `json:"lastUsed,omitempty"`+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+ OrgId openapi_types.UUID `json:"orgId"`+ UpdatedAt time.Time `json:"updatedAt"`}// JSON400 the response for an HTTP 400 `application/json` responseJSON400 *struct {@@ -311118,13 +311186,15 @@ type UpdateSamlConfigResponse struct {// GetJSON200 returns the response for an HTTP 200 `application/json` responsefunc (r UpdateSamlConfigResponse) GetJSON200() *struct {- AuthProvider string `json:"authProvider"`- CreatedAt time.Time `json:"createdAt"`- Id openapi_types.UUID `json:"id"`- IsActive bool `json:"isActive"`- LastUsed *time.Time `json:"lastUsed,omitempty"`- OrgId openapi_types.UUID `json:"orgId"`- UpdatedAt time.Time `json:"updatedAt"`+ AuthProvider string `json:"authProvider"`+ CreatedAt time.Time `json:"createdAt"`+ Id openapi_types.UUID `json:"id"`+ IsActive bool `json:"isActive"`+ LastUsed *time.Time `json:"lastUsed,omitempty"`+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+ OrgId openapi_types.UUID `json:"orgId"`+ UpdatedAt time.Time `json:"updatedAt"`} {return r.JSON200}@@ -311225,13 +311295,15 @@ type CreateSamlConfigResponse struct {HTTPResponse *http.Response// JSON200 the response for an HTTP 200 `application/json` responseJSON200 *struct {- AuthProvider string `json:"authProvider"`- CreatedAt time.Time `json:"createdAt"`- Id openapi_types.UUID `json:"id"`- IsActive bool `json:"isActive"`- LastUsed *time.Time `json:"lastUsed,omitempty"`- OrgId openapi_types.UUID `json:"orgId"`- UpdatedAt time.Time `json:"updatedAt"`+ AuthProvider string `json:"authProvider"`+ CreatedAt time.Time `json:"createdAt"`+ Id openapi_types.UUID `json:"id"`+ IsActive bool `json:"isActive"`+ LastUsed *time.Time `json:"lastUsed,omitempty"`+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+ OrgId openapi_types.UUID `json:"orgId"`+ UpdatedAt time.Time `json:"updatedAt"`}// JSON400 the response for an HTTP 400 `application/json` responseJSON400 *struct {@@ -311281,13 +311353,15 @@ type CreateSamlConfigResponse struct {// GetJSON200 returns the response for an HTTP 200 `application/json` responsefunc (r CreateSamlConfigResponse) GetJSON200() *struct {- AuthProvider string `json:"authProvider"`- CreatedAt time.Time `json:"createdAt"`- Id openapi_types.UUID `json:"id"`- IsActive bool `json:"isActive"`- LastUsed *time.Time `json:"lastUsed,omitempty"`- OrgId openapi_types.UUID `json:"orgId"`- UpdatedAt time.Time `json:"updatedAt"`+ AuthProvider string `json:"authProvider"`+ CreatedAt time.Time `json:"createdAt"`+ Id openapi_types.UUID `json:"id"`+ IsActive bool `json:"isActive"`+ LastUsed *time.Time `json:"lastUsed,omitempty"`+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+ OrgId openapi_types.UUID `json:"orgId"`+ UpdatedAt time.Time `json:"updatedAt"`} {return r.JSON200}@@ -311536,6 +311610,8 @@ type GetOidcConfigResponse struct {JwksUri *string `json:"jwksUri,omitempty"`JwtSignatureAlgorithm *string `json:"jwtSignatureAlgorithm,omitempty"`ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`+ MfaClaimName *string `json:"mfaClaimName,omitempty"`OrgId openapi_types.UUID `json:"orgId"`TokenEndpoint *string `json:"tokenEndpoint,omitempty"`UserinfoEndpoint *string `json:"userinfoEndpoint,omitempty"`@@ -311600,6 +311676,8 @@ func (r GetOidcConfigResponse) GetJSON200() *struct {JwksUri *string `json:"jwksUri,omitempty"`JwtSignatureAlgorithm *string `json:"jwtSignatureAlgorithm,omitempty"`ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`+ MfaClaimName *string `json:"mfaClaimName,omitempty"`OrgId openapi_types.UUID `json:"orgId"`TokenEndpoint *string `json:"tokenEndpoint,omitempty"`UserinfoEndpoint *string `json:"userinfoEndpoint,omitempty"`@@ -311712,6 +311790,8 @@ type UpdateOidcConfigResponse struct {Issuer *string `json:"issuer,omitempty"`JwksUri *string `json:"jwksUri,omitempty"`ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`+ MfaClaimName *string `json:"mfaClaimName,omitempty"`OrgId openapi_types.UUID `json:"orgId"`TokenEndpoint *string `json:"tokenEndpoint,omitempty"`UserinfoEndpoint *string `json:"userinfoEndpoint,omitempty"`@@ -311773,6 +311853,8 @@ func (r UpdateOidcConfigResponse) GetJSON200() *struct {Issuer *string `json:"issuer,omitempty"`JwksUri *string `json:"jwksUri,omitempty"`ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`+ MfaClaimName *string `json:"mfaClaimName,omitempty"`OrgId openapi_types.UUID `json:"orgId"`TokenEndpoint *string `json:"tokenEndpoint,omitempty"`UserinfoEndpoint *string `json:"userinfoEndpoint,omitempty"`@@ -311886,6 +311968,8 @@ type CreateOidcConfigResponse struct {JwksUri *string `json:"jwksUri,omitempty"`JwtSignatureAlgorithm *string `json:"jwtSignatureAlgorithm,omitempty"`ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`+ MfaClaimName *string `json:"mfaClaimName,omitempty"`OrgId openapi_types.UUID `json:"orgId"`TokenEndpoint *string `json:"tokenEndpoint,omitempty"`UserinfoEndpoint *string `json:"userinfoEndpoint,omitempty"`@@ -311948,6 +312032,8 @@ func (r CreateOidcConfigResponse) GetJSON200() *struct {JwksUri *string `json:"jwksUri,omitempty"`JwtSignatureAlgorithm *string `json:"jwtSignatureAlgorithm,omitempty"`ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`+ MfaClaimName *string `json:"mfaClaimName,omitempty"`OrgId openapi_types.UUID `json:"orgId"`TokenEndpoint *string `json:"tokenEndpoint,omitempty"`UserinfoEndpoint *string `json:"userinfoEndpoint,omitempty"`@@ -322569,6 +322655,7 @@ type CreateOrganizationResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -322652,6 +322739,7 @@ func (r CreateOrganizationResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -322786,6 +322874,7 @@ type UpgradePrivilegeSystemResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -322869,6 +322958,7 @@ func (r UpgradePrivilegeSystemResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -323203,6 +323293,7 @@ type DeleteOrganizationResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -323287,6 +323378,7 @@ func (r DeleteOrganizationResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -336684,6 +336776,7 @@ type ListUserOrganizationsResponse struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organizations"`@@ -336767,6 +336860,7 @@ func (r ListUserOrganizationsResponse) GetJSON200() *struct {ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organizations"`@@ -358514,6 +358608,7 @@ func ParseListAdminOrganizationsResponse(rsp *http.Response) (*ListAdminOrganizaShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organizations"`@@ -358655,6 +358750,7 @@ func ParseCreateAdminOrganizationResponse(rsp *http.Response) (*CreateAdminOrganShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -358795,6 +358891,7 @@ func ParseDeleteAdminOrganizationResponse(rsp *http.Response) (*DeleteAdminOrganShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -359288,6 +359385,7 @@ func ParseAdminSignUpResponse(rsp *http.Response) (*AdminSignUpResponse, error)ShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -387489,6 +387587,7 @@ func ParseListOrganizationsResponse(rsp *http.Response) (*ListOrganizationsRespoShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserJoinedAt time.Time `json:"userJoinedAt"`UserRole string `json:"userRole"`@@ -387862,6 +387961,7 @@ func ParseListAccessibleOrganizationsWithSubOrgsResponse(rsp *http.Response) (*LShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`SubOrganizations []struct {Id openapi_types.UUID `json:"id"`Name string `json:"name"`@@ -391048,6 +391148,7 @@ func ParseGetOrganizationByIdResponse(rsp *http.Response) (*GetOrganizationByIdRShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -391184,6 +391285,7 @@ func ParseUpdateOrganizationResponse(rsp *http.Response) (*UpdateOrganizationResShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -417044,16 +417146,18 @@ func ParseGetSamlConfigResponse(rsp *http.Response) (*GetSamlConfigResponse, errswitch {case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:var dest struct {- AuthProvider string `json:"authProvider"`- Cert string `json:"cert"`- EnableGroupSync *bool `json:"enableGroupSync,omitempty"`- EntryPoint string `json:"entryPoint"`- Id string `json:"id"`- IsActive bool `json:"isActive"`- Issuer string `json:"issuer"`- LastUsed *time.Time `json:"lastUsed,omitempty"`- OrgId string `json:"orgId"`- Organization string `json:"organization"`+ AuthProvider string `json:"authProvider"`+ Cert string `json:"cert"`+ EnableGroupSync *bool `json:"enableGroupSync,omitempty"`+ EntryPoint string `json:"entryPoint"`+ Id string `json:"id"`+ IsActive bool `json:"isActive"`+ Issuer string `json:"issuer"`+ LastUsed *time.Time `json:"lastUsed,omitempty"`+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+ OrgId string `json:"orgId"`+ Organization string `json:"organization"`}if err := json.Unmarshal(bodyBytes, &dest); err != nil {return nil, err@@ -417155,13 +417259,15 @@ func ParseUpdateSamlConfigResponse(rsp *http.Response) (*UpdateSamlConfigResponsswitch {case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:var dest struct {- AuthProvider string `json:"authProvider"`- CreatedAt time.Time `json:"createdAt"`- Id openapi_types.UUID `json:"id"`- IsActive bool `json:"isActive"`- LastUsed *time.Time `json:"lastUsed,omitempty"`- OrgId openapi_types.UUID `json:"orgId"`- UpdatedAt time.Time `json:"updatedAt"`+ AuthProvider string `json:"authProvider"`+ CreatedAt time.Time `json:"createdAt"`+ Id openapi_types.UUID `json:"id"`+ IsActive bool `json:"isActive"`+ LastUsed *time.Time `json:"lastUsed,omitempty"`+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+ OrgId openapi_types.UUID `json:"orgId"`+ UpdatedAt time.Time `json:"updatedAt"`}if err := json.Unmarshal(bodyBytes, &dest); err != nil {return nil, err@@ -417263,13 +417369,15 @@ func ParseCreateSamlConfigResponse(rsp *http.Response) (*CreateSamlConfigResponsswitch {case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:var dest struct {- AuthProvider string `json:"authProvider"`- CreatedAt time.Time `json:"createdAt"`- Id openapi_types.UUID `json:"id"`- IsActive bool `json:"isActive"`- LastUsed *time.Time `json:"lastUsed,omitempty"`- OrgId openapi_types.UUID `json:"orgId"`- UpdatedAt time.Time `json:"updatedAt"`+ AuthProvider string `json:"authProvider"`+ CreatedAt time.Time `json:"createdAt"`+ Id openapi_types.UUID `json:"id"`+ IsActive bool `json:"isActive"`+ LastUsed *time.Time `json:"lastUsed,omitempty"`+ MfaAuthnContexts *[]string `json:"mfaAuthnContexts,omitempty"`+ MfaSignalAttribute *string `json:"mfaSignalAttribute,omitempty"`+ OrgId openapi_types.UUID `json:"orgId"`+ UpdatedAt time.Time `json:"updatedAt"`}if err := json.Unmarshal(bodyBytes, &dest); err != nil {return nil, err@@ -417447,6 +417555,8 @@ func ParseGetOidcConfigResponse(rsp *http.Response) (*GetOidcConfigResponse, errJwksUri *string `json:"jwksUri,omitempty"`JwtSignatureAlgorithm *string `json:"jwtSignatureAlgorithm,omitempty"`ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`+ MfaClaimName *string `json:"mfaClaimName,omitempty"`OrgId openapi_types.UUID `json:"orgId"`TokenEndpoint *string `json:"tokenEndpoint,omitempty"`UserinfoEndpoint *string `json:"userinfoEndpoint,omitempty"`@@ -417560,6 +417670,8 @@ func ParseUpdateOidcConfigResponse(rsp *http.Response) (*UpdateOidcConfigResponsIssuer *string `json:"issuer,omitempty"`JwksUri *string `json:"jwksUri,omitempty"`ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`+ MfaClaimName *string `json:"mfaClaimName,omitempty"`OrgId openapi_types.UUID `json:"orgId"`TokenEndpoint *string `json:"tokenEndpoint,omitempty"`UserinfoEndpoint *string `json:"userinfoEndpoint,omitempty"`@@ -417674,6 +417786,8 @@ func ParseCreateOidcConfigResponse(rsp *http.Response) (*CreateOidcConfigResponsJwksUri *string `json:"jwksUri,omitempty"`JwtSignatureAlgorithm *string `json:"jwtSignatureAlgorithm,omitempty"`ManageGroupMemberships *bool `json:"manageGroupMemberships,omitempty"`+ MfaAmrValues *[]string `json:"mfaAmrValues,omitempty"`+ MfaClaimName *string `json:"mfaClaimName,omitempty"`OrgId openapi_types.UUID `json:"orgId"`TokenEndpoint *string `json:"tokenEndpoint,omitempty"`UserinfoEndpoint *string `json:"userinfoEndpoint,omitempty"`@@ -424605,6 +424719,7 @@ func ParseCreateOrganizationResponse(rsp *http.Response) (*CreateOrganizationResShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -424740,6 +424855,7 @@ func ParseUpgradePrivilegeSystemResponse(rsp *http.Response) (*UpgradePrivilegeSShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -425002,6 +425118,7 @@ func ParseDeleteOrganizationResponse(rsp *http.Response) (*DeleteOrganizationResShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organization"`@@ -433489,6 +433606,7 @@ func ParseListUserOrganizationsResponse(rsp *http.Response) (*ListUserOrganizatiShareSecretsProductEnabled *bool `json:"shareSecretsProductEnabled,omitempty"`ShouldUseNewPrivilegeSystem *bool `json:"shouldUseNewPrivilegeSystem,omitempty"`Slug string `json:"slug"`+ SsoMfaTrust *string `json:"ssoMfaTrust,omitempty"`UpdatedAt time.Time `json:"updatedAt"`UserTokenExpiration *string `json:"userTokenExpiration,omitempty"`} `json:"organizations"`diff --git a/tests/fakes/samlidp/samlidp.go b/tests/fakes/samlidp/samlidp.goindex 732d36afdf..0d79d2ff08 100644--- a/tests/fakes/samlidp/samlidp.go+++ b/tests/fakes/samlidp/samlidp.go@@ -144,6 +144,9 @@ type Response struct {LastName stringAttributes map[string][]string+ // Defaults to PasswordProtectedTransport, a single factor.+ AuthnContextClassRef string+NotBefore time.Time // defaults to a minute agoNotOnOrAfter time.Time // defaults to five minutes from now@@ -168,6 +171,9 @@ func (i *IdP) Respond(t *testing.T, r Response) url.Values {if r.NameID == "" {r.NameID = r.Email}+ if r.AuthnContextClassRef == "" {+ r.AuthnContextClassRef = "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"+ }if r.Status == "" {r.Status = StatusSuccess}@@ -250,8 +256,7 @@ func (i *IdP) assertion(r Response, now time.Time) *etree.Element {authn := a.CreateElement("saml:AuthnStatement")authn.CreateAttr("AuthnInstant", instant(now))authn.CreateAttr("SessionIndex", "_"+id.Short())- authn.CreateElement("saml:AuthnContext").CreateElement("saml:AuthnContextClassRef").- SetText("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport")+ authn.CreateElement("saml:AuthnContext").CreateElement("saml:AuthnContextClassRef").SetText(r.AuthnContextClassRef)statement := a.CreateElement("saml:AttributeStatement")attribute := func(name string, values ...string) {diff --git a/tests/fixture/sso/saml.go b/tests/fixture/sso/saml.goindex 724f7352a1..50b8652af5 100644--- a/tests/fixture/sso/saml.go+++ b/tests/fixture/sso/saml.go@@ -231,6 +231,16 @@ func signupClaims(tt *testing.T, loc *url.URL) map[string]any {// Session turns the refresh cookie an SSO login set into an org-scoped client, the way// the select-organization page does.func Session(tt *testing.T, tn *harness.Tenant, login *http.Response) *api.ClientWithResponses {+ tt.Helper()+ selected := SelectOrganization(tt, tn, login, tn.OrgID.String())+ require.Equalf(tt, http.StatusOK, selected.StatusCode(), "selecting the organization: %s", apierr.Body(selected.Body))+ require.False(tt, selected.JSON200.IsMfaEnabled, "selecting the organization asked for MFA")+ return tn.Client(tt, selected.JSON200.Token)+}++// SelectOrganization picks orgID with the session an SSO login set. Unlike Session, it+// hands back the raw answer, so a test can see the MFA challenge.+func SelectOrganization(tt *testing.T, tn *harness.Tenant, login *http.Response, orgID string) *api.SelectOrganizationV3Response {tt.Helper()ctx := tt.Context()jid := RefreshCookie(login)@@ -244,10 +254,22 @@ func Session(tt *testing.T, tn *harness.Tenant, login *http.Response) *api.Clienrequire.Equalf(tt, http.StatusOK, refreshed.StatusCode(), "refreshing the SSO session: %s", apierr.Body(refreshed.Body))selected, err := tn.Client(tt, refreshed.JSON200.Token).SelectOrganizationV3WithResponse(ctx,- api.SelectOrganizationV3JSONRequestBody{OrganizationId: tn.OrgID.String()})+ api.SelectOrganizationV3JSONRequestBody{OrganizationId: orgID})require.NoError(tt, err)- require.Equalf(tt, http.StatusOK, selected.StatusCode(), "selecting the organization: %s", apierr.Body(selected.Body))- return tn.Client(tt, selected.JSON200.Token)+ return selected+}++// EnforceMFA turns on email MFA. With api.Signal, an SSO login the IdP flagged as MFA+// skips the challenge.+func EnforceMFA(tt *testing.T, tn *harness.Tenant, trust api.UpdateOrganizationJSONBodySsoMfaTrust) {+ tt.Helper()+ res, err := tn.Admin.API.UpdateOrganizationWithResponse(tt.Context(), tn.OrgID.String(), api.UpdateOrganizationJSONRequestBody{+ EnforceMfa: new(true),+ SelectedMfaMethod: new(api.UpdateOrganizationJSONBodySelectedMfaMethodEmail),+ SsoMfaTrust: &trust,+ })+ require.NoError(tt, err)+ require.Equalf(tt, http.StatusOK, res.StatusCode(), "enforcing MFA: %s", apierr.Body(res.Body))}// CompleteSignup finishes SSO signup from the login that sent the browser to the SSOdiff --git a/tests/suites/organization/helpers_test.go b/tests/suites/organization/helpers_test.goindex bfa74bb3df..0b9e2e931c 100644--- a/tests/suites/organization/helpers_test.go+++ b/tests/suites/organization/helpers_test.go@@ -43,6 +43,7 @@ type organization struct {AuthEnforced boolGoogleSsoAuthEnforced boolDefaultMembershipRole string+ SsoMfaTrust string}func orgOf(t *testing.T, tn *harness.Tenant) organization {@@ -57,6 +58,7 @@ func orgOf(t *testing.T, tn *harness.Tenant) organization {AuthEnforced: o.AuthEnforced != nil && *o.AuthEnforced,GoogleSsoAuthEnforced: o.GoogleSsoAuthEnforced != nil && *o.GoogleSsoAuthEnforced,DefaultMembershipRole: deref(o.DefaultMembershipRole),+ SsoMfaTrust: deref(o.SsoMfaTrust),}}diff --git a/tests/suites/organization/ssomfatrust_test.go b/tests/suites/organization/ssomfatrust_test.gonew file mode 100644index 0000000000..805e9d08a9--- /dev/null+++ b/tests/suites/organization/ssomfatrust_test.go@@ -0,0 +1,73 @@+package organization_test++import (+ "net/http"+ "testing"++ "github.com/Infisical/infisical/tests/clients/api"+ "github.com/Infisical/infisical/tests/fakes/license"+ "github.com/Infisical/infisical/tests/fixture"+ "github.com/Infisical/infisical/tests/harness"+ "github.com/Infisical/infisical/tests/internal/apierr"+ "github.com/stretchr/testify/require"+)++func TestOrganization_SsoMfaTrust(t *testing.T) {+ t.Parallel()+ h := harness.From(t)++ t.Run("should store the trust when MFA is not enforced yet", func(t *testing.T) {+ t.Parallel()++ // Setup+ tn := h.NewTenant(t)++ // Action+ res := trustIdP(t, tn, tn.Admin)++ // Assert+ requireStatus(t, http.StatusOK, res.StatusCode(), res.Body)+ require.Equal(t, "signal", orgOf(t, tn).SsoMfaTrust)+ })++ t.Run("should refuse the trust and keep none when the plan does not include MFA enforcement", func(t *testing.T) {+ t.Parallel()++ // Setup+ tn := h.NewTenant(t, harness.WithPlan(license.Enterprise().Without(license.EnforceMFA)))++ // Action+ res := trustIdP(t, tn, tn.Admin)++ // Assert+ requireStatus(t, http.StatusBadRequest, res.StatusCode(), res.Body)+ require.Equal(t, "Failed to update MFA for SSO logins due to plan restriction. Upgrade plan to trust identity provider MFA.",+ apierr.Message(res.Body))+ require.Equal(t, "none", orgOf(t, tn).SsoMfaTrust)+ })++ t.Run("should refuse a member who can edit settings but not SSO, and keep none", func(t *testing.T) {+ t.Parallel()++ // Setup+ tn := h.NewTenant(t)+ editor := customRoleUser(t, tn, "settings-editor",+ fixture.Permission{Subject: "settings", Action: []string{"read", "edit"}})++ // Action+ res := trustIdP(t, tn, editor)++ // Assert+ requireStatus(t, http.StatusForbidden, res.StatusCode(), res.Body)+ require.Equal(t, "You are not allowed to edit on sso", apierr.Message(res.Body))+ require.Equal(t, "none", orgOf(t, tn).SsoMfaTrust)+ })+}++func trustIdP(t *testing.T, tn *harness.Tenant, actor *harness.Principal) *api.UpdateOrganizationResponse {+ t.Helper()+ res, err := fresh(t, tn, actor).UpdateOrganizationWithResponse(t.Context(), tn.OrgID.String(),+ api.UpdateOrganizationJSONRequestBody{SsoMfaTrust: new(api.Signal)})+ require.NoError(t, err)+ return res+}diff --git a/tests/suites/sso/oidc/mfatrust_test.go b/tests/suites/sso/oidc/mfatrust_test.gonew file mode 100644index 0000000000..3b6a6df6c6--- /dev/null+++ b/tests/suites/sso/oidc/mfatrust_test.go@@ -0,0 +1,95 @@+package oidc_test++import (+ "net/http"+ "testing"++ "github.com/Infisical/infisical/tests/clients/api"+ "github.com/Infisical/infisical/tests/fakes/oidcidp"+ "github.com/Infisical/infisical/tests/fixture/sso"+ "github.com/Infisical/infisical/tests/internal/apierr"+ "github.com/stretchr/testify/require"+)++var customMFAClaim = api.UpdateOidcConfigJSONRequestBody{MfaClaimName: new("auth_methods"), MfaAmrValues: &[]string{"otp"}}++func TestOIDCMFATrust(t *testing.T) {+ t.Parallel()++ cases := []struct {+ name string+ config *api.UpdateOidcConfigJSONRequestBody+ claims map[string]any+ challenged bool+ }{+ {+ name: "should skip the MFA challenge when the amr claim lists mfa",+ claims: map[string]any{"amr": []string{"pwd", "mfa"}},+ },+ {+ name: "should challenge when the amr claim lists a password only",+ claims: map[string]any{"amr": []string{"pwd"}},+ challenged: true,+ },+ {+ name: "should skip the MFA challenge when the claim the config names lists a value it accepts",+ config: &customMFAClaim,+ claims: map[string]any{"auth_methods": []string{"pwd", "otp"}},+ },+ }++ for _, c := range cases {+ t.Run(c.name, func(t *testing.T) {+ t.Parallel()++ // Setup+ o := setup(t)+ alice := signedUp(t, o)+ sso.EnforceMFA(t, o.Tenant, api.Signal)+ if c.config != nil {+ updateConfig(t, o, *c.config)+ }+ alice.Claims = c.claims++ // Action+ res := selectAfterLogin(t, o, alice)++ // Assert+ require.Equal(t, c.challenged, res.JSON200.IsMfaEnabled)+ if !c.challenged {+ require.Equal(t, http.StatusOK, readOrg(t, o.Tenant.Client(t, res.JSON200.Token), o.Tenant))+ }+ })+ }++ t.Run("should keep SSO enforced when an update changes only the MFA claim fields", func(t *testing.T) {+ t.Parallel()++ // Setup+ o := setup(t)+ enforce(t, o)++ // Action+ updateConfig(t, o, customMFAClaim)++ // Assert+ require.True(t, authEnforced(t, o.Tenant))+ })+}++func selectAfterLogin(t *testing.T, o *sso.OIDC, p oidcidp.Person) *api.SelectOrganizationV3Response {+ t.Helper()+ login := o.Login(t, p)+ o.Redirect(t, login)+ res := sso.SelectOrganization(t, o.Tenant, login.HTTPResponse, o.Tenant.OrgID.String())+ require.Equalf(t, http.StatusOK, res.StatusCode(), "selecting the organization: %s", apierr.Body(res.Body))+ return res+}++func updateConfig(t *testing.T, o *sso.OIDC, body api.UpdateOidcConfigJSONRequestBody) {+ t.Helper()+ body.OrganizationId = o.Tenant.OrgID.String()+ res, err := o.Tenant.Admin.API.UpdateOidcConfigWithResponse(t.Context(), body)+ require.NoError(t, err)+ require.Equalf(t, http.StatusOK, res.StatusCode(), "updating the OIDC config: %s", apierr.Body(res.Body))+}diff --git a/tests/suites/sso/saml/mfatrust_test.go b/tests/suites/sso/saml/mfatrust_test.gonew file mode 100644index 0000000000..9a378016bf--- /dev/null+++ b/tests/suites/sso/saml/mfatrust_test.go@@ -0,0 +1,294 @@+package saml_test++import (+ "context"+ "net/http"+ "testing"+ "time"++ "github.com/Infisical/infisical/tests/clients/api"+ "github.com/Infisical/infisical/tests/fakes/samlidp"+ "github.com/Infisical/infisical/tests/fixture/sso"+ "github.com/Infisical/infisical/tests/harness"+ "github.com/Infisical/infisical/tests/internal/apierr"+ "github.com/Infisical/infisical/tests/internal/wait"+ openapi_types "github.com/oapi-codegen/runtime/types"+ "github.com/stretchr/testify/require"+)++var amrMFA = map[string][]string{"amr": {"pwd", "mfa"}}++func TestSAMLMFATrust_Login(t *testing.T) {+ t.Parallel()++ // One case per place the signal can come from. The matching rules are unit tested+ // in idp-mfa-signal.test.ts, so no need to repeat that matrix here.+ cases := []struct {+ name string+ provider api.CreateSamlConfigJSONBodyAuthProvider+ trust api.UpdateOrganizationJSONBodySsoMfaTrust+ config *api.UpdateSamlConfigJSONRequestBody+ idp func(*samlidp.Response)+ challenged bool+ }{+ {+ name: "should skip the MFA challenge when the amr attribute lists mfa",+ provider: sso.Okta, trust: api.Signal,+ idp: func(r *samlidp.Response) { r.Attributes = amrMFA },+ },+ {+ name: "should skip the MFA challenge when the AuthnContextClassRef is a two-factor class",+ provider: sso.Okta, trust: api.Signal,+ idp: func(r *samlidp.Response) {+ r.AuthnContextClassRef = "urn:oasis:names:tc:SAML:2.0:ac:classes:MobileTwoFactorContract"+ },+ },+ {+ name: "should skip the MFA challenge for Entra ID when authnmethodsreferences lists multipleauthn",+ provider: sso.Azure, trust: api.Signal,+ idp: func(r *samlidp.Response) {+ r.Attributes = map[string][]string{+ "http://schemas.microsoft.com/claims/authnmethodsreferences": {"http://schemas.microsoft.com/claims/multipleauthn"},+ }+ },+ },+ {+ name: "should skip the MFA challenge when the AuthnContextClassRef is one the config accepts",+ provider: sso.Okta, trust: api.Signal,+ config: &api.UpdateSamlConfigJSONRequestBody{MfaAuthnContexts: &[]string{"urn:acme:ac:push-approved"}},+ idp: func(r *samlidp.Response) { r.AuthnContextClassRef = "urn:acme:ac:push-approved" },+ },+ {+ name: "should skip the MFA challenge when the attribute the config names lists mfa",+ provider: sso.Okta, trust: api.Signal,+ config: &api.UpdateSamlConfigJSONRequestBody{MfaSignalAttribute: new("session.amr")},+ idp: func(r *samlidp.Response) { r.Attributes = map[string][]string{"session.amr": {"pwd", "mfa"}} },+ },+ {+ name: "should challenge when the IdP reports a password only",+ provider: sso.Okta, trust: api.Signal,+ idp: func(r *samlidp.Response) { r.Attributes = map[string][]string{"amr": {"pwd"}} },+ challenged: true,+ },+ {+ name: "should challenge when the amr attribute lists mfa but the org does not trust the IdP",+ provider: sso.Okta, trust: api.None,+ idp: func(r *samlidp.Response) { r.Attributes = amrMFA },+ challenged: true,+ },+ }++ for _, c := range cases {+ t.Run(c.name, func(t *testing.T) {+ t.Parallel()++ // Setup+ s := setup(t, c.provider)+ alice := signUp(t, s, c.provider)+ sso.EnforceMFA(t, s.Tenant, c.trust)+ if c.config != nil {+ updateConfig(t, s, *c.config)+ }+ c.idp(&alice)++ // Action+ res := selectAfterLogin(t, s, alice)++ // Assert+ if c.challenged {+ requireChallenged(t, res)+ return+ }+ require.False(t, res.JSON200.IsMfaEnabled, "the login was asked for MFA")+ require.Equal(t, http.StatusOK, readOrg(t, s.Tenant, res.JSON200.Token))+ })+ }+}++func TestSAMLMFATrust(t *testing.T) {+ t.Parallel()+ h := harness.From(t)++ t.Run("should challenge a password login when the org trusts the IdP", func(t *testing.T) {+ t.Parallel()++ // Setup+ s := setup(t, sso.Okta)+ bob := s.Tenant.NewUser(t)+ sso.EnforceMFA(t, s.Tenant, api.Signal)+ login, err := s.Tenant.Anonymous(t).LoginV3WithResponse(t.Context(), api.LoginV3JSONRequestBody{+ Email: bob.Email,+ Password: harness.UserPassword,+ })+ require.NoError(t, err)+ require.Equalf(t, http.StatusOK, login.StatusCode(), "password login: %s", apierr.Body(login.Body))++ // Action+ res, err := s.Tenant.Client(t, login.JSON200.AccessToken).SelectOrganizationV3WithResponse(t.Context(),+ api.SelectOrganizationV3JSONRequestBody{OrganizationId: s.Tenant.OrgID.String()})++ // Assert+ require.NoError(t, err)+ requireChallenged(t, res)+ })++ t.Run("should challenge in another org when the MFA proof came from this org's IdP", func(t *testing.T) {+ t.Parallel()++ // Setup+ s := setup(t, sso.Okta)+ alice := s.SignedUp(t)+ other := h.NewTenant(t)+ inviteToOrg(t, other, alice.Email)+ sso.EnforceMFA(t, other, api.Signal)+ alice.Attributes = amrMFA+ acs := s.SPLogin(t, alice)+ s.Redirect(t, acs)++ // Action+ res := sso.SelectOrganization(t, s.Tenant, acs.HTTPResponse, other.OrgID.String())++ // Assert+ requireChallenged(t, res)+ })++ t.Run("should skip the MFA challenge on the first login, which verifies the mailbox", func(t *testing.T) {+ t.Parallel()++ // Setup+ s := setup(t, sso.Okta)+ sso.EnforceMFA(t, s.Tenant, api.Signal)+ alice := s.Person()+ alice.Attributes = amrMFA+ signup := s.CompleteSignup(t, s.SPLogin(t, alice), s.VerificationCode(t, alice.Email))+ require.Equalf(t, http.StatusOK, signup.StatusCode(), "completing SSO signup: %s", apierr.Body(signup.Body))++ // Action+ res, err := s.Tenant.Client(t, signup.JSON200.Token).SelectOrganizationV3WithResponse(t.Context(),+ api.SelectOrganizationV3JSONRequestBody{OrganizationId: s.Tenant.OrgID.String()})++ // Assert+ require.NoError(t, err)+ require.Equalf(t, http.StatusOK, res.StatusCode(), "selecting: %s", apierr.Body(res.Body))+ require.False(t, res.JSON200.IsMfaEnabled, "the login was asked for MFA")+ })++ t.Run("should record what the IdP sent and that the IdP satisfied MFA in the audit log", func(t *testing.T) {+ t.Parallel()++ // Setup+ s := setup(t, sso.Okta)+ alice := s.SignedUp(t)+ sso.EnforceMFA(t, s.Tenant, api.Signal)+ alice.Attributes = amrMFA++ // Action+ selectAfterLogin(t, s, alice)++ // Assert+ login := waitForAuditEvent(t, s.Tenant, "user-login", func(m map[string]any) bool {+ idpMfa, _ := m["idpMfa"].(map[string]any)+ return idpMfa["verified"] == true+ })+ require.Equal(t, map[string]any{+ "verified": true,+ "evidence": []any{"amr=mfa"},+ "received": []any{"urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", "amr=pwd", "amr=mfa"},+ }, login["idpMfa"])+ waitForAuditEvent(t, s.Tenant, "select-organization", func(m map[string]any) bool { return m["mfaSatisfiedBy"] == "idp" })+ })++ t.Run("should keep SSO enforced when an update changes only the MFA signal fields", func(t *testing.T) {+ t.Parallel()++ // Setup+ s := setup(t, sso.Okta)+ s.Enforce(t)++ // Action+ updateConfig(t, s, api.UpdateSamlConfigJSONRequestBody{+ MfaSignalAttribute: new("session.amr"),+ MfaAuthnContexts: &[]string{"urn:acme:ac:push-approved"},+ })++ // Assert+ require.True(t, authEnforced(t, s.Tenant))+ })+}++// signUp is SignedUp, plus the spn: audience Azure wants on SP-initiated logins.+func signUp(t *testing.T, s *sso.SAML, provider api.CreateSamlConfigJSONBodyAuthProvider) samlidp.Response {+ t.Helper()+ if provider != sso.Azure {+ return s.SignedUp(t)+ }+ p := s.Person()+ p.Audience = "spn:" + s.Issuer+ res := s.CompleteSignup(t, s.SPLogin(t, p), s.VerificationCode(t, p.Email))+ require.Equalf(t, http.StatusOK, res.StatusCode(), "completing SSO signup: %s", apierr.Body(res.Body))+ return p+}++func selectAfterLogin(t *testing.T, s *sso.SAML, p samlidp.Response) *api.SelectOrganizationV3Response {+ t.Helper()+ acs := s.SPLogin(t, p)+ s.Redirect(t, acs)+ res := sso.SelectOrganization(t, s.Tenant, acs.HTTPResponse, s.Tenant.OrgID.String())+ require.Equalf(t, http.StatusOK, res.StatusCode(), "selecting the organization: %s", apierr.Body(res.Body))+ return res+}++func requireChallenged(t *testing.T, res *api.SelectOrganizationV3Response) {+ t.Helper()+ require.Equalf(t, http.StatusOK, res.StatusCode(), "selecting the organization: %s", apierr.Body(res.Body))+ require.True(t, res.JSON200.IsMfaEnabled, "the login was not asked for MFA")+ require.Equal(t, "email", *res.JSON200.MfaMethod)+}++func readOrg(t *testing.T, tn *harness.Tenant, token string) int {+ t.Helper()+ res, err := tn.Client(t, token).GetOrganizationByIdWithResponse(t.Context(), tn.OrgID.String())+ require.NoError(t, err)+ return res.StatusCode()+}++func updateConfig(t *testing.T, s *sso.SAML, body api.UpdateSamlConfigJSONRequestBody) {+ t.Helper()+ body.OrganizationId = s.Tenant.OrgID.String()+ res, err := s.Tenant.Admin.API.UpdateSamlConfigWithResponse(t.Context(), body)+ require.NoError(t, err)+ require.Equalf(t, http.StatusOK, res.StatusCode(), "updating the SAML config: %s", apierr.Body(res.Body))+}++func inviteToOrg(t *testing.T, tn *harness.Tenant, email string) {+ t.Helper()+ res, err := tn.Admin.API.InviteUsersToOrganizationWithResponse(t.Context(), api.InviteUsersToOrganizationJSONRequestBody{+ InviteeEmails: []openapi_types.Email{openapi_types.Email(email)},+ OrganizationId: tn.OrgID.String(),+ OrganizationRoleSlug: new("member"),+ })+ require.NoError(t, err)+ require.Equalf(t, http.StatusOK, res.StatusCode(), "inviting %s: %s", email, apierr.Body(res.Body))+}++// Audit logs go through a queue, so poll instead of reading once.+func waitForAuditEvent(t *testing.T, tn *harness.Tenant, eventType string, match func(map[string]any) bool) map[string]any {+ t.Helper()+ got, err := wait.For(t.Context(), func(ctx context.Context) (map[string]any, bool, error) {+ res, err := tn.Admin.API.ListOrganizationAuditLogsWithResponse(ctx, &api.ListOrganizationAuditLogsParams{+ EventType: &eventType,+ StartDate: new(time.Now().UTC().Add(-time.Hour).Truncate(time.Second)),+ })+ if err != nil || res.JSON200 == nil {+ return nil, false, err+ }+ for _, l := range res.JSON200.AuditLogs {+ if m, ok := l.Event.Metadata.(map[string]any); ok && match(m) {+ return m, true, nil+ }+ }+ return nil, false, nil+ })+ require.NoErrorf(t, err, "waiting for a %s audit event", eventType)+ return got+}