auth

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnnotationAuthType labels Secrets that can be used for basic Auth.
	AnnotationAuthType = "tbncloud.org/auth-type"
	// AnnotationAuthRealm labels Secrets that match our authentication realm
	AnnotationAuthRealm = "tbncloud.org/auth-realm"
)

Variables

This section is empty.

Functions

func NewServerCredentials

func NewServerCredentials(certPath string, keyPath string, caPath string) (credentials.TransportCredentials, error)

NewServerCredentials loads TLS transport credentials for the GRPC server.

func RegisterServer

func RegisterServer(srv *grpc.Server, c Checker)

RegisterServer registers the Checker with the external authorization GRPC server.

func RunServer

func RunServer(listener net.Listener, srv *grpc.Server, stopChan <-chan struct{}) error

RunServer runs the server until signaled by stopChan.

Types

type CheckRequestV2

type CheckRequestV2 = envoy_service_auth_v2.CheckRequest //nolint(golint)

type CheckRequestV3

type CheckRequestV3 = envoy_service_auth_v3.CheckRequest //nolint(golint)

type CheckResponseV2

type CheckResponseV2 = envoy_service_auth_v2.CheckResponse //nolint(golint)

type CheckResponseV3

type CheckResponseV3 = envoy_service_auth_v3.CheckResponse //nolint(golint)

type Htpasswd

type Htpasswd struct {
	Log       logr.Logger
	Realm     string
	Client    client.Client
	Passwords *htpasswd.File
	Selector  labels.Selector

	Lock sync.Mutex
}

Htpasswd watches Secrets for htpasswd files and uses them for HTTP Basic Authentication.

func (*Htpasswd) Check

func (h *Htpasswd) Check(ctx context.Context, request *Request) (*Response, error)

Check ...

func (*Htpasswd) Match

func (h *Htpasswd) Match(user string, pass string) bool

Match authenticates the credential against the htpasswd file.

func (*Htpasswd) Reconcile

func (h *Htpasswd) Reconcile(ctrl.Request) (ctrl.Result, error)

Reconcile ...

func (*Htpasswd) RegisterWithManager

func (h *Htpasswd) RegisterWithManager(mgr ctrl.Manager) error

RegisterWithManager ...

func (*Htpasswd) Set

func (h *Htpasswd) Set(passwd *htpasswd.File)

Set set the htpasswd file to use.

type Request

type Request struct {
	Context map[string]string
	Request http.Request
	ID      string
}

Request captures the information needed to process a CheckRequest.

func (*Request) FromV2

func (r *Request) FromV2(c *CheckRequestV2) *Request

FromV2 initializes a Request from a v2 CheckRequest.

func (*Request) FromV3

func (r *Request) FromV3(c *CheckRequestV3) *Request

FromV3 initializes a Request from a v3 CheckRequest.

type Response

type Response struct {
	Allow    bool
	Response http.Response
}

Response captures the information needed to generate a CheckResponse.

func (*Response) AsV2

func (r *Response) AsV2() *CheckResponseV2

AsV2 converts to a v2 CheckResponse.

func (*Response) AsV3

func (r *Response) AsV3() *CheckResponseV3

AsV3 converts to a v3 CheckResponse.

type Testserver

type Testserver struct {
	Log logr.Logger
}

Testserver is a no-op implementation of the Checker interface. For testing only.

func (*Testserver) Check

func (t *Testserver) Check(xts context.Context, request *Request) (*Response, error)

Check ...

Jump to

Keyboard shortcuts

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