Documentation ¶
Overview ¶
Package forsooth provides a dropin Oauth2 handler for gogle logins
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomString ¶
RandomString produces a base64 string (websafe?) from n random bytes
Types ¶
type ActiveSession ¶
type ActiveSession struct { SessionID string `json:"sessionid"` User GoogleUserProfile `json:"auth_user"` Token string `json:"token"` State string `json:"state"` Expires time.Time `json:"exipires"` }
ActiveSession to serialize and track valid tokens
func GetSession ¶
func GetSession(w http.ResponseWriter, r *http.Request) *ActiveSession
GetSession returns the logged in user or cleans up if youve expired
type Forsooth ¶
type Forsooth struct { ClientID string `yaml:"client_id"` ClientSecret string `yaml:"client_secret"` RedirectURL string `yaml:"redirect_url"` Scopes []string `yaml:"scopes"` Conf *oauth2.Config `yaml:-` }
Forsooth is the config object for the funcs
func (*Forsooth) LoadConfig ¶
type GoogleUserProfile ¶
type GoogleUserProfile struct { Email string `json:"email"` Verified bool `json:"verified_email"` ID string `json:"id"` Picture string `json:"picture"` }
GoogleUserProfile catches user data
type OauthLogin ¶
OauthLogin type for oauth handler
func NewLoginHandler ¶
func NewLoginHandler(next http.Handler) OauthLogin
NewLoginHandler generates a login middleware
func NewLogoutHandler ¶
func NewLogoutHandler(next http.Handler) OauthLogin
NewLogoutHandler generates a login middleware
func (OauthLogin) ServeHTTP ¶
func (l OauthLogin) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP makes OauthLogin a http.Handler
Click to show internal directories.
Click to hide internal directories.