Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.0.15
type Config struct {
Providers []ProviderMeta `json:"providers" help:"Providers which can be signed in with"`
}
Config is what a server's configuration says of signing in: the providers, for a sign-in page
type Credential ¶ added in v0.0.15
type Credential struct {
Code string `json:"code,omitempty" help:"Authorization code, from the provider's callback"`
CodeVerifier string `json:"code_verifier,omitempty" help:"PKCE verifier of the code"`
RedirectURL string `json:"redirect_uri,omitempty" help:"Redirect URL the code was for"`
Username string `json:"username,omitempty" help:"Username, for a password provider"`
Password string `json:"password,omitempty" help:"Password, for a password provider"`
}
Credential is what's exchanged with a provider for an identity: the code from a redirect provider's callback, with the PKCE verifier and the redirect URL it was for, or the username and password for a password provider
func (Credential) String ¶ added in v0.0.15
func (c Credential) String() string
String doesn't include the password, or the code
type Identity ¶
type Identity struct {
Provider string `json:"provider" help:"Name of the provider which was signed in with, such as google"`
Issuer string `json:"iss" help:"Issuer of the identity, such as https://accounts.google.com"`
Subject string `json:"sub" help:"Subject, which identifies the person at the issuer, and doesn't change"`
Email string `json:"email,omitempty" help:"Email address"`
EmailVerified bool `json:"email_verified,omitempty" help:"Whether the issuer has verified the email address"`
Name string `json:"name,omitempty" help:"Name, to show"`
Groups []string `json:"groups,omitempty" help:"Groups the person is in, at the issuer, such as LDAP groups or GitHub organisations"`
Claims map[string]any `json:"claims,omitempty" help:"Other claims the issuer made about the person"`
}
Identity is who a provider says someone is, once they've signed in with it, which is exchanged for a session, when it's allowed. It's by the provider's issuer and subject, which don't change, unlike an email address.
type OAuthClient ¶ added in v0.0.15
type OAuthClient struct {
ClientID string `json:"client_id" help:"Client ID, at the provider"`
ClientSecret string `json:"client_secret,omitempty" help:"Client secret, at the provider"`
}
OAuthClient is a client's registration at a provider, such as Google or GitHub, which is a credential's value, so its secret is stored encrypted
func (OAuthClient) String ¶ added in v0.0.15
func (c OAuthClient) String() string
String doesn't include the secret
type ProviderKind ¶ added in v0.0.15
type ProviderKind string
ProviderKind is how a provider is signed in with: by a redirect to the provider, such as Google or GitHub, or a username and password, such as LDAP
const ( ProviderKindRedirect ProviderKind = "redirect" ProviderKindPassword ProviderKind = "password" )
type ProviderMeta ¶ added in v0.0.15
type ProviderMeta struct {
Name string `json:"name" help:"Name of the provider, which is in its paths, such as google"`
Label string `json:"label" help:"Label, to show, such as Google"`
Kind ProviderKind `json:"kind" help:"How it's signed in with: redirect, or password" enum:"redirect,password"`
}
ProviderMeta describes a provider, which is safe for anyone to see, such as for a sign-in page
func (ProviderMeta) String ¶ added in v0.0.15
func (m ProviderMeta) String() string
type Session ¶
type Session struct {
ID string `json:"id" help:"Identifier of the session, which isn't its token"`
User User `json:"user" help:"Who signed in"`
Provider string `json:"provider" help:"Provider which was signed in with"`
Client string `json:"client,omitempty" help:"Name of the OAuth client the session was issued to"`
Scopes []string `json:"scopes,omitempty" help:"Scopes the user had, when they signed in"`
CreatedAt time.Time `json:"created_at" help:"When the session was made"`
ExpiresAt time.Time `json:"expires_at" help:"When the session expires"`
}
Session is a user's, once they've signed in, with the scopes they had then, until it expires, or is revoked
type SessionToken ¶ added in v0.0.15
type SessionToken struct {
Token string `json:"token" help:"Token of the session, which is only returned once"`
Session
}
SessionToken is a new session, with its token, which is only returned when it's made, and is what's sent with requests
func (SessionToken) String ¶ added in v0.0.15
func (t SessionToken) String() string
String doesn't include the token
type User ¶
type User struct {
ID string `json:"id" help:"Identifier of the user, which doesn't change"`
Name string `json:"name,omitempty" help:"Name, to show"`
Email string `json:"email,omitempty" help:"Email address"`
Groups []string `json:"groups,omitempty" help:"Groups the user is in"`
}
User is who an identity is, which a user store says, or else the identity itself