Skip to content

Commit

Permalink
Issue #59, Fixed an issue where oidcsupport and session support were …
Browse files Browse the repository at this point in the history
…both issuing redirects to start a login causing a superfluous write error in the log.

Signed-off-by: Phil Hunt <phil.hunt@independentid.com>
  • Loading branch information
independentid committed Sep 15, 2024
1 parent d559e07 commit a47414f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/oidcSupport/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func (o *OidcClientHandler) HandleSessionScope(next http.HandlerFunc, _ []string
if o.SessionHandler.ValidateSession(w, r) {
// TODO Check scopes
next.ServeHTTP(w, r)
return
}
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
} else {
Expand Down
4 changes: 2 additions & 2 deletions pkg/sessionSupport/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (s *sessionManager) SetSessionMiddleware(router *mux.Router) {
router.Use(s.manager.LoadAndSave)
}

func (s *sessionManager) ValidateSession(w http.ResponseWriter, r *http.Request) bool {
func (s *sessionManager) ValidateSession(_ http.ResponseWriter, r *http.Request) bool {

// If sub is not set, we assume the session was not authenticated
// Note the value of sessionId is just a unique ID for logging purposes
Expand All @@ -82,7 +82,7 @@ func (s *sessionManager) ValidateSession(w http.ResponseWriter, r *http.Request)
if s.loginEnabled {
sub := s.manager.GetString(r.Context(), KeySubject)
if sub == "" {
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
// http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
return false
}
}
Expand Down

0 comments on commit a47414f

Please sign in to comment.