Documentation
¶
Index ¶
- Constants
- func AllServiceIdStrings() []string
- func AllValidServiceIds(ids []string) bool
- func IsValidServiceId(id ServiceId) bool
- func KindToString(k yaml.Kind) string
- type AdminUser
- type AdminUsers
- type AdminUsersExternalSource
- type AdminUsersList
- type Auth
- type AuthApiKey
- type AuthOAuth2
- type AuthType
- type C
- type Connector
- type Database
- type DatabaseProvider
- type DatabaseSqlite
- type ErrorPages
- type HumanDuration
- type Image
- type ImageBase64
- type ImagePublicUrl
- type Key
- type KeyData
- type KeyDataBase64Val
- type KeyDataEnvVar
- type KeyDataFile
- type KeyDataRandomBytes
- type KeyDataRawVal
- type KeyDataValue
- type KeyPublicPrivate
- type KeyShared
- type OAuth
- type Redis
- type RedisMiniredis
- type RedisProvider
- type RedisReal
- type Root
- type Scope
- type Service
- type ServiceAdminApi
- type ServiceApi
- type ServiceId
- type ServicePublic
- type StringValue
- type StringValueBase64
- type StringValueDirect
- type StringValueEnvVar
- type StringValueFile
- type SystemAuth
Constants ¶
const ( AuthTypeOAuth2 = AuthType("OAuth2") AuthTypeAPIKey = AuthType("api-key") )
const ( DefaultInitiateToRedirectTtl = 30 * time.Second DefaultOAuthRoundTripTtl = 1 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
func AllServiceIdStrings ¶
func AllServiceIdStrings() []string
func AllValidServiceIds ¶
func IsValidServiceId ¶
func KindToString ¶
func KindToString(k yaml.Kind) string
Types ¶
type AdminUser ¶
type AdminUser struct { Username string `json:"username" yaml:"username"` Key Key `json:"key" yaml:"key"` }
func UnmarshallYamlAdminUser ¶
func (*AdminUser) UnmarshalYAML ¶
type AdminUsers ¶
func UnmarshallYamlAdminUsers ¶
func UnmarshallYamlAdminUsers(data []byte) (AdminUsers, error)
func UnmarshallYamlAdminUsersString ¶
func UnmarshallYamlAdminUsersString(data string) (AdminUsers, error)
type AdminUsersExternalSource ¶
type AdminUsersExternalSource struct {
KeysPath string `json:"keys_path" yaml:"keys_path"`
}
func UnmarshallYamlAdminUsersExternalSource ¶
func UnmarshallYamlAdminUsersExternalSource(data []byte) (*AdminUsersExternalSource, error)
func UnmarshallYamlAdminUsersExternalSourceString ¶
func UnmarshallYamlAdminUsersExternalSourceString(data string) (*AdminUsersExternalSource, error)
func (*AdminUsersExternalSource) All ¶
func (s *AdminUsersExternalSource) All() []*AdminUser
func (*AdminUsersExternalSource) GetByUsername ¶
func (s *AdminUsersExternalSource) GetByUsername(username string) (*AdminUser, bool)
type AdminUsersList ¶
type AdminUsersList []*AdminUser
func UnmarshallYamlAdminUsersList ¶
func UnmarshallYamlAdminUsersList(data []byte) (AdminUsersList, error)
func UnmarshallYamlAdminUsersListString ¶
func UnmarshallYamlAdminUsersListString(data string) (AdminUsersList, error)
func (AdminUsersList) All ¶
func (aul AdminUsersList) All() []*AdminUser
func (AdminUsersList) GetByUsername ¶
func (aul AdminUsersList) GetByUsername(username string) (*AdminUser, bool)
type Auth ¶
type Auth interface {
GetType() AuthType
}
func UnmarshallYamlAuth ¶
type AuthApiKey ¶
type AuthApiKey struct {
Type AuthType `json:"type" yaml:"type"`
}
func (*AuthApiKey) GetType ¶
func (a *AuthApiKey) GetType() AuthType
type AuthOAuth2 ¶
type AuthOAuth2 struct { Type AuthType `json:"type" yaml:"type"` ClientId StringValue `json:"client_id" yaml:"client_id"` ClientSecret StringValue `json:"client_secret" yaml:"client_secret"` Scopes []Scope `json:"scopes" yaml:"scopes"` AuthorizationEndpoint string `json:"authorization_endpoint" yaml:"authorization_endpoint"` TokenEndpoint string `json:"token_endpoint" yaml:"token_endpoint"` }
func (*AuthOAuth2) GetType ¶
func (a *AuthOAuth2) GetType() AuthType
func (*AuthOAuth2) UnmarshalYAML ¶
func (i *AuthOAuth2) UnmarshalYAML(value *yaml.Node) error
type C ¶
type C interface { // GetRoot gets the root of the configuration; the data loaded from a configuration file GetRoot() *Root // IsDebugMode tells the system if debug flags have been passed when running this service IsDebugMode() bool // MustGetService gets the service information for the specified service name MustGetService(serviceName ServiceId) Service // GetFallbackConnectorLogo gets a logo to use if not specified for a connector configuration GetFallbackConnectorLogo() string }
func LoadConfig ¶
type Connector ¶
type Connector struct { Id string `json:"id" yaml:"id"` Version uint64 `json:"version" yaml:"version"` DisplayName string `json:"display_name" yaml:"display_name"` Logo Image `json:"logo" yaml:"logo"` Description string `json:"description" yaml:"description"` Auth Auth `json:"auth" yaml:"auth"` }
func (*Connector) UnmarshalYAML ¶
type Database ¶
type Database interface {
GetProvider() DatabaseProvider
}
func UnmarshallYamlDatabase ¶
type DatabaseProvider ¶
type DatabaseProvider string
const (
DatabaseProviderSqlite DatabaseProvider = "sqlite"
)
type DatabaseSqlite ¶
type DatabaseSqlite struct { Provider DatabaseProvider `json:"provider" yaml:"provider"` Path string `json:"path" yaml:"path"` }
func (*DatabaseSqlite) GetProvider ¶
func (d *DatabaseSqlite) GetProvider() DatabaseProvider
type ErrorPages ¶
type ErrorPages struct { Fallback string `json:"fallback" yaml:"fallback"` }
func (*ErrorPages) GetUnauthorized ¶
func (e *ErrorPages) GetUnauthorized() string
type HumanDuration ¶
func (HumanDuration) MarshalJSON ¶
func (d HumanDuration) MarshalJSON() ([]byte, error)
MarshalJSON provides custom serialization of the duration to a human-readable string (e.g., "2m").
func (HumanDuration) MarshalYAML ¶
func (d HumanDuration) MarshalYAML() (interface{}, error)
MarshalYAML provides custom serialization of the duration to a human-readable string (e.g., "2m").
func (*HumanDuration) UnmarshalJSON ¶
func (d *HumanDuration) UnmarshalJSON(data []byte) error
UnmarshalJSON parses a human-readable duration string back into `time.Duration`.
func (*HumanDuration) UnmarshalYAML ¶
func (d *HumanDuration) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML parses a human-readable duration string back into `time.Duration`.
type Image ¶
type Image interface {
GetUrl() string
}
func UnmarshallYamlImage ¶
type ImageBase64 ¶
type ImageBase64 struct { MimeType string `json:"mime_type" yaml:"mime_type"` Base64 string `json:"base64" yaml:"base64"` }
func (*ImageBase64) GetUrl ¶
func (i *ImageBase64) GetUrl() string
type ImagePublicUrl ¶
type ImagePublicUrl struct {
PublicUrl string `json:"public_url" yaml:"public_url"`
}
func (*ImagePublicUrl) GetUrl ¶
func (i *ImagePublicUrl) GetUrl() string
type Key ¶
type Key interface { // CanSign checks if the key can sign requests (either private key is present or shared key) CanSign() bool // CanVerifySignature checks if the key can be used to verify the signature of something (public key is present or shared key) CanVerifySignature() bool }
func UnmarshallYamlKey ¶
func UnmarshallYamlKeyString ¶
type KeyData ¶
type KeyData interface { // HasData checks if this value has data. HasData(ctx context.Context) bool // GetData retrieves the bytes of the key GetData(ctx context.Context) ([]byte, error) }
func UnmarshallYamlKeyData ¶
type KeyDataBase64Val ¶
type KeyDataBase64Val struct {
Base64 string `json:"base64" yaml:"base64"`
}
type KeyDataEnvVar ¶
type KeyDataEnvVar struct {
EnvVar string `json:"env_var" yaml:"env_var"`
}
type KeyDataFile ¶
type KeyDataFile struct {
Path string `json:"path" yaml:"path"`
}
type KeyDataRandomBytes ¶
type KeyDataRandomBytes struct { NumBytes int `json:"num_bytes" yaml:"num_bytes"` // contains filtered or unexported fields }
type KeyDataRawVal ¶
type KeyDataRawVal struct {
Raw []byte `json:"-" yaml:"-"`
}
KeyDataRawVal is where the key data is specified directly as bytes. This isn't used for config via file but can be used as way to return data in a config interface that has data already loaded.
type KeyDataValue ¶
type KeyDataValue struct {
Value string `json:"value" yaml:"value"`
}
type KeyPublicPrivate ¶
type KeyPublicPrivate struct { PublicKey KeyData `json:"public_key" yaml:"public_key"` PrivateKey KeyData `json:"private_key" yaml:"private_key"` }
func (*KeyPublicPrivate) CanSign ¶
func (kpp *KeyPublicPrivate) CanSign() bool
func (*KeyPublicPrivate) CanVerifySignature ¶
func (kpp *KeyPublicPrivate) CanVerifySignature() bool
func (*KeyPublicPrivate) UnmarshalYAML ¶
func (kpp *KeyPublicPrivate) UnmarshalYAML(value *yaml.Node) error
type KeyShared ¶
type KeyShared struct {
}func (*KeyShared) CanVerifySignature ¶
func (*KeyShared) UnmarshalYAML ¶
type OAuth ¶
type OAuth struct { // InitiateToRedirectTtl is the time allowed between the oauth initiate API call, and the time when the browser // completes the redirect from the auth proxy public service. This value must be less than RoundTripTtl. This value // should be as small as possible as the handoff from the API to the redirect involves a one-time-use auth token // in the query parameters, which could be used to steal the session. InitiateToRedirectTtl HumanDuration `json:"initiate_to_redirect_ttl" yaml:"initiate_to_redirect_ttl"` // RoundTripTtl is the time we allow for the user to go through the oauth flow, from the initiate call, all the // way back to returning to AuthProxy to exchange the auth token for an access token. The purpose of this timeout // is to reduce the time that a redirect link from auth proxy would be valid for the purposes of phishing other // peoples credentials using this link as the basis. RoundTripTtl HumanDuration `json:"round_trip_ttl" yaml:"round_trip_ttl"` }
func (*OAuth) GetInitiateToRedirectTtlOrDefault ¶
func (*OAuth) GetRoundTripTtlOrDefault ¶
type Redis ¶
type Redis interface {
GetProvider() RedisProvider
}
func UnmarshallYamlRedis ¶
type RedisMiniredis ¶
type RedisMiniredis struct {
Provider RedisProvider `json:"provider" yaml:"provider"`
}
func (*RedisMiniredis) GetProvider ¶
func (d *RedisMiniredis) GetProvider() RedisProvider
type RedisProvider ¶
type RedisProvider string
const ( RedisProviderMiniredis RedisProvider = "miniredis" RedisProviderRedis RedisProvider = "redis" )
type RedisReal ¶
type RedisReal struct { Provider RedisProvider `json:"provider" yaml:"provider"` // The network type, either tcp or unix. // Default is tcp. Network string `json:"network" yaml:"network"` // host:port address. Address string `json:"address" yaml:"address"` // Protocol 2 or 3. Use the version to negotiate RESP version with redis-server. // Default is 3. Protocol int `json:"protocol" yaml:"protocol"` // Use the specified Username to authenticate the current connection // with one of the connections defined in the ACL list when connecting // to a Redis 6.0 instance, or greater, that is using the Redis ACL system. Username StringValue `json:"username" yaml:"username"` // Optional password. Must match the password specified in the // requirepass server configuration option (if connecting to a Redis 5.0 instance, or lower), // or the User Password when connecting to a Redis 6.0 instance, or greater, // that is using the Redis ACL system. Password StringValue `json:"password" yaml:"password"` // Database to be selected after connecting to the server. DB int `json:"db" yaml:"db"` }
func (*RedisReal) GetProvider ¶
func (d *RedisReal) GetProvider() RedisProvider
func (*RedisReal) ToRedisOptions ¶
func (*RedisReal) UnmarshalYAML ¶
type Root ¶
type Root struct { AdminApi ServiceAdminApi `json:"admin_api" yaml:"admin_api"` Api ServiceApi `json:"api" yaml:"api"` Public ServicePublic `json:"public" yaml:"public"` SystemAuth SystemAuth `json:"system_auth" yaml:"system_auth"` Database Database `json:"database" yaml:"database"` Redis Redis `json:"redis" yaml:"redis"` Oauth OAuth `json:"oauth" yaml:"oauth"` ErrorPages ErrorPages `json:"error_pages" yaml:"error_pages"` Connectors []Connector `json:"connectors" yaml:"connectors"` }
func UnmarshallYamlRoot ¶
func (*Root) MustGetService ¶
func (*Root) UnmarshalYAML ¶
type Scope ¶
type Scope struct { Id string `json:"id" yaml:"id"` Required bool `json:"required" yaml:"required"` Reason string `json:"reason" yaml:"reason"` }
func UnmarshallYamlScope ¶
func (*Scope) UnmarshalYAML ¶
type ServiceAdminApi ¶
type ServiceAdminApi struct { PortVal uint64 `json:"port" yaml:"port"` DomainVal string `json:"domain" yaml:"domain"` IsHttpsVal bool `json:"https" yaml:"https"` }
func (*ServiceAdminApi) Domain ¶
func (s *ServiceAdminApi) Domain() string
func (*ServiceAdminApi) GetBaseUrl ¶
func (s *ServiceAdminApi) GetBaseUrl() string
func (*ServiceAdminApi) GetId ¶
func (s *ServiceAdminApi) GetId() ServiceId
func (*ServiceAdminApi) IsHttps ¶
func (s *ServiceAdminApi) IsHttps() bool
func (*ServiceAdminApi) Port ¶
func (s *ServiceAdminApi) Port() uint64
func (*ServiceAdminApi) SupportsSession ¶
func (s *ServiceAdminApi) SupportsSession() bool
type ServiceApi ¶
type ServiceApi struct { PortVal uint64 `json:"port" yaml:"port"` DomainVal string `json:"domain" yaml:"domain"` IsHttpsVal bool `json:"https" yaml:"https"` }
func (*ServiceApi) Domain ¶
func (s *ServiceApi) Domain() string
func (*ServiceApi) GetBaseUrl ¶
func (s *ServiceApi) GetBaseUrl() string
func (*ServiceApi) GetId ¶
func (s *ServiceApi) GetId() ServiceId
func (*ServiceApi) IsHttps ¶
func (s *ServiceApi) IsHttps() bool
func (*ServiceApi) Port ¶
func (s *ServiceApi) Port() uint64
func (*ServiceApi) SupportsSession ¶
func (s *ServiceApi) SupportsSession() bool
type ServicePublic ¶
type ServicePublic struct { PortVal uint64 `json:"port" yaml:"port"` DomainVal string `json:"domain" yaml:"domain"` IsHttpsVal bool `json:"https" yaml:"https"` }
func (*ServicePublic) Domain ¶
func (s *ServicePublic) Domain() string
func (*ServicePublic) GetBaseUrl ¶
func (s *ServicePublic) GetBaseUrl() string
func (*ServicePublic) GetId ¶
func (s *ServicePublic) GetId() ServiceId
func (*ServicePublic) IsHttps ¶
func (s *ServicePublic) IsHttps() bool
func (*ServicePublic) Port ¶
func (s *ServicePublic) Port() uint64
func (*ServicePublic) SupportsSession ¶
func (s *ServicePublic) SupportsSession() bool
type StringValue ¶
type StringValue interface { // HasValue checks if this value has data. HasValue(ctx context.Context) bool // GetValue retrieves the bytes of the key GetValue(ctx context.Context) (string, error) }
func UnmarshallYamlStringValue ¶
func UnmarshallYamlStringValue(data []byte) (StringValue, error)
func UnmarshallYamlStringValueString ¶
func UnmarshallYamlStringValueString(data string) (StringValue, error)
type StringValueBase64 ¶
type StringValueBase64 struct {
Base64 string `json:"base64" yaml:"base64"`
}
type StringValueDirect ¶
type StringValueDirect struct {
Value string `json:"value" yaml:"value"`
}
StringValueDirect is where the key data is specified directly as bytes. This isn't used for config via file but can be used as way to return data in a config interface that has data already loaded.
type StringValueEnvVar ¶
type StringValueEnvVar struct {
EnvVar string `json:"env_var" yaml:"env_var"`
}
type StringValueFile ¶
type StringValueFile struct {
Path string `json:"path" yaml:"path"`
}
type SystemAuth ¶
type SystemAuth struct { JwtSigningKey Key `json:"jwt_signing_key" yaml:"jwt_signing_key"` JwtIssuerVal string `json:"jwt_issuer" yaml:"jwt_issuer"` JwtTokenDurationVal time.Duration `json:"jwt_token_duration" yaml:"jwt_token_duration"` CookieDomain string `json:"cookie_domain" yaml:"cookie_domain"` CookieDurationVal time.Duration `json:"cookie_duration" yaml:"cookie_duration"` DisableXSRF bool `json:"disable_xsrf" yaml:"disable_xsrf"` AdminUsers AdminUsers `json:"admin_users" yaml:"admin_users"` GlobalAESKey KeyData `json:"global_aes_key" yaml:"global_aes_key"` }
func UnmarshallYamlSystemAuth ¶
func UnmarshallYamlSystemAuth(data []byte) (*SystemAuth, error)
func UnmarshallYamlSystemAuthString ¶
func UnmarshallYamlSystemAuthString(data string) (*SystemAuth, error)
func (*SystemAuth) CookieDuration ¶
func (sa *SystemAuth) CookieDuration() time.Duration
func (*SystemAuth) JwtIssuer ¶
func (sa *SystemAuth) JwtIssuer() string
func (*SystemAuth) JwtTokenDuration ¶
func (sa *SystemAuth) JwtTokenDuration() time.Duration
func (*SystemAuth) UnmarshalYAML ¶
func (sa *SystemAuth) UnmarshalYAML(value *yaml.Node) error
Source Files
¶
- admin_user.go
- admin_users.go
- admin_users_external_source.go
- admin_users_list.go
- auth.go
- auth_api_key.go
- auth_oauth2.go
- connector.go
- database.go
- database_sqlite.go
- error_pages.go
- human_duration.go
- image.go
- interface.go
- key.go
- key_data.go
- key_data_base64_val.go
- key_data_env_var.go
- key_data_file.go
- key_data_random_bytes.go
- key_data_raw_val.go
- key_data_value.go
- key_public_private.go
- key_shared.go
- oauth.go
- redis.go
- redis_miniredis.go
- redis_real.go
- root.go
- scope.go
- service.go
- service_admin_api.go
- service_api.go
- service_public.go
- services.go
- string_value.go
- string_value_base64.go
- string_value_direct.go
- string_value_env_var.go
- string_value_file.go
- system_auth.go
- util.go