auth

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, cfg Config) (*service, error)

Types

type Config

type Config struct {
	Issuer       string   `mapstructure:"issuer"`
	ClientID     string   `mapstructure:"client_id"`
	ClientSecret string   `mapstructure:"client_secret"`
	Scopes       []string `mapstructure:"scopes"`
	RedirectURL  string   `mapstructure:"redirect_url"`
}

func (*Config) Bind

func (c *Config) Bind()

func (*Config) Validate

func (c *Config) Validate() error

type Service

type Service interface {
	AuthURL() (url string, state any)
	Exchange(ctx context.Context, code, state string, verifier any) (*User, error)
}

type User

type User struct {
	Username string   `json:"username"`
	Groups   []string `json:"groups"`
}

func (*User) IsAdmin

func (u *User) IsAdmin() bool

Jump to

Keyboard shortcuts

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