Documentation ¶
Index ¶
- func Healthz(ctx context.Context) (err error)
- func Init(c *Config, infoLog, errLog, dbgLog *log.Logger) (err error)
- func InstallHTTPHandler(r *gin.RouterGroup)
- func Middleware() gin.HandlerFunc
- type Auth
- type AuthBackendInfo
- type AuthorizationInfo
- type BackendState
- type Config
- type HTTPErrorResponse
- type NewSessionRequest
- type NewSessionResponse
- type OIDCBackend
- type OIDCConfig
- type OIDCSession
- type PasswdBackend
- type PasswdUserConfig
- type Session
- type SessionManager
- type SessionState
- type SessionsConfig
- type StaticSessionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallHTTPHandler ¶
func InstallHTTPHandler(r *gin.RouterGroup)
func Middleware ¶
func Middleware() gin.HandlerFunc
Types ¶
type AuthBackendInfo ¶
type AuthBackendInfo struct { Name string Description string State *BackendState `swaggertype:"string" enums:"new,initializing,ready,failed,destroyed,unknown"` }
type AuthorizationInfo ¶
type AuthorizationInfo struct { Privileged bool `json:"privileged" yaml:"privileged" toml:"privileged"` Entitled bool `json:"entitled" yaml:"entitled" toml:"entitled"` ReadOnly bool `json:"readonly" yaml:"readonly" toml:"readonly"` AllShows bool `json:"allShows" yaml:"allShows" toml:"allShows"` Shows []uint64 `json:"ownedShowIds" yaml:"ownedShowIds" toml:"ownedShowIds"` PublicShows []uint64 `json:"publicShowIds" yaml:"publicShowIds" toml:"publicShowIds"` }
type BackendState ¶
type BackendState uint32
const ( BackendNew BackendState = iota BackendInitializing BackendReady BackendFailed BackendDestroyed )
func (*BackendState) MarshalText ¶
func (s *BackendState) MarshalText() (data []byte, err error)
func (*BackendState) String ¶
func (s *BackendState) String() string
type Config ¶
type Config struct { Sessions SessionsConfig `json:"sessions" yaml:"sessions" toml:"sessions"` OIDC *OIDCConfig `json:"oidc" yaml:"oidc" toml:"oidc"` Passwd map[string]*PasswdUserConfig `json:"passwd" yaml:"passwd" toml:"passwd"` }
type HTTPErrorResponse ¶
type HTTPErrorResponse struct {
Error string `json:"error,omitempty"`
}
type NewSessionRequest ¶
type NewSessionRequest struct { Backend string `json:"backend"` Arguments json.RawMessage `json:"arguments"` }
type NewSessionResponse ¶
type OIDCBackend ¶
type OIDCBackend struct {
// contains filtered or unexported fields
}
func NewOIDCBackend ¶
func NewOIDCBackend(cfg *OIDCConfig) (b *OIDCBackend, err error)
func (*OIDCBackend) Callback ¶
func (b *OIDCBackend) Callback(c *gin.Context)
Callback completes OIDC login. @Summary Complete OIDC login @Description Completes OIDC login. @Produce json @Param state query string true "OIDC state" @Param code query string true "OIDC code" @Success 200 {object} string @Failure 400 {object} HTTPErrorResponse @Failure 401 {object} HTTPErrorResponse @Failure 409 {object} HTTPErrorResponse @Failure 410 {object} HTTPErrorResponse @Failure 500 {object} HTTPErrorResponse @Router /auth/oidc/callback [get]
func (*OIDCBackend) Login ¶
func (b *OIDCBackend) Login(c *gin.Context)
Login creates a session via OIDC. @Summary Create OIDC session @Description Creates a session via OIDC. Redirects to identity provider. @Produce json @Param session-id query string true "OIDC session ID" @Success 302 @Failure 400 {object} HTTPErrorResponse @Failure 401 {object} HTTPErrorResponse @Failure 409 {object} HTTPErrorResponse @Router /auth/oidc/login [get]
func (*OIDCBackend) NewSession ¶
func (b *OIDCBackend) NewSession(ctx context.Context, arguments json.RawMessage) (s *Session, err error)
func (*OIDCBackend) String ¶
func (b *OIDCBackend) String() string
type OIDCConfig ¶
type OIDCConfig struct { IssuerURL string `json:"issuer-url" yaml:"issuer-url" toml:"issuer-url"` ClientID string `json:"client-id" yaml:"client-id" toml:"client-id"` ClientSecret string `json:"client-secret" yaml:"client-secret" toml:"client-secret"` CallbackURL string `json:"callback-url" yaml:"callback-url" toml:"callback-url"` LoginTimeout time.Duration `json:"login-timeout" yaml:"login-timeout" toml:"login-timeout"` }
type OIDCSession ¶
type OIDCSession struct {
// contains filtered or unexported fields
}
func (*OIDCSession) MarshalJSON ¶
func (s *OIDCSession) MarshalJSON() ([]byte, error)
This is only safe when session is logged in!
type PasswdBackend ¶
type PasswdBackend struct {
// contains filtered or unexported fields
}
func NewPasswdBackend ¶
func NewPasswdBackend(userDB map[string]*PasswdUserConfig) (b *PasswdBackend, err error)
func (*PasswdBackend) NewSession ¶
func (b *PasswdBackend) NewSession(ctx context.Context, arguments json.RawMessage) (s *Session, err error)
func (*PasswdBackend) String ¶
func (b *PasswdBackend) String() string
type PasswdUserConfig ¶
type PasswdUserConfig struct { Password string `json:"password" yaml:"password" toml:"password"` AuthorizationInfo `yaml:",inline"` }
type Session ¶
type Session struct { Username string `json:"username"` AuthorizationInfo // contains filtered or unexported fields }
func (*Session) MarshalJSON ¶
func (*Session) State ¶
func (s *Session) State() SessionState
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
func NewSessionManager ¶
func NewSessionManager(c SessionsConfig) (sm *SessionManager, err error)
type SessionState ¶
type SessionState uint32
const ( SessionStateNew SessionState = iota SessionStateStale SessionStateLoginStarted SessionStateLoginFinalizing SessionStateLoggedIn SessionStateLoginFailed SessionStateLoginTimeout SessionStateLoggedOut SessionStateRemoved )
func (SessionState) MarshalText ¶
func (s SessionState) MarshalText() (data []byte, err error)
func (SessionState) String ¶
func (s SessionState) String() string
type SessionsConfig ¶
type SessionsConfig struct { MaxAge time.Duration `json:"max-age" yaml:"max-age" toml:"max-age"` Static map[string]*StaticSessionConfig `json:"static" yaml:"static" toml:"static"` }
type StaticSessionConfig ¶
type StaticSessionConfig struct { Secret string `json:"secret" yaml:"secret" toml:"secret"` AuthorizationInfo `yaml:",inline"` }