auth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

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 NewAgentAuthenticator

func NewAgentAuthenticator(store store.Store) *AgentAuthenticator

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 NewAuthenticator

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

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