Documentation ¶
Overview ¶
Package opa provides of utilities for using OPA
Index ¶
- func ParseX509Cert(authInfo credentials.AuthInfo) *x509.Certificate
- func PreparedOpaInput(ctx context.Context, model interface{}) (map[string]interface{}, error)
- type AuthorizationPolicy
- func PoliciesByFileMask(masks ...string) ([]*AuthorizationPolicy, error)
- func PolicyFromFile(p string) (*AuthorizationPolicy, error)
- func WithNamedPolicyFromSource(name, source, query string, checkQuery CheckQueryFunc) *AuthorizationPolicy
- func WithPolicyFromSource(source, query string, checkQuery CheckQueryFunc) *AuthorizationPolicy
- type CheckAccessFunc
- type CheckQueryFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseX509Cert ¶ added in v1.5.0
func ParseX509Cert(authInfo credentials.AuthInfo) *x509.Certificate
ParseX509Cert - parses x509 certificate from the passed credentials.AuthInfo
Types ¶
type AuthorizationPolicy ¶
type AuthorizationPolicy struct {
// contains filtered or unexported fields
}
AuthorizationPolicy checks that passed tokens are valid
func PoliciesByFileMask ¶ added in v1.7.0
func PoliciesByFileMask(masks ...string) ([]*AuthorizationPolicy, error)
func PolicyFromFile ¶ added in v1.7.0
func PolicyFromFile(p string) (*AuthorizationPolicy, error)
func WithNamedPolicyFromSource ¶ added in v1.9.0
func WithNamedPolicyFromSource(name, source, query string, checkQuery CheckQueryFunc) *AuthorizationPolicy
WithNamedPolicyFromSource creates named custom policy based on rego source code
func WithPolicyFromSource ¶
func WithPolicyFromSource(source, query string, checkQuery CheckQueryFunc) *AuthorizationPolicy
WithPolicyFromSource creates custom policy based on rego source code
func (*AuthorizationPolicy) Check ¶
func (d *AuthorizationPolicy) Check(ctx context.Context, model interface{}) error
Check returns nil if passed tokens are valid
func (*AuthorizationPolicy) Name ¶ added in v1.9.0
func (d *AuthorizationPolicy) Name() string
Name returns AuthorizationPolicy name
type CheckAccessFunc ¶
CheckAccessFunc checks rego result. Returns bool flag that means access. Returns error if something was wrong
func True ¶
func True(query string) CheckAccessFunc
True is default access checker, returns true if in the result set of rego exist query and it has true value
type CheckQueryFunc ¶
type CheckQueryFunc func(string) CheckAccessFunc
CheckQueryFunc converts query string to CheckAccessFunc function