Commit 5e99c3de authored by ale's avatar ale

Set the U2F AppID on auth requests

Without this field, U2F just isn't working and the accounts with U2F
set up are shown an OTP prompt.
parent bb8238ee
......@@ -5,6 +5,7 @@ import (
"encoding/gob"
"encoding/json"
"errors"
"fmt"
"html/template"
"log"
"net/http"
......@@ -277,8 +278,9 @@ func (l *loginHandler) makeAuthRequest(w http.ResponseWriter, req *http.Request,
Username: username,
Password: []byte(password),
OTP: otp,
U2FResponse: u2fResponse,
DeviceInfo: l.devMgr.GetDeviceInfoFromRequest(w, req),
U2FResponse: u2fResponse,
U2FAppID: u2fAppIDFromRequest(req),
}
return l.authClient.Authenticate(req.Context(), &ar)
}
......@@ -302,3 +304,8 @@ func toJSON(obj interface{}) string {
}
return string(data)
}
// Guess the correct U2F AppID from the HTTP request.
func u2fAppIDFromRequest(r *http.Request) string {
return fmt.Sprintf("https://%s", r.Host)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment