Documentation
¶
Index ¶
- Constants
- Variables
- func AddVisitedPlugin(ctx context.Context, pluginID string) context.Context
- func CheckAllowPublicWithoutAuth(c ExternalAccessConfig, r *http.Request) error
- func GetCurrentUserID(ctx context.Context) *string
- func GetVisitedPlugins(ctx context.Context) []string
- func LogExternalAccessError(err ExternalAccessError)
- func SetCurrentUserID(ctx context.Context, userID string) context.Context
- type ExternalAccessConfig
- type ExternalAccessError
- 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
Constants ¶
View Source
const (
ApiKeyHeader = "ApiKey"
ApiKeyParameter = "apikey"
)
Variables ¶
View Source
var ErrInvalidCredentials = errors.New("invalid username or password")
View Source
var ErrUnauthorized = errors.New("unauthorized")
Functions ¶
func AddVisitedPlugin ¶
func AddVisitedPlugin(ctx context.Context, pluginID string) context.Context
func CheckAllowPublicWithoutAuth ¶ added in v0.10.0
func CheckAllowPublicWithoutAuth(c ExternalAccessConfig, r *http.Request) error
func GetCurrentUserID ¶
func GetCurrentUserID(ctx context.Context) *string
GetCurrentUserID gets the current user id from the provided context
func GetVisitedPlugins ¶
func GetVisitedPlugins(ctx context.Context) []string
func LogExternalAccessError ¶ added in v0.10.0
func LogExternalAccessError(err ExternalAccessError)
func SetCurrentUserID ¶
func SetCurrentUserID(ctx context.Context, userID string) context.Context
Types ¶
type ExternalAccessConfig ¶ added in v0.14.0
type ExternalAccessConfig interface {
HasCredentials() bool
GetDangerousAllowPublicWithoutAuth() bool
GetSecurityTripwireAccessedFromPublicInternet() string
IsNewSystem() bool
}
type ExternalAccessError ¶ added in v0.10.0
type ExternalAccessError net.IP
func CheckExternalAccessTripwire ¶ added in v0.10.0
func CheckExternalAccessTripwire(c ExternalAccessConfig) *ExternalAccessError
type SessionConfig ¶ added in v0.14.0
type SessionConfig interface {
GetUsername() string
GetAPIKey() string
GetSessionStoreKey() []byte
GetMaxSessionAge() int
ValidateCredentials(username string, password string) bool
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Authenticate ¶
func (s *Store) Authenticate(w http.ResponseWriter, r *http.Request) (userID string, err error)
func (*Store) GetSessionUserID ¶
func (s *Store) GetSessionUserID(w http.ResponseWriter, r *http.Request) (string, error)
func (*Store) MakePluginCookie ¶
func (s *Store) MakePluginCookie(ctx context.Context) *http.Cookie
func (*Store) VisitedPluginHandler ¶
func (s *Store) VisitedPluginHandler() func(http.Handler) http.Handler
Click to show internal directories.
Click to hide internal directories.