auth

package
v1.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 6 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MagicLinkProvider

type MagicLinkProvider struct {
	// contains filtered or unexported fields
}

MagicLinkProvider adapts the MagicLinkService to the web.MagicLinkAuthProvider interface. It requires a SessionService for session management (shared with OAuth if both are enabled).

func NewMagicLinkProvider

func NewMagicLinkProvider(service *services.MagicLinkService, sessionService *infraAuth.SessionService, enabled bool) *MagicLinkProvider

NewMagicLinkProvider creates a new MagicLink provider adapter.

func (*MagicLinkProvider) CreateReminderAuthToken

func (p *MagicLinkProvider) CreateReminderAuthToken(ctx context.Context, email, docID string) (string, error)

CreateReminderAuthToken implements web.MagicLinkAuthProvider.

func (*MagicLinkProvider) GetCurrentUser

func (p *MagicLinkProvider) GetCurrentUser(r *http.Request) (*web.User, error)

GetCurrentUser implements web.AuthProvider.

func (*MagicLinkProvider) GetService

func (p *MagicLinkProvider) GetService() *services.MagicLinkService

GetService returns the underlying MagicLinkService for backward compatibility.

func (*MagicLinkProvider) GetSessionService

func (p *MagicLinkProvider) GetSessionService() *infraAuth.SessionService

GetSessionService returns the underlying SessionService for backward compatibility.

func (*MagicLinkProvider) IsConfigured

func (p *MagicLinkProvider) IsConfigured() bool

IsConfigured implements web.AuthProvider.

func (*MagicLinkProvider) Logout

Logout implements web.AuthProvider.

func (p *MagicLinkProvider) RequestMagicLink(ctx context.Context, email, redirectTo, ip, userAgent, locale string) error

RequestMagicLink implements web.MagicLinkAuthProvider.

func (*MagicLinkProvider) SetCurrentUser

func (p *MagicLinkProvider) SetCurrentUser(w http.ResponseWriter, r *http.Request, user *web.User) error

SetCurrentUser implements web.AuthProvider.

func (p *MagicLinkProvider) VerifyMagicLink(ctx context.Context, token, ip, userAgent string) (*web.MagicLinkResult, error)

VerifyMagicLink implements web.MagicLinkAuthProvider.

func (*MagicLinkProvider) VerifyReminderAuthToken

func (p *MagicLinkProvider) VerifyReminderAuthToken(ctx context.Context, token, ip, userAgent string) (*web.MagicLinkResult, error)

VerifyReminderAuthToken implements web.MagicLinkAuthProvider.

type OAuthProvider

type OAuthProvider struct {
	// contains filtered or unexported fields
}

OAuthProvider adapts the internal OauthService to the web.OAuthAuthProvider interface. This allows the OAuth authentication to be used as a pluggable capability.

func NewOAuthProvider

func NewOAuthProvider(service *infraAuth.OauthService, enabled bool) *OAuthProvider

NewOAuthProvider creates a new OAuth provider adapter.

func (*OAuthProvider) CreateAuthURL

func (p *OAuthProvider) CreateAuthURL(w http.ResponseWriter, r *http.Request, nextURL string) string

CreateAuthURL implements web.OAuthAuthProvider.

func (*OAuthProvider) GetCurrentUser

func (p *OAuthProvider) GetCurrentUser(r *http.Request) (*web.User, error)

GetCurrentUser implements web.AuthProvider.

func (*OAuthProvider) GetLogoutURL

func (p *OAuthProvider) GetLogoutURL() string

GetLogoutURL implements web.OAuthAuthProvider.

func (*OAuthProvider) GetService

func (p *OAuthProvider) GetService() *infraAuth.OauthService

GetService returns the underlying OauthService for backward compatibility. This should only be used during migration; prefer using the interface methods.

func (*OAuthProvider) HandleCallback

func (p *OAuthProvider) HandleCallback(ctx context.Context, w http.ResponseWriter, r *http.Request, code, state string) (*web.User, string, error)

HandleCallback implements web.OAuthAuthProvider.

func (*OAuthProvider) IsAllowedDomain

func (p *OAuthProvider) IsAllowedDomain(email string) bool

IsAllowedDomain implements web.OAuthAuthProvider.

func (*OAuthProvider) IsConfigured

func (p *OAuthProvider) IsConfigured() bool

IsConfigured implements web.AuthProvider.

func (*OAuthProvider) Logout

func (p *OAuthProvider) Logout(w http.ResponseWriter, r *http.Request)

Logout implements web.AuthProvider.

func (*OAuthProvider) SetCurrentUser

func (p *OAuthProvider) SetCurrentUser(w http.ResponseWriter, r *http.Request, user *web.User) error

SetCurrentUser implements web.AuthProvider.

func (*OAuthProvider) VerifyState

func (p *OAuthProvider) VerifyState(w http.ResponseWriter, r *http.Request, stateToken string) bool

VerifyState implements web.OAuthAuthProvider.

type SimpleAuthorizer

type SimpleAuthorizer struct {
	// contains filtered or unexported fields
}

SimpleAuthorizer is an authorization implementation based on a list of admin emails. This is the default authorizer for Community Edition.

func NewSimpleAuthorizer

func NewSimpleAuthorizer(adminEmails []string, onlyAdminCanCreate bool) *SimpleAuthorizer

NewSimpleAuthorizer creates a new simple authorizer.

func (*SimpleAuthorizer) CanCreateDocument

func (a *SimpleAuthorizer) CanCreateDocument(ctx context.Context, userEmail string) bool

CanCreateDocument implements web.Authorizer.

func (*SimpleAuthorizer) IsAdmin

func (a *SimpleAuthorizer) IsAdmin(_ context.Context, userEmail string) bool

IsAdmin implements web.Authorizer.

func (*SimpleAuthorizer) OnlyAdminCanCreate

func (a *SimpleAuthorizer) OnlyAdminCanCreate() bool

OnlyAdminCanCreate returns whether only administrators can create documents. This is provided for backward compatibility with existing code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL