Code Monkey home page Code Monkey logo

Comments (8)

chadlwilson avatar chadlwilson commented on August 23, 2024 1

https://build.gocd.org also uses this plugin so if I remember I can check for our use case during the next brownout on the 8th as well (assuming the API isn't fixed by then!). Looks like we use roughly the same (simple) config as yours.

from github-oauth-authorization-plugin.

chadlwilson avatar chadlwilson commented on August 23, 2024

Hi there - are you able to help report

  • any stacktraces from the plugin logs to show which GoCD functionality was/is affected
  • confirm the version of the plugin you are using
  • confirm the configuration you are using (redacted if necessary, for the Authorization and the Roles) that should be able to replicate this

This information will make it easier to test from GoCD perspective, even if we are dependent on a change in the API library. Looks like maybe just the below, but would be good to confirm

private boolean checkTeamMembershipUsingPersonalAccessToken(GHUser ghUser, AuthConfig authConfig, Map<String, List<String>> organizationAndTeamsAllowed) throws IOException {
final GitHub gitHubForPersonalAccessToken = clientBuilder.from(authConfig.gitHubConfiguration());
for (String organizationName : organizationAndTeamsAllowed.keySet()) {
final GHOrganization organization = gitHubForPersonalAccessToken.getOrganization(organizationName);
if (organization != null) {
final List<String> allowedTeamsFromRole = organizationAndTeamsAllowed.get(organizationName);
final Map<String, GHTeam> teamsFromGitHub = organization.getTeams();
for (GHTeam team : teamsFromGitHub.values()) {
if (allowedTeamsFromRole.contains(team.getName().toLowerCase()) && team.hasMember(ghUser)) {
LOG.info(format("[MembershipChecker] User `{0}` is a member of `{1}` team.", ghUser.getLogin(), team.getName()));
return true;
}
}
}
}

from github-oauth-authorization-plugin.

pedrocarrico avatar pedrocarrico commented on August 23, 2024

hi @chadlwilson

Right now I won't be able to replicate because the brownout from Github only lasted for 12h starting on 2pm UTC yesterday.

  • any stacktraces from the plugin logs to show which GoCD functionality was/is affected

There's no errors or stack traces (but I was running with no debug) but what happened was that users were not assigned to their correspondent roles in their team.

What I saw in the logs before the brownout was this:

[MembershipChecker] User `<redacted>` is a member of `<redacted>` organization.
2022-03-01 12:07:22,743 INFO  [qtp1382469079-25] GitHubPlugin:72 - [Authenticate] User `<redacted>` authenticated successfully.
2022-03-01 12:07:23,440 INFO  [qtp1382469079-25] GitHubPlugin:72 - [MembershipChecker] User `<redacted>` is a member of `developers` team.

And during the brownout:

2022-03-01 15:41:22,338 INFO  [qtp1382469079-26] GitHubPlugin:72 - [MembershipChecker] User `<redacted>` is a member of `<redacted>` organization.
2022-03-01 15:41:22,344 INFO  [qtp1382469079-26] GitHubPlugin:72 - [Authenticate] User `<redacted>` authenticated successfully.
  • confirm the version of the plugin you are using

I'm using the latest version in the releases page (version 3.2.0-135).

  • confirm the configuration you are using (redacted if necessary, for the Authorization and the Roles) that should be able to replicate this

Just configured the specific team for the role to apply like in this screenshot (organization is redacted):
Screenshot 2022-03-02 at 12 34 20

Yup, it also seems to me that this plugin is just dependent from a change in the API library as well.

Thanks for helping out.

from github-oauth-authorization-plugin.

chadlwilson avatar chadlwilson commented on August 23, 2024

Right, ok thanks, that's helpful!

Perhaps no logs because it's only the team.hasMember check that is failing. The way that code is written inside the API I think it just catches all exceptions and assumes false regardless of cause.

from github-oauth-authorization-plugin.

chadlwilson avatar chadlwilson commented on August 23, 2024

See v3.3.0-146 - new API version seems to work fine.

from github-oauth-authorization-plugin.

chadlwilson avatar chadlwilson commented on August 23, 2024

https://github.blog/changelog/2022-03-04-paused-sunset-of-deprecated-teams-api-endpoints/ FWIW. Sigh :-)

from github-oauth-authorization-plugin.

pedrocarrico avatar pedrocarrico commented on August 23, 2024

@chadlwilson oh well... Since then I've updated the plugin and it seems to be working alright.

Thanks for the heads up!
BTW what would be the best option to contact you directly with some quick questions regarding GoCD?

from github-oauth-authorization-plugin.

chadlwilson avatar chadlwilson commented on August 23, 2024

Feel free to use the Google Groups at https://groups.google.com/forum/#!forum/go-cd or GitHub discussions at https://github.com/gocd/gocd/discussions if it's general questions potentially of relevance to others.

from github-oauth-authorization-plugin.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.