mirror of
https://github.com/documize/community.git
synced 2025-08-08 15:05:28 +02:00
auth with cas
This commit is contained in:
parent
8c99977fc9
commit
8c2df6178d
150 changed files with 43682 additions and 24175 deletions
28
vendor/gopkg.in/cas.v2/middleware.go
generated
vendored
Normal file
28
vendor/gopkg.in/cas.v2/middleware.go
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
package cas
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
func (c *Client) Handler(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if glog.V(2) {
|
||||
glog.Infof("cas: handling %v request for %v", r.Method, r.URL)
|
||||
}
|
||||
|
||||
setClient(r, c)
|
||||
|
||||
if !IsAuthenticated(r) {
|
||||
RedirectToLogin(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
if r.URL.Path == "/logout" {
|
||||
RedirectToLogout(w, r)
|
||||
return
|
||||
}
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue