Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Issue 1655: Add authorize credentials list and removal on organization under SAML#1676

Open
AlexandreODelisle wants to merge 13 commits into
PyGithub:mainfrom
AlexandreODelisle:master
Open

Issue 1655: Add authorize credentials list and removal on organization under SAML#1676
AlexandreODelisle wants to merge 13 commits into
PyGithub:mainfrom
AlexandreODelisle:master

Conversation

@AlexandreODelisle
Copy link
Copy Markdown

@AlexandreODelisle AlexandreODelisle commented Aug 27, 2020

The objective is to implement the two available methods to list and remove credential ids linked to an Organization that have been Authorize by the user to act as authentication on the Organization.

Added the two endpoints available under the Organization on the GitHub API
https://developer.github.com/v3/orgs/#list-saml-sso-authorizations-for-an-organization
https://developer.github.com/v3/orgs/#remove-a-saml-sso-authorization-for-an-organization

Also needed to create a new Object to handle the return payload of the API since the raw data differs from the Authorization Object..

Added one unit test to list the credentials under an Organization, but I do not have a Organization that is SAML protected that I can use to display in the unittest.. So I added on a personnal organization with no SAML, so an empty List is validated.

#1655

Copy link
Copy Markdown
Collaborator

@s-t-e-v-e-n-k s-t-e-v-e-n-k left a comment

Choose a reason for hiding this comment

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

It's a good start, but requires more before merging. Thanks!

Comment thread github/AuthorizationOrganization.pyi Outdated
@property
def token_last_eight(self) -> str: ...
@property
def scopes(self) -> list: ...
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

List[] including the types, such as List[str], please.

Comment thread tests/Organization1655.py Outdated
from . import Framework


class Organization1655(Framework.TestCase):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we have a better name, such as OrganizationAuthorization?

Comment thread tests/Organization1655.py Outdated

def testGetCredentialsAuth(self):
credentials_list = self.org.get_credential_authorizations()
self.assertListEqual(credentials_list, [])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You also need to test delete, but I'd also prefer we return something so we can verify the returned attributes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I will need to wait in that case, since the only Organization I have available at the moment,with SAML SSO, is private. I can not display the credentials list in the --record. I will ask GitHub sales for a trial for Entreprise Org hosted on GitHub.

Comment thread tests/Organization1655.py Outdated

############################ Copyrights and license ############################
# #
# Copyright 2020 Alexandre Delisle <alexodelisle @gmail.com> #
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

space in the email address.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 21, 2020

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.69%. Comparing base (7ec4f15) to head (a699832).
Report is 371 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1676      +/-   ##
==========================================
+ Coverage   98.67%   98.69%   +0.02%     
==========================================
  Files          48       49       +1     
  Lines        2561     2609      +48     
==========================================
+ Hits         2527     2575      +48     
  Misses         34       34              

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

@AlexandreODelisle
Copy link
Copy Markdown
Author

@s-t-e-v-e-n-k , finally got the coverage to pass. I think I got all the reviews, since there is now test for the Attributes and repr, also got an Enterprise Team so the credential list also has non redacted information.
Thanks

Copy link
Copy Markdown
Collaborator

@s-t-e-v-e-n-k s-t-e-v-e-n-k left a comment

Choose a reason for hiding this comment

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

This is looking like a great start, I have some concerns.

Comment thread github/Organization.py
def get_credential_authorizations(self):
"""
:calls: `GET /orgs/:org/credential-authorizations <https://developer.github.com/v3/orgs>`_
:rtype: list
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

list of :class:github.AuthorizationOrganization.AuthorizationOrganization_

(I'm not certain of the formatting, but roughly that, please)

Comment thread github/Organization.pyi
def remove_credential_authorization(
self,
credential_id: Union[int, _NotSetType] = ...,
) -> None: ...
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The return type is not None.


class AuthorizationOrganization(github.GithubObject.NonCompletableGithubObject):
"""
This class represents a credential id.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd like more detail here, along with a link to the documentation of the object.

@stale
Copy link
Copy Markdown

stale Bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the stale label Jan 8, 2022
@alexef
Copy link
Copy Markdown

alexef commented Mar 14, 2022

Any chance this gets some traction?

@stale stale Bot removed the stale label Mar 14, 2022
@EnricoMi
Copy link
Copy Markdown
Collaborator

@AlexandreODelisle this is awesome, can we get this over the finish line? Happy to approve once review comments are resolved.

@alambike
Copy link
Copy Markdown

alambike commented Sep 8, 2023

Is it possible to do something with this to resume this pull request and be able to have this functionality in PyGithub? Is it correct to create a new PR with these changes to be able to work on it? cc/ @EnricoMi , @AlexandreODelisle

@AlexandreODelisle
Copy link
Copy Markdown
Author

Please feel free to go ahead with it.

Personally, I am no longer using SAML SSO on a regular basis for authentication, and also another py package.

I am sorry for the delay in response.

@github-actions github-actions Bot added the ⭐ top pull request Top pull request. label Sep 19, 2024
@lionas32
Copy link
Copy Markdown

Picked this up here: #3392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⭐ top pull request Top pull request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants