authorizer

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 7 Imported by: 0

Documentation

Overview

Package authorizer defines authorization interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthorization

func NewAuthorization(getter PolicyGetter) authorization.AuthorizationInterface

NewAuthorization create a new Authorization instance.

Types

type Authorization

type Authorization struct {
	// contains filtered or unexported fields
}

Authorization implements authorization.AuthorizationInterface interface.

func (*Authorization) Create

func (auth *Authorization) Create(policy *ladon.DefaultPolicy) error

Create create a policy. Return nil because we use mysql storage to store the policy.

func (*Authorization) Delete

func (auth *Authorization) Delete(id string) error

Delete delete a policy by the given identifier. Return nil because we use mysql storage to store the policy.

func (*Authorization) DeleteCollection

func (auth *Authorization) DeleteCollection(idList []string) error

DeleteCollection batch delete policies by the given identifiers. Return nil because we use mysql storage to store the policy.

func (*Authorization) Get

func (auth *Authorization) Get(id string) (*ladon.DefaultPolicy, error)

Get returns the policy detail by the given identifier. Return nil because we use mysql storage to store the policy.

func (*Authorization) List

func (auth *Authorization) List(username string) ([]*ladon.DefaultPolicy, error)

List returns all the policies under the username.

func (*Authorization) LogGrantedAccessRequest

func (auth *Authorization) LogGrantedAccessRequest(r *ladon.Request, p ladon.Policies, d ladon.Policies)

LogGrantedAccessRequest write granted subject access to redis.

func (*Authorization) LogRejectedAccessRequest

func (auth *Authorization) LogRejectedAccessRequest(r *ladon.Request, p ladon.Policies, d ladon.Policies)

LogRejectedAccessRequest write rejected subject access to redis.

func (*Authorization) Update

func (auth *Authorization) Update(policy *ladon.DefaultPolicy) error

Update update a policy. Return nil because we use mysql storage to store the policy.

type PolicyGetter

type PolicyGetter interface {
	GetPolicy(key string) ([]*ladon.DefaultPolicy, error)
}

PolicyGetter defines function to get policy for a given user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL