Documentation
¶
Overview ¶
Package github provides a GitHub-specific identity provider adapter that resolves GitHub user identities and organization memberships for use with the RBAC system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoPrimaryEmail = errors.New("no primary verified email found")
ErrNoPrimaryEmail is returned when no primary verified email is found.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// GetUser returns the authenticated user.
GetUser(ctx context.Context) (*github.User, error)
// ListEmails returns the authenticated user's email addresses.
ListEmails(ctx context.Context) ([]*github.UserEmail, error)
// ListOrgs returns the organizations the authenticated user belongs to.
ListOrgs(ctx context.Context) ([]*github.Organization, error)
}
Client abstracts the GitHub API calls needed by the identity provider.
type ClientFactory ¶
ClientFactory creates a GitHub API client from an OAuth access token. This abstraction enables testing without real HTTP calls.
type IdentityProvider ¶
type IdentityProvider struct {
// contains filtered or unexported fields
}
IdentityProvider implements userport.IdentityProviderUsecase for GitHub.
func NewIdentityProvider ¶
func NewIdentityProvider( clientFactory ClientFactory, logger *slog.Logger, ) *IdentityProvider
NewIdentityProvider creates a new GitHub identity provider.
func (*IdentityProvider) ListOrganizations ¶
func (p *IdentityProvider) ListOrganizations( ctx context.Context, accessToken string, ) ([]string, error)
ListOrganizations implements userport.IdentityProviderUsecase.
func (*IdentityProvider) ProviderName ¶
func (p *IdentityProvider) ProviderName() string
ProviderName implements userport.IdentityProviderUsecase.
func (*IdentityProvider) ResolveIdentity ¶
func (p *IdentityProvider) ResolveIdentity( ctx context.Context, accessToken string, ) (*usermodel.ExternalIdentity, error)
ResolveIdentity implements userport.IdentityProviderUsecase.