rbac

package
v0.0.0-...-fe632b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionArgs

type ActionArgs struct {
	Namespace  string
	Service    string
	Method     string
	Path       string
	Properties []string
}

ActionArgs contains information about the detail of a request.

type ConfigStore

type ConfigStore struct {
	// All the Roles organized per namespace.
	Roles RolesMapByNamespace
}

ConfigStore contains all ServiceRole and ServiceRoleBinding information. ConfigStore implements authorizer interface.

func (*ConfigStore) CheckPermission

func (rs *ConfigStore) CheckPermission(subject SubjectArgs, action ActionArgs) (bool, error)

CheckPermission checks permission for a given subject and action. TODO(yangminzhu): Refactor and support checking RbacConfig.

type RoleInfo

type RoleInfo struct {
	// ServiceRole proto definition
	Info *rbacproto.ServiceRole

	// A set of ServiceRoleBindings that refer to this role.
	Bindings map[string]*rbacproto.ServiceRoleBinding
}

RoleInfo contains information about a ServiceRole and associated ServiceRoleBindings.

type RolesByName

type RolesByName map[string]*RoleInfo

RolesByName maps role name to role info

type RolesMapByNamespace

type RolesMapByNamespace map[string]RolesByName

RolesMapByNamespace maps namespace to a set of Roles in the namespace

func (*RolesMapByNamespace) AddServiceRole

func (rs *RolesMapByNamespace) AddServiceRole(name, namespace string, proto *rbacproto.ServiceRole) error

AddServiceRole adds a new ServiceRole to RolesMapByNamespace with the specified name and namespace. Return nil if added successfully, otherwise return an error.

func (*RolesMapByNamespace) AddServiceRoleBinding

func (rs *RolesMapByNamespace) AddServiceRoleBinding(name, namespace string, proto *rbacproto.ServiceRoleBinding) error

AddServiceRoleBinding adds a new ServiceRoleBinding to RolesMapByNamespace with the specified name and namespace. Return nil if added successfully, otherwise return an error.

type SubjectArgs

type SubjectArgs struct {
	User       string
	Groups     string
	Properties []string
}

SubjectArgs contains information about the subject of a request.

Jump to

Keyboard shortcuts

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