clive

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package clive provides CLI-Live interactions with Auth0 by running a local server for OAuth challenges and handling them on behalf of the user.

Index

Constants

View Source
const (
	BindAddr    = "127.0.0.1:4784"
	RedirectURI = "http://localhost:4784/auth/callback"
)
View Source
const AssetDebug = false

AssetDebug is true if the assets were built with the debug flag enabled.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDigest

func AssetDigest(name string) ([sha256.Size]byte, error)

AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"}, AssetDir("data/img") would return []string{"a.png", "b.png"}, AssetDir("foo.txt") and AssetDir("notexist") would return an error, and AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func AssetString

func AssetString(name string) (string, error)

AssetString returns the asset contents as a string (instead of a []byte).

func CodeChallenge

func CodeChallenge(verifier string) string

func Digests

func Digests() (map[string][sha256.Size]byte, error)

Digests returns a map of all known files and their checksums.

func GenerateCodeToken

func GenerateCodeToken() (_ string, err error)

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MustAssetString

func MustAssetString(name string) string

MustAssetString is like AssetString but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory.

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively.

Types

type AccessToken

type AccessToken struct {
	AccessToken string    `json:"access_token"`
	IDToken     string    `json:"id_token"`
	Scope       string    `json:"scope"`
	ExpiresIn   int       `json:"expires_in"`
	TokenType   string    `json:"token_type"`
	CreatedAt   time.Time `json:"created_at"`
	ExpiresAt   time.Time `json:"expires_at"`
}

type Config

type Config struct {
	Domain     string `envconfig:"AUTH0_DOMAIN"`
	Audience   string `envconfig:"AUTH0_AUDIENCE"`
	ClientID   string `envconfig:"AUTH0_CLIENT_ID"`
	TokenCache string `envconfig:"AUTH0_TOKEN_CACHE"`
}

Config stores the client ID and secrets for accessing auth0 in order to conduct "live" authentication on a CLI from the localhost.

func NewConfig

func NewConfig() (conf Config, err error)

func (Config) IsZero

func (c Config) IsZero() bool

func (Config) Validate

func (c Config) Validate() error

type RenderContext

type RenderContext struct {
	Code        string `json:"code"`
	State       string `json:"state"`
	Error       string `json:"error"`
	Description string `json:"error_description"`
}

type Server

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

func New

func New(conf Config) (*Server, error)

func (*Server) Authorize

func (s *Server) Authorize(w http.ResponseWriter, req *http.Request)

func (*Server) Favicon

func (s *Server) Favicon(w http.ResponseWriter, req *http.Request)

func (*Server) GetAuthenticationURL

func (s *Server) GetAuthenticationURL() (u *url.URL, err error)

func (*Server) Serve

func (s *Server) Serve() (err error)

func (*Server) Shutdown

func (s *Server) Shutdown() (err error)

Jump to

Keyboard shortcuts

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