auth

package
Version: v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 18 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 MakeGinAccountsFromUsers added in v0.8.0

func MakeGinAccountsFromUsers(users []User) gin.Accounts

MakeGinAccountsFromUsers is a utility func to convert the Epinio users to gin.Accounts, that can be passed to the BasicAuth middleware.

Types

type AuthService added in v0.8.0

type AuthService struct {
	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) GetUsersByAge added in v0.8.0

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

GetUsersByAge returns the Epinio Users BasicAuth sorted from older to younger by CreationTime.

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

type ByCreationTime added in v0.8.0

type ByCreationTime []User

ByCreationTime can be used to sort Users by CreationTime

func (ByCreationTime) Len added in v0.8.0

func (c ByCreationTime) Len() int

func (ByCreationTime) Less added in v0.8.0

func (c ByCreationTime) Less(i, j int) bool

func (ByCreationTime) Swap added in v0.8.0

func (a ByCreationTime) Swap(i, j int)

type SecretInterface added in v0.8.0

type SecretInterface interface {
	typedcorev1.SecretInterface
}

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 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