Documentation
¶
Overview ¶
SPDX-License-Identifier: AGPL-3.0-or-later
Index ¶
- type Config
- type OauthService
- func (s *OauthService) CreateAuthURL(w http.ResponseWriter, r *http.Request, nextURL string) string
- func (s *OauthService) GetAuthURL(nextURL string) string
- func (s *OauthService) GetLogoutURL() string
- func (s *OauthService) GetUser(r *http.Request) (*models.User, error)
- func (s *OauthService) HandleCallback(ctx context.Context, code, state string) (*models.User, string, error)
- func (s *OauthService) IsAllowedDomain(email string) bool
- func (s *OauthService) Logout(w http.ResponseWriter, r *http.Request)
- func (s *OauthService) SetUser(w http.ResponseWriter, r *http.Request, user *models.User) error
- func (s *OauthService) VerifyState(w http.ResponseWriter, r *http.Request, stateToken string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OauthService ¶
type OauthService struct {
// contains filtered or unexported fields
}
func NewOAuthService ¶
func NewOAuthService(config Config) *OauthService
func (*OauthService) CreateAuthURL ¶
func (s *OauthService) CreateAuthURL(w http.ResponseWriter, r *http.Request, nextURL string) string
CreateAuthURL Persist a CSRF state token server-side to prevent forged OAuth callbacks; encode nextURL to preserve intended redirect.
func (*OauthService) GetAuthURL ¶
func (s *OauthService) GetAuthURL(nextURL string) string
func (*OauthService) GetLogoutURL ¶ added in v1.1.2
func (s *OauthService) GetLogoutURL() string
GetLogoutURL returns the SSO logout URL if configured, otherwise returns empty string
func (*OauthService) HandleCallback ¶
func (*OauthService) IsAllowedDomain ¶
func (s *OauthService) IsAllowedDomain(email string) bool
func (*OauthService) Logout ¶
func (s *OauthService) Logout(w http.ResponseWriter, r *http.Request)
func (*OauthService) SetUser ¶
func (s *OauthService) SetUser(w http.ResponseWriter, r *http.Request, user *models.User) error
func (*OauthService) VerifyState ¶
func (s *OauthService) VerifyState(w http.ResponseWriter, r *http.Request, stateToken string) bool
VerifyState Clear single-use state on success to prevent replay; compare in constant time to avoid timing leaks.
Click to show internal directories.
Click to hide internal directories.