mirror of
https://github.com/openziti/zrok.git
synced 2024-11-24 17:13:51 +01:00
normalize some existing log messages
This commit is contained in:
parent
ece79f28d9
commit
7be46bfd40
@ -87,7 +87,7 @@ func (cmd *testWebsocketCommand) run(_ *cobra.Command, args []string) {
|
||||
addr = cmd.serviceName
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
logrus.Error("Address required if not using ziti")
|
||||
logrus.Error("address required if not using ziti")
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
@ -102,13 +102,13 @@ func (cmd *testWebsocketCommand) run(_ *cobra.Command, args []string) {
|
||||
}
|
||||
defer c.Close(websocket.StatusInternalError, "the sky is falling")
|
||||
|
||||
logrus.Info("Writing to server...")
|
||||
logrus.Info("writing to server...")
|
||||
err = wsjson.Write(ctx, c, "hi")
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
logrus.Info("Reading response...")
|
||||
logrus.Info("reading response...")
|
||||
typ, dat, err := c.Read(ctx)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
|
@ -80,7 +80,7 @@ func configureGithubOauth(cfg *OauthConfig, tls bool) error {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
host, err := url.QueryUnescape(r.URL.Query().Get("targethost"))
|
||||
if err != nil {
|
||||
logrus.Errorf("Unable to unescape target host: %v", err)
|
||||
logrus.Errorf("unable to unescape target host: %v", err)
|
||||
}
|
||||
rp.AuthURLHandler(func() string {
|
||||
id := uuid.New().String()
|
||||
@ -99,7 +99,7 @@ func configureGithubOauth(cfg *OauthConfig, tls bool) error {
|
||||
})
|
||||
s, err := t.SignedString(key)
|
||||
if err != nil {
|
||||
logrus.Errorf("Unable to sign intermediate JWT: %v", err)
|
||||
logrus.Errorf("unable to sign intermediate JWT: %v", err)
|
||||
}
|
||||
return s
|
||||
}, party, rp.WithURLParam("access_type", "offline"))(w, r)
|
||||
@ -121,7 +121,7 @@ func configureGithubOauth(cfg *OauthConfig, tls bool) error {
|
||||
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", tokens.AccessToken))
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
logrus.Error("Error getting user info from github: " + err.Error() + "\n")
|
||||
logrus.Errorf("error getting user info from github: %v", err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
@ -130,14 +130,14 @@ func configureGithubOauth(cfg *OauthConfig, tls bool) error {
|
||||
}()
|
||||
response, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
logrus.Errorf("Error reading response body: %v", err)
|
||||
logrus.Errorf("error reading response body: %v", err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
var rDat []githubUserResp
|
||||
err = json.Unmarshal(response, &rDat)
|
||||
if err != nil {
|
||||
logrus.Errorf("Error unmarshalling google oauth response: %v", err)
|
||||
logrus.Errorf("error unmarshalling google oauth response: %v", err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ func configureGoogleOauth(cfg *OauthConfig, tls bool) error {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
host, err := url.QueryUnescape(r.URL.Query().Get("targethost"))
|
||||
if err != nil {
|
||||
logrus.Errorf("Unable to unescape target host: %v", err)
|
||||
logrus.Errorf("unable to unescape target host: %v", err)
|
||||
}
|
||||
rp.AuthURLHandler(func() string {
|
||||
id := uuid.New().String()
|
||||
@ -97,7 +97,7 @@ func configureGoogleOauth(cfg *OauthConfig, tls bool) error {
|
||||
})
|
||||
s, err := t.SignedString(key)
|
||||
if err != nil {
|
||||
logrus.Errorf("Unable to sign intermediate JWT: %v", err)
|
||||
logrus.Errorf("unable to sign intermediate JWT: %v", err)
|
||||
}
|
||||
return s
|
||||
}, party, rp.WithURLParam("access_type", "offline"))(w, r)
|
||||
@ -108,7 +108,7 @@ func configureGoogleOauth(cfg *OauthConfig, tls bool) error {
|
||||
getEmail := func(w http.ResponseWriter, r *http.Request, tokens *oidc.Tokens[*oidc.IDTokenClaims], state string, rp rp.RelyingParty) {
|
||||
resp, err := http.Get("https://www.googleapis.com/oauth2/v2/userinfo?access_token=" + url.QueryEscape(tokens.AccessToken))
|
||||
if err != nil {
|
||||
logrus.Error("Error getting user info from google: " + err.Error() + "\n")
|
||||
logrus.Errorf("error getting user info from google: %v", err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
@ -117,15 +117,15 @@ func configureGoogleOauth(cfg *OauthConfig, tls bool) error {
|
||||
}()
|
||||
response, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
logrus.Errorf("Error reading response body: %v", err)
|
||||
logrus.Errorf("error reading response body: %v", err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
logrus.Infof("Response from google userinfo endpoint: %s", string(response))
|
||||
logrus.Infof("response from google userinfo endpoint: %s", string(response))
|
||||
rDat := googleOauthEmailResp{}
|
||||
err = json.Unmarshal(response, &rDat)
|
||||
if err != nil {
|
||||
logrus.Errorf("Error unmarshalling google oauth response: %v", err)
|
||||
logrus.Errorf("error unmarshalling google oauth response: %v", err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ func authHandler(handler http.Handler, pcfg *Config, key []byte, ctx ziti.Contex
|
||||
if provider, found := oauthCfg.(map[string]interface{})["provider"]; found {
|
||||
var authCheckInterval time.Duration
|
||||
if checkInterval, found := oauthCfg.(map[string]interface{})["authorization_check_interval"]; !found {
|
||||
logrus.Errorf("Missing authorization check interval in share config. Defaulting to 3 hours")
|
||||
logrus.Errorf("missing authorization check interval in share config. Defaulting to 3 hours")
|
||||
authCheckInterval = 3 * time.Hour
|
||||
} else {
|
||||
i, err := time.ParseDuration(checkInterval.(string))
|
||||
|
Loading…
Reference in New Issue
Block a user