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

find nameId of specific user with a given loginid in org #414

Open
davidkarlsen opened this issue Sep 7, 2021 · 3 comments
Open

find nameId of specific user with a given loginid in org #414

davidkarlsen opened this issue Sep 7, 2021 · 3 comments

Comments

@davidkarlsen
Copy link

The query [1] will list all users with samlIds in the org, but how can I craft the query to search for a user with a specific login?

[1]

query Users($org: String!, $first: Int = 100, $after: String) {
      organization(login: $org) {
        samlIdentityProvider {
          externalIdentities(first: $first, after: $after) {
            edges {
              node {
                guid,
                samlIdentity {
                  nameId
                }
                user {
                  login
                }
              }
            }
            pageInfo {
              hasNextPage
              endCursor
            }
          }
        }
      }
    }
@elimuhub7407

This comment was marked as off-topic.

@stoe
Copy link
Member

stoe commented Jul 21, 2023

@davidkarlsen, just stumbled upon this, hope that after 2+ years the below is still helpful

query user($org: String!, $login: String = null, $after: String = null) {
  organization(login: $org) {
    samlIdentityProvider {
      externalIdentities(login: $login, first: 100, after: $after) {
        nodes {
          guid
          samlIdentity {
            nameId
          }
          user {
            login
            organizationVerifiedDomainEmails(login: $org)
          }
        }
        pageInfo {
          hasNextPage
          endCursor
        }
      }
    }
  }
}

@JohnLBevan
Copy link

Similarly, if you want to search by IdP username (for us, this is the user's UPN/AAD username/email) replace login: with userName:. We use enterprise instead of organization (more here: https://stackoverflow.com/a/50614349/361842)

{
  enterprise(slug: "my-enterprise-name") {
    ownerInfo {
      samlIdentityProvider {
        externalIdentities(after: null, first: 100, userName: "Simon.Borg@example.com") {
          totalCount
          pageInfo {
            hasNextPage
            endCursor
          }
          edges {
            node {
              user {
                login
              }
              samlIdentity {
                nameId
              }
            }
          }
        }
      }
    }
  }
}

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

7 participants
@davidkarlsen @stoe @JohnLBevan @elimuhub7407 and others