-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap login requests to clear in-memory session
- Loading branch information
Showing
3 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package origin | ||
|
||
import ( | ||
"net/http" | ||
|
||
cmdutil "github.com/openshift/origin/pkg/cmd/util" | ||
) | ||
|
||
type handlerWrapper interface { | ||
Wrap(http.Handler) http.Handler | ||
} | ||
|
||
// handlerWrapperMux wraps all handlers before registering them in the contained mux | ||
type handlerWrapperMux struct { | ||
mux cmdutil.Mux | ||
wrapper handlerWrapper | ||
} | ||
|
||
var _ = cmdutil.Mux(&handlerWrapperMux{}) | ||
|
||
func (m *handlerWrapperMux) Handle(pattern string, handler http.Handler) { | ||
m.mux.Handle(pattern, m.wrapper.Wrap(handler)) | ||
} | ||
func (m *handlerWrapperMux) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) { | ||
m.mux.Handle(pattern, m.wrapper.Wrap(http.HandlerFunc(handler))) | ||
} |