security

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadTokenRoles

func ReadTokenRoles(token string) (roles []string, err error)

Types

type ConditionConfig

type ConditionConfig struct {
	Feature   string             `json:"feature"`
	Operation QueryOperationType `json:"operation"`
	Value     interface{}        `json:"value"`
	Ref       string             `json:"ref"`
}

type IdWrapper

type IdWrapper struct {
	Id string `json:"id"`
}

type ListElement

type ListElement struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type OpenidToken

type OpenidToken struct {
	AccessToken      string    `json:"access_token"`
	ExpiresIn        float64   `json:"expires_in"`
	RefreshExpiresIn float64   `json:"refresh_expires_in"`
	RefreshToken     string    `json:"refresh_token"`
	TokenType        string    `json:"token_type"`
	RequestTime      time.Time `json:"-"`
}

type QueryCheckIds

type QueryCheckIds struct {
	Ids    []string `json:"ids"`
	Rights string   `json:"rights"`
}

type QueryFind

type QueryFind struct {
	QueryListCommons
	Search string     `json:"search"`
	Filter *Selection `json:"filter"`
}

type QueryListCommons

type QueryListCommons struct {
	Limit    int    `json:"limit"`
	Offset   int    `json:"offset"`
	Rights   string `json:"rights"`
	SortBy   string `json:"sort_by"`
	SortDesc bool   `json:"sort_desc"`
}

type QueryListIds

type QueryListIds struct {
	QueryListCommons
	Ids []string `json:"ids"`
}

type QueryMessage

type QueryMessage struct {
	Resource      string         `json:"resource"`
	Find          *QueryFind     `json:"find"`
	ListIds       *QueryListIds  `json:"list_ids"`
	CheckIds      *QueryCheckIds `json:"check_ids"`
	TermAggregate *string        `json:"term_aggregate"`
}

type QueryOperationType

type QueryOperationType string
const (
	QueryEqualOperation             QueryOperationType = "=="
	QueryUnequalOperation           QueryOperationType = "!="
	QueryAnyValueInFeatureOperation QueryOperationType = "any_value_in_feature"
)

type Security

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

func New

func New(config configuration.Config) *Security

func (*Security) CheckBool

func (this *Security) CheckBool(token string, kind string, id string, rights string) (allowed bool, err error)

func (*Security) CheckMultiple

func (this *Security) CheckMultiple(token string, kind string, ids []string, rights string) (result map[string]bool, err error)

func (*Security) GetAdminToken

func (this *Security) GetAdminToken() (token string, err error)

func (*Security) IsAdmin

func (this *Security) IsAdmin(token string) bool

func (*Security) List

func (this *Security) List(token string, resource string, limit string, offset string, rights string) (result []ListElement, err error)

func (*Security) ListElements

func (this *Security) ListElements(token string, resource string, limit string, offset string, rights string, result interface{}) (err error)

type Selection

type Selection struct {
	And       []Selection     `json:"and"`
	Or        []Selection     `json:"or"`
	Not       *Selection      `json:"not"`
	Condition ConditionConfig `json:"condition"`
}

Jump to

Keyboard shortcuts

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