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

Add SourceHut (sr.ht) provider #2359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bitfehler
Copy link
Contributor

Description

This adds a provider for SourceHut instances, defaulting to the main public instance at sr.ht, but custom instances can be used by overriding the usual URLs (see added documentation).

Motivation and Context

Full disclosure: I am affiliated with SourceHut. Nevertheless, I'd simply like to use oauth2-proxy with sr.ht accounts for one of my projects, and I think others might benefit from this as well.

How Has This Been Tested?

I have tested this against both the public instance as well as a local development instance.

Checklist:

  • My change requires a change to the documentation or CHANGELOG.
  • [?] I have updated the documentation/CHANGELOG accordingly.
  • I have created a feature (non-master) branch for my PR.
  • I have written tests for my code changes.

I added documentation, not sure about the Changelog. Let me know if you'd like me to put something in there...

providers/srht.go Outdated Show resolved Hide resolved
providers/srht.go Outdated Show resolved Hide resolved
providers/srht.go Outdated Show resolved Hide resolved
s.Email = email

username, err := json.Get("data").Get("me").Get("username").String()
if err == nil {
Copy link
Member

Choose a reason for hiding this comment

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

So errors / missing usernames are going to be ignored? Shouldn't we at least log something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, not sure what I had in mind there. I made it a hard error, for if a response is received but it does not contain a username, something is certainly amiss.

@bitfehler
Copy link
Contributor Author

As I just learned from #2357 I guess I should add an item to the Changelog. However, to avoid a merge conflict, I'll wait until you merged that one, so I can rebase this branch.

@tuunit
Copy link
Member

tuunit commented Jan 8, 2024

Hi @bitfehler does sourcehut only offer a oauth2 integration or oidc as well?

@bitfehler
Copy link
Contributor Author

Hi @bitfehler does sourcehut only offer a oauth2 integration or oidc as well?

There is no OIDC right now.

@bitfehler
Copy link
Contributor Author

Added a changelog, now that the potentially conflicting branch was merged. Let me know if there is anything else I was missing!

@tuunit
Copy link
Member

tuunit commented Jan 9, 2024

Hi @bitfehler does sourcehut only offer a oauth2 integration or oidc as well?

There is no OIDC right now.

Thanks for the clarification. I'll check the code once more when I find the time. Probably on the weekend.

@bitfehler bitfehler force-pushed the srht branch 2 times, most recently from 521b961 to bb0a911 Compare February 9, 2024 09:23
@bitfehler
Copy link
Contributor Author

Fixed the outstanding CI failures, sorry for the delay.

Copy link
Contributor

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.

@github-actions github-actions bot added the Stale label Apr 10, 2024
@bitfehler
Copy link
Contributor Author

@tuunit gentle ping 🙂

Copy link
Contributor

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.

@github-actions github-actions bot added the Stale label Jun 10, 2024
@github-actions github-actions bot closed this Jun 17, 2024
@tuunit tuunit reopened this Jun 23, 2024
@github-actions github-actions bot removed the Stale label Jun 25, 2024
Copy link
Contributor

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.

@github-actions github-actions bot added the Stale label Aug 27, 2024
@github-actions github-actions bot closed this Sep 4, 2024
@tuunit tuunit reopened this Sep 4, 2024
@tuunit tuunit removed the Stale label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants