acl

package
v1.14.7 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ACLsEnabled               bool
	Logger                    hclog.Logger
	LoadAuthMethod            func(authMethod string, entMeta *acl.EnterpriseMeta) (*structs.ACLAuthMethod, Validator, error)
	NewLogin                  func() Login
	ForwardRPC                func(structs.RPCInfo, func(*grpc.ClientConn) error) (bool, error)
	ValidateEnterpriseRequest func(*acl.EnterpriseMeta, bool) error
	LocalTokensEnabled        func() bool
	InPrimaryDatacenter       bool
	PrimaryDatacenter         string
	NewTokenWriter            func() TokenWriter
}

type Login

type Login interface {
	TokenForVerifiedIdentity(identity *authmethod.Identity, authMethod *structs.ACLAuthMethod, description string) (*structs.ACLToken, error)
}

type MockLogin

type MockLogin struct {
	mock.Mock
}

MockLogin is an autogenerated mock type for the Login type

func NewMockLogin

func NewMockLogin(t mockConstructorTestingTNewMockLogin) *MockLogin

NewMockLogin creates a new instance of MockLogin. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockLogin) TokenForVerifiedIdentity

func (_m *MockLogin) TokenForVerifiedIdentity(identity *authmethod.Identity, authMethod *structs.ACLAuthMethod, description string) (*structs.ACLToken, error)

TokenForVerifiedIdentity provides a mock function with given fields: identity, authMethod, description

type MockTokenWriter

type MockTokenWriter struct {
	mock.Mock
}

MockTokenWriter is an autogenerated mock type for the TokenWriter type

func NewMockTokenWriter

func NewMockTokenWriter(t mockConstructorTestingTNewMockTokenWriter) *MockTokenWriter

NewMockTokenWriter creates a new instance of MockTokenWriter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockTokenWriter) Delete

func (_m *MockTokenWriter) Delete(secretID string, fromLogout bool) error

Delete provides a mock function with given fields: secretID, fromLogout

type MockValidator

type MockValidator struct {
	mock.Mock
}

MockValidator is an autogenerated mock type for the Validator type

func NewMockValidator

func NewMockValidator(t mockConstructorTestingTNewMockValidator) *MockValidator

NewMockValidator creates a new instance of MockValidator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockValidator) ValidateLogin

func (_m *MockValidator) ValidateLogin(ctx context.Context, loginToken string) (*authmethod.Identity, error)

ValidateLogin provides a mock function with given fields: ctx, loginToken

type Server

type Server struct {
	Config
}

func NewServer

func NewServer(cfg Config) *Server

func (*Server) Login

func (s *Server) Login(ctx context.Context, req *pbacl.LoginRequest) (*pbacl.LoginResponse, error)

Login exchanges the presented bearer token for a Consul ACL token using a configured auth method.

func (*Server) Logout

Logout destroys the given ACL token once the caller is done with it.

func (*Server) Register

func (s *Server) Register(grpcServer *grpc.Server)

type TokenWriter

type TokenWriter interface {
	Delete(secretID string, fromLogout bool) error
}

type Validator

type Validator interface {
	ValidateLogin(ctx context.Context, loginToken string) (*authmethod.Identity, error)
}

Jump to

Keyboard shortcuts

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