Skip to content

Commit

Permalink
fix: Use resilient client for HIBP lookup
Browse files Browse the repository at this point in the history
Closes #261
  • Loading branch information
aeneasr committed Mar 15, 2020
1 parent a7477ab commit 15e15f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion selfservice/errorx/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestPersister(p Persister) func(t *testing.T) {
actual, err := p.Read(context.Background(), actualID)
require.NoError(t, err)

assert.JSONEq(t, `{"code":404,"status":"Not Found","reason":"foobar","message":"The requested resource could not be found"}`, gjson.Get(toJSON(t, actual),"errors.0").String(), toJSON(t, actual))
assert.JSONEq(t, `{"code":404,"status":"Not Found","reason":"foobar","message":"The requested resource could not be found"}`, gjson.Get(toJSON(t, actual), "errors.0").String(), toJSON(t, actual))
})

t.Run("case=clear", func(t *testing.T) {
Expand Down
4 changes: 3 additions & 1 deletion selfservice/strategy/password/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

"github.com/arbovm/levenshtein"

"github.com/ory/x/httpx"

"github.com/pkg/errors"

"github.com/ory/herodot"
Expand Down Expand Up @@ -56,7 +58,7 @@ type DefaultPasswordValidator struct {

func NewDefaultPasswordValidatorStrategy() *DefaultPasswordValidator {
return &DefaultPasswordValidator{
c: http.DefaultClient,
c: httpx.NewResilientClientLatencyToleranceMedium(nil),
maxBreachesThreshold: 0,
hashes: map[string]int64{},
ignoreNetworkErrors: true,
Expand Down
2 changes: 1 addition & 1 deletion session/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (

func (h *Handler) RegisterPublicRoutes(public *x.RouterPublic) {
for _, m := range []string{http.MethodGet, http.MethodHead, http.MethodPost, http.MethodPut, http.MethodPatch,
http.MethodDelete, http.MethodConnect, http.MethodOptions, http.MethodTrace,} {
http.MethodDelete, http.MethodConnect, http.MethodOptions, http.MethodTrace} {
public.Handle(m, SessionsWhoamiPath, h.whoami)
}
}
Expand Down

0 comments on commit 15e15f1

Please sign in to comment.