Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authenticator ¶
type Authenticator struct {
OAuth2Authenticator
// contains filtered or unexported fields
}
The underlying implementation uses the golang.org/x/oauth2 package
func (Authenticator) Authenticate ¶
func (a Authenticator) Authenticate(c *gin.Context)
middleware (authentication): authenticates a request coming from the oauth2 server two possible behaviors (based on the query string): - sign up user - log in user
func (Authenticator) CleanUpStatesEach ¶
func (a Authenticator) CleanUpStatesEach(d time.Duration)
clean up utilty: removes all expired states from the memory storage run it as go routine when init the authenticator
func (*Authenticator) Ft ¶
func (a *Authenticator) Ft()
func (Authenticator) GetToken ¶
func (a Authenticator) GetToken(c *gin.Context)
func (Authenticator) Redirect ¶
func (a Authenticator) Redirect(scope string) gin.HandlerFunc
type OAuth2Authenticator ¶
type OAuth2Authenticator interface {
auth.Authenticator
// middlware:
// 1. gets the user's token object from the oauth2 server
// 2. stores the token in the context (at "oauth2.token")
GetToken(c *gin.Context)
// middleware (handler):
// redirects the user to the oauth2 server endpoint for the given
// scope
Redirect(scope string)
}
Middlewares exposed by the `Authenticator` struct below are described by this interface:
type OAuth2StateProvider ¶
type States ¶
type States map[string]stateValue
We implement this interface as a mere map.
func (States) GenerateState ¶
Click to show internal directories.
Click to hide internal directories.