-
Notifications
You must be signed in to change notification settings - Fork 0
Switch to reader and writer auth #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,41 @@ | ||
| {{- if .Values.enabled }} | ||
| # MinIO storage credentials | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ .Release.Name }}-secrets | ||
| name: {{ .Release.Name }}-minio-secrets | ||
| labels: | ||
| app: {{ .Release.Name }} | ||
| type: Opaque | ||
| data: | ||
| minio-access-key: {{ "minioadmin" | b64enc | quote }} | ||
| minio-secret-key: {{ "minioadmin" | b64enc | quote }} | ||
| {{- if .Values.auth.enabled }} | ||
| cache-password: {{ .Values.auth.password | b64enc | quote }} | ||
| {{- end }} | ||
| {{- if .Values.auth.enabled }} | ||
| --- | ||
| # Read-only cache credentials (for Theia IDE / students) | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ .Release.Name }}-cache-reader | ||
| labels: | ||
| app: {{ .Release.Name }} | ||
| role: reader | ||
| type: kubernetes.io/basic-auth | ||
| data: | ||
| username: {{ .Values.auth.reader.username | b64enc | quote }} | ||
| password: {{ .Values.auth.reader.password | b64enc | quote }} | ||
| --- | ||
| # Read-write cache credentials (for CI/CD, admin, cache pre-warming) | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ .Release.Name }}-cache-writer | ||
| labels: | ||
| app: {{ .Release.Name }} | ||
| role: writer | ||
| type: kubernetes.io/basic-auth | ||
| data: | ||
| username: {{ .Values.auth.writer.username | b64enc | quote }} | ||
| password: {{ .Values.auth.writer.password | b64enc | quote }} | ||
| {{- end }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,12 +8,21 @@ import ( | |||||||||
| "github.com/kevingruber/gradle-cache/internal/config" | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| // BasicAuth creates a middleware that validates HTTP Basic Authentication. | ||||||||||
| type userCredential struct { | ||||||||||
| Password string | ||||||||||
| Role string | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // BasicAuth creates a middleware that validates HTTP Basic Authentication | ||||||||||
| // and stores the user's role in the gin context. | ||||||||||
|
||||||||||
| // BasicAuth creates a middleware that validates HTTP Basic Authentication | |
| // and stores the user's role in the gin context. | |
| // CacheAuth creates a middleware that validates HTTP Basic Authentication | |
| // with role-based access control (reader/writer). |
🤖 Prompt for AI Agents
In `@src/internal/middleware/auth.go` around lines 11 - 12, Update the stale doc
comment that references BasicAuth to correctly describe CacheAuth: find the
top-of-file or above the CacheAuth function declaration (symbol CacheAuth) in
auth.go and replace "BasicAuth" with "CacheAuth" and adjust wording if necessary
so the comment accurately describes that the middleware validates cached
authentication and stores the user's role in the gin context.
Uh oh!
There was an error while loading. Please reload this page.