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 ¶
- Variables
- func ExtendLocalTrust(certs string)
- func ExtendLocalTrustFromFile(path string) error
- func FilterResources[T NamespacedResource](user User, resources []T) []T
- type AuthService
- func (s *AuthService) AddNamespaceToUser(ctx context.Context, username, namespace string) error
- func (s *AuthService) GetUserByUsername(ctx context.Context, username string) (User, error)
- func (s *AuthService) GetUsers(ctx context.Context) ([]User, error)
- func (s *AuthService) RemoveNamespaceFromUsers(ctx context.Context, namespace string) error
- func (s *AuthService) SaveUser(ctx context.Context, user User) (User, error)
- type NamespacedResource
- type User
Constants ¶
This section is empty.
Variables ¶
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
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
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
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
NewUserFromIDToken create an Epinio User from an IDToken
func NewUserFromSecret ¶ added in v0.8.0
NewUserFromSecret create an Epinio User from a Secret
func (*User) AddNamespace ¶ added in v0.8.0
AddNamespace adds the namespace to the User's namespaces, if not already exists
func (*User) RemoveNamespace ¶ added in v0.8.0
RemoveNamespace removes a namespace from the User's namespaces. It returns false if the namespace was not there