Skip to content

feat(mongo): add session store + rename colliding collections#159

Merged
coopernetes merged 1 commit intomainfrom
feat/mongodb-support
Apr 15, 2026
Merged

feat(mongo): add session store + rename colliding collections#159
coopernetes merged 1 commit intomainfrom
feat/mongodb-support

Conversation

@coopernetes
Copy link
Copy Markdown
Owner

Summary

  • Add MongoSessionRepository — a Spring Session SessionRepository backed directly by the raw mongo-java-driver (no spring-data-mongodb dep). Attributes are JDK-serialized into a BSON Binary; a TTL index on expireAt delegates idle-session cleanup to MongoDB. Wired via SessionStoreConfig under server.session-store=mongo, reusing the shared MongoClient from MongoStoreFactory so the connection pool is not duplicated.
  • Rename the two MongoDB collections that collided with upstream finos/git-proxy: usersproxy_users, pushesproxy_pushes. The other three collections (repo_permissions, access_rules, fetch_records) already had distinct names. From 1.0.0 onward these names are part of the stability contract.
  • Update docs: CONFIGURATION.md gains a Mongo session-store example and a new "coexisting with upstream" subsection that recommends a dedicated database while explaining the rename makes shared-database deployments no longer a correctness hazard.
  • Fix compose overlays: add GITPROXY_SERVER_SESSION_STORE to docker-compose.mongo.yml and docker-compose.postgres.yml so the session store actually engages (the previous GITPROXY_SESSION_STORE was missing the SERVER_ segment and was a no-op).

Closes #138
Closes #139

Test plan

  • ./gradlew :git-proxy-java-core:test :git-proxy-java-dashboard:test — full suites pass, including the new MongoSessionRepositoryIntegrationTest (6 cases: createSession, save/load round-trip, unknown id, delete, expired-session cleanup, save-updates-existing) running against a real Mongo 7.0 Testcontainer
  • Manual end-to-end via ./compose.sh ... --profile mongo with session-store: mongo: logged in, stopped and restarted the git-proxy-java container, re-opened the dashboard and remained authenticated
  • Verified via Mongo Express that session documents land in proxy_sessions with the expected shape (JDK-serialized attribute blob, 86400s default timeout, expireAt index with expireAfterSeconds: 0)

Adds MongoDB as a first-class session store backend and eliminates the
document-shape collision with the upstream Node.js git-proxy by renaming
the two colliding collections.

- MongoSessionRepository: Spring Session SessionRepository backed by the
  raw mongo-java-driver (no spring-data-mongodb). Attributes are
  JDK-serialized into a BSON Binary; a TTL index on expireAt delegates
  idle-session cleanup to MongoDB. Wired via SessionStoreConfig under
  server.session-store=mongo, reusing the shared MongoClient from
  MongoStoreFactory so the connection pool is not duplicated.
- Collection renames: users → proxy_users, pushes → proxy_pushes. The
  other three Mongo collections (repo_permissions, access_rules,
  fetch_records) already had distinct names. From 1.0.0 onward these
  names are part of the stability contract.
- Docs: CONFIGURATION.md gains a Mongo session-store example and a new
  "coexisting with upstream" subsection that recommends a dedicated
  database while explaining that the rename makes shared-database
  deployments no longer a correctness hazard.
- Compose overlays: add GITPROXY_SERVER_SESSION_STORE to the mongo and
  postgres overlays so the session store actually engages.

closes #138
closes #139
@coopernetes coopernetes merged commit d42c9fe into main Apr 15, 2026
9 checks passed
@coopernetes coopernetes deleted the feat/mongodb-support branch April 15, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: MongoDB-backed HTTP session store warn: detect and warn on finos/git-proxy MongoDB collection collision

1 participant