acl

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: MPL-2.0 Imports: 14 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 testing.TB) *MockLogin

NewMockLogin creates a new instance of MockLogin. It also registers the testing.TB 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 testing.TB) *MockTokenWriter

NewMockTokenWriter creates a new instance of MockTokenWriter. It also registers the testing.TB 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 testing.TB) *MockValidator

NewMockValidator creates a new instance of MockValidator. It also registers the testing.TB 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