Versions in this module Expand all Collapse all v1 v1.4.0 Jan 6, 2020 Changes in this version + func MustHash(clear string) []byte + func SameHash(hash []byte, clear string) bool + type Config struct + AccessTokenLifespan time.Duration + AllowedScope oauth2.Scope + AuthorizationCodeLifespan time.Duration + KeyLength int + RefreshTokenLifespan time.Duration + Secret []byte + func Default(secret []byte, allowed oauth2.Scope) Config + func (c Config) MustGenerate() *hmacsha.Token + type Credential struct + ClientID string + Code string + ExpiresAt time.Time + RedirectURI string + Scope oauth2.Scope + Signature string + Used bool + Username string + type Entity struct + Confidential bool + ID string + RedirectURI string + Secret []byte + type Server struct + func New(config Config) *Server + func (s *Server) AddAccessToken(token *Credential) + func (s *Server) AddAuthorizationCode(code *Credential) + func (s *Server) AddClient(client *Entity) + func (s *Server) AddRefreshToken(token *Credential) + func (s *Server) AddUser(user *Entity) + func (s *Server) Authorize(w http.ResponseWriter, r *http.Request, required oauth2.Scope) bool + func (s *Server) Config() Config + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)