tangled
alpha
login
or
join now
evan.jarrett.net
/
at-container-registry
66
fork
atom
A container registry that uses the AT Protocol for manifest storage and S3 for blob storage.
atcr.io
docker
container
atproto
go
66
fork
atom
overview
issues
1
pulls
pipelines
try and persist session tokens
evan.jarrett.net
4 months ago
4667d34b
4d5182e2
verified
This commit was signed with the committer's
known signature
.
evan.jarrett.net
SSH Key Fingerprint:
SHA256:bznk0uVPp7XFOl67P0uTM1pCjf2A4ojeP/lsUE7uauQ=
1/1
tests.yml
success
1m 16s
+18
1 changed file
expand all
collapse all
unified
split
pkg
auth
oauth
refresher.go
+18
pkg/auth/oauth/refresher.go
···
134
134
return nil, fmt.Errorf("failed to resume session: %w", err)
135
135
}
136
136
137
137
+
// Set up callback to persist token updates to SQLite
138
138
+
// This ensures that when indigo automatically refreshes tokens,
139
139
+
// the new tokens are saved to the database immediately
140
140
+
session.PersistSessionCallback = func(callbackCtx context.Context, updatedData *oauth.ClientSessionData) {
141
141
+
if err := r.app.GetClientApp().Store.SaveSession(callbackCtx, *updatedData); err != nil {
142
142
+
slog.Error("Failed to persist OAuth session update",
143
143
+
"component", "oauth/refresher",
144
144
+
"did", did,
145
145
+
"sessionID", sessionID,
146
146
+
"error", err)
147
147
+
} else {
148
148
+
slog.Debug("Persisted OAuth token refresh to database",
149
149
+
"component", "oauth/refresher",
150
150
+
"did", did,
151
151
+
"sessionID", sessionID)
152
152
+
}
153
153
+
}
154
154
+
137
155
// Cache the session
138
156
r.mu.Lock()
139
157
r.sessions[did] = &SessionCache{