aboutsummaryrefslogtreecommitdiff
path: root/internal/http/request/context.go
diff options
context:
space:
mode:
authorGravatar Florian RĂ¼chel <florian.ruechel.github@inexplicity.de> 2023-11-06 04:27:35 +1030
committerGravatar GitHub <noreply@github.com> 2023-11-05 18:57:35 +0100
commit62ef8ed57aab9f2b05a64b153d231ae4f42769f4 (patch)
treeacc33ab1fd02113f8fc93751e593dc67ff504a84 /internal/http/request/context.go
parent62188b49f072ea3c2bf30a8ed42f8b9303840191 (diff)
downloadv2-62ef8ed57aab9f2b05a64b153d231ae4f42769f4.tar.gz
v2-62ef8ed57aab9f2b05a64b153d231ae4f42769f4.tar.zst
v2-62ef8ed57aab9f2b05a64b153d231ae4f42769f4.zip
Add WebAuthn / Passkey integration
This is a rebase of #1618 in which @dave-atx added WebAuthn support. Closes #1618
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)