-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Add Gitea provider, fixes #1636 #1759
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
Add Gitea provider, fixes #1636 #1759
Conversation
|
Ok now the tests are working and there is no more cruft hanging around. I think all that needs to be done is:
|
|
As far as I'm concerned the code is done and was tested with most possible combinations of gitea parameters being set and unset. My updated docker-compose used to test: version: '3'
services:
whoami:
image: traefik/whoami
container_name: whoami
restart: unless-stopped
ports:
- 80:80
gitea:
image: gitea/gitea
container_name: gitea
ports:
- 3000:3000
- 2222:22/tcp
volumes:
- ./gitea:/data
restart: unless-stopped
oauth-proxy:
image: test/oauth2-proxy
container_name: oauth-proxy
ports:
- 8000:8000
environment:
- OAUTH2_PROXY_HTTP_ADDRESS=0.0.0.0:8000
- OAUTH2_PROXY_REVERSE_PROXY=false
- OAUTH2_PROXY_EMAIL_DOMAINS=*
- OAUTH2_PROXY_COOKIE_EXPIRE=0h0m5s
- OAUTH2_PROXY_REDIRECT_URL=http://localhost:8000/oauth2/callback
- OAUTH2_PROXY_UPSTREAMS=http://whoami:80
- OAUTH2_PROXY_PROVIDER=gitea
- OAUTH2_PROXY_PROVIDER_DISPLAY_NAME=Gitea
- OAUTH2_PROXY_LOGIN_URL=http://localhost:3000/login/oauth/authorize
# Has to use docker network instead of localhost
- OAUTH2_PROXY_REDEEM_URL=http://gitea:3000/login/oauth/access_token
- OAUTH2_PROXY_VALIDATE_URL=http://gitea:3000/api/v1/user
- OAUTH2_PROXY_CLIENT_ID=ded3e589-4c0d-44f2-86da-894086394c0e
- OAUTH2_PROXY_CLIENT_SECRET=gto_wb4ki7w6vo4fwsmdcavwlbsqjfi6ntsmpl5zpfouh365om3uweuq
- OAUTH2_PROXY_COOKIE_SECRET=1m0NiLTieZBo_yNjf6Zcv8XJ0jDey-4Jl_4rmPydlGI=
- OAUTH2_PROXY_COOKIE_SECURE=false
- OAUTH2_PROXY_GITEA_USERS=898,899,900,901,902,903,904,905 # These are usernames not ids
# - OAUTH2_PROXY_GITEA_ORG=privateorg
# - OAUTH2_PROXY_GITEA_TEAM=teamA
- OAUTH2_PROXY_GITEA_REPO=publicorg/publicrepo
restart: unless-stopped |
|
The only thing missing, as far as I can tell, is changes to the alpha config |
…or building api requests getApiBase is used.
851cce0 to
9d76502
Compare
|
Is there anything I can do to get this merged? |
|
I am reluctant to accept new providers at the moment for several reasons:
Once we have the new provider implementations in place and we get things a little more sorted, I may revisit this decision, but for now, please maintain this on your own fork |
|
Thanks for the response. I hope the rewrite goes well and Gitea will get supported in the future. It would be great for the selfhosted community. |
I'd love to be able to support it in the future yes, but right now we can't commit to supporting new providers when the existing collection isn't sustainable for us. I've finished my travels and just about settled post moving house now so hoping to get back into the project a bit more this year |
|
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
|
I'm interested in this. @JoelSpeed said
I'd argue that Gitea is more than just a lesser-known site: For self-hosting, it's one of the main competitors to Gitlab CE, and there is a number of Gitea cloud providers; e.g. Codeberg Similar to Gitlab, Gitea can provide easy user and auth management for applications. Other than Gitlab, it's light on memory and there is a fully libre option (Forgejo). Please consider re-opening this, or at least adding the hot-fix #1996 |
Description
I copied
providers/github.goandproviders/github_test.goto makeproviders/gitea.goandgitea_test.go.gitea_test.gois still unchanged.The Gitea Provider now takes
/api/v1/useras ValidateURL. The Base URL for making API requests gets created by taking the dir of the supplied URL.Motivation and Context
This change fixes #1636 by taking
/api/v1/useras ValidateURL instead of/api/v1, because Gitea returns 404 for/api/v1.There is a lot of cruft still hanging around in providers/gitea.go. I don't know what is needed and what is not. I also haven't fixed all comments in
providers/gitea.go.providers/gitea_test.gostill has to be changed sogo testworks again.I got time the next few weeks so I am willing to finish the Gitea provider, if you give me some directions.
Also this is my first time programming in Golang, so feel free to criticize me.
How Has This Been Tested?
I built the docker image and tested the login workflow with the following docker-compose.
docker buildx build --platform linux/amd64 -t test/oauth2-proxy .Checklist: