lib

package module
v0.0.0-...-373d8b7 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest      = AuthErr(http.StatusBadRequest, "bad request: invalid token format")
	ErrUnauthenticated = AuthErr(http.StatusUnauthorized, "bad request: unauthenticated")
	ErrInternalAuthN   = AuthErr(http.StatusInternalServerError, "internal error: failed to authenticate user")
	ErrInternalAuthZ   = AuthErr(http.StatusInternalServerError, "internal error: failed to authorize user")
)

Functions

func AuthErr

func AuthErr(statusCode int, message string) authErr

Types

type SubjectAuthorizer

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

func NewSubjectAuthorizer

func NewSubjectAuthorizer(client kubernetes.Interface) *SubjectAuthorizer

NewSubjectAuthorizer creates a new authorizer with the provided Kubernetes client.

func (*SubjectAuthorizer) AuthorizeSubject

func (s *SubjectAuthorizer) AuthorizeSubject(ctx context.Context, user authnv1.UserInfo, namespace, group, resource, verb string) (bool, error)

AuthorizeSubject checks if the user is allowed to perform the provided action

type TokenAuthenticator

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

func NewTokenAuthenticator

func NewTokenAuthenticator(client kubernetes.Interface) *TokenAuthenticator

func (*TokenAuthenticator) AuthenticateFromHeader

func (t *TokenAuthenticator) AuthenticateFromHeader(ctx context.Context, authHeader string) (bool, authnv1.UserInfo, error)

Jump to

Keyboard shortcuts

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