Documentation
¶
Index ¶
Constants ¶
View Source
const ( SessionKey = "ginoauthgh" UserKey = "user" StateKey = "state" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶ added in v1.2.0
type Provider interface {
// Session returns the middleware that loads the cookie session of the given name.
Session(name string) gin.HandlerFunc
// SessionHandler returns the guard that lets signed-in users pass.
SessionHandler() gin.HandlerFunc
// Routes registers the sign in, sign out and session routes.
Routes(r *gin.Engine)
}
Provider is one way to sign in: it owns the session store and brings the session middleware, the guard for the authenticated routes and its routes.
type User ¶
type User struct {
// ID is the id of the hub user (models.User.ID). It is the only part of
// the session that identifies the user; the other fields are labels.
ID uint `json:"id"`
Login string `json:"login"`
Name string `json:"name"`
Email string `json:"email"`
Company string `json:"company"`
URL string `json:"url"`
Role string `json:"role"`
}
User is the signed-in user of a request.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package github signs users in with their GitHub account.
|
Package github signs users in with their GitHub account. |
|
Package oauth2 signs users in with any OAuth2 provider that has a user endpoint.
|
Package oauth2 signs users in with any OAuth2 provider that has a user endpoint. |
|
Package oauthflow is the OAuth2 authorization-code sign in shared by the GitHub and the generic OAuth2 provider.
|
Package oauthflow is the OAuth2 authorization-code sign in shared by the GitHub and the generic OAuth2 provider. |
|
flowtest
Package flowtest runs the sign in scenarios every OAuth2 provider must pass against a fake identity provider.
|
Package flowtest runs the sign in scenarios every OAuth2 provider must pass against a fake identity provider. |
|
Package password signs users in with an email address and a password.
|
Package password signs users in with an email address and a password. |
|
Package usersession keeps the signed-in user in a cookie session.
|
Package usersession keeps the signed-in user in a cookie session. |
Click to show internal directories.
Click to hide internal directories.