Documentation ¶
Index ¶
- Variables
- func AuthenticationMiddleware() gin.HandlerFunc
- func DatabaseMiddleware(db *gorm.DB) gin.HandlerFunc
- func MetricsMiddleware(path string) gin.HandlerFunc
- func NewAPIMux(reg *Registry, router *gin.RouterGroup)
- func RequestTimeoutMiddleware() gin.HandlerFunc
- func RequireAPIToken(c *gin.Context) error
- func Run(options Options) (err error)
- func SetupMetrics(db *gorm.DB) error
- type API
- func (a *API) CreateAPIToken(c *gin.Context, r *api.CreateAPITokenRequest) (*api.CreateAPITokenResponse, error)
- func (a *API) CreateDestination(c *gin.Context, r *api.CreateDestinationRequest) (*api.Destination, error)
- func (a *API) CreateGrant(c *gin.Context, r *api.CreateGrantRequest) (*api.Grant, error)
- func (a *API) CreateGroup(c *gin.Context, r *api.CreateGroupRequest) (*api.Group, error)
- func (a *API) CreateProvider(c *gin.Context, r *api.CreateProviderRequest) (*api.Provider, error)
- func (a *API) CreateToken(c *gin.Context, r *api.CreateTokenRequest) (*api.CreateTokenResponse, error)
- func (a *API) CreateUser(c *gin.Context, r *api.CreateUserRequest) (*api.User, error)
- func (a *API) DeleteAPIToken(c *gin.Context, r *api.Resource) error
- func (a *API) DeleteDestination(c *gin.Context, r *api.Resource) error
- func (a *API) DeleteGrant(c *gin.Context, r *api.Resource) error
- func (a *API) DeleteProvider(c *gin.Context, r *api.Resource) error
- func (a *API) GetDestination(c *gin.Context, r *api.Resource) (*api.Destination, error)
- func (a *API) GetGrant(c *gin.Context, r *api.Resource) (*api.Grant, error)
- func (a *API) GetGroup(c *gin.Context, r *api.Resource) (*api.Group, error)
- func (a *API) GetProvider(c *gin.Context, r *api.Resource) (*api.Provider, error)
- func (a *API) GetUser(c *gin.Context, r *api.Resource) (*api.User, error)
- func (a *API) ListAPITokens(c *gin.Context, r *api.EmptyRequest) ([]api.APIToken, error)
- func (a *API) ListDestinations(c *gin.Context, r *api.ListDestinationsRequest) ([]api.Destination, error)
- func (a *API) ListGrants(c *gin.Context, r *api.ListGrantsRequest) ([]api.Grant, error)
- func (a *API) ListGroupGrants(c *gin.Context, r *api.Resource) ([]api.Grant, error)
- func (a *API) ListGroups(c *gin.Context, r *api.ListGroupsRequest) ([]api.Group, error)
- func (a *API) ListProviders(c *gin.Context, r *api.ListProvidersRequest) ([]api.Provider, error)
- func (a *API) ListUserGrants(c *gin.Context, r *api.Resource) ([]api.Grant, error)
- func (a *API) ListUserGroups(c *gin.Context, r *api.Resource) ([]api.Group, error)
- func (a *API) ListUsers(c *gin.Context, r *api.ListUsersRequest) ([]api.User, error)
- func (a *API) Login(c *gin.Context, r *api.LoginRequest) (*api.LoginResponse, error)
- func (a *API) Logout(c *gin.Context, r *api.EmptyRequest) (*api.EmptyResponse, error)
- func (a *API) UpdateDestination(c *gin.Context, r *api.UpdateDestinationRequest) (*api.Destination, error)
- func (a *API) UpdateProvider(c *gin.Context, r *api.UpdateProviderRequest) (*api.Provider, error)
- func (a *API) Version(c *gin.Context, r *api.EmptyRequest) (*api.Version, error)
- type KeyProvider
- type Options
- type Registry
- type ReqHandlerFunc
- type ReqResHandlerFunc
- type ResHandlerFunc
- type SecretProvider
- type Telemetry
Constants ¶
This section is empty.
Variables ¶
var ( CookieTokenName = "token" CookieLoginName = "login" CookieDomain = "" CookiePath = "/" // while these vars look goofy, they avoid "magic number" arguments to SetCookie CookieHTTPOnlyJavascriptAccessible = false // setting HttpOnly to false means JS can access it. CookieHTTPOnlyNotJavascriptAccessible = true // setting HttpOnly to true means JS can't access it. CookieSecureHTTPSOnly = true // setting Secure to true means the cookie is only sent over https connections CookieSecureHttpOrHTTPS = false // setting Secure to false means the cookie will be sent over http or https connections CookieMaxAgeDeleteImmediately = int(-1) // <0: delete immediately CookieMaxAgeNoExpiry = int(0) // zero has special meaning of "no expiry" )
Functions ¶
func AuthenticationMiddleware ¶ added in v0.5.0
func AuthenticationMiddleware() gin.HandlerFunc
AuthenticationMiddleware validates the incoming token and adds their permissions to the context
func DatabaseMiddleware ¶ added in v0.5.0
func DatabaseMiddleware(db *gorm.DB) gin.HandlerFunc
DatabaseMiddleware injects a `db` object into the Gin context.
func MetricsMiddleware ¶ added in v0.5.0
func MetricsMiddleware(path string) gin.HandlerFunc
MetricsMiddleware wraps the request with a standard set of Prometheus metrics. It has an additional responsibility of stripping out any unique identifiers as it will drastically increase the cardinality, and cost, of produced metrics.
func NewAPIMux ¶ added in v0.4.0
func NewAPIMux(reg *Registry, router *gin.RouterGroup)
func RequestTimeoutMiddleware ¶ added in v0.4.13
func RequestTimeoutMiddleware() gin.HandlerFunc
RequestTimeoutMiddleware adds a timeout to the request context within the Gin context. To correctly abort long-running requests, this depends on the users of the context to stop working when the context cancels. Note: The goroutine for the request is never halted; if the context is not passed down to lower packages and long-running tasks, then the app will not magically stop working on the request. No effort should be made to write an early http response here; it's up to the users of the context to watch for c.Request.Context().Err() or <-c.Request.Context().Done()
func RequireAPIToken ¶ added in v0.5.0
RequireAPIToken checks the bearer token is present and valid then adds its permissions to the context
func SetupMetrics ¶ added in v0.5.0
Types ¶
type API ¶ added in v0.4.0
type API struct {
// contains filtered or unexported fields
}
func (*API) CreateAPIToken ¶ added in v0.5.0
func (a *API) CreateAPIToken(c *gin.Context, r *api.CreateAPITokenRequest) (*api.CreateAPITokenResponse, error)
func (*API) CreateDestination ¶ added in v0.4.0
func (a *API) CreateDestination(c *gin.Context, r *api.CreateDestinationRequest) (*api.Destination, error)
func (*API) CreateGrant ¶ added in v0.5.0
func (*API) CreateGroup ¶ added in v0.5.0
func (*API) CreateProvider ¶ added in v0.5.0
func (*API) CreateToken ¶ added in v0.4.0
func (a *API) CreateToken(c *gin.Context, r *api.CreateTokenRequest) (*api.CreateTokenResponse, error)
func (*API) CreateUser ¶ added in v0.5.0
func (*API) DeleteAPIToken ¶ added in v0.5.0
func (*API) DeleteDestination ¶ added in v0.5.0
func (*API) DeleteGrant ¶ added in v0.5.0
func (*API) DeleteProvider ¶ added in v0.5.0
func (*API) GetDestination ¶ added in v0.4.0
func (*API) GetProvider ¶ added in v0.4.0
caution: this endpoint is unauthenticated, do not return sensitive info
func (*API) ListAPITokens ¶ added in v0.5.0
func (*API) ListDestinations ¶ added in v0.4.0
func (a *API) ListDestinations(c *gin.Context, r *api.ListDestinationsRequest) ([]api.Destination, error)
func (*API) ListGrants ¶ added in v0.5.0
func (*API) ListGroupGrants ¶ added in v0.5.0
func (*API) ListGroups ¶ added in v0.4.0
func (*API) ListProviders ¶ added in v0.4.0
caution: this endpoint is unauthenticated, do not return sensitive info
func (*API) ListUserGrants ¶ added in v0.5.0
func (*API) ListUserGroups ¶ added in v0.5.0
func (*API) Login ¶ added in v0.4.0
func (a *API) Login(c *gin.Context, r *api.LoginRequest) (*api.LoginResponse, error)
func (*API) Logout ¶ added in v0.4.0
func (a *API) Logout(c *gin.Context, r *api.EmptyRequest) (*api.EmptyResponse, error)
func (*API) UpdateDestination ¶ added in v0.5.0
func (a *API) UpdateDestination(c *gin.Context, r *api.UpdateDestinationRequest) (*api.Destination, error)
func (*API) UpdateProvider ¶ added in v0.5.0
type KeyProvider ¶ added in v0.5.0
type KeyProvider struct { Kind string `yaml:"kind" validate:"required"` Config interface{} // contains secret-provider-specific config }
func (*KeyProvider) UnmarshalYAML ¶ added in v0.5.0
func (sp *KeyProvider) UnmarshalYAML(unmarshal func(interface{}) error) error
type Options ¶
type Options struct { Import *config.Config `yaml:"import"` Secrets []SecretProvider `yaml:"secrets" validate:"dive"` Keys []KeyProvider `yaml:"keys" validate:"dive"` TLSCache string `yaml:"tlsCache"` RootAPIToken string `yaml:"rootAPIToken"` EngineAPIToken string `yaml:"engineAPIToken"` DBFile string `yaml:"dbFile" ` DBEncryptionKey string `yaml:"dbEncryptionKey"` DBEncryptionKeyProvider string `yaml:"dbEncryptionKeyProvider"` DBHost string `yaml:"dbHost" ` DBPort int `yaml:"dbPort"` DBName string `yaml:"dbName"` DBUser string `yaml:"dbUser"` DBPassword string `yaml:"dbPassword"` DBParameters string `yaml:"dbParameters"` EnableTelemetry bool `yaml:"enableTelemetry"` EnableCrashReporting bool `yaml:"enableCrashReporting"` SessionDuration time.Duration `yaml:"sessionDuration"` }
type Registry ¶ added in v0.4.0
type Registry struct {
// contains filtered or unexported fields
}
type ReqHandlerFunc ¶ added in v0.5.0
type ReqResHandlerFunc ¶ added in v0.5.0
type ResHandlerFunc ¶ added in v0.5.0
type SecretProvider ¶ added in v0.5.0
type SecretProvider struct { Kind string `yaml:"kind" validate:"required"` Name string `yaml:"name"` // optional Config interface{} // contains secret-provider-specific config }
func (*SecretProvider) UnmarshalYAML ¶ added in v0.5.0
func (sp *SecretProvider) UnmarshalYAML(unmarshal func(interface{}) error) error
type Telemetry ¶ added in v0.3.3
type Telemetry struct {
// contains filtered or unexported fields
}