Documentation ¶
Index ¶
Constants ¶
View Source
const SessionContextKey = "AuthSession"
SessionContextKey is the auth session context key
Variables ¶
View Source
var ( ErrTokenNotFound = errors.New("Error finding token in request") ErrFetchUserData = errors.New("Error fetching user data") ErrInvalidSession = errors.New("Invalid session") )
Auth errors
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials interface { GetProtocol() string GetIdentifier() string GetPassword() string GetHost() string GetPort() string }
Credentials represents connection to a service having a protocol, identifier, password, host and port
type Endpoints ¶
type Endpoints struct { Login string `json:"login"` Logout string `json:"logout"` Profile string `json:"profile"` ForgetPassword string `json:"forget_password"` Register string `json:"register"` }
Endpoints is a list of common provider endpoints
type Options ¶
Options is a set options
type Provider ¶
type Provider interface { // Name returns the name of provider Name() string // Options returns the provider options Options() *Options // SetOptions sets the provider options SetOptions(options *Options) // Endpoints returns the provider endpoints Endpoints() *Endpoints // SetEndpoints sets the provider endpoints SetEndpoints(endpoints *Endpoints) // Session returns a Session Session(req *http.Request) (Session, error) }
Provider defines an auth interface
type Session ¶
type Session interface { // User returns the user info User() *User // IsAllowed returns whether user can perform an action IsAllowed(action string) bool }
Session represents signature for a session
type User ¶
type User struct { RawData map[string]interface{} `json:"raw_data"` Provider string `json:"provider"` // Provider name Token string `json:"-"` // :sensitive: UserID string `json:"user_id"` Username string `json:"username"` Email string `json:"email"` AvatarURL string `json:"avatar_url"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Location string `json:"location"` Types []string `json:"types"` // `Roles` for some Providers Actions []string `json:"actions"` // `Permissions` for some Providers }
User contains the information common amongst most providers. All of the "raw" datafrom the provider can be found in the `RawData` field.
Click to show internal directories.
Click to hide internal directories.