Documentation
¶
Index ¶
- type AuthHandler
- type GoogleOAuthService
- func (g *GoogleOAuthService) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
- func (g *GoogleOAuthService) Client(ctx context.Context, token *oauth2.Token) *http.Client
- func (g *GoogleOAuthService) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
- func (g *GoogleOAuthService) RefreshToken(ctx context.Context, token *oauth2.Token) (*oauth2.Token, error)
- func (g *GoogleOAuthService) Revoke(ctx context.Context, token *oauth2.Token) error
- type OAuthService
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(cfg *config.Config, sessions session.SessionService, db database.DatabaseService, oauth OAuthService) *AuthHandler
func (*AuthHandler) Callback ¶
func (ah *AuthHandler) Callback(w http.ResponseWriter, r *http.Request)
func (*AuthHandler) Login ¶
func (ah *AuthHandler) Login(w http.ResponseWriter, r *http.Request)
func (*AuthHandler) Logout ¶
func (ah *AuthHandler) Logout(w http.ResponseWriter, r *http.Request)
TODO: ensure same site lax when frontend is scaffolded
type GoogleOAuthService ¶
type GoogleOAuthService struct {
// contains filtered or unexported fields
}
func NewGoogleOAuthService ¶
func NewGoogleOAuthService(cfg *config.Config) *GoogleOAuthService
func (*GoogleOAuthService) AuthCodeURL ¶
func (g *GoogleOAuthService) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
func (*GoogleOAuthService) Exchange ¶
func (g *GoogleOAuthService) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
func (*GoogleOAuthService) RefreshToken ¶
type OAuthService ¶
type OAuthService interface {
AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
Client(ctx context.Context, token *oauth2.Token) *http.Client
Revoke(ctx context.Context, token *oauth2.Token) error
RefreshToken(ctx context.Context, token *oauth2.Token) (*oauth2.Token, error)
}
Click to show internal directories.
Click to hide internal directories.