Documentation
¶
Index ¶
- Constants
- func GetLoggerForRequest(r *http.Request, clientHeader string) *slog.Logger
- type ChallengeCallback
- type ChallengeInformation
- type RequestData
- type RuleState
- type State
- func (state *State) AwaitChallenge(key []byte, ctx context.Context) challenge.VerifyResult
- func (state *State) GetChallengeByName(name string) (challenge.Challenge, bool)
- func (state *State) GetChallengeKeyForRequest(challengeName string, until time.Time, r *http.Request) []byte
- func (state *State) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (state *State) SolveChallenge(key []byte, result challenge.VerifyResult)
- type StateSettings
Constants ¶
View Source
const DefaultValidity = time.Hour * 24 * 7
DefaultValidity TODO: adjust
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChallengeCallback ¶ added in v0.2.0
type ChallengeCallback func(result challenge.VerifyResult)
type ChallengeInformation ¶
type ChallengeInformation struct {
Name string `json:"name"`
Key []byte `json:"key"`
Result []byte `json:"result"`
Expiry *jwt.NumericDate `json:"exp,omitempty"`
NotBefore *jwt.NumericDate `json:"nbf,omitempty"`
IssuedAt *jwt.NumericDate `json:"iat,omitempty"`
}
type RequestData ¶
type RequestData struct {
Id [16]byte
ProgramEnv map[string]any
Expires time.Time
Challenges map[challenge.Id]challenge.VerifyResult
}
func RequestDataFromContext ¶
func RequestDataFromContext(ctx context.Context) *RequestData
func (*RequestData) HasValidChallenge ¶
func (d *RequestData) HasValidChallenge(id challenge.Id) bool
type State ¶
type State struct {
Client *http.Client
Settings StateSettings
UrlPath string
Mux *http.ServeMux
Networks map[string]cidranger.Ranger
Wasm *wasm.Runner
Challenges map[challenge.Id]challenge.Challenge
RulesEnv *cel.Env
Rules []RuleState
Poison map[string][]byte
ChallengeSolve sync.Map
// contains filtered or unexported fields
}
func (*State) AwaitChallenge ¶ added in v0.2.0
func (*State) GetChallengeByName ¶
func (*State) GetChallengeKeyForRequest ¶
func (*State) SolveChallenge ¶ added in v0.2.0
func (state *State) SolveChallenge(key []byte, result challenge.VerifyResult)
Click to show internal directories.
Click to hide internal directories.