Documentation ¶
Index ¶
Constants ¶
const SlackURL = "https://slack.com"
Variables ¶
var ( ErrNoToken = errors.New("no token") ErrNoCookies = errors.New("no cookies") ErrNotSupported = errors.New("not supported") )
var ErrNoProvider = errors.New("internal error: no provider in context")
Functions ¶
func IsClientToken ¶ added in v2.2.3
IsClientToken returns true if the tok is a web-client token.
Types ¶
type BrowserAuth ¶
type BrowserAuth struct {
// contains filtered or unexported fields
}
func NewBrowserAuth ¶
func NewBrowserAuth(ctx context.Context, opts ...Option) (BrowserAuth, error)
func (BrowserAuth) HTTPClient ¶ added in v2.4.6
func (BrowserAuth) SlackToken ¶
func (c BrowserAuth) SlackToken() string
func (BrowserAuth) Test ¶ added in v2.3.0
TestAuth attempts to authenticate with the given provider. It will return AuthError if failed.
func (BrowserAuth) Type ¶ added in v2.0.3
func (BrowserAuth) Type() Type
type BrowserAuthUI ¶ added in v2.0.3
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) HTTPClient ¶ added in v2.4.6
func (CookieFileAuth) SlackToken ¶
func (c CookieFileAuth) SlackToken() string
func (CookieFileAuth) Test ¶ added in v2.3.0
TestAuth attempts to authenticate with the given provider. It will return AuthError if failed.
func (CookieFileAuth) Type ¶ added in v2.0.3
func (CookieFileAuth) Type() Type
type Error ¶ added in v2.3.0
Error is the error returned by New, the underlying Err contains an API error returned by slack.AuthTest call.
type Option ¶ added in v2.3.0
type Option func(*options)
func BrowserWithAuthFlow ¶ added in v2.0.3
func BrowserWithAuthFlow(flow BrowserAuthUI) Option
func BrowserWithBrowser ¶ added in v2.3.0
func BrowserWithTimeout ¶ added in v2.4.4
func BrowserWithVerbose ¶ added in v2.5.0
func BrowserWithWorkspace ¶ added in v2.0.3
func RodWithWorkspace ¶ added in v2.5.0
type Provider ¶
type Provider interface { // SlackToken should return the Slack Token value. SlackToken() string // Cookies should return 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 // Test tests if credentials are valid. Test(ctx context.Context) error // Client returns an authenticated HTTP client HTTPClient() (*http.Client, error) }
Provider is the Slack Authentication provider.
type RodAuth ¶ added in v2.5.0
type RodAuth struct {
// contains filtered or unexported fields
}
func NewRODAuth ¶ added in v2.5.0
func (RodAuth) HTTPClient ¶ added in v2.5.0
func (RodAuth) SlackToken ¶ added in v2.5.0
func (c RodAuth) SlackToken() string
type Type ¶ added in v2.0.3
type Type uint8
Type is the auth type.
type ValueAuth ¶
type ValueAuth struct {
// contains filtered or unexported fields
}
ValueAuth stores Slack credentials.
func Load ¶ added in v2.1.0
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 (ValueAuth) HTTPClient ¶ added in v2.4.6
func (ValueAuth) SlackToken ¶
func (c ValueAuth) SlackToken() string