open-consul/acl/policy_authorizer_oss.go
Matt Keeler 8af12bf4f4
Miscellaneous acl package cleanup
• Renamed EnterpriseACLConfig to just Config
• Removed chained_authorizer_oss.go as it was empty
• Renamed acl.go to errors.go to more closely describe its contents
2019-12-18 13:44:32 -05:00

31 lines
1,009 B
Go

// +build !consulent
package acl
// enterprisePolicyAuthorizer stub
type enterprisePolicyAuthorizer struct{}
func (authz *enterprisePolicyAuthorizer) init(*Config) {
// nothing to do
}
func (authz *enterprisePolicyAuthorizer) enforce(_ *EnterpriseRule, _ *AuthorizerContext) EnforcementDecision {
return Default
}
// NewPolicyAuthorizer merges the policies and returns an Authorizer that will enforce them
func NewPolicyAuthorizer(policies []*Policy, entConfig *Config) (Authorizer, error) {
return newPolicyAuthorizer(policies, entConfig)
}
// NewPolicyAuthorizerWithDefaults will actually created a ChainedAuthorizer with
// the policies compiled into one Authorizer and the backup policy of the defaultAuthz
func NewPolicyAuthorizerWithDefaults(defaultAuthz Authorizer, policies []*Policy, entConfig *Config) (Authorizer, error) {
authz, err := newPolicyAuthorizer(policies, entConfig)
if err != nil {
return nil, err
}
return NewChainedAuthorizer([]Authorizer{authz, defaultAuthz}), nil
}