Documentation ¶
Index ¶
- Constants
- func GetRoundTripper() http.RoundTripper
- func GetSecurityKey() string
- func SetRoundTripper(t http.RoundTripper)
- func SetSecurityKey(key string)
- type AuthServerError
- type Config
- type Credentials
- type MissingParameterError
- type MissingProviderError
- type Provider
- type ProviderList
- type State
- type Tripper
- type TripperFactory
- type User
Constants ¶
const ( UserKeyAuthCode string = "authCode" UserKeyProviderCredentials string = "creds" )
const (
CredentialsKeyID string = "id"
)
const (
PrefixForErrors string = "gomniauth: "
)
Variables ¶
This section is empty.
Functions ¶
func GetRoundTripper ¶
func GetRoundTripper() http.RoundTripper
func SetRoundTripper ¶
func SetRoundTripper(t http.RoundTripper)
func SetSecurityKey ¶
func SetSecurityKey(key string)
SetSecurityKey sets the global security key to be used for signing the state variable in the auth request. This allows gomniauth to detect if the data in the state variable has been changed.
Types ¶
type AuthServerError ¶
func (*AuthServerError) Error ¶
func (e *AuthServerError) Error() string
type Config ¶
Config represent data that describes information needed to make authenticated requests.
type Credentials ¶
Credentials represent data that describes information needed to make authenticated requests.
var EmptyCredentials *Credentials = nil
func (*Credentials) PublicData ¶
func (c *Credentials) PublicData(options map[string]interface{}) (publicData interface{}, err error)
PublicData gets the storable data from this credentials object.
type MissingParameterError ¶
type MissingParameterError struct {
ParameterName string
}
func (*MissingParameterError) Error ¶
func (e *MissingParameterError) Error() string
type MissingProviderError ¶
type MissingProviderError struct {
ProviderName string
}
func (*MissingProviderError) Error ¶
func (e *MissingProviderError) Error() string
type Provider ¶
type Provider interface { codecs.Facade // Name is the unique name for this provider. Name() string // DisplayName is a human readable name for the provider. DisplayName() string // GetBeginAuthURL gets the URL that the client must visit in order // to begin the authentication process. // // The state argument contains anything you wish to have sent back to your // callback endpoint. // The options argument takes any options used to configure the auth request // sent to the provider. GetBeginAuthURL(state *State, options objx.Map) (string, error) // CompleteAuth takes a map of arguments that are used to // complete the authorisation process, completes it, and returns // the appropriate Credentials. CompleteAuth(data objx.Map) (*Credentials, error) // GetUser uses the specified Credentials to access the users profile // from the remote provider, and builds the appropriate User object. GetUser(creds *Credentials) (User, error) // Get makes an authenticated request and returns the data in the // response as a data map. Get(creds *Credentials, endpoint string) (objx.Map, error) // GetClient gets an http.Client authenticated with the specified // Credentials. GetClient(creds *Credentials) (*http.Client, error) }
Provider represents an authentication provider.
type ProviderList ¶
type ProviderList interface { // Providers gets all registered Provider objects. Providers() []Provider // Provider gets a provider by name, or returns a MissingProviderError // if no provider with that name is registered. Provider(name string) (Provider, error) }
ProviderList represents objects capable of managing a collection of providers.
type State ¶
State represents a map of state arguments that can be used to persist values across the authentication process.
type Tripper ¶
type Tripper interface { http.RoundTripper // Credentials gets the authentication credentials that // this Tripper will use. Credentials() *Credentials // Provider gets the Provider that this tripper will make // requests to. Provider() Provider }
Tripper represents an object capable of making authenticated round trips.
type TripperFactory ¶
type TripperFactory interface {
NewTripper(*Credentials, Provider) (Tripper, error)
}
TripperFactory describes an object responsible for making authenticated Trippers.
type User ¶
type User interface { // Email gets the users email address. Email() string // Name gets the users full name. Name() string // Nickname gets the users nickname or username. Nickname() string // AvatarURL gets the URL of an image representing the user. AvatarURL() string // ProviderCredentials gets a map of Credentials (by provider name). ProviderCredentials() map[string]*Credentials // IDForProvider gets the ID value for the specified provider name for // this user from the ProviderCredentials data. IDForProvider(provider string) string // AuthCode gets this user's globally unique ID (generated by the host program) AuthCode() string // Data gets the underlying data that makes up this User. Data() objx.Map }