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

GitHubOAuthenticator: another way to check org_whitelist #226

Closed
xuwaters opened this issue Nov 8, 2018 · 3 comments
Closed

GitHubOAuthenticator: another way to check org_whitelist #226

xuwaters opened this issue Nov 8, 2018 · 3 comments

Comments

@xuwaters
Copy link
Contributor

xuwaters commented Nov 8, 2018

Currently the algorithm of checking organization whitelist is to call
api /orgs/%s/members which requires the organization members to be publicly visible.

I think we can call api /user/orgs to get current user's orgs and check whether the login field of each org item is in the configured org_whitelist

Pros and Cons of this method:
Pros:

  • only one api call (/user/orgs) to check user's membership instead of call (/orgs/%s/members) for each configured organization
  • even organization members is not publicly visible, user's membership of organization can be checked correctly

Cons:

  • require permission of user scope instead of read:user scope of the login user
@xuwaters
Copy link
Contributor Author

xuwaters commented Nov 8, 2018

Sorry, I don't think user scope is a good idea, which requires read/write access to profile info.

@xuwaters xuwaters closed this as completed Nov 8, 2018
@manics
Copy link
Member

manics commented Nov 8, 2018

You can already get access to private GitHub org memberships by changing .scope. The exact rules are a bit complicated though, for some discussion see:

@xuwaters
Copy link
Contributor Author

xuwaters commented Nov 8, 2018

Thank you @manics
I followed your links and tested read:org scope, it works.

And I find another api GET /orgs/:org/members/:username,
I think this api is more efficient than get all members and check member login one by one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants