feat: configurable ignore of tls verification for hydra connections
All checks were successful
Cadoles/hydra-werther/pipeline/pr-develop This commit looks good
All checks were successful
Cadoles/hydra-werther/pipeline/pr-develop This commit looks good
This commit is contained in:
@ -26,6 +26,8 @@ var (
|
||||
ErrChallengeNotFound = errors.New("challenge not found")
|
||||
// ErrChallengeExpired is an error that happens when a challenge is already used.
|
||||
ErrChallengeExpired = errors.New("challenge expired")
|
||||
//ErrServiceUnavailable is an error that happens when the hydra admin service is unavailable
|
||||
ErrServiceUnavailable = errors.New("hydra service unavailable")
|
||||
)
|
||||
|
||||
type reqType string
|
||||
@ -52,6 +54,7 @@ func initiateRequest(typ reqType, hydraURL string, fakeTLSTermination bool, chal
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
u, err := parseURL(hydraURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -145,6 +148,8 @@ func checkResponse(resp *http.Response) error {
|
||||
return ErrChallengeNotFound
|
||||
case 409:
|
||||
return ErrChallengeExpired
|
||||
case 503:
|
||||
return ErrServiceUnavailable
|
||||
default:
|
||||
var rs struct {
|
||||
Message string `json:"error"`
|
||||
|
@ -11,6 +11,7 @@ package identp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@ -127,7 +128,8 @@ func newLoginStartHandler(rproc oa2LoginReqProcessor, tmplRenderer TemplateRende
|
||||
return
|
||||
}
|
||||
log.Infow("Failed to initiate an OAuth2 login request", zap.Error(err), "challenge", challenge)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
errMsg := fmt.Sprintf("%s - %s - %s", http.StatusText(http.StatusInternalServerError), err, errors.Cause(err))
|
||||
http.Error(w, errMsg, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
log.Infow("A login request is initiated", "challenge", challenge, "username", ri.Subject)
|
||||
|
Reference in New Issue
Block a user