Skip to content

Commit

Permalink
refactor: rename verify to verificaiton (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Jul 24, 2020
1 parent e3aa81b commit 0ecd69a
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 51 deletions.
10 changes: 5 additions & 5 deletions cmd/daemon/serve.go
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/ory/kratos/selfservice/flow/logout"
"github.com/ory/kratos/selfservice/flow/registration"
"github.com/ory/kratos/selfservice/flow/settings"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
"github.com/ory/kratos/selfservice/strategy/oidc"
"github.com/ory/kratos/selfservice/strategy/password"
"github.com/ory/kratos/selfservice/strategy/profile"
Expand Down Expand Up @@ -131,10 +131,10 @@ func sqa(cmd *cobra.Command, d driver.Driver) *metricsx.Service {
settings.PublicPath,
settings.PublicRequestPath,
profile.PublicSettingsProfilePath,
verify.PublicVerificationCompletePath,
strings.ReplaceAll(strings.ReplaceAll(verify.PublicVerificationConfirmPath, ":via", "email"), ":code", ""),
strings.ReplaceAll(verify.PublicVerificationInitPath, ":via", "email"),
verify.PublicVerificationRequestPath,
verification.PublicVerificationCompletePath,
strings.ReplaceAll(strings.ReplaceAll(verification.PublicVerificationConfirmPath, ":via", "email"), ":code", ""),
strings.ReplaceAll(verification.PublicVerificationInitPath, ":via", "email"),
verification.PublicVerificationRequestPath,
errorx.ErrorsPath,
},
BuildVersion: d.Registry().BuildVersion(),
Expand Down
10 changes: 5 additions & 5 deletions driver/registry.go
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ory/kratos/schema"
"github.com/ory/kratos/selfservice/flow/recovery"
"github.com/ory/kratos/selfservice/flow/settings"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"

"github.com/ory/x/healthx"

Expand Down Expand Up @@ -108,10 +108,10 @@ type Registry interface {
registration.HandlerProvider
registration.StrategyProvider

verify.PersistenceProvider
verify.ErrorHandlerProvider
verify.SenderProvider
verify.HandlerProvider
verification.PersistenceProvider
verification.ErrorHandlerProvider
verification.SenderProvider
verification.HandlerProvider

recovery.RequestPersistenceProvider
recovery.ErrorHandlerProvider
Expand Down
8 changes: 4 additions & 4 deletions driver/registry_default.go
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/ory/kratos/schema"
"github.com/ory/kratos/selfservice/flow/recovery"
"github.com/ory/kratos/selfservice/flow/settings"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
"github.com/ory/kratos/selfservice/hook"
"github.com/ory/kratos/selfservice/strategy/profile"
"github.com/ory/kratos/selfservice/strategy/recoverytoken"
Expand Down Expand Up @@ -106,10 +106,10 @@ type RegistryDefault struct {
selfserviceSettingsErrorHandler *settings.ErrorHandler
selfserviceSettingsExecutor *settings.HookExecutor

selfserviceVerifyErrorHandler *verify.ErrorHandler
selfserviceVerifyErrorHandler *verification.ErrorHandler
selfserviceVerifyManager *identity.Manager
selfserviceVerifyHandler *verify.Handler
selfserviceVerifySender *verify.Sender
selfserviceVerifyHandler *verification.Handler
selfserviceVerifySender *verification.Sender

selfserviceRecoveryErrorHandler *recovery.ErrorHandler
selfserviceRecoveryHandler *recovery.Handler
Expand Down
16 changes: 8 additions & 8 deletions driver/registry_default_verify.go
Expand Up @@ -2,16 +2,16 @@ package driver

import (
"github.com/ory/kratos/identity"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
)

func (m *RegistryDefault) VerificationPersister() verify.Persister {
func (m *RegistryDefault) VerificationPersister() verification.Persister {
return m.persister
}

func (m *RegistryDefault) VerificationRequestErrorHandler() *verify.ErrorHandler {
func (m *RegistryDefault) VerificationRequestErrorHandler() *verification.ErrorHandler {
if m.selfserviceVerifyErrorHandler == nil {
m.selfserviceVerifyErrorHandler = verify.NewErrorHandler(m, m.c)
m.selfserviceVerifyErrorHandler = verification.NewErrorHandler(m, m.c)
}

return m.selfserviceVerifyErrorHandler
Expand All @@ -25,17 +25,17 @@ func (m *RegistryDefault) VerificationManager() *identity.Manager {
return m.selfserviceVerifyManager
}

func (m *RegistryDefault) VerificationHandler() *verify.Handler {
func (m *RegistryDefault) VerificationHandler() *verification.Handler {
if m.selfserviceVerifyHandler == nil {
m.selfserviceVerifyHandler = verify.NewHandler(m, m.c)
m.selfserviceVerifyHandler = verification.NewHandler(m, m.c)
}

return m.selfserviceVerifyHandler
}

func (m *RegistryDefault) VerificationSender() *verify.Sender {
func (m *RegistryDefault) VerificationSender() *verification.Sender {
if m.selfserviceVerifySender == nil {
m.selfserviceVerifySender = verify.NewSender(m, m.c)
m.selfserviceVerifySender = verification.NewSender(m, m.c)
}

return m.selfserviceVerifySender
Expand Down
4 changes: 2 additions & 2 deletions internal/testhelpers/sql.go
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/ory/kratos/selfservice/flow/recovery"
"github.com/ory/kratos/selfservice/flow/registration"
"github.com/ory/kratos/selfservice/flow/settings"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
"github.com/ory/kratos/selfservice/strategy/recoverytoken"
"github.com/ory/kratos/session"
)
Expand All @@ -32,7 +32,7 @@ func CleanSQL(t *testing.T, c *pop.Connection) {
new(recoverytoken.Token).TableName(),
new(recovery.RequestMethods).TableName(),
new(recovery.Request).TableName(),
new(verify.Request).TableName(),
new(verification.Request).TableName(),
new(session.Session).TableName(),
new(identity.CredentialIdentifierCollection).TableName(),
new(identity.CredentialsCollection).TableName(),
Expand Down
4 changes: 2 additions & 2 deletions persistence/reference.go
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/ory/kratos/selfservice/flow/recovery"
"github.com/ory/kratos/selfservice/flow/registration"
"github.com/ory/kratos/selfservice/flow/settings"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
"github.com/ory/kratos/selfservice/strategy/recoverytoken"
"github.com/ory/kratos/session"
)
Expand All @@ -32,7 +32,7 @@ type Persister interface {
courier.Persister
session.Persister
errorx.Persister
verify.Persister
verification.Persister
recovery.RequestPersister
recoverytoken.Persister

Expand Down
4 changes: 2 additions & 2 deletions persistence/sql/persister_test.go
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/ory/kratos/selfservice/flow/login"
"github.com/ory/kratos/selfservice/flow/registration"
"github.com/ory/kratos/selfservice/flow/settings"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
"github.com/ory/kratos/session"
)

Expand Down Expand Up @@ -162,7 +162,7 @@ func TestPersister(t *testing.T) {
})
t.Run("contract=verification.TestPersister", func(t *testing.T) {
pop.SetLogger(pl(t))
verify.TestPersister(p)(t)
verification.TestPersister(p)(t)
})
t.Run("contract=recovery.TestRequestPersister", func(t *testing.T) {
pop.SetLogger(pl(t))
Expand Down
12 changes: 6 additions & 6 deletions persistence/sql/persister_verify.go
Expand Up @@ -7,25 +7,25 @@ import (

"github.com/ory/x/sqlcon"

"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
)

var _ verify.Persister = new(Persister)
var _ verification.Persister = new(Persister)

func (p Persister) CreateVerificationRequest(ctx context.Context, r *verify.Request) error {
func (p Persister) CreateVerificationRequest(ctx context.Context, r *verification.Request) error {
// This should not create the request eagerly because otherwise we might accidentally create an address
// that isn't supposed to be in the database.
return p.GetConnection(ctx).Create(r)
}

func (p Persister) GetVerificationRequest(ctx context.Context, id uuid.UUID) (*verify.Request, error) {
var r verify.Request
func (p Persister) GetVerificationRequest(ctx context.Context, id uuid.UUID) (*verification.Request, error) {
var r verification.Request
if err := p.GetConnection(ctx).Find(&r, id); err != nil {
return nil, sqlcon.HandleError(err)
}
return &r, nil
}

func (p Persister) UpdateVerificationRequest(ctx context.Context, r *verify.Request) error {
func (p Persister) UpdateVerificationRequest(ctx context.Context, r *verification.Request) error {
return sqlcon.HandleError(p.GetConnection(ctx).Update(r))
}
@@ -1,4 +1,4 @@
package verify
package verification

import (
"net/http"
Expand Down
@@ -1,4 +1,4 @@
package verify
package verification

import (
"net/http"
Expand Down
@@ -1,4 +1,4 @@
package verify_test
package verification_test

import (
"context"
Expand Down Expand Up @@ -27,7 +27,7 @@ import (
"github.com/ory/kratos/internal/httpclient/client"
"github.com/ory/kratos/internal/httpclient/client/common"
"github.com/ory/kratos/internal/testhelpers"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
"github.com/ory/kratos/x"
)

Expand Down Expand Up @@ -90,12 +90,12 @@ func TestHandler(t *testing.T) {
t.Run("case=request verification for unknown via", func(t *testing.T) {
res, body := x.EasyGet(t,
&http.Client{Jar: x.EasyCookieJar(t, nil)},
publicTS.URL+strings.Replace(verify.PublicVerificationInitPath, ":via", "notemail", 1))
publicTS.URL+strings.Replace(verification.PublicVerificationInitPath, ":via", "notemail", 1))
assert.Contains(t, res.Request.URL.String(), errTS.URL)
assert.EqualValues(t, http.StatusBadRequest, gjson.GetBytes(body, "0.code").Int())
})

initURL := publicTS.URL + strings.Replace(verify.PublicVerificationInitPath, ":via", "email", 1)
initURL := publicTS.URL + strings.Replace(verification.PublicVerificationInitPath, ":via", "email", 1)

t.Run("case=init and validate request payload", func(t *testing.T) {
hc := &http.Client{Jar: x.EasyCookieJar(t, nil)}
Expand All @@ -113,7 +113,7 @@ func TestHandler(t *testing.T) {
assert.True(t, time.Time(svr.Payload.ExpiresAt).After(time.Now()))
assert.Contains(t, svr.Payload.RequestURL, initURL)
assert.Contains(t, svr.Payload.ID, rid)
assert.Equal(t, publicTS.URL+strings.Replace(verify.PublicVerificationCompletePath, ":via", "email", 1)+"?request="+rid, *svr.Payload.Form.Action)
assert.Equal(t, publicTS.URL+strings.Replace(verification.PublicVerificationCompletePath, ":via", "email", 1)+"?request="+rid, *svr.Payload.Form.Action)
assert.Contains(t, "csrf_token", *svr.Payload.Form.Fields[0].Name)
assert.Contains(t, "to_verify", *svr.Payload.Form.Fields[1].Name)
assert.Contains(t, "email", *svr.Payload.Form.Fields[1].Type)
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestHandler(t *testing.T) {
hc := &http.Client{Jar: x.EasyCookieJar(t, nil)}
res, _ := x.EasyGet(t, hc,
publicTS.URL+strings.ReplaceAll(
strings.ReplaceAll(verify.PublicVerificationConfirmPath, ":code", "unknown-code"),
strings.ReplaceAll(verification.PublicVerificationConfirmPath, ":code", "unknown-code"),
":via", "email"))
assert.Contains(t, res.Request.URL.String(), verifyTS.URL)

Expand Down
@@ -1,4 +1,4 @@
package verify
package verification

import (
"context"
Expand Down
@@ -1,4 +1,4 @@
package verify
package verification

import (
"net/http"
Expand Down
@@ -1,4 +1,4 @@
package verify
package verification

import (
"crypto/tls"
Expand Down
@@ -1,4 +1,4 @@
package verify
package verification

import (
"context"
Expand Down
@@ -1,4 +1,4 @@
package verify_test
package verification_test

import (
"context"
Expand All @@ -13,7 +13,7 @@ import (
"github.com/ory/kratos/driver/configuration"
"github.com/ory/kratos/identity"
"github.com/ory/kratos/internal"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
)

func TestManager(t *testing.T) {
Expand All @@ -36,7 +36,7 @@ func TestManager(t *testing.T) {
require.NoError(t, err)

_, err = reg.VerificationSender().SendCode(context.Background(), address.Via, "not-tracked@ory.sh")
require.EqualError(t, err, verify.ErrUnknownAddress.Error())
require.EqualError(t, err, verification.ErrUnknownAddress.Error())

messages, err := reg.CourierPersister().NextMessages(context.Background(), 12)
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions selfservice/hook/verification.go
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/ory/kratos/identity"
"github.com/ory/kratos/selfservice/flow/registration"
"github.com/ory/kratos/selfservice/flow/settings"
"github.com/ory/kratos/selfservice/flow/verify"
"github.com/ory/kratos/selfservice/flow/verification"
"github.com/ory/kratos/session"
)

Expand All @@ -15,7 +15,7 @@ var _ settings.PostHookPostPersistExecutor = new(Verifier)

type (
verifierDependencies interface {
verify.SenderProvider
verification.SenderProvider
}
Verifier struct {
r verifierDependencies
Expand Down

0 comments on commit 0ecd69a

Please sign in to comment.