Documentation
¶
Overview ¶
SPDX-License-Identifier: AGPL-3.0-or-later
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, w http.ResponseWriter, r *http.Request, ...) (*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
- type SessionRepository
- type SessionWorker
- type SessionWorkerConfig
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
func (*OauthService) GetAuthURL ¶
func (s *OauthService) GetAuthURL(nextURL string) string
func (*OauthService) GetLogoutURL ¶
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
type SessionRepository ¶
type SessionRepository interface {
Create(ctx context.Context, session *models.OAuthSession) error
GetBySessionID(ctx context.Context, sessionID string) (*models.OAuthSession, error)
UpdateRefreshToken(ctx context.Context, sessionID string, encryptedToken []byte, expiresAt time.Time) error
DeleteBySessionID(ctx context.Context, sessionID string) error
DeleteExpired(ctx context.Context, olderThan time.Duration) (int64, error)
}
SessionRepository defines the interface for OAuth session storage
type SessionWorker ¶
type SessionWorker struct {
// contains filtered or unexported fields
}
SessionWorker handles background cleanup of expired OAuth sessions
func NewSessionWorker ¶
func NewSessionWorker(sessionRepo SessionRepository, config SessionWorkerConfig) *SessionWorker
NewSessionWorker creates a new OAuth session cleanup worker
type SessionWorkerConfig ¶
type SessionWorkerConfig struct {
CleanupInterval time.Duration // How often to run cleanup (default: 24 hours)
CleanupAge time.Duration // Age of sessions to delete (default: 37 days = 30 + 7 grace period)
}
SessionWorkerConfig contains configuration for the session worker
func DefaultSessionWorkerConfig ¶
func DefaultSessionWorkerConfig() SessionWorkerConfig
DefaultSessionWorkerConfig returns default session worker configuration
Click to show internal directories.
Click to hide internal directories.