mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-06-05 22:44:17 +00:00
Verify provided token on every request.
This commit is contained in:
@@ -137,7 +137,18 @@ func (t *TraefikOidc) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
|
||||
authenticated, _ := session.Values["authenticated"].(bool)
|
||||
if authenticated {
|
||||
// infoLogger.Printf("User is authenticated, proceeding to next handler")
|
||||
idToken, ok := session.Values["id_token"].(string)
|
||||
if !ok || idToken == "" {
|
||||
http.Error(rw, "Invalid session", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
if err := t.verifyToken(idToken); err != nil {
|
||||
http.Error(rw, "Invalid token", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
// Proceed with the request
|
||||
t.next.ServeHTTP(rw, req)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user