Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Jan 3, 2023
1 parent eeafb7f commit 79309dc
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 39 deletions.
3 changes: 2 additions & 1 deletion cmd/identities/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"bytes"
"context"
"encoding/json"
"github.com/ory/kratos/identity"
"os"
"testing"

"github.com/ory/kratos/identity"

"github.com/ory/kratos/cmd/identities"

"github.com/gofrs/uuid"
Expand Down
3 changes: 2 additions & 1 deletion identity/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ package identity

import (
"context"
"github.com/gobuffalo/pop/v6"
"reflect"
"time"

"github.com/gobuffalo/pop/v6"

"github.com/ory/kratos/ui/node"

"github.com/gofrs/uuid"
Expand Down
3 changes: 2 additions & 1 deletion identity/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
"database/sql/driver"
"encoding/json"
"fmt"
"github.com/gobuffalo/pop/v6"
"sync"
"time"

"github.com/gobuffalo/pop/v6"

"github.com/tidwall/sjson"

"github.com/tidwall/gjson"
Expand Down
5 changes: 3 additions & 2 deletions identity/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ package identity

import (
"context"
"reflect"

"github.com/ory/kratos/x"
"github.com/ory/x/otelx"
"reflect"

"github.com/ory/kratos/driver/config"

Expand Down Expand Up @@ -87,7 +88,7 @@ func (m *Manager) Create(ctx context.Context, i *Identity, opts ...ManagerOption
}

func (m *Manager) requiresPrivilegedAccess(ctx context.Context, original, updated *Identity, o *managerOptions) (err error) {
ctx, span := m.r.Tracer(ctx).Tracer().Start(ctx, "identity.Manager.requiresPrivilegedAccess")
_, span := m.r.Tracer(ctx).Tracer().Start(ctx, "identity.Manager.requiresPrivilegedAccess")
defer otelx.End(span, &err)

if !o.AllowWriteProtectedTraits {
Expand Down
1 change: 1 addition & 0 deletions identity/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package identity

import (
"context"

"github.com/ory/x/sqlxx"

"github.com/gofrs/uuid"
Expand Down
27 changes: 2 additions & 25 deletions persistence/sql/persister_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"context"
"database/sql"
"fmt"
"github.com/ory/kratos/credentialmigrate"
"strings"
"time"

"github.com/ory/kratos/credentialmigrate"

"go.opentelemetry.io/otel/attribute"

"github.com/ory/x/otelx"
Expand Down Expand Up @@ -282,30 +283,6 @@ func (p *Persister) createRecoveryAddresses(ctx context.Context, i *identity.Ide
return nil
}

func (p *Persister) findVerifiableAddresses(ctx context.Context, i *identity.Identity) error {
ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.findVerifiableAddresses")
defer span.End()

var addresses []identity.VerifiableAddress
if err := p.GetConnection(ctx).Where("identity_id = ? AND nid = ?", i.ID, p.NetworkID(ctx)).Order("id ASC").All(&addresses); err != nil {
return err
}
i.VerifiableAddresses = addresses
return nil
}

func (p *Persister) findRecoveryAddresses(ctx context.Context, i *identity.Identity) error {
ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.findRecoveryAddresses")
defer span.End()

var addresses []identity.RecoveryAddress
if err := p.GetConnection(ctx).Where("identity_id = ? AND nid = ?", i.ID, p.NetworkID(ctx)).Order("id ASC").All(&addresses); err != nil {
return err
}
i.RecoveryAddresses = addresses
return nil
}

func (p *Persister) CountIdentities(ctx context.Context) (int64, error) {
ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.CountIdentities")
defer span.End()
Expand Down
8 changes: 5 additions & 3 deletions persistence/sql/persister_identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (
"context"
"encoding/base64"
"fmt"
"github.com/ory/kratos/credentialmigrate"
"github.com/ory/kratos/driver"
"github.com/ory/kratos/identity"
"strconv"
"strings"
"testing"
"time"

"github.com/ory/kratos/credentialmigrate"
"github.com/ory/kratos/driver"
"github.com/ory/kratos/identity"

"github.com/ory/x/randx"

"github.com/tidwall/gjson"
Expand All @@ -24,6 +25,7 @@ import (
"github.com/ory/kratos/internal/testhelpers"

"github.com/bxcodec/faker/v3"

"github.com/ory/x/sqlxx"

"github.com/ory/x/errorsx"
Expand Down
3 changes: 2 additions & 1 deletion persistence/sql/persister_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ package sql
import (
"context"
"fmt"
"github.com/ory/x/otelx"
"time"

"github.com/ory/x/otelx"

"github.com/ory/kratos/identity"

"github.com/ory/x/pagination/keysetpagination"
Expand Down
3 changes: 2 additions & 1 deletion persistence/sql/persister_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ package sql
import (
"context"
"fmt"
"github.com/ory/kratos/identity"
"time"

"github.com/ory/kratos/identity"

"github.com/gofrs/uuid"

"github.com/ory/x/sqlcon"
Expand Down
3 changes: 2 additions & 1 deletion persistence/sql/persister_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ package sql_test
import (
"context"
"fmt"
"github.com/stretchr/testify/suite"
"os"
"path/filepath"
"sync"
"testing"

"github.com/stretchr/testify/suite"

"github.com/ory/x/dbal"

"github.com/ory/kratos/driver/config"
Expand Down
2 changes: 1 addition & 1 deletion session/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (h *Handler) whoami(w http.ResponseWriter, r *http.Request, ps httprouter.P
h.r.Writer().WriteError(w, r, ErrNoSessionFound.WithWrap(err))
return
}

var aalErr *ErrAALNotSatisfied
if err := h.r.SessionManager().DoesSessionSatisfy(r, s, c.SessionWhoAmIAAL(r.Context())); errors.As(err, &aalErr) {
h.r.Audit().WithRequest(r).WithError(err).Info("Session was found but AAL is not satisfied for calling this endpoint.")
Expand Down
3 changes: 2 additions & 1 deletion session/manager_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ package session

import (
"context"
"github.com/ory/x/otelx"
"net/http"
"net/url"
"time"

"github.com/ory/x/otelx"

"github.com/ory/x/randx"

"github.com/gorilla/sessions"
Expand Down
3 changes: 2 additions & 1 deletion session/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ package session

import (
"context"
"github.com/gobuffalo/pop/v6"
"time"

"github.com/gobuffalo/pop/v6"

"github.com/ory/kratos/identity"

"github.com/ory/x/pagination/keysetpagination"
Expand Down

0 comments on commit 79309dc

Please sign in to comment.