auth

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RHSSOAuthentication string = "rhsso"
	LocalAuthentication string = "local"
	NoneAuthentication  string = "none"
)
View Source
const (
	AgentTokenHeader = "X-Agent-Token"
)

Variables

This section is empty.

Functions

func GenerateAgentJWT

func GenerateAgentJWT(signingKey *model.Key, source *model.Source) (string, error)

func GenerateAgentJWTAndKey

func GenerateAgentJWTAndKey(source *model.Source) (*model.Key, string, error)

func NewTokenContext

func NewTokenContext(ctx context.Context, t any) context.Context

Types

type AgentAuthenticator

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

func (*AgentAuthenticator) Authenticate

func (aa *AgentAuthenticator) Authenticate(token string) (AgentJWT, error)

func (*AgentAuthenticator) Authenticator

func (aa *AgentAuthenticator) Authenticator(next http.Handler) http.Handler

type AgentJWT

type AgentJWT struct {
	ExpireAt time.Time `json:"exp"`
	IssueAt  time.Time `json:"iat"`
	Issuer   string    `json:"iss"`
	OrgID    string    `json:"sub"`
	SourceID string    `json:"sourceID"`
}

func AgentFromContext

func AgentFromContext(ctx context.Context) (AgentJWT, bool)

func MustHaveAgent

func MustHaveAgent(ctx context.Context) AgentJWT

type Authenticator

type Authenticator interface {
	Authenticator(next http.Handler) http.Handler
}

func NewAgentAuthenticator

func NewAgentAuthenticator(enabled bool, store store.Store) Authenticator

func NewAuthenticator

func NewAuthenticator(authConfig config.Auth) (Authenticator, error)

type NoneAgentAuthenticator added in v0.13.5

type NoneAgentAuthenticator struct{}

func NewNoneAgentAuthenticator added in v0.13.5

func NewNoneAgentAuthenticator() *NoneAgentAuthenticator

func (*NoneAgentAuthenticator) Authenticator added in v0.13.5

func (n *NoneAgentAuthenticator) Authenticator(next http.Handler) http.Handler

type NoneAuthenticator

type NoneAuthenticator struct{}

func NewNoneAuthenticator

func NewNoneAuthenticator() (*NoneAuthenticator, error)

func (*NoneAuthenticator) Authenticator

func (n *NoneAuthenticator) Authenticator(next http.Handler) http.Handler

type RHSSOAuthenticator

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

func NewRHSSOAuthenticator

func NewRHSSOAuthenticator(ctx context.Context, jwkCertUrl string) (*RHSSOAuthenticator, error)

func NewRHSSOAuthenticatorWithKeyFn

func NewRHSSOAuthenticatorWithKeyFn(keyFn func(t *jwt.Token) (any, error)) (*RHSSOAuthenticator, error)

func (*RHSSOAuthenticator) Authenticate

func (rh *RHSSOAuthenticator) Authenticate(token string) (User, error)

func (*RHSSOAuthenticator) Authenticator

func (rh *RHSSOAuthenticator) Authenticator(next http.Handler) http.Handler

type User

type User struct {
	Username     string
	Organization string
	EmailDomain  string
	FirstName    string
	LastName     string
	Token        *jwt.Token
}

func MustHaveUser

func MustHaveUser(ctx context.Context) User

func UserFromContext

func UserFromContext(ctx context.Context) (User, bool)

Jump to

Keyboard shortcuts

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