Documentation
¶
Overview ¶
Package session provides session authentication and management for the application.
Index ¶
- Constants
- Variables
- func AddVisitedPluginHook(ctx context.Context, pluginID string, hookType hook.TriggerEnum) context.Context
- func CheckAllowPublicWithoutAuth(c ExternalAccessConfig, r *http.Request) error
- func GetCurrentUserID(ctx context.Context) *string
- func IsLocalRequest(ctx context.Context) bool
- func LogExternalAccessError(err ExternalAccessError)
- func SetCurrentUserID(ctx context.Context, userID string) context.Context
- func SetLocalRequest(r *http.Request) *http.Request
- type ExternalAccessConfig
- type ExternalAccessError
- type InvalidCredentialsError
- type SessionConfig
- type Store
- func (s *Store) Authenticate(w http.ResponseWriter, r *http.Request) (userID string, err error)
- func (s *Store) GetSessionUserID(w http.ResponseWriter, r *http.Request) (string, error)
- func (s *Store) Login(w http.ResponseWriter, r *http.Request) error
- func (s *Store) Logout(w http.ResponseWriter, r *http.Request) error
- func (s *Store) MakePluginCookie(ctx context.Context) *http.Cookie
- func (s *Store) VisitedPluginHandler() func(http.Handler) http.Handler
- type VisitedPluginHook
Constants ¶
View Source
const ( ApiKeyHeader = "ApiKey" ApiKeyParameter = "apikey" )
Variables ¶
Functions ¶
func AddVisitedPluginHook ¶ added in v0.25.0
func CheckAllowPublicWithoutAuth ¶ added in v0.10.0
func CheckAllowPublicWithoutAuth(c ExternalAccessConfig, r *http.Request) error
func GetCurrentUserID ¶
GetCurrentUserID gets the current user id from the provided context
func IsLocalRequest ¶ added in v0.31.0
IsLocalRequest returns true if the request is from localhost, as determined by the context value set by SetLocalRequest. If the context value is not set, it returns false.
func LogExternalAccessError ¶ added in v0.10.0
func LogExternalAccessError(err ExternalAccessError)
func SetLocalRequest ¶ added in v0.31.0
SetLocalRequest checks if the request is from localhost and sets the context value accordingly. It returns the modified request with the updated context, or the original request if it did not come from localhost or if there was an error parsing the remote address.
Types ¶
type ExternalAccessConfig ¶ added in v0.14.0
type ExternalAccessError ¶ added in v0.10.0
func CheckExternalAccessTripwire ¶ added in v0.10.0
func CheckExternalAccessTripwire(c ExternalAccessConfig) *ExternalAccessError
func (ExternalAccessError) Error ¶ added in v0.10.0
func (e ExternalAccessError) Error() string
type InvalidCredentialsError ¶ added in v0.21.0
type InvalidCredentialsError struct {
Username string
}
func (InvalidCredentialsError) Error ¶ added in v0.21.0
func (e InvalidCredentialsError) Error() string
type SessionConfig ¶ added in v0.14.0
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewStore ¶
func NewStore(c SessionConfig) *Store
func (*Store) Authenticate ¶
func (*Store) GetSessionUserID ¶
type VisitedPluginHook ¶ added in v0.25.0
type VisitedPluginHook struct {
PluginID string
HookType hook.TriggerEnum
}
func GetVisitedPluginHooks ¶ added in v0.25.0
func GetVisitedPluginHooks(ctx context.Context) []VisitedPluginHook
Click to show internal directories.
Click to hide internal directories.