[PR #6223] [CLOSED] feat: add gin BasicAuth using OLLAMA_BASIC_AUTH_KEY setup in env #12058

Closed
opened 2026-04-12 23:48:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/6223
Author: @kemalelmizan
Created: 8/7/2024
Status: Closed

Base: mainHead: basic-auth


📝 Commits (4)

  • 1283f41 feat: add gin BasicAuth for username:password setup in env
  • 32e0dca change approach, set BasicAuthKey to only password instead of username:password pair, with ollama as user gin account
  • 62041fc Merge branch 'main' of github.com:ollama/ollama into basic-auth
  • 0910378 Merge branch 'main' of github.com:ollama/ollama into basic-auth

📊 Changes

3 files changed (+52 additions, -0 deletions)

View changed files

📝 envconfig/config.go (+3 -0)
📝 server/routes.go (+9 -0)
📝 server/routes_test.go (+40 -0)

📄 Description

This adds gin BasicAuth for username:password setup in env. I checked ollama server is using gin, and gin offers basic auth middleware. In this PR I attempted to use this middleware to validate request from using env var OLLAMA_BASIC_AUTH_KEY. Inputs, comments and feedback are welcome 🙏

Requested in https://github.com/ollama/ollama/issues/1053


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/6223 **Author:** [@kemalelmizan](https://github.com/kemalelmizan) **Created:** 8/7/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `basic-auth` --- ### 📝 Commits (4) - [`1283f41`](https://github.com/ollama/ollama/commit/1283f413f824a43b33c7c08e85320a6463fab1bb) feat: add gin BasicAuth for username:password setup in env - [`32e0dca`](https://github.com/ollama/ollama/commit/32e0dca416ce9ef1ec1067070bcb299bd24dacd3) change approach, set BasicAuthKey to only password instead of username:password pair, with ollama as user gin account - [`62041fc`](https://github.com/ollama/ollama/commit/62041fcff0c57030acbcd3e504d8933d04df5e51) Merge branch 'main' of github.com:ollama/ollama into basic-auth - [`0910378`](https://github.com/ollama/ollama/commit/091037857f4d5f0c15d8055b74792f74ef052b4a) Merge branch 'main' of github.com:ollama/ollama into basic-auth ### 📊 Changes **3 files changed** (+52 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `envconfig/config.go` (+3 -0) 📝 `server/routes.go` (+9 -0) 📝 `server/routes_test.go` (+40 -0) </details> ### 📄 Description This adds gin BasicAuth for username:password setup in env. I checked ollama server is using gin, and gin offers [basic auth middleware](https://gin-gonic.com/docs/examples/using-basicauth-middleware/). In this PR I attempted to use this middleware to validate request from using env var `OLLAMA_BASIC_AUTH_KEY`. Inputs, comments and feedback are welcome 🙏 Requested in https://github.com/ollama/ollama/issues/1053 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-12 23:48:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#12058