-
Notifications
You must be signed in to change notification settings - Fork 751
feat: allow one app to authenticate #1053
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
Conversation
@bitwiseman I started this to allow one app to authenticate against multiple orgs, and eventually try to solve JENKINS-62220 /cc @nrayapati |
against multiple app installations and orgs by inspecting the url that it tries to access
See jenkinsci/github-branch-source-plugin#290 (comment) for background. You are not going to be able to use the App credentials as generic username/password credentials, for example in a |
@@ -17,47 +23,75 @@ | |||
*/ | |||
public class OrgAppInstallationAuthorizationProvider extends GitHub.DependentAuthorizationProvider { | |||
|
|||
private final String organizationName; | |||
private static final Pattern pattern = Pattern.compile("/repos/(.*)/.*"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This provider has a reference to a GitHub
instance, meaning we can get the base URL using getApiUrl()
and then do simpler string matching. I'd rather not regex if we don't have to.
Also do GitHub App tokens only apply to /repos/*
endpoints or can they interact with other endpoints? I'm pretty sure there are even if they are not accessed by Jenkins.
@carlossg In Jenkins Pipeline any one job is only ever dealing with one Org. The You could implement a solution and test it here. The testing cycle will be faster and allow greater coverage. But this seems like it could get pretty hairy. If you implement it here, I would expect it to be implemented in a manner that would work in general, not just in the Jenkins case. Hacking |
Not currently, but we could define something along the lines of interface Contexualized<T extends Credentials> extends Credentials {
T contextualize(Item context);
} Have not studied in detail what would need to be patched to make this work. |
@carlossg Do you plan to continue with this? |
Description
allow one app to authenticate
against multiple app installations and orgs
by inspecting the url that it tries to access
Before submitting a PR:
We love getting PRs, but we hate asking people for the same basic changes every time.
master
. Create your PR from that branch.mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI.When creating a PR: