mockoidc

package
v0.0.0-...-e0216f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadOrGeneratePrivateKey

func LoadOrGeneratePrivateKey(privatePath string, logger *slog.Logger) (*rsa.PrivateKey, error)

func NewApp

func NewApp() *cli.App

Types

type Config

type Config struct {
	Provider ProviderConfig `yaml:"provider"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) FindClient

func (c *Config) FindClient(clientID string) (OAuthClient, bool)

func (*Config) FindUser

func (c *Config) FindUser(email string) (User, bool)

type OAuthClient

type OAuthClient struct {
	ClientID     string   `yaml:"client_id"`
	ClientSecret string   `yaml:"client_secret"`
	Name         string   `yaml:"name"`
	RedirectURIs []string `yaml:"redirect_uris"`
}

func (OAuthClient) AllowsRedirect

func (oc OAuthClient) AllowsRedirect(uri string) bool

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(cfg *Config, logger *slog.Logger, issuer string, privateKey *rsa.PrivateKey) (*Provider, error)

func (*Provider) ConsumeCode

func (p *Provider) ConsumeCode(code string) (*codeEntry, bool)

func (*Provider) Issuer

func (p *Provider) Issuer() string

func (*Provider) JWKS

func (p *Provider) JWKS() jwks

func (*Provider) KeyID

func (p *Provider) KeyID() string

func (*Provider) LookupAccessToken

func (p *Provider) LookupAccessToken(tok string) (*tokenEntry, bool)

func (*Provider) MintAccessToken

func (p *Provider) MintAccessToken(user User, scope string) (string, time.Time, error)

func (*Provider) MintCode

func (p *Provider) MintCode(entry *codeEntry) (string, error)

func (*Provider) RunSweeper

func (p *Provider) RunSweeper(stop <-chan struct{})

func (*Provider) SignIDToken

func (p *Provider) SignIDToken(user User, clientID, nonce string, expires time.Time) (string, error)

func (*Provider) Sweep

func (p *Provider) Sweep()

type ProviderConfig

type ProviderConfig struct {
	Users        []User        `yaml:"users"`
	OAuthClients []OAuthClient `yaml:"oauth_clients"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(provider *Provider, logger *slog.Logger) *Server

func (*Server) Handler

func (s *Server) Handler() http.Handler

type User

type User struct {
	Email         string `yaml:"email"`
	Name          string `yaml:"name"`
	HD            string `yaml:"hd,omitempty"`
	Picture       string `yaml:"picture,omitempty"`
	EmailVerified bool   `yaml:"email_verified"`
}

func (User) Subject

func (u User) Subject() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL