Skip to content

Commit

Permalink
Correct spelling, always set header
Browse files Browse the repository at this point in the history
  • Loading branch information
NHAS committed Jun 10, 2024
1 parent 6d05569 commit 2f3320d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions internal/webserver/authenticators/pam.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ func (t *Pam) AuthorisationAPI(w http.ResponseWriter, r *http.Request) {
challenge, err := user.Authenticate(clientTunnelIp.String(), t.Type(), t.AuthoriseFunc(w, r))

msg, status := resultMessage(err)
if err != nil {
w.Header().Set("WAG-CHALLENGE", challenge)
}
w.Header().Set("WAG-CHALLENGE", challenge)

jsonResponse(w, msg, status)

Expand Down
4 changes: 1 addition & 3 deletions internal/webserver/authenticators/totp.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ func (t *Totp) AuthorisationAPI(w http.ResponseWriter, r *http.Request) {
}

challenge, err := user.Authenticate(clientTunnelIp.String(), t.Type(), t.AuthoriseFunc(w, r))
if err != nil {
w.Header().Set("WAG-CHALLENGE", challenge)
}
w.Header().Set("WAG-CHALLENGE", challenge)

msg, status := resultMessage(err)
jsonResponse(w, msg, status)
Expand Down
6 changes: 1 addition & 5 deletions internal/webserver/authenticators/webauthn.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,9 @@ func (wa *Webauthn) RegistrationAPI(w http.ResponseWriter, r *http.Request) {

return nil
})
w.Header().Set("WAG-CHALLENGE", challenge)

msg, status := resultMessage(err)

if err != nil {
w.Header().Set("WAG-CHALLENGE", challenge)
}

jsonResponse(w, msg, status) // Send back an error message before we do the server side of handling it

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/webserver/resources/static/js/challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const httpsEnabled = window.location.protocol == "https:";
const url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + "/challenge/";


let challenge = localStorage.getItem("challange");
let challenge = localStorage.getItem("challenge");
if (challenge === null) {
// oidc sets the challenge via cookie
challenge = getCookie("challenge");
Expand Down

0 comments on commit 2f3320d

Please sign in to comment.