auth

package
v2.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoToken   = errors.New("no token")
	ErrNoCookies = errors.New("no cookies")
)

Functions

func IsClientToken added in v2.2.3

func IsClientToken(tok string) bool

func Save added in v2.1.0

func Save(w io.Writer, p Provider) error

Save serialises authentication information to writer. It will return ErrNoToken or ErrNoCookie if provider fails validation.

Types

type BrowserAuth

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

func NewBrowserAuth

func NewBrowserAuth(ctx context.Context, opts ...BrowserOption) (BrowserAuth, error)

func (BrowserAuth) Cookies

func (c BrowserAuth) Cookies() []http.Cookie

func (BrowserAuth) SlackToken

func (c BrowserAuth) SlackToken() string

func (BrowserAuth) Type added in v2.0.3

func (BrowserAuth) Type() Type

func (BrowserAuth) Validate

func (c BrowserAuth) Validate() error

type BrowserAuthUI added in v2.0.3

type BrowserAuthUI interface {
	RequestWorkspace(w io.Writer) (string, error)
	Stop()
}

type BrowserOption added in v2.0.3

type BrowserOption func(*BrowserAuth)

func BrowserWithAuthFlow added in v2.0.3

func BrowserWithAuthFlow(flow BrowserAuthUI) BrowserOption

func BrowserWithWorkspace added in v2.0.3

func BrowserWithWorkspace(name string) BrowserOption

type CookieFileAuth

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

func NewCookieFileAuth

func NewCookieFileAuth(token string, cookieFile string) (CookieFileAuth, error)

NewCookieFileAuth creates new auth provider from token and Mozilla cookie file.

func (CookieFileAuth) Cookies

func (c CookieFileAuth) Cookies() []http.Cookie

func (CookieFileAuth) SlackToken

func (c CookieFileAuth) SlackToken() string

func (CookieFileAuth) Type added in v2.0.3

func (CookieFileAuth) Type() Type

func (CookieFileAuth) Validate

func (c CookieFileAuth) Validate() error

type Provider

type Provider interface {
	// SlackToken should return the Slack Token value.
	SlackToken() string
	// Cookies should returns a set of Slack Session cookies.
	Cookies() []http.Cookie
	// Type returns the auth type.
	Type() Type
	// Validate should return error, in case the token or cookies cannot be
	// retrieved.
	Validate() error
}

Provider is the Slack Authentication provider.

type Type added in v2.0.3

type Type uint8

Type is the auth type.

const (
	TypeInvalid Type = iota
	TypeValue
	TypeCookieFile
	TypeBrowser
)

All supported auth types.

type ValueAuth

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

ValueAuth stores Slack credentials.

func Load added in v2.1.0

func Load(r io.Reader) (ValueAuth, error)

Load deserialises JSON data from reader and returns a ValueAuth, that can be used to authenticate Slackdump. It will return ErrNoToken or ErrNoCookie if the authentication information is missing.

func NewValueAuth

func NewValueAuth(token string, cookie string) (ValueAuth, error)

func (ValueAuth) Cookies

func (c ValueAuth) Cookies() []http.Cookie

func (ValueAuth) SlackToken

func (c ValueAuth) SlackToken() string

func (ValueAuth) Type added in v2.0.3

func (ValueAuth) Type() Type

func (ValueAuth) Validate

func (c ValueAuth) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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