Skip to content

Commit

Permalink
Simplify basic auth server check
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Donini <lorenzo.donini90@gmail.com>
  • Loading branch information
lorenzodonini committed Jul 25, 2021
1 parent 747c045 commit 0d571bd
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions ws/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,6 @@ out:
// Handle client authentication
if server.basicAuthHandler != nil {
username, password, ok := r.BasicAuth()
if !ok {
server.error(fmt.Errorf("basic auth failed: credentials not found"))
w.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`)
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
ok = server.basicAuthHandler(username, password)
if !ok {
server.error(fmt.Errorf("basic auth failed: credentials invalid"))
Expand Down

0 comments on commit 0d571bd

Please sign in to comment.