Skip to content

Commit

Permalink
session: Inject Identity Traits JSON Schema
Browse files Browse the repository at this point in the history
Closes #189
  • Loading branch information
aeneasr committed Jan 28, 2020
1 parent 7c2989f commit 3a4c5ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions persistence/sql/persister_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ func (p *Persister) GetSession(ctx context.Context, sid uuid.UUID) (*session.Ses
if err := p.c.Eager().Find(&s, sid); err != nil {
return nil, sqlcon.HandleError(err)
}
if err := p.injectTraitsSchemaURL(s.Identity); err != nil {
return nil, err
}
return &s, nil
}

Expand Down
2 changes: 2 additions & 0 deletions session/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ func TestPersister(p interface {
actual, err := p.GetSession(context.Background(), expected.ID)
require.NoError(t, err)
assert.Equal(t, expected.Identity.ID, actual.Identity.ID)
assert.NotEmpty(t, actual.Identity.TraitsSchemaURL)
assert.NotEmpty(t, actual.Identity.TraitsSchemaID)
assert.Equal(t, expected.ID, actual.ID)
assert.EqualValues(t, expected.ExpiresAt.Unix(), actual.ExpiresAt.Unix())
assert.Equal(t, expected.AuthenticatedAt.Unix(), actual.AuthenticatedAt.Unix())
Expand Down

0 comments on commit 3a4c5ad

Please sign in to comment.