@@ -19,7 +19,6 @@ import (
1919
2020 "github.com/bmatcuk/doublestar/v4"
2121 "github.com/patrickmn/go-cache"
22- "github.com/sirupsen/logrus"
2322 "golang.org/x/oauth2/clientcredentials"
2423)
2524
@@ -111,10 +110,9 @@ func getAuth0Clients(ctx context.Context) ([]auth0ClientStub, error) {
111110 }
112111
113112 if resp .StatusCode != http .StatusOK {
114- appLogger (ctx ).WithFields (logrus.Fields {
115- "status" : resp .StatusCode ,
116- "body" : string (bodyBytes ),
117- }).Error ("Auth0 get_users error" )
113+ appLogger (ctx ).Error ("Auth0 get_users error" ,
114+ "status" , resp .StatusCode ,
115+ "body" , string (bodyBytes ))
118116 return nil , errors .New ("Auth0 get_clients error" )
119117 }
120118
@@ -163,18 +161,17 @@ func getAuth0ClientByService(ctx context.Context, serviceURL string) (*auth0Clie
163161 var match bool
164162 match , err = doublestar .Match (glob , serviceURL )
165163 if err != nil {
166- appLogger (ctx ).WithFields (logrus.Fields {
167- "pattern" : glob ,
168- logrus .ErrorKey : err ,
169- }).Warning ("unexpected bad cas_service glob in cache" )
164+ appLogger (ctx ).Warn ("unexpected bad cas_service glob in cache" ,
165+ "pattern" , glob ,
166+ "error" , err )
170167 continue
171168 }
172169 if ! match {
173170 continue
174171 }
175172
176173 // There is a match
177- appLogger (ctx ).WithFields (logrus. Fields { " service" : serviceURL , "glob" : glob , "auth0_client" : client .Name }). Debug ( "matched service in glob cache" )
174+ appLogger (ctx ).Debug ( "matched service in glob cache" , "service" , serviceURL , "glob" , glob , "auth0_client" , client .Name )
178175 auth0Cache .Set ("cas-service-url/" + url .PathEscape (serviceURL ), client , cache .NoExpiration )
179176 return & client , nil
180177 }
@@ -198,10 +195,9 @@ func getAuth0ClientByService(ctx context.Context, serviceURL string) (*auth0Clie
198195 }
199196
200197 if client .TokenEndpointAuthMethod != "client_secret_post" && client .TokenEndpointAuthMethod != "client_secret_basic" {
201- appLogger (ctx ).WithFields (logrus.Fields {
202- "token_endpoint_auth_method" : client .TokenEndpointAuthMethod ,
203- "auth0_client" : client .Name ,
204- }).Warning ("client with cas_service has unsupported token_endpoint_auth_method" )
198+ appLogger (ctx ).Warn ("client with cas_service has unsupported token_endpoint_auth_method" ,
199+ "token_endpoint_auth_method" , client .TokenEndpointAuthMethod ,
200+ "auth0_client" , client .Name )
205201 continue
206202 }
207203
@@ -212,10 +208,9 @@ func getAuth0ClientByService(ctx context.Context, serviceURL string) (*auth0Clie
212208 for _ , glob := range serviceGlobs {
213209 match , err := doublestar .Match (glob , serviceURL )
214210 if err != nil {
215- appLogger (ctx ).WithFields (logrus.Fields {
216- "pattern" : glob ,
217- logrus .ErrorKey : err ,
218- }).Warning ("ignoring bad cas_service glob" )
211+ appLogger (ctx ).Warn ("ignoring bad cas_service glob" ,
212+ "pattern" , glob ,
213+ "error" , err )
219214 continue
220215 }
221216 // Store the glob-to-client lookup (for cache).
@@ -225,7 +220,7 @@ func getAuth0ClientByService(ctx context.Context, serviceURL string) (*auth0Clie
225220 continue
226221 }
227222
228- appLogger (ctx ).WithFields (logrus. Fields { " service": serviceURL , "glob" : glob , "auth0_client" : client .Name }). Debug ( "matched service" )
223+ appLogger (ctx ).Debug ( "matched service", "service" , serviceURL , "glob" , glob , "auth0_client" , client .Name )
229224 // If the glob matches, save the match, but keep processing remaining
230225 // comma-delimited globs AND clients to complete the glob-to-client cache
231226 // update.
0 commit comments