feat: log more information on authentication errors
Cadoles/go-http-peering/pipeline/head There was a failure building this commit
Details
Cadoles/go-http-peering/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
b28a87cc5d
commit
34adfb3e87
|
@ -5,11 +5,11 @@ import (
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
jwt "github.com/dgrijalva/jwt-go"
|
jwt "github.com/dgrijalva/jwt-go"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
peering "forge.cadoles.com/Cadoles/go-http-peering"
|
peering "forge.cadoles.com/Cadoles/go-http-peering"
|
||||||
"forge.cadoles.com/Cadoles/go-http-peering/crypto"
|
"forge.cadoles.com/Cadoles/go-http-peering/crypto"
|
||||||
|
@ -52,7 +52,7 @@ func (c *Client) Advertise(attrs peering.PeerAttributes) error {
|
||||||
case http.StatusConflict:
|
case http.StatusConflict:
|
||||||
return peering.ErrPeerExists
|
return peering.ErrPeerExists
|
||||||
default:
|
default:
|
||||||
return ErrUnexpectedResponse
|
return errors.Wrapf(ErrUnexpectedResponse, "unexpected http status code '%d'", res.StatusCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ func (c *Client) UpdateAttributes(attrs peering.PeerAttributes) error {
|
||||||
case http.StatusForbidden:
|
case http.StatusForbidden:
|
||||||
return ErrRejected
|
return ErrRejected
|
||||||
default:
|
default:
|
||||||
return ErrUnexpectedResponse
|
return errors.Wrapf(ErrUnexpectedResponse, "unexpected http status code '%d'", res.StatusCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ func (c *Client) Ping() error {
|
||||||
case http.StatusForbidden:
|
case http.StatusForbidden:
|
||||||
return ErrRejected
|
return ErrRejected
|
||||||
default:
|
default:
|
||||||
return ErrUnexpectedResponse
|
return errors.Wrapf(ErrUnexpectedResponse, "unexpected http status code '%d'", res.StatusCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ func AdvertiseHandler(store peering.Store, key *rsa.PublicKey, funcs ...OptionFu
|
||||||
|
|
||||||
serverClaims, err := assertServerToken(key, serverToken)
|
serverClaims, err := assertServerToken(key, serverToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Printf("[ERROR] %+v", errors.WithStack(err))
|
logger.Printf("[ERROR] %+v", errors.Wrapf(err, "could not validate token '%s'", serverToken))
|
||||||
sendError(w, http.StatusUnauthorized)
|
sendError(w, http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue