Documentation
¶
Index ¶
- Constants
- type AccessToken
- type Consumer
- func (c *Consumer) AuthorizeRedirect(t *RequestToken) (string, error)
- func (c *Consumer) AuthorizeToken(t *RequestToken, verifier string) (*AccessToken, error)
- func (c *Consumer) RequestToken() (*RequestToken, error)
- func (c *Consumer) Sign(req *http.Request, token Token) error
- func (c *Consumer) SignParams(req *http.Request, token Token, params map[string]string) error
- type RequestToken
- type Token
Constants ¶
const OOB = "oob"
Out-Of-Band mode, used for applications that do not have a callback URL, such as mobile phones or command-line utilities.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AccessToken struct {
// contains filtered or unexported fields
}
AccessToken represents a value used by the Consumer to gain access to the Protected Resources on behalf of the User, instead of using the User's Service Provider credentials.
func NewAccessToken ¶
func NewAccessToken(token, secret string, params map[string]string) *AccessToken
NewAccessToken returns a new instance of AccessToken with the specified token, secret and additional parameters.
func ParseAccessToken ¶
func ParseAccessToken(reader io.ReadCloser) (*AccessToken, error)
ParseAccessToken parses the URL-encoded query string from the Reader and returns an AccessToken.
func ParseAccessTokenStr ¶
func ParseAccessTokenStr(str string) (*AccessToken, error)
ParseAccessTokenStr parses the URL-encoded query string and returns an AccessToken.
func (*AccessToken) Encode ¶
func (a *AccessToken) Encode() string
Encode encodes the values into “URL encoded” form of the AccessToken. e.g. "oauth_token=foo&oauth_token_secret=baz"
func (*AccessToken) Params ¶
func (a *AccessToken) Params() map[string]string
Gets any additional parameters, as defined by the Service Provider.
func (*AccessToken) Secret ¶
func (a *AccessToken) Secret() string
Gets the oauth_token_secret value
type Consumer ¶
type Consumer struct {
// A value used by the Consumer to identify itself
// to the Service Provider.
ConsumerKey string
// A secret used by the Consumer to establish
// ownership of the Consumer Key.
ConsumerSecret string
// An absolute URL to which the Service Provider will redirect
// the User back when the Obtaining User Authorization step
// is completed.
//
// If the Consumer is unable to receive callbacks or a callback
// URL has been established via other means, the parameter
// value MUST be set to oob (case sensitive), to indicate
// an out-of-band configuration.
CallbackURL string
// The URL used to obtain an unauthorized
// Request Token.
RequestTokenURL string
// The URL used to obtain User authorization
// for Consumer access.
AccessTokenURL string
// The URL used to exchange the User-authorized
// Request Token for an Access Token.
AuthorizationURL string
}
Consumer represents a website or application that uses the OAuth 1.0a protocol to access protected resources on behalf of a User.
func (*Consumer) AuthorizeRedirect ¶
func (c *Consumer) AuthorizeRedirect(t *RequestToken) (string, error)
AuthorizeRedirect constructs the request URL that should be used to redirect the User to verify User identify and consent.
func (*Consumer) AuthorizeToken ¶
func (c *Consumer) AuthorizeToken(t *RequestToken, verifier string) (*AccessToken, error)
func (*Consumer) RequestToken ¶
func (c *Consumer) RequestToken() (*RequestToken, error)
type RequestToken ¶
type RequestToken struct {
// contains filtered or unexported fields
}
RequestToken represents a value used by the Consumer to obtain authorization from the User, and exchanged for an Access Token.
func ParseRequestToken ¶
func ParseRequestToken(reader io.ReadCloser) (*RequestToken, error)
ParseRequestToken parses the URL-encoded query string from the Reader and returns a RequestToken.
func ParseRequestTokenStr ¶
func ParseRequestTokenStr(str string) (*RequestToken, error)
ParseRequestTokenStr parses the URL-encoded query string and returns a RequestToken.
func (*RequestToken) Encode ¶
func (r *RequestToken) Encode() string
Encode encodes the values into “URL encoded” form of the ReqeustToken. e.g. "oauth_token=foo&oauth_token_secret=baz"
func (*RequestToken) Secret ¶
func (r *RequestToken) Secret() string
Gets the oauth_token_secret value