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

Merged
merged 5 commits into from
Nov 22, 2024
Merged

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

Deployment of preview was torn down

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.50%. Comparing base (785f2e6) to head (6a4f2f1).
Report is 90 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.52%   26.50%   -0.03%     
==========================================
  Files         377      377              
  Lines       27451    27476      +25     
==========================================
+ Hits         7282     7283       +1     
- Misses      19504    19528      +24     
  Partials      665      665              

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


🚨 Try these New Features:

@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
@anbraten anbraten requested a review from a team November 22, 2024 10:14
Copy link
Contributor

@pat-s pat-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's test it a bit before releasing. Good to have it in 3.0.

Thanks for all the work!

@pat-s pat-s merged commit 53d6421 into woodpecker-ci:main Nov 22, 2024
9 checks passed
@woodpecker-bot woodpecker-bot mentioned this pull request Nov 22, 2024
1 task
@woodpecker-bot woodpecker-bot mentioned this pull request Dec 14, 2024
1 task
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
5 participants