Skip to content
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

Support github refresh tokens #3811

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

anbraten
Copy link
Member

@anbraten anbraten commented Jun 21, 2024

closes #3804

Changes

  • add expiry when creating user
  • rename user.Token to AccessToken
  • rename user.Secret to RefreshToken
  • add support for github refresh tokens, ignore them if not provided as using an oauth app
  • add expiry to gitlab login (prevent direct refresh)

@anbraten anbraten added bug Something isn't working server forge/github github forge related build_pr_images If set, the CI will build images for this PR and push to Dockerhub labels Jun 21, 2024
@woodpecker-bot
Copy link
Collaborator

woodpecker-bot commented Jun 22, 2024

Deploying preview to https://woodpecker-ci-woodpecker-pr-3811.surge.sh

Copy link

codecov bot commented Jun 22, 2024

Codecov Report

Attention: Patch coverage is 31.09244% with 82 lines in your changes missing coverage. Please review.

Project coverage is 26.17%. Comparing base (c10d0e0) to head (03a87a0).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
server/forge/github/github.go 5.40% 35 Missing ⚠️
server/forge/gitlab/gitlab.go 21.05% 15 Missing ⚠️
server/forge/forgejo/forgejo.go 42.10% 11 Missing ⚠️
server/forge/gitea/gitea.go 42.10% 11 Missing ⚠️
server/forge/addon/args.go 0.00% 4 Missing ⚠️
...r/forge/bitbucketdatacenter/bitbucketdatacenter.go 33.33% 2 Missing ⚠️
server/forge/bitbucketdatacenter/convert.go 0.00% 2 Missing ⚠️
server/forge/common/utils.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3811      +/-   ##
==========================================
- Coverage   26.20%   26.17%   -0.03%     
==========================================
  Files         373      373              
  Lines       27038    27063      +25     
==========================================
+ Hits         7084     7085       +1     
- Misses      19298    19322      +24     
  Partials      656      656              
Flag Coverage Δ
26.17% <31.09%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anbraten anbraten added this to the 3.0.0 milestone Jul 25, 2024
@eliasscosta
Copy link
Contributor

Could you update the branch and generate a new version of this PR? I want to test it.

@eliasscosta
Copy link
Contributor

eliasscosta commented Sep 24, 2024

I ran a test with this version, using a GitHub APP and some permissions need to be set up for correct integration.

Maybe, we need more permission, but the simplest usage, activation, push, and deployment work as expected, I will continue testing the refresh token usage.

Repositories:

  • Webhook - Read and Write
  • Deployments - Read and Write
  • Checks - Read and Write
  • Status - Read and Write

Organization

  • Members - Read

Accounts

  • Email address - Read

I don't know why after I moved to the GitHub App, the status on GitHub got my profile picture.
image

@6543
Copy link
Member

6543 commented Sep 24, 2024

it looks ready why is it still a draft?

@anbraten
Copy link
Member Author

anbraten commented Sep 24, 2024

I think the code is ready. Haven't tested it by myself yet.

@anbraten anbraten marked this pull request as ready for review September 24, 2024 17:02
@anbraten anbraten requested a review from a team September 27, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build_pr_images If set, the CI will build images for this PR and push to Dockerhub forge/github github forge related server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unauthorized user tokens preventing builds from running when protected by SAML enforcement
4 participants