Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMultipleSelectors in case there is more then one selector configured. ErrMultipleSelectors = fmt.Errorf("only one type of policy-selector (static or migration) can be configured") // ErrSelectorConfigIncomplete if policy_selector conf is missing ErrSelectorConfigIncomplete = fmt.Errorf("missing either \"static\" or \"migration\" configuration in policy_selector config ") // ErrUnexpectedConfigError unexpected config error ErrUnexpectedConfigError = fmt.Errorf("could not initialize policy-selector for given config") )
Functions ¶
This section is empty.
Types ¶
type Selector ¶
Selector is a function which selects a proxy-policy based on the request.
A policy is a random name which identifies a set of proxy-routes:
{
"policies": [
{
"name": "us-east-1",
"routes": [
{
"endpoint": "/",
"backend": "https://backend.us.example.com:8080/app"
}
]
},
{
"name": "eu-ams-1",
"routes": [
{
"endpoint": "/",
"backend": "https://backend.eu.example.com:8080/app"
}
]
}
]
}
func LoadSelector ¶
func LoadSelector(cfg *config.PolicySelector) (Selector, error)
LoadSelector constructs a specific policy-selector from a given configuration
func NewMigrationSelector ¶
func NewMigrationSelector(cfg *config.MigrationSelectorConf, ss accounts.AccountsService) Selector
NewMigrationSelector selects the policy based on the existence of the oidc "preferred_username" claim in the accounts-service. The policy for each case is configurable:
"policy_selector": {
"migration": {
"acc_found_policy" : "reva",
"acc_not_found_policy": "oc10",
"unauthenticated_policy": "oc10"
}
},
This selector can be used in migration-scenarios where some users have already migrated from ownCloud10 to OCIS and thus have an entry in ocis-accounts. All users without accounts entry are routed to the legacy ownCloud10 instance.
func NewStaticSelector ¶
func NewStaticSelector(cfg *config.StaticSelectorConf) Selector
NewStaticSelector returns a selector which uses a pre-configured policy.
Configuration:
"policy_selector": {
"static": {"policy" : "reva"}
},