Documentation
¶
Index ¶
- Constants
- Variables
- func ContextWithJWTCreator(ctx context.Context) context.Context
- func OpenIDDiscoverURL(base string) (string, error)
- func Start(ctx context.Context, authCfg any) error
- type AllStrategieser
- type IDTokenGrant
- type JWTCreator
- type JWTFiler
- type ListenAddresser
- type NodeAuthenticater
- type OpenIDConfiguration
- type OpenIDSettings
- type StrategyManager
- type UserAndPasswordGranter
- type UserGranter
- type X509CACertFiler
- type X509Strategy
Constants ¶
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" )
const ( StrategyUX = "ux" StrategyJWT = "jwt" StrategyJWTOpenID = "jwt-openid" StrategyNode = "node" StrategyUser = "user" StrategyX509 = "x509" )
Variables ¶
var (
Strategy = &StrategyManager{}
)
Functions ¶
func OpenIDDiscoverURL ¶
Types ¶
type AllStrategieser ¶
type AllStrategieser interface {
ListenAddresser
JWTFiler
X509CACertFiler
NodeAuthenticater
UserGranter
}
AllStrategieser defines interfaces that allows all strategies
type IDTokenGrant ¶
func (IDTokenGrant) New ¶
func (i IDTokenGrant) New() oauth2.ClaimsResolver
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 ¶
JWTFiler is the interface that groups SignKeyFile and VerifyKeyFile methods for JWT auth.
type ListenAddresser ¶
ListenAddresser is the interface for ListenAddr method for ux auth.
type NodeAuthenticater ¶
NodeAuthenticater is the interface for AuthenticateNode method for node basic auth.
type OpenIDConfiguration ¶
type OpenIDSettings ¶
type UserAndPasswordGranter ¶
type UserAndPasswordGranter interface {
GrantsFromUsernameAndPassword(username, password string) ([]string, error)
}
UserAndPasswordGranter is the interface for UserGrants method for user basic auth.
type UserGranter ¶
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
}