oauth

package
v0.0.0-...-9f76edf Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package oauth provides containers for OAuth data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBOAuthApp

type DBOAuthApp struct {
	OAuthAppProps
	// contains filtered or unexported fields
}

DBOAuthApp is OAuthApp associated with a specified database.

func (*DBOAuthApp) Delete

func (a *DBOAuthApp) Delete() error

func (*DBOAuthApp) Load

func (a *DBOAuthApp) Load() error

Load retrieves credential information from a specified database and stores it.

func (*DBOAuthApp) Save

func (a *DBOAuthApp) Save() error

Save saves the credential information to a specified database.

type DBOAuthCreds

type DBOAuthCreds struct {
	OAuthCredsProps `yaml:",inline"`

	ID string `json:"id" toml:"id" bson:"id" yaml:"id"`
	// contains filtered or unexported fields
}

DBOAuthCreds is a user credential container for OAuth and associated with a specified database (currently only MongoDB supported).

func NewDBOAuthCreds

func NewDBOAuthCreds(col models.MgoCollection, id string) (*DBOAuthCreds, error)

NewDBOAuthCreds returns a new DBOAuthCreds with specified arguments.

func (*DBOAuthCreds) Delete

func (a *DBOAuthCreds) Delete() error

func (*DBOAuthCreds) Load

func (a *DBOAuthCreds) Load() error

Load retrieves credential information from a specified database and stores it.

func (*DBOAuthCreds) Save

func (a *DBOAuthCreds) Save() error

Save saves the credential information to a specified database.

type DefaultOAuthAppProps

type DefaultOAuthAppProps struct {
	ConsumerKey    string `json:"consumer_key" toml:"consumer_key" bson:"consumer_key" yaml:"consumer_key"`
	ConsumerSecret string `json:"consumer_secret" toml:"consumer_secret" bson:"consumer_secret" yaml:"consumer_secret"`
}

DefaultOAuthAppProps contains variables for general OAuth application usage.

func (*DefaultOAuthAppProps) GetCreds

func (a *DefaultOAuthAppProps) GetCreds() (string, string)

GetCreds returns application credential information stored in a.

func (*DefaultOAuthAppProps) SetCreds

func (a *DefaultOAuthAppProps) SetCreds(ck, cs string)

SetCreds sets application credential information to a.

type FileOAuthApp

type FileOAuthApp struct {
	OAuthAppProps
	File string `json:"-" toml:"-" bson:"-" yaml:"-"`
}

FileOAuthApp is OAuthApp associated with a specified file.

func (*FileOAuthApp) Delete

func (a *FileOAuthApp) Delete() error

func (*FileOAuthApp) Load

func (a *FileOAuthApp) Load() error

Load retrieves credential information from a.File and stores it. This method does nothing and returns nil if the specified file doesn't exist.

func (*FileOAuthApp) Save

func (a *FileOAuthApp) Save() error

Save saves the credential information to a.File.

type FileOAuthCreds

type FileOAuthCreds struct {
	OAuthCredsProps `yaml:",inline"`
	File            string `json:"-" toml:"-" bson:"-" yaml:"-"`
}

FileOAuthCreds is a user credential container for OAuth and associated with a specified file.

func NewFileOAuthCreds

func NewFileOAuthCreds(file string) (*FileOAuthCreds, error)

NewFileOAuthCreds returns a new FileOAuthCreds with file.

func (*FileOAuthCreds) Delete

func (a *FileOAuthCreds) Delete() error

func (*FileOAuthCreds) Load

func (a *FileOAuthCreds) Load() error

Load retrieves credential information from a specified file and stores it. This does nothing and returns nil if the file doesn't exist.

func (*FileOAuthCreds) Save

func (a *FileOAuthCreds) Save() error

Save saves the credential information in a into a.File.

type OAuthApp

type OAuthApp interface {
	utils.Savable
	utils.Loadable
	utils.Deletable
	SetCreds(ck, cs string)
	GetCreds() (string, string)
}

OAuthApp provides features to save/load and set/get application credential information for OAuth.

func NewDBOAuthApp

func NewDBOAuthApp(col models.MgoCollection) (OAuthApp, error)

NewDBOAuthApp returns a new DBOAuthApp with a specified MongoDB collection. Currently only supported database is MongoDB.

func NewDBTwitterOAuthApp

func NewDBTwitterOAuthApp(col models.MgoCollection) (OAuthApp, error)

NewDBTwitterOAuthApp returns a new DBTwitterOAuthApp with a specified MongoDB collection.

func NewFileOAuthApp

func NewFileOAuthApp(file string) (OAuthApp, error)

NewFileOAuthApp returns a new FileOAuthApp with file.

func NewFileTwitterOAuthApp

func NewFileTwitterOAuthApp(file string) (OAuthApp, error)

NewFileTwitterOAuthApp returns a new FileTwitterOAuthApp with file.

type OAuthAppProps

type OAuthAppProps interface {
	SetCreds(ck, cs string)
	GetCreds() (string, string)
}

OAuthAppProps abstracts features to set/get application credential properties for OAuth.

type OAuthCreds

type OAuthCreds interface {
	utils.Savable
	utils.Loadable
	utils.Deletable
	SetCreds(at, ats string)
	GetCreds() (string, string)
}

OAuthCreds providves features to save/load and set/get user credential information for OAuth.

type OAuthCredsProps

type OAuthCredsProps struct {
	AccessToken       string `json:"access_token" toml:"access_token" bson:"access_token" yaml:"access_token"`
	AccessTokenSecret string `json:"access_token_secret" toml:"access_token_secret" bson:"access_token_secret" yaml:"access_token_secret"`
}

OAuthCredsProps contains actual variables for user credential information.

func (*OAuthCredsProps) GetCreds

func (a *OAuthCredsProps) GetCreds() (string, string)

GetCreds returns user credential information stored in a.

func (*OAuthCredsProps) SetCreds

func (a *OAuthCredsProps) SetCreds(at, ats string)

SetCreds sets user credential information to a.

type TwitterOAuthAppProps

type TwitterOAuthAppProps struct {
}

TwitterOAuthAppProps is a credential information container for Twitter application.

func (*TwitterOAuthAppProps) GetCreds

func (a *TwitterOAuthAppProps) GetCreds() (string, string)

GetCreds returns application credential information stored in a.

func (*TwitterOAuthAppProps) SetCreds

func (a *TwitterOAuthAppProps) SetCreds(ck, cs string)

SetCreds sets application credential information to a.

Jump to

Keyboard shortcuts

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