feat(auth): record how a session was authenticated
Refs #41, #45 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
ee09c497de
commit
30409697f7
2 files changed
+66
-15
No files matched your search
@@ -36,7 +36,7 @@ func newTestSessions(t *testing.T) (*Sessions, *time.Time) {
|
||||
|
||||
func mustCreate(t *testing.T, s *Sessions, user uuid.UUID) *Session {
|
||||
t.Helper()
|
||||
sess, err := s.Create(context.Background(), user, uuid.Nil, "")
|
||||
sess, err := s.Create(context.Background(), NewSession{UserID: user})
|
||||
if err != nil {
|
||||
t.Fatalf("Create() failed: %v", err)
|
||||
}
|
||||
@@ -48,7 +48,7 @@ func TestSessionRoundTrip(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
user, org := uuid.New(), uuid.New()
|
||||
|
||||
created, err := s.Create(ctx, user, org, "de")
|
||||
created, err := s.Create(ctx, NewSession{UserID: user, OrgID: org, Locale: "de", Method: MethodSSO, SSOOrg: org})
|
||||
if err != nil {
|
||||
t.Fatalf("Create() failed: %v", err)
|
||||
}
|
||||
@@ -56,7 +56,7 @@ func TestSessionRoundTrip(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Get() failed: %v", err)
|
||||
}
|
||||
if got.UserID != user || got.OrgID != org || got.Locale != "de" || got.CSRF != created.CSRF {
|
||||
if got.UserID != user || got.OrgID != org || got.Locale != "de" || got.Method != MethodSSO || got.SSOOrg != org || got.CSRF != created.CSRF {
|
||||
t.Errorf("Get() = %+v, want user %v org %v locale de csrf %q", got, user, org, created.CSRF)
|
||||
}
|
||||
for token, want := range map[string]bool{created.CSRF: true, "": false, "x": false} {
|
||||
|
||||
Reference in new issue
Block a user