daemonauth

package
v3.0.0-rc21 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TkUseClaim is a constant used as the key to identify the token usage type in claims or authentication context.
	TkUseClaim = "token_use"

	// TkUseAccess represents the token usage type for access tokens.
	TkUseAccess = "access"

	// TkUseRefresh represents the token usage type for refresh tokens.
	TkUseRefresh = "refresh"

	// TkUseProxy represents the token usage type for proxy tokens.
	TkUseProxy = "proxy"
)
View Source
const (
	StrategyUX        = "ux"
	StrategyJWT       = "jwt"
	StrategyJWTOpenID = "jwt-openid"
	StrategyNode      = "node"
	StrategyUser      = "user"
	StrategyX509      = "x509"
)

Variables

View Source
var (
	Strategy = &StrategyManager{}
)

Functions

func ContextWithJWTCreator

func ContextWithJWTCreator(ctx context.Context) context.Context

func OpenIDDiscoverURL

func OpenIDDiscoverURL(base string) (string, error)

func Start

func Start(ctx context.Context, authCfg any) error

Types

type AllStrategieser

AllStrategieser defines interfaces that allows all strategies

type IDTokenGrant

type IDTokenGrant struct {
	*jwt.IDToken
	Grant []string `json:"entitlements"`
}

func (IDTokenGrant) New

func (IDTokenGrant) Resolve

func (i IDTokenGrant) Resolve() auth.Info

func (IDTokenGrant) Verify

func (i IDTokenGrant) Verify(options claims.VerifyOptions) error

type JWTCreator

type JWTCreator struct{}

JWTCreator implements CreateUserToken method

func JWTCreatorFromContext

func JWTCreatorFromContext(ctx context.Context) *JWTCreator

func (*JWTCreator) CreateToken

func (*JWTCreator) CreateToken(duration time.Duration, xClaims map[string]interface{}) (tk string, expiredAt time.Time, err error)

CreateToken implements CreateToken interface for `daemonapi.JWTCreater`. It generates a JWT with the specified duration and custom claims, returning the token, expiration time, and error if any.

type JWTFiler

type JWTFiler interface {
	SignKeyFile() string
	VerifyKeyFile() string
}

JWTFiler is the interface that groups SignKeyFile and VerifyKeyFile methods for JWT auth.

type ListenAddresser

type ListenAddresser interface {
	ListenAddr(context.Context) string
}

ListenAddresser is the interface for ListenAddr method for ux auth.

type NodeAuthenticater

type NodeAuthenticater interface {
	AuthenticateNode(nodename, password string) error
}

NodeAuthenticater is the interface for AuthenticateNode method for node basic auth.

type OpenIDConfiguration

type OpenIDConfiguration struct {
	Issuer          string   `json:"issuer"`
	ScopesSupported []string `json:"scopes_supported"`
	JwsksUri        string   `json:"jwks_uri"`
}

type OpenIDSettings

type OpenIDSettings interface {
	OpenIDIssuer() string
	OpenIDClientID() string
}

type StrategyManager

type StrategyManager struct {
	Mutex sync.RWMutex
	Value union.Union
}

type UserAndPasswordGranter

type UserAndPasswordGranter interface {
	GrantsFromUsernameAndPassword(username, password string) ([]string, error)
}

UserAndPasswordGranter is the interface for UserGrants method for user basic auth.

type UserGranter

type UserGranter interface {
	GrantsFromUsername(username string) ([]string, error)
}

UserGranter is the interface for UserGrants method for user basic auth.

type X509CACertFiler

type X509CACertFiler interface {
	X509CACertFile() string
}

X509CACertFiler is the interface for X509CACertFile method for x509 auth.

type X509Strategy

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

func (*X509Strategy) Authenticate

func (s *X509Strategy) Authenticate(ctx context.Context, r *http.Request) (auth.Info, error)

Jump to

Keyboard shortcuts

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