Documentation ¶
Index ¶
- Variables
- func ParseClientID(u string) string
- func ParseProfileURL(u string) string
- type Client
- type Code
- type Database
- func (d *Database) CacheProfile(profile Profile) error
- func (d *Database) Client(clientID, redirectURI string) (Client, error)
- func (d *Database) Close() error
- func (d *Database) Code(c string) (code Code, err error)
- func (d *Database) CreateCode(me, code string, createdAt time.Time) error
- func (d *Database) CreateSession(session Session) error
- func (d *Database) CreateToken(token Token) error
- func (d *Database) Forget(me string) error
- func (d *Database) Login(r *http.Request) (string, error)
- func (d *Database) Profile(me string) (Profile, error)
- func (d *Database) RevokeClient(me, clientID string) error
- func (d *Database) RevokeToken(shortToken string) error
- func (d *Database) SaveLogin(w http.ResponseWriter, r *http.Request, me string) error
- func (d *Database) Session(me string) (session Session, err error)
- func (d *Database) SetProvider(me, provider, profileURI string) error
- func (d *Database) Token(t string) (token Token, err error)
- func (d *Database) Tokens(me string) (tokens []Token, err error)
- type Expiry
- type Login
- type Method
- type Profile
- type Session
- type StrategyStore
- type Token
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoLogin = errors.New("no login exists")
View Source
var ErrUnknownCodeChallengeMethod = errors.New("code_challenge_method is not understood")
Functions ¶
func ParseClientID ¶
func ParseProfileURL ¶
Types ¶
type Client ¶
type Client struct { ID string RedirectURI string Name string UpdatedAt time.Time // contains filtered or unexported fields }
Client stores an app's information, so it doesn't have to be queried again. If redirectURI no longer matches then the data is invalidated.
type Code ¶
type Code struct { Code string ResponseType string Me string ClientID string RedirectURI string CodeChallenge string CodeChallengeMethod string Scope string CreatedAt time.Time ExpiresAt time.Time }
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) CacheProfile ¶
func (*Database) CreateCode ¶
func (*Database) CreateSession ¶
func (*Database) CreateToken ¶
func (*Database) Login ¶
Login returns a user's profile URL (i.e. 'me' value), if they have recently logged in with relme-auth.
func (*Database) RevokeClient ¶
func (*Database) RevokeToken ¶
func (*Database) SetProvider ¶
type Expiry ¶
type Expiry struct { // Session specifies how long a session should be valid for. This is the time // from the start of authentication (being served the "choose" page), and // hitting the callback from an auth provider. Session time.Duration // Code specifies how long a code should be valid for. This is the time // between hitting the callback from an auth provider, and the client // verifying the code. Code time.Duration // Client specifies how long to store information about a client. It has no // influence on the authentication session, but outdated information may be // misleading. Client time.Duration // Profile specifies how long to store the authentication methods for a // user. This data can be manually refreshed on the "choose" page. Profile time.Duration // Login specifies how long to consider the user logged in to relme-auth. If a // un-expired login is found a user will be presented with the option to // "continue" on the "choose" page, bypassing the need to reauthenticate with // a downstream provider. Login time.Duration }
type Login ¶
type Method ¶
Method is a way a user can authenticate, it contains the name of a 3rd party provider and the expected profile URL with that provider.
type Profile ¶
type Profile struct { Me string UpdatedAt time.Time Methods []Method // contains filtered or unexported fields }
Profile stores a user's authentication methods, so they don't have to be queried again.
type Session ¶
type Session struct { ResponseType string Me string Provider string ProfileURI string ClientID string RedirectURI string CodeChallenge string CodeChallengeMethod string Scope string State string CreatedAt time.Time ExpiresAt time.Time }
Session contains all of the information needed to keep track of OAuth requests/responses with a 3rd party.
type StrategyStore ¶
type StrategyStore struct {
// contains filtered or unexported fields
}
func Strategy ¶
func Strategy(name string) (*StrategyStore, error)
func (*StrategyStore) Claim ¶
func (s *StrategyStore) Claim(key string) (value interface{}, ok bool)
func (*StrategyStore) Insert ¶
func (s *StrategyStore) Insert(value interface{}) (state string, err error)
func (*StrategyStore) Set ¶
func (s *StrategyStore) Set(key string, value interface{}) error
Click to show internal directories.
Click to hide internal directories.