auth

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package auth collects structures and functions around the generation and processing of credentials.

Package auth collects structures and functions around the generation and processing of credentials.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound = errors.New("user not found")
)

Functions

func ExtendLocalTrust added in v0.0.16

func ExtendLocalTrust(certs string)

ExtendLocalTrust makes the certs found in specified PEM string available as root CA certs, beyond the standard certs. It does this by creating an in-memory pool of certs filled from both the system pool and the argument, and setting this as the cert origin for net/http's default transport. Ditto for the websocket's default dialer.

func ExtendLocalTrustFromFile added in v1.3.0

func ExtendLocalTrustFromFile(path string) error

ExtendLocalTrustFromFile will load a cert from the specified file and will extend the local trust

func FilterResources added in v0.9.0

func FilterResources[T NamespacedResource](user User, resources []T) []T

FilterResources returns only the NamespacedResources where the user has permissions

Types

type AuthService added in v0.8.0

type AuthService struct {
	typedcorev1.SecretInterface
}

func NewAuthServiceFromContext added in v0.8.0

func NewAuthServiceFromContext(ctx context.Context) (*AuthService, error)

func (*AuthService) AddNamespaceToUser added in v0.8.0

func (s *AuthService) AddNamespaceToUser(ctx context.Context, username, namespace string) error

AddNamespaceToUser will add to the User the specified namespace

func (*AuthService) GetUserByUsername added in v0.8.0

func (s *AuthService) GetUserByUsername(ctx context.Context, username string) (User, error)

GetUserByUsername returns the user with the provided username It will return a UserNotFound error if the user is not found

func (*AuthService) GetUsers added in v0.8.0

func (s *AuthService) GetUsers(ctx context.Context) ([]User, error)

GetUsers returns all the Epinio users

func (*AuthService) RemoveNamespaceFromUsers added in v0.8.0

func (s *AuthService) RemoveNamespaceFromUsers(ctx context.Context, namespace string) error

RemoveNamespaceFromUsers will remove the specified namespace from all the users

func (*AuthService) SaveUser added in v1.3.0

func (s *AuthService) SaveUser(ctx context.Context, user User) (User, error)

type NamespacedResource added in v0.9.0

type NamespacedResource interface {
	Namespace() string
}

type User added in v0.8.0

type User struct {
	Username   string
	Password   string
	CreatedAt  time.Time
	Role       string
	Namespaces []string
	// contains filtered or unexported fields
}

User is a struct containing all the information of an Epinio User

func NewUserFromIDToken added in v1.3.0

func NewUserFromIDToken(idToken *oidc.IDToken) (User, error)

NewUserFromIDToken create an Epinio User from an IDToken

func NewUserFromSecret added in v0.8.0

func NewUserFromSecret(secret corev1.Secret) User

NewUserFromSecret create an Epinio User from a Secret

func (*User) AddNamespace added in v0.8.0

func (u *User) AddNamespace(namespace string)

AddNamespace adds the namespace to the User's namespaces, if not already exists

func (*User) RemoveNamespace added in v0.8.0

func (u *User) RemoveNamespace(namespace string) bool

RemoveNamespace removes a namespace from the User's namespaces. It returns false if the namespace was not there

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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