transport

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: MIT Imports: 15 Imported by: 0

README

Transport

transport is a collection of light-weight authorization algorithms for connecting to clients.

OAuth1

TODO

OAuth2

TODO

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

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

APIKey is transport for authenticating with an API KEy. API Key authentication should only be used to access your own account. If your application requires access to other accounts, do not use API Key. API key authentication requires each request to be signed (enhanced security measure). Your API keys should be assigned to access only accounts and permission scopes that are necessary for your app to function.

func NewAPIKey

func NewAPIKey() *APIKey

NewAPIKey will return an APIKey authentication transport.

func (*APIKey) RoundTrip

func (auth *APIKey) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip authorizes the request with a signed API Key Authorization header.

func (*APIKey) SetKey

func (auth *APIKey) SetKey(key string) *APIKey

SetKey will set the key field on APIKey.

func (*APIKey) SetPassphrase

func (auth *APIKey) SetPassphrase(passphrase string) *APIKey

SetPassphrase will set the key field on APIKey.

func (*APIKey) SetSecret

func (auth *APIKey) SetSecret(secret string) *APIKey

SetSecret will set the key field on APIKey.

func (*APIKey) SetURL

func (auth *APIKey) SetURL(u string) *APIKey

SetURL will set the key field on APIKey.

type Auth1

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

Auth1 is an http.RoundTripper used to authenticate using the OAuth 1.a algorithm defined by twitter: https://developer.twitter.com/en/docs/authentication/oauth-1-0a/creating-a-signature

func NewAuth1

func NewAuth1() *Auth1

NewAuth1 will return an OAuth1 http transpoauth.

func (*Auth1) RoundTrip

func (auth *Auth1) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip authorizes the request with a signed OAuth1 Authorization header.

func (*Auth1) SetAccessToken

func (auth *Auth1) SetAccessToken(val string) *Auth1

SetConsumerKey will set the consumerKey field on Auth1.

func (*Auth1) SetAccessTokenSecret

func (auth *Auth1) SetAccessTokenSecret(val string) *Auth1

SetAccessTokenSecret will set the accessTokenSecret field on Auth1.

func (*Auth1) SetConsumerKey

func (auth *Auth1) SetConsumerKey(val string) *Auth1

SetConsumerKey will set the consumerKey field on Auth1.

func (*Auth1) SetConsumerSecret

func (auth *Auth1) SetConsumerSecret(val string) *Auth1

SetConsumerSecret will set the consumerSecret field on Auth1.

func (*Auth1) SetURL

func (auth *Auth1) SetURL(u string) *Auth1

SetURL will set the key field on APIKey.

type Auth2

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

TODO

func NewAuth2

func NewAuth2() *Auth2

NewAuth2 will return an OAuth2 http transport.

func (*Auth2) RoundTrip

func (auth *Auth2) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip authorizes the request with a signed OAuth1 Authorization header using the author and TokenSource.

func (*Auth2) SetBearer

func (auth *Auth2) SetBearer(val string) *Auth2

SetBearer will set the bearer field on Auth2.

func (*Auth2) SetURL

func (auth *Auth2) SetURL(u string) *Auth2

SetURL will set the key field on APIKey.

type Basic

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

func NewBasic

func NewBasic() *Basic

NewBasic will return an Basic http transport.

func (*Basic) RoundTrip

func (auth *Basic) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip authorizes the request with a signed OAuth1 Authorization header using the author and TokenSource.

func (*Basic) SetEmail

func (auth *Basic) SetEmail(val string) *Basic

SetEmail will set the email field on Basic.

func (*Basic) SetPassword

func (auth *Basic) SetPassword(val string) *Basic

SetPassword will set the password field on Basic.

func (*Basic) SetURL

func (auth *Basic) SetURL(val string) *Basic

SetURL will set the key field on Basic.

type T

type T interface {
	http.RoundTripper
}

Jump to

Keyboard shortcuts

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