Documentation
¶
Overview ¶
Package oauth2 provides oauth2 middleware
Index ¶
Constants ¶
View Source
const OAuth2LoggerKey = "web.middleware.oauth2"
Variables ¶
View Source
var ErrSessionNotInitialized = fmt.Errorf("session is not initialized in the context")
ErrSessionNotInitialized is an error if the session middleware is not initialized.
Functions ¶
Types ¶
type Config ¶
type Config interface { AuthCodeURL(string, ...oauth2.AuthCodeOption) string Exchange(context.Context, string) (*oauth2.Token, error) }
Config is an interface for OAuth2 configuration. Use "golang.org/x/oauth2.Config"
type Middleware ¶
type Middleware struct { AuthPath string // path that redirects to oauth2 provider CallbackPath string AuthCodeOptions []oauth2.AuthCodeOption Store StateStore Config Config }
func NewMiddleware ¶
func NewMiddleware() *Middleware
func (*Middleware) Process ¶
func (m *Middleware) Process(req *web.Request, next web.NextHandler) *response.Response
type SessionStateStore ¶
type SessionStateStore struct { }
SessionStateStore is an implementation of StateStore using session.
Click to show internal directories.
Click to hide internal directories.