aboutsummaryrefslogtreecommitdiff
path: root/internal/http/request/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/http/request/context.go')
-rw-r--r--internal/http/request/context.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/http/request/context.go b/internal/http/request/context.go
index 9a0acbf4..b2ce54cf 100644
--- a/internal/http/request/context.go
+++ b/internal/http/request/context.go
@@ -6,6 +6,8 @@ package request // import "miniflux.app/v2/internal/http/request"
import (
"net/http"
"strconv"
+
+ "miniflux.app/v2/internal/model"
)
// ContextKey represents a context key.
@@ -30,8 +32,22 @@ const (
LastForceRefreshContextKey
ClientIPContextKey
GoogleReaderToken
+ WebAuthnDataContextKey
)
+func WebAuthnSessionData(r *http.Request) *model.WebAuthnSession {
+ if v := r.Context().Value(WebAuthnDataContextKey); v != nil {
+ value, valid := v.(model.WebAuthnSession)
+ if !valid {
+ return nil
+ }
+
+ return &value
+ }
+
+ return nil
+}
+
// GoolgeReaderToken returns the google reader token if it exists.
func GoolgeReaderToken(r *http.Request) string {
return getContextStringValue(r, GoogleReaderToken)