Documentation
¶
Index ¶
- Constants
- func JwkToJKT(jwk map[string]interface{}) string
- func JwkToString(jwk map[string]interface{}) string
- type AccessControl
- type Argon2CostWarning
- type Argon2Limiter
- type BasicAuth
- type DPoPTokenSource
- type DisablePrivateCaching
- type IntrospectionResponse
- type Introspector
- type JWT
- type LimiterEntry
- type List
- type ListItem
- type Map
- type NameTokenSource
- type OAuth2Callback
- type PermissionsControl
- type ProofClaims
- type ProtectedHandler
- type RateLimiter
- type Saml2
- type TokenSource
- type ValidateFunc
- type ValueTokenSource
Constants ¶
const DefaultArgon2MemoryBudget uint32 = 256 * 1024
DefaultArgon2MemoryBudget is the memory in KiB that the argon2 derivations may use at the same time, if the settings give no beta_argon2_memory_budget.
const (
DpopTyp = "dpop+jwt"
)
Variables ¶
This section is empty.
Functions ¶
func JwkToString ¶ added in v1.14.0
Types ¶
type AccessControl ¶
type Argon2CostWarning ¶ added in v1.14.3
type Argon2CostWarning struct {
User string
Line int
Parameter string // m, t or p
Value uint64
Maximum uint64
}
Argon2CostWarning names an htpasswd entry that loads with an argon2 parameter above the recommended maximum. Each request for this user pays that cost.
func (Argon2CostWarning) String ¶ added in v1.14.3
func (w Argon2CostWarning) String() string
String states the fact. The caller adds the location and the advice.
type Argon2Limiter ¶ added in v1.14.3
type Argon2Limiter struct {
// contains filtered or unexported fields
}
Argon2Limiter limits the argon2 derivations that run at the same time, so the peak memory follows a budget and not the number of requests. One limiter serves all basic_auth blocks of a configuration.
func NewArgon2Limiter ¶ added in v1.14.3
func NewArgon2Limiter(budget, memory uint32) *Argon2Limiter
NewArgon2Limiter gives as many slots as derivations of the most expensive entry fit into the budget, both in KiB. The number of cores is the upper limit, because a derivation keeps one core busy and more slots only raise the memory use. One derivation can always run, even if it alone exceeds the budget.
func (*Argon2Limiter) PeakMemory ¶ added in v1.14.3
func (l *Argon2Limiter) PeakMemory() uint64
PeakMemory returns the memory in KiB that all slots use together.
func (*Argon2Limiter) Slots ¶ added in v1.14.3
func (l *Argon2Limiter) Slots() int
Slots returns the number of derivations that run at the same time.
type BasicAuth ¶
type BasicAuth struct {
// contains filtered or unexported fields
}
BasicAuth represents an AC-BasicAuth object
func NewBasicAuth ¶
NewBasicAuth creates a new AC-BasicAuth object
func (*BasicAuth) Argon2Memory ¶ added in v1.14.3
Argon2Memory returns the memory in KiB that one derivation of the most expensive argon2 entry needs, or 0 if no entry uses argon2.
func (*BasicAuth) UseArgon2Limiter ¶ added in v1.14.3
func (ba *BasicAuth) UseArgon2Limiter(limiter *Argon2Limiter)
UseArgon2Limiter replaces the limiter, so all basic_auth blocks of a configuration share one memory budget.
func (*BasicAuth) Warnings ¶ added in v1.14.3
func (ba *BasicAuth) Warnings() []Argon2CostWarning
Warnings lists the htpasswd entries that load with an argon2 parameter above the recommended maximum.
type DPoPTokenSource ¶ added in v1.14.0
type DPoPTokenSource struct {
// contains filtered or unexported fields
}
func (*DPoPTokenSource) TokenValue ¶ added in v1.14.0
func (s *DPoPTokenSource) TokenValue(req *http.Request) (string, error)
func (*DPoPTokenSource) ValidateTokenClaims ¶ added in v1.14.0
type DisablePrivateCaching ¶
type DisablePrivateCaching interface {
DisablePrivateCaching() bool
}
type IntrospectionResponse ¶ added in v1.14.0
type IntrospectionResponse map[string]interface{}
IntrospectionResponse represents the response body to a token introspection request.
func NewIntrospectionResponse ¶ added in v1.14.0
func NewIntrospectionResponse(res *http.Response) (IntrospectionResponse, error)
func (IntrospectionResponse) Active ¶ added in v1.14.0
func (ir IntrospectionResponse) Active() bool
Active returns whether the token is active.
type Introspector ¶ added in v1.14.0
type Introspector struct {
// contains filtered or unexported fields
}
Introspector represents a token introspector.
func NewIntrospector ¶ added in v1.14.0
func NewIntrospector(evalCtx *hcl.EvalContext, conf *config.Introspection, transport http.RoundTripper, memStore *cache.MemoryStore) (*Introspector, error)
NewIntrospector creates a new token introspector.
func (*Introspector) Introspect ¶ added in v1.14.0
func (i *Introspector) Introspect(ctx context.Context, token string, exp, nbf int64) (IntrospectionResponse, error)
Introspect retrieves introspection data for the given token using either cached or fresh information.
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
func NewJWT ¶
func NewJWT(jwtConf *config.JWT, introspector *Introspector, key []byte, memStore *cache.MemoryStore) (*JWT, error)
NewJWT parses the key and creates Validation obj which can be referenced in related handlers.
func NewJWTFromJWKS ¶
func NewJWTFromJWKS(jwtConf *config.JWT, introspector *Introspector, jwks *jwk.JWKS, memStore *cache.MemoryStore) (*JWT, error)
func (*JWT) DisablePrivateCaching ¶
type LimiterEntry ¶ added in v1.14.0
type LimiterEntry struct {
// contains filtered or unexported fields
}
type ListItem ¶
type ListItem struct {
// contains filtered or unexported fields
}
func NewItem ¶
func NewItem(nameLabel string, control AccessControl, errHandler http.Handler) *ListItem
func (ListItem) DisablePrivateCaching ¶
func (ListItem) ErrorHandler ¶
type Map ¶
type Map map[string]AccessControl
type NameTokenSource ¶ added in v1.14.0
type NameTokenSource struct {
// contains filtered or unexported fields
}
func (*NameTokenSource) TokenValue ¶ added in v1.14.0
func (s *NameTokenSource) TokenValue(req *http.Request) (string, error)
func (*NameTokenSource) ValidateTokenClaims ¶ added in v1.14.0
type OAuth2Callback ¶
type OAuth2Callback struct {
// contains filtered or unexported fields
}
OAuth2Callback represents the access control for the OAuth2 authorization code flow callback.
func NewOAuth2Callback ¶
func NewOAuth2Callback(oauth2Client oauth2.AuthCodeFlowClient, name string) *OAuth2Callback
NewOAuth2Callback creates a new access control for the OAuth2 authorization code flow callback.
type PermissionsControl ¶
type PermissionsControl struct {
// contains filtered or unexported fields
}
func NewPermissionsControl ¶
func NewPermissionsControl(permissionExpr hcl.Expression) *PermissionsControl
type ProofClaims ¶ added in v1.14.0
type ProofClaims struct {
jwt.RegisteredClaims
Ath string `json:"ath,omitempty"`
Htm string `json:"htm,omitempty"`
Htu string `json:"htu,omitempty"`
// contains filtered or unexported fields
}
func (*ProofClaims) Validate ¶ added in v1.14.0
func (p *ProofClaims) Validate() error
type ProtectedHandler ¶
type RateLimiter ¶ added in v1.14.0
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter represents an AC-RateLimiter object
func NewRateLimiter ¶ added in v1.14.0
func NewRateLimiter(ctx context.Context, name string, conf *config.RateLimiter) (*RateLimiter, error)
NewRateLimiter creates a new AC-RateLimiter object
func (*RateLimiter) ActiveKeyCount ¶ added in v1.14.0
func (rl *RateLimiter) ActiveKeyCount() int
ActiveKeyCount returns the number of currently tracked keys.
func (*RateLimiter) Name ¶ added in v1.14.0
func (rl *RateLimiter) Name() string
Name returns the rate limiter's configured name.
type Saml2 ¶
type Saml2 struct {
// contains filtered or unexported fields
}
func NewSAML2ACS ¶
func (*Saml2) GetAssertionData ¶
func (s *Saml2) GetAssertionData(assertionInfo *saml2.AssertionInfo) map[string]interface{}
func (*Saml2) ValidateAssertionInfo ¶
func (s *Saml2) ValidateAssertionInfo(assertionInfo *saml2.AssertionInfo) error
type TokenSource ¶
type TokenSource interface {
// TokenValue retrieves the token value from the request.
TokenValue(req *http.Request) (string, error)
// ValidateTokenClaims validates the token (claims) according to e.g. a specific request header field.
ValidateTokenClaims(token string, tokenClaims map[string]interface{}, req *http.Request) error
}
TokenSource represents the source from which a token is retrieved.
func NewTokenSource ¶
func NewTokenSource(bearer, dpop bool, cookie, header string, value hcl.Expression) (TokenSource, error)
NewTokenSource creates a new token source according to various configuration attributes.
type ValidateFunc ¶
type ValueTokenSource ¶ added in v1.14.0
type ValueTokenSource struct {
// contains filtered or unexported fields
}
func (*ValueTokenSource) TokenValue ¶ added in v1.14.0
func (s *ValueTokenSource) TokenValue(req *http.Request) (string, error)