• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mindersec / minder / 24823388278

23 Apr 2026 07:45AM UTC coverage: 60.268% (+2.0%) from 58.315%
24823388278

Pull #6265

github

web-flow
Merge 0a27a5083 into f719494bf
Pull Request #6265: Generalize identity provider and implement OIDC discovery

21 of 124 new or added lines in 10 files covered. (16.94%)

1295 existing lines in 41 files now uncovered.

20258 of 33613 relevant lines covered (60.27%)

36.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/auth/github.go
1
// SPDX-FileCopyrightText: Copyright 2023 The Minder Authors
2
// SPDX-License-Identifier: Apache-2.0
3

4
// Package auth contains the authentication logic for the control plane
5
package auth
6

7
import (
8
        "context"
9
        "errors"
10
        "fmt"
11
)
12

13
// GetUserForGitHubId looks up a user in the identity provider by their GitHub ID.
14
//
15
// If the user is found, it returns their subject suitable for use in
16
// the `sub` claim of a JWT, and in OpenFGA's user field. Note that this function may
17
// return a user of "" with no error if no users were found matching the GitHub ID.
NEW
18
func GetUserForGitHubId(ctx context.Context, idClient Resolver, ghUser int64) (string, error) {
×
NEW
19
        // look up the user in the identity provider
×
NEW
20
        // TODO: For a generic identity provider, resolving by a raw numerical GitHub ID
×
NEW
21
        // might not work unless the provider specifically indexes 'gh_id' attributes (like Keycloak does).
×
NEW
22
        id, err := idClient.Resolve(ctx, fmt.Sprintf("%d", ghUser))
×
23
        if err != nil {
×
NEW
24
                // If the user is not found, return an empty string and no error
×
NEW
25
                if errors.Is(err, ErrNotFound) {
×
NEW
26
                        return "", nil
×
NEW
27
                }
×
28
                return "", err
×
29
        }
30

NEW
31
        return id.UserID, nil
×
32
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc