add silent refresh middleware

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2020-07-07 14:08:18 +02:00
parent 60e064ea7d
commit 26a1b6f98b
2 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
package middleware
import (
"net/http"
)
// SilentRefresh allows the oidc client lib to silently refresh the token in an iframe
func SilentRefresh(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
next.ServeHTTP(w, r)
})
}

View File

@@ -1,6 +1,7 @@
package http
import (
phoenixmid "github.com/owncloud/ocis-phoenix/pkg/middleware"
svc "github.com/owncloud/ocis-phoenix/pkg/service/v0"
"github.com/owncloud/ocis-phoenix/pkg/version"
"github.com/owncloud/ocis-pkg/v2/middleware"
@@ -30,6 +31,7 @@ func Server(opts ...Option) (http.Service, error) {
middleware.Cache,
middleware.Cors,
middleware.Secure,
phoenixmid.SilentRefresh,
middleware.Version(
"phoenix",
version.String,