Remove all fmr.Println and add zerolog logging
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 1m52s

This commit is contained in:
2024-11-11 19:50:17 +01:00
parent a51f077358
commit a8acc9950a
30 changed files with 333 additions and 325 deletions

View File

@@ -6,6 +6,7 @@ import (
"net/http"
groupsmanagement "git.coopgo.io/coopgo-platform/groups-management/grpcapi"
"github.com/rs/zerolog/log"
)
const GroupKey ContextKey = "group"
@@ -28,7 +29,7 @@ func (p *IdentificationProvider) GroupsMiddleware(next http.Handler) http.Handle
claimgroups, ok := claims["groups"].([]any)
if !ok {
fmt.Println("cast issue")
log.Error().Msg("cast issue")
w.WriteHeader(http.StatusInternalServerError)
return
}

View File

@@ -4,7 +4,6 @@ import (
"context"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
"net/http"
@@ -12,6 +11,7 @@ import (
"git.coopgo.io/coopgo-apps/parcoursmob/utils/storage"
"github.com/coreos/go-oidc/v3/oidc"
"github.com/gorilla/sessions"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"golang.org/x/oauth2"
)
@@ -91,7 +91,7 @@ func (p *IdentificationProvider) Middleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
session, err := p.SessionsStore.Get(r, "parcoursmob_session")
if err != nil {
fmt.Println(err)
log.Error().Err(err).Msg("")
}
if session.Values["idtoken"] == nil || session.Values["idtoken"] == "" {
@@ -122,7 +122,7 @@ func (p *IdentificationProvider) Middleware(next http.Handler) http.Handler {
err = idtoken.Claims(&claims)
if err != nil {
fmt.Println(err)
log.Error().Err(err).Msg("")
}
ctx := context.WithValue(r.Context(), IdtokenKey, idtoken)