Documentation ¶
Overview ¶
nolint
nolint
nolint
Index ¶
- func AddAndLoginIdentities(t *testing.T, reg *driver.RegistryDefault, public *httptest.Server, ...) map[string]*http.Client
- func CheckE2EServerOnHTTP(t *testing.T, publicPort, adminPort int) (publicUrl, adminUrl string)
- func CheckE2EServerOnHTTPS(t *testing.T, publicPort, adminPort int) (publicUrl, adminUrl string)
- func CourierExpectLinkInMessage(t *testing.T, message *courier.Message, offset int) string
- func CourierExpectMessage(t *testing.T, reg interface{ ... }, recipient, subject string) *courier.Message
- func CreateSession(t *testing.T, reg driver.Registry) *session.Session
- func EncodeFormAsJSON(t *testing.T, isApi bool, values url.Values) (payload string)
- func EnsureAAL(t *testing.T, c *http.Client, ts *httptest.Server, aal string, ...)
- func ExistingNetwork(t *testing.T, p persistence.Persister, id uuid.UUID) persistence.Persister
- func ExpectStatusCode(isAPI bool, api, browser int) int
- func ExpectURL(isAPI bool, api, browser string) string
- func GenerateTLSCertificateFilesForTests(t *testing.T, certPath, keyPath string)
- func GetRecoveryFlow(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.SelfServiceRecoveryFlow
- func GetVerificationFlow(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.SelfServiceVerificationFlow
- func HTTPPostForm(t *testing.T, client *http.Client, remote string, in *url.Values) ([]byte, *http.Response)
- func HTTPRequestJSON(t *testing.T, client *http.Client, method string, url string, in interface{}) ([]byte, *http.Response)
- func InitKratosServers(t *testing.T, reg driver.Registry, public, admin *httptest.Server)
- func InitializeLoginFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server, forced bool, ...) *kratos.SelfServiceLoginFlow
- func InitializeLoginFlowViaBrowser(t *testing.T, client *http.Client, ts *httptest.Server, forced bool, ...) *kratos.SelfServiceLoginFlow
- func InitializeRecoveryFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.SelfServiceRecoveryFlow
- func InitializeRecoveryFlowViaBrowser(t *testing.T, client *http.Client, isSPA bool, ts *httptest.Server) *kratos.SelfServiceRecoveryFlow
- func InitializeRegistrationFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.SelfServiceRegistrationFlow
- func InitializeRegistrationFlowViaBrowser(t *testing.T, client *http.Client, ts *httptest.Server, isSPA bool, ...) *kratos.SelfServiceRegistrationFlow
- func InitializeSettingsFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.SelfServiceSettingsFlow
- func InitializeSettingsFlowViaBrowser(t *testing.T, client *http.Client, isSPA bool, ts *httptest.Server) *kratos.SelfServiceSettingsFlow
- func InitializeVerificationFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.SelfServiceVerificationFlow
- func InitializeVerificationFlowViaBrowser(t *testing.T, client *http.Client, isSPA bool, ts *httptest.Server) *kratos.SelfServiceVerificationFlow
- func JSONEq(t *testing.T, expected, actual interface{}, messageAndArgs ...interface{})
- func LogJSON(t *testing.T, v interface{})
- func LoginMakeRequest(t *testing.T, isAPI bool, isSPA bool, f *kratos.SelfServiceLoginFlow, ...) (string, *http.Response)
- func MockGetSession(t *testing.T, reg mockDeps) httprouter.Handle
- func MockHydrateCookieClient(t *testing.T, c *http.Client, u string)
- func MockMakeAuthenticatedRequest(t *testing.T, reg mockDeps, conf *config.Config, router *httprouter.Router, ...) ([]byte, *http.Response)
- func MockSessionCreateHandler(t *testing.T, reg mockDeps) (httprouter.Handle, *session.Session)
- func MockSessionCreateHandlerWithIdentity(t *testing.T, reg mockDeps, i *identity.Identity) (httprouter.Handle, *session.Session)
- func MockSessionCreateHandlerWithIdentityAndAMR(t *testing.T, reg mockDeps, i *identity.Identity, ...) (httprouter.Handle, *session.Session)
- func MockSetSession(t *testing.T, reg mockDeps, conf *config.Config) httprouter.Handle
- func NewClientWithCookies(t *testing.T) *http.Client
- func NewDebugClient(t *testing.T) *http.Client
- func NewErrorTestServer(t *testing.T, reg interface{ ... }) *httptest.Server
- func NewFakeCSRFNode() *kratos.UiNode
- func NewHTTPClientWithArbitrarySessionCookie(t *testing.T, reg *driver.RegistryDefault) *http.Client
- func NewHTTPClientWithArbitrarySessionToken(t *testing.T, reg *driver.RegistryDefault) *http.Client
- func NewHTTPClientWithIdentitySessionCookie(t *testing.T, reg *driver.RegistryDefault, id *identity.Identity) *http.Client
- func NewHTTPClientWithIdentitySessionToken(t *testing.T, reg *driver.RegistryDefault, id *identity.Identity) *http.Client
- func NewHTTPClientWithSessionCookie(t *testing.T, reg *driver.RegistryDefault, sess *session.Session) *http.Client
- func NewHTTPClientWithSessionToken(t *testing.T, reg *driver.RegistryDefault, sess *session.Session) *http.Client
- func NewHTTPDeleteJSONRequest(t *testing.T, url string, in interface{}) *http.Request
- func NewHTTPGetAJAXRequest(t *testing.T, url string) *http.Request
- func NewHTTPGetJSONRequest(t *testing.T, url string) *http.Request
- func NewHTTPTestServer(t *testing.T, h http.Handler) *httptest.Server
- func NewKratosServer(t *testing.T, reg driver.Registry) (public, admin *httptest.Server)
- func NewKratosServerWithCSRF(t *testing.T, reg driver.Registry) (public, admin *httptest.Server)
- func NewKratosServerWithCSRFAndRouters(t *testing.T, reg driver.Registry) (public, admin *httptest.Server, rp *x.RouterPublic, ra *x.RouterAdmin)
- func NewKratosServerWithRouters(t *testing.T, reg driver.Registry, rp *x.RouterPublic, ra *x.RouterAdmin) (public, admin *httptest.Server)
- func NewKratosServers(t *testing.T) (public, admin *httptest.Server)
- func NewLoginUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func NewLoginUIWith401Response(t *testing.T, c *config.Config) *httptest.Server
- func NewMethodSubmit(group, value string) *kratos.UiNode
- func NewNetwork(t *testing.T, ctx context.Context, p persistence.Persister) (uuid.UUID, persistence.Persister)
- func NewNetworkUnlessExisting(t *testing.T, ctx context.Context, p persistence.Persister) (uuid.UUID, persistence.Persister)
- func NewPasswordNode() *kratos.UiNode
- func NewRecoveryUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func NewRedirSessionEchoTS(t *testing.T, reg interface{ ... }) *httptest.Server
- func NewRedirTS(t *testing.T, body string, conf *config.Config) *httptest.Server
- func NewRegistrationUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func NewRequest(t *testing.T, isAPI bool, method string, url string, payload io.Reader) *http.Request
- func NewSDKClient(ts *httptest.Server) *kratos.APIClient
- func NewSDKClientFromURL(u string) *kratos.APIClient
- func NewSDKCustomClient(ts *httptest.Server, client *http.Client) *kratos.APIClient
- func NewSDKEmailNode(group string) *kratos.UiNode
- func NewSDKOIDCNode(name, provider string) *kratos.UiNode
- func NewSessionClient(t *testing.T, u string) *http.Client
- func NewSettingsAPIServer(t *testing.T, reg *driver.RegistryDefault, ids map[string]*identity.Identity) (*httptest.Server, *httptest.Server, map[string]*http.Client)
- func NewSettingsLoginAcceptAPIServer(t *testing.T, publicClient *kratos.APIClient, conf *config.Config) *httptest.Server
- func NewSettingsUIEchoServer(t *testing.T, reg *driver.RegistryDefault) *httptest.Server
- func NewSettingsUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func NewSettingsUITestServer(t *testing.T, conf *config.Config) *httptest.Server
- func NewVerificationUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func RecoveryMakeRequest(t *testing.T, isAPI bool, f *kratos.SelfServiceRecoveryFlow, hc *http.Client, ...) (string, *http.Response)
- func RegistrationMakeRequest(t *testing.T, isAPI bool, isSPA bool, f *kratos.SelfServiceRegistrationFlow, ...) (string, *http.Response)
- func SDKFormFieldsToURLValues(ff []kratos.UiNode) url.Values
- func SelfServiceHookConfigReset(t *testing.T, conf *config.Config) func()
- func SelfServiceHookCreateFakeIdentity(t *testing.T, reg driver.Registry) *identity.Identity
- func SelfServiceHookErrorHandler(t *testing.T, w http.ResponseWriter, r *http.Request, abortErr error, ...) bool
- func SelfServiceHookFakeIdentity(t *testing.T) *identity.Identity
- func SelfServiceHookLoginErrorHandler(t *testing.T, w http.ResponseWriter, r *http.Request, err error) bool
- func SelfServiceHookLoginSetDefaultRedirectTo(t *testing.T, conf *config.Config, value string)
- func SelfServiceHookLoginSetDefaultRedirectToStrategy(t *testing.T, conf *config.Config, strategy, value string)
- func SelfServiceHookLoginViperSetPost(t *testing.T, conf *config.Config, strategy string, c []config.SelfServiceHook)
- func SelfServiceHookRegistrationErrorHandler(t *testing.T, w http.ResponseWriter, r *http.Request, err error) bool
- func SelfServiceHookRegistrationSetDefaultRedirectTo(t *testing.T, conf *config.Config, value string)
- func SelfServiceHookRegistrationSetDefaultRedirectToStrategy(t *testing.T, conf *config.Config, strategy, value string)
- func SelfServiceHookRegistrationViperSetPost(t *testing.T, conf *config.Config, strategy string, c []config.SelfServiceHook)
- func SelfServiceHookSettingsErrorHandler(t *testing.T, w http.ResponseWriter, r *http.Request, err error) bool
- func SelfServiceHookSettingsSetDefaultRedirectTo(t *testing.T, conf *config.Config, value string)
- func SelfServiceHookSettingsSetDefaultRedirectToStrategy(t *testing.T, conf *config.Config, strategy, value string)
- func SelfServiceMakeHookRequest(t *testing.T, ts *httptest.Server, suffix string, asAPI bool, query url.Values) (*http.Response, string)
- func SelfServiceMakeLoginPostHookRequest(t *testing.T, ts *httptest.Server, asAPI bool, query url.Values) (*http.Response, string)
- func SelfServiceMakeLoginPreHookRequest(t *testing.T, ts *httptest.Server) (*http.Response, string)
- func SelfServiceMakeRegistrationPostHookRequest(t *testing.T, ts *httptest.Server, asAPI bool, query url.Values) (*http.Response, string)
- func SelfServiceMakeRegistrationPreHookRequest(t *testing.T, ts *httptest.Server) (*http.Response, string)
- func SelfServiceMakeSettingsPostHookRequest(t *testing.T, ts *httptest.Server, asAPI bool, query url.Values) (*http.Response, string)
- func SetDefaultIdentitySchema(t *testing.T, conf *config.Config, location string)
- func SetIdentitySchemas(t *testing.T, conf *config.Config, schemas map[string]string)
- func SettingsMakeRequest(t *testing.T, isAPI bool, isSPA bool, f *kratos.SelfServiceSettingsFlow, ...) (string, *http.Response)
- func SkipIfNetworkContext(t *testing.T, ctx context.Context)
- func SnapshotTExcept(t *testing.T, actual interface{}, except []string)
- func StartE2EServer(t *testing.T, configFile string, configOptions ConfigOptions) (publicUrl, adminUrl string)
- func StartE2EServerOnly(t *testing.T, configFile string, isTLS bool, configOptions ConfigOptions) (publicPort, adminPort int)
- func StrategyEnable(t *testing.T, c *config.Config, strategy string, enable bool)
- func SubmitLoginForm(t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, ...) string
- func SubmitRecoveryForm(t *testing.T, isAPI bool, isSPA bool, hc *http.Client, ...) string
- func SubmitRegistrationForm(t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, ...) string
- func SubmitSettingsForm(t *testing.T, isAPI bool, isSPA bool, hc *http.Client, ...) string
- func SubmitVerificationForm(t *testing.T, isAPI bool, isSPA bool, hc *http.Client, ...) string
- func TestSelfServicePreHook(configKey string, ...) func(t *testing.T)
- func UseConfigFile(t *testing.T, path string) *pflag.FlagSet
- func VerificationMakeRequest(t *testing.T, isAPI bool, f *kratos.SelfServiceVerificationFlow, ...) (string, *http.Response)
- type ConfigOptions
- type InitFlowWithOption
- type SessionLifespanProvider
- type TransportWithLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAndLoginIdentities ¶
func AddAndLoginIdentities(t *testing.T, reg *driver.RegistryDefault, public *httptest.Server, ids map[string]*identity.Identity) map[string]*http.Client
AddAndLoginIdentities adds the given identities to the store (like a registration flow) and returns http.Clients which contain their sessions.
func CheckE2EServerOnHTTP ¶
func CheckE2EServerOnHTTPS ¶
func CourierExpectMessage ¶
func EncodeFormAsJSON ¶
func ExistingNetwork ¶
func ExistingNetwork(t *testing.T, p persistence.Persister, id uuid.UUID) persistence.Persister
func ExpectStatusCode ¶
func GetRecoveryFlow ¶
func GetVerificationFlow ¶
func HTTPPostForm ¶
func HTTPRequestJSON ¶
func InitKratosServers ¶
func InitializeLoginFlowViaAPI ¶
func InitializeLoginFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server, forced bool, opts ...InitFlowWithOption) *kratos.SelfServiceLoginFlow
func InitializeRegistrationFlowViaBrowser ¶
func InitializeRegistrationFlowViaBrowser(t *testing.T, client *http.Client, ts *httptest.Server, isSPA bool, opts ...InitFlowWithOption) *kratos.SelfServiceRegistrationFlow
func LoginMakeRequest ¶
func MockGetSession ¶
func MockGetSession(t *testing.T, reg mockDeps) httprouter.Handle
func MockSessionCreateHandlerWithIdentityAndAMR ¶
func MockSessionCreateHandlerWithIdentityAndAMR(t *testing.T, reg mockDeps, i *identity.Identity, methods []identity.CredentialsType) (httprouter.Handle, *session.Session)
func MockSetSession ¶
func NewErrorTestServer ¶
func NewFakeCSRFNode ¶
func NewKratosServer ¶
func NewKratosServerWithCSRF ¶
func NewKratosServerWithCSRFAndRouters ¶
func NewKratosServerWithCSRFAndRouters(t *testing.T, reg driver.Registry) (public, admin *httptest.Server, rp *x.RouterPublic, ra *x.RouterAdmin)
func NewKratosServerWithRouters ¶
func NewKratosServerWithRouters(t *testing.T, reg driver.Registry, rp *x.RouterPublic, ra *x.RouterAdmin) (public, admin *httptest.Server)
func NewMethodSubmit ¶
func NewNetwork ¶
func NewNetwork(t *testing.T, ctx context.Context, p persistence.Persister) (uuid.UUID, persistence.Persister)
func NewNetworkUnlessExisting ¶
func NewNetworkUnlessExisting(t *testing.T, ctx context.Context, p persistence.Persister) (uuid.UUID, persistence.Persister)
func NewPasswordNode ¶
func NewRedirSessionEchoTS ¶
func NewRedirSessionEchoTS(t *testing.T, reg interface { x.WriterProvider session.ManagementProvider config.Provider }) *httptest.Server
func NewRequest ¶
func NewSDKClientFromURL ¶
func NewSDKCustomClient ¶
func NewSDKEmailNode ¶
func NewSDKOIDCNode ¶
func NewSettingsAPIServer ¶
func NewSettingsUIEchoServer ¶
func NewSettingsUITestServer ¶
func RecoveryMakeRequest ¶
func RegistrationMakeRequest ¶
func SetDefaultIdentitySchema ¶
SetDefaultIdentitySchema sets the identity schemas in viper config:
testhelpers.SetDefaultIdentitySchema("file://customer.json")
func SetIdentitySchemas ¶
SetIdentitySchemas sets the identity schemas in viper config:
testhelpers.SetIdentitySchemas(map[string]string{"customer": "file://customer.json"})
func SettingsMakeRequest ¶
func SnapshotTExcept ¶
func StartE2EServer ¶
func StartE2EServer(t *testing.T, configFile string, configOptions ConfigOptions) (publicUrl, adminUrl string)
func StartE2EServerOnly ¶
func StrategyEnable ¶
func SubmitLoginForm ¶
func SubmitLoginForm( t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), isSPA bool, forced bool, expectedStatusCode int, expectedURL string, ) string
SubmitLoginForm initiates a login flow (for Browser and API!), fills out the form and modifies the form values with `withValues`, and submits the form. Returns the body and checks for expectedStatusCode and expectedURL on completion
func SubmitRecoveryForm ¶
func SubmitRecoveryForm( t *testing.T, isAPI bool, isSPA bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), expectedStatusCode int, expectedURL string, ) string
SubmitRecoveryForm initiates a registration flow (for Browser and API!), fills out the form and modifies the form values with `withValues`, and submits the form. If completed, it will return the flow as JSON.
func SubmitRegistrationForm ¶
func SubmitRegistrationForm( t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), isSPA bool, expectedStatusCode int, expectedURL string, ) string
SubmitRegistrationForm (for Browser and API!), fills out the form and modifies // the form values with `withValues`, and submits the form. Returns the body and checks for expectedStatusCode and // expectedURL on completion
func SubmitSettingsForm ¶
func SubmitSettingsForm( t *testing.T, isAPI bool, isSPA bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), expectedStatusCode int, expectedURL string, ) string
SubmitSettingsForm initiates a settings flow (for Browser and API!), fills out the form and modifies the form values with `withValues`, and submits the form. If completed, it will return the flow as JSON.
func SubmitVerificationForm ¶
func SubmitVerificationForm( t *testing.T, isAPI bool, isSPA bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), expectedStatusCode int, expectedURL string, ) string
SubmitVerificationForm initiates a registration flow (for Browser and API!), fills out the form and modifies the form values with `withValues`, and submits the form. If completed, it will return the flow as JSON.
func TestSelfServicePreHook ¶
Types ¶
type ConfigOptions ¶
type ConfigOptions map[string]interface{}
type InitFlowWithOption ¶
type InitFlowWithOption func(*initFlowOptions)
func InitFlowWithAAL ¶
func InitFlowWithAAL(aal identity.AuthenticatorAssuranceLevel) InitFlowWithOption
func InitFlowWithReturnTo ¶
func InitFlowWithReturnTo(returnTo string) InitFlowWithOption
type SessionLifespanProvider ¶
type SessionLifespanProvider struct {
// contains filtered or unexported fields
}
func NewSessionLifespanProvider ¶
func NewSessionLifespanProvider(expiresIn time.Duration) *SessionLifespanProvider
func (*SessionLifespanProvider) SessionLifespan ¶
func (p *SessionLifespanProvider) SessionLifespan() time.Duration
type TransportWithLogger ¶
type TransportWithLogger struct { http.RoundTripper // contains filtered or unexported fields }
func NewTransportWithLogger ¶
func NewTransportWithLogger(parent http.RoundTripper, t *testing.T) *TransportWithLogger
Source Files ¶
- config.go
- courier.go
- e2e_server.go
- errorx.go
- handler_mock.go
- http.go
- httptest.go
- identity.go
- identity_schema.go
- json.go
- network.go
- sdk.go
- selfservice.go
- selfservice_login.go
- selfservice_recovery.go
- selfservice_registration.go
- selfservice_settings.go
- selfservice_verification.go
- server.go
- session.go
- snapshot.go
- strategies.go