-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 query that lists SAML external identities for an Organization #168
Comments
This query was super helpful for us as we're primarily using v3 and couldn't see a way to do this there. I found the token needs |
This query was also super helpful for us - v3 provides their SCIM endpoint (https://developer.github.com/v3/scim/) which gets us close, but does not provide a true way to tie a GitHub identity to a SAML identity. Using this query in v4 we are able to pull our user's verified domain email addresses and associate it to their github handle, making our notification process a lot easier. |
@AjkayAlan, I'm testing on the same where the email address for SAML authentication is different from github registered email address, can you please share us the query to trigger in GraphQL |
@kamaltejaaol Unfortunately my org policy does not allow me to share code easily, specifically code I developed for our organization. What we ended up doing was using the query provided by @osowskit above to get the SAML nameId, which corresponded to our user's primary email address associated to their enterprise account (the same address we would send emails on). Additionally, the query above gets you the user login, which is the actual github login of the associated user. From there, you can just make a key value pair list of github login to enterprise email address. Once you have that, you should be off to the races. In our case, we had to revoke PAT and SSH keys over a specified age limit using the credential authorizations API (https://developer.github.com/v3/orgs/#list-credential-authorizations-for-an-organization). That returns the github login, which we then look up against the list of login/email kvp's. From there, we were able to notify the users in advance that they needed to rotate their credentials to avoid disruption. |
@AjkayAlan, i understand the corporate security policies, but thanks for giving the detailed explanation, i will try to work it out. Thanks again. |
Hi, @osowskit below is the return. |
Just did a bit more research on the issue, could it be related to SCIM is not enabled? |
I am experiencing the same
So I'm wondering:
Also, this query has been added to the examples. |
What I've learned since the above:
|
https://gist.github.com/gbaman/b3137e18c739e0cf98539bf4ec4366ad ... these details helped me to develop python code to get the saml identify value and generate report |
I also got
|
For anyone interested in how to adapt the original query from the first comment to support pagination, after some playing around and reading the docs (I'm not too familiar with GraphQL, so this wasn't obvious to me), I got this (example below using the GitHub CLI, see also here):
|
for anyone who comes here looking for a way to find the organisational email for a particular user, it is:
|
Is there no way to get this information with a REST API endpoint? |
So I wanted to find the GH username for a specific SAML email address and didn't want to have to paginate and loop through the results so this worked for me:
|
Thanks all - this helped me out. For anyone working with c# who gets here, here's a gist https://gist.github.com/dylan-asos/091f2b8e6a865538f061f7554fc03566 - give it an email, it'll give you the matching username/login. I'm being overly verbose to show some of the moving parts, you could switch out some of that with parsing libs of your choice. |
I'm trying this but we have SAML enabled at Enterprise level and when we try these or similar queries I get this:
I can't find any similar option to get this information at the enterprise level. Any ideas on how to get that info? |
@EdEastman see my comment above |
Gah, sorry, now I'm the guy that didn't read the thread :( oh well hopefully at least that error message will be indexed now...many thanks @barakwei - that works perfectly |
Thanks ,Here is the query with variables query($user: String!, $org:String!) {
|
Hello,
I still can see the sso email through web interface though. |
Has anyone got this to work on enterprise server? I can get it to work on cloud but not server (self-hosted). I'm just getting: {"data":{"enterprise":{"ownerInfo":{"samlIdentityProvider":null}}}} |
All you need is read scope permissions now. https://github.blog/changelog/2023-03-30-samlidentity-graphql-object-now-supports-read-scope/ |
Is |
Business Plan hosted customers with SAML would like a way to programmatically query information about a GitHub user account's SAML identity. The following is a GraphQL query that accomplishes this for an Organization.
/cc @francisfuzz as you might be able to track down the author to see if they want to add this ☝️
The text was updated successfully, but these errors were encountered: