mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-26 18:28:20 -04:00
add silent refresh middleware
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
13
pkg/middleware/silentrefresh.go
Normal file
13
pkg/middleware/silentrefresh.go
Normal 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)
|
||||
})
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user