Documentation
¶
Overview ¶
Package githubsso implements interactive "Sign in with GitHub" login for human dashboard users via the GitHub OAuth web-application flow, and the same identity resolution for a GitHub personal-access token a CLI presents as a bearer. Both paths reduce a GitHub token to a verified Identity and then apply one Allowlist, so the browser and the CLI authorize identically.
It is deliberately independent of internal/githuboidc, which verifies GitHub Actions *workload* identity tokens for CI uploads, not human logins.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotAllowed = errors.New("github identity is not on the allowlist")
ErrNotAllowed means authentication succeeded but the account is not on the allowlist. Callers map it to 403, distinct from an authentication failure.
Functions ¶
This section is empty.
Types ¶
type Allowlist ¶
Allowlist decides which authenticated GitHub accounts may use the instance. An account is permitted if it matches any configured rule: an explicit login or verified email, or membership of Org (further narrowed to Team when set). Logins and Emails keys are compared case-insensitively.
type Config ¶
type Config struct {
ClientID string
ClientSecret string
CallbackURL string
Allowlist Allowlist
// APIBaseURL overrides https://api.github.com; tests point it at an
// httptest.Server so identity resolution needs no network.
APIBaseURL string
}
Config constructs a Provider.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider runs the GitHub OAuth web flow and resolves tokens to allowlisted identities.
func New ¶
New builds a Provider. The requested scopes are read:user and user:email, plus read:org only when the allowlist gates by org/team.
func (*Provider) AuthCodeURL ¶
AuthCodeURL is the GitHub authorize URL to redirect the browser to, carrying an opaque state the callback verifies.