OAuth2 configuration example #705
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Question
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Help wanted
Status
In progress
Status
Need More Info
Status
Needs feedback
No milestone
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
forgejo-helm/forgejo-helm#705
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I would like to configure https://code.forgejo.org/f3/f3-forgejo/raw/branch/main/helm/a.yml so that it allows registration from code.forgejo.org.
https://code.forgejo.org/forgejo-helm/forgejo-helm#oauth2-settings
I think I should do something like:
What I'm not sure about is where I should get
keyandsecret? https://forgejo.org/docs/latest/admin/oauth2-provider/ does not seem to document that. https://forgejo.org/docs/latest/user/oauth2-provider/ looks more relevant and the example at https://forgejo.org/docs/latest/user/oauth2-provider/#examples is what I think is good for that.But ... should I really do that with a user that I create myself? Isn't it better if an admin of code.forgejo.org does it instead?
Also, how can the icon be set?
An alternative is to follow the steps manually as explained in the documentation. But it would be interesting to do that with the Helm itself for automation.
https://code.forgejo.org/forgejo-helm/forgejo-helm#oauth2-settings
you should create a kubernetes secret manually and reference it from the yaml via
existingSecretthe oauth settings will be configured via
gitea admin auth add-oauthandgitea admin auth update-oauthhttps://forgejo.org/docs/latest/admin/command-line/#admin-auth-add-oauth
so you need to the proper option names freom the cli without the
--prefix.if [[ -z "${AUTH_ID}" ]]; thenecho "No oauth configuration found with name '${OAUTH_NAME}'. Installing it now..."gitea admin auth add-oauth {{- include "gitea.oauth_settings" (list $idx $value) | indent 1 }}echo '...installed.'elseecho "Existing oauth configuration with name '${OAUTH_NAME}': '${AUTH_ID}'. Running update to sync settings..."gitea admin auth update-oauth --id "${AUTH_ID}" {{- include "gitea.oauth_settings" (list $idx $value) | indent 1 }}echo '...sync settings done.'fi{{- define "gitea.oauth_settings" -}}{{- $idx := index . 0 }}{{- $values := index . 1 }}{{- if not (hasKey $values "key") -}}{{- $_ := set $values "key" (printf "${GITEA_OAUTH_KEY_%d}" $idx) -}}{{- end -}}{{- if not (hasKey $values "secret") -}}{{- $_ := set $values "secret" (printf "${GITEA_OAUTH_SECRET_%d}" $idx) -}}{{- end -}}{{- range $key, $val := $values -}}{{- if ne $key "existingSecret" -}}{{- printf "--%s %s " ($key | kebabcase) ($val | quote) -}}{{- end -}}{{- end -}}{{- end -}}{{- define "gitea.public_protocol" -}}{{- if and .Values.ingress.enabled (gt (len .Values.ingress.tls) 0) -}}https{{- else -}}{{ .Values.gitea.config.server.PROTOCOL }}{{- end -}}{{- end -}}so something like this (you can use caml-case, it will be converted automatically)
you need to create an oauth application
https://code.forgejo.org/user/settings/applications
@earl-warren i can also configure a new app on our forgejo org at https://codeberg.org/org/forgejo/settings/applications
There's one flag that I can't quite wrap my head around how to use it:
--skip-local-2fa. It doesn't take a value, so how does one provide it through the Helm chart?@kernald wrote in #705 (comment):
skipLocal-2fa: trueor
skip-local-2fa: trueThe chart is smart enough to know it's a flag option
@limiting-factor are you still interested to configure oauth on f3 test instance? i can do that for you, especially configure the secret in a k8s secret
I'm good with that, feel free to experiment with it. Until the end of next week I'll only use a local instance for F3 development and will not be disturbed if a.forgefriends.org is down.