session := Session{} is scoped to main(). If two users attempt to authenticate at the same time, the session object will be overwritten causing login failure for the first person.
func (session *Session) login(w http.ResponseWriter, r *http.Request, c *duouniversal.Client) {
...
// Step 4: Generate and save a state variable
session.duoState, err = c.GenerateState()
if err != nil {
log.Fatal("Error generating state: ", err)
}
Please use something like gorrillas sessions package to manage duoState for each pre-auth session. I'm a bit busy right now but if I get some time I'll PR the right way of doing it.
https://pkg.go.dev/github.com/gorilla/sessions
duo_universal_golang/example/main.go
Line 33 in 0c2571f
session := Session{}is scoped tomain(). If two users attempt to authenticate at the same time, the session object will be overwritten causing login failure for the first person.Please use something like gorrillas sessions package to manage duoState for each pre-auth session. I'm a bit busy right now but if I get some time I'll PR the right way of doing it.
https://pkg.go.dev/github.com/gorilla/sessions